📄 labeltemplatestatic.aspx.cs
字号:
namespace PowerEasy.WebSite.Admin.Template
{
using AjaxControlToolkit;
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Controls;
using PowerEasy.Model.TemplateProc;
using PowerEasy.Templates;
using PowerEasy.Web.UI;
using System;
using System.Configuration;
using System.IO;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public class LabelTemplateStatic : AdminPage
{
private string action;
protected Label attlist;
protected Button BtnFinal;
protected Button BtnPrv;
protected DropDownList DropLabelList;
private string labelname;
protected Label LblLabelList;
private string m_LabelLibPath;
protected ScriptManager ScriptManager1;
protected ExtendedSiteMapPath SmpNavigator;
protected TabContainer TabContainer1;
protected TabPanel TabPanel1;
protected TabPanel TabPanel2;
protected TabPanel TabPanel3;
protected TabPanel TabPanel4;
protected TabPanel TabPanel5;
protected TabContainer Tabs;
protected TextBox TxtTemplate;
protected System.Web.UI.UpdatePanel UpdatePanel1;
private string xmlfilepath;
protected void BtnFinal_Click(object sender, EventArgs e)
{
try
{
if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
{
File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.labelname + ".config", true);
BasePage.ResponseRedirect("LabelManage.aspx");
}
}
catch (IOException)
{
AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
}
catch (UnauthorizedAccessException)
{
AdminPage.WriteErrMsg("没有标签目录或临时目录或标签文件的访问权限!", "LabelManage.aspx");
}
}
protected void BtnPrv_Click(object sender, EventArgs e)
{
BasePage.ResponseRedirect("LabelProperty.aspx?action=" + this.action + "&name=" + DataSecurity.UrlEncode(this.labelname));
}
protected void BuildLabelList(string typename)
{
this.LblLabelList.Text = string.Empty;
foreach (LabelManageInfo info in LabelManage.GetLabelList(typename))
{
string text = this.LblLabelList.Text;
this.LblLabelList.Text = text + "<div onclick=\"cit()\" outype=\"1\" class=\"spanfixdiv\" alt=\"" + info.Intro + "\">" + info.Name + "</div>";
}
}
protected void DropLabelList_SelectedIndexChanged(object sender, EventArgs e)
{
this.BuildLabelList(this.DropLabelList.SelectedValue);
}
protected void Page_Load(object sender, EventArgs e)
{
this.action = BasePage.RequestString("action");
this.labelname = BasePage.RequestString("name");
this.m_LabelLibPath = "~/" + SiteConfig.SiteOption.LabelDir;
if (string.IsNullOrEmpty(this.labelname))
{
BasePage.ResponseRedirect("Label.aspx");
}
else
{
string path = ConfigurationManager.AppSettings["PowerEasy:LabelXsltPath"];
this.xmlfilepath = HttpContext.Current.Server.MapPath(path) + @"\" + this.labelname + ".config";
if (!base.IsPostBack)
{
if (LabelManage.GetAttributeList(this.xmlfilepath).Count == 0)
{
this.attlist.Text = "您尚未建立属性!<a href=\"LabelProperty.aspx?action=" + this.action + "&name=" + this.labelname + "\">建立属性</a>";
}
else
{
foreach (LabelAttributeInfo info in LabelManage.GetAttributeList(this.xmlfilepath))
{
string text = this.attlist.Text;
this.attlist.Text = text + "<div onclick=\"cit()\" outype=\"2\" class=\"spanfixdiv\" alt=\"" + info.Intro + "
默认值:" + info.DefaultValue + "\">" + info.AttributeName + "</div>";
}
}
if (!string.IsNullOrEmpty(XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelTemplate")))
{
this.TxtTemplate.Text = XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelTemplate");
}
ListItem item = new ListItem();
item.Text = "全部分类";
this.DropLabelList.DataSource = LabelManage.GetLabelTypeList();
this.DropLabelList.DataTextField = "Name";
this.DropLabelList.DataValueField = "Name";
this.DropLabelList.DataBind();
this.DropLabelList.Items.Insert(0, item);
this.BuildLabelList(string.Empty);
}
this.TxtTemplate.Attributes.Add("onmouseup", "dragend(this)");
this.TxtTemplate.Attributes.Add("onClick", "savePos(this)");
this.TxtTemplate.Attributes.Add("onmousemove", "DragPos(this)");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -