📄 index.cs
字号:
namespace PowerEasy.WebSite.Admin
{
using PowerEasy.AccessManage;
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Enumerations;
using PowerEasy.Web.UI;
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Web;
using System.Web.UI.HtmlControls;
using System.Xml;
public class Index : AdminPage
{
protected HtmlTitle AdminPageTitle;
protected HtmlGenericControl ChannelMenuItems;
protected string CheckNewVersionJSUrl = "";
public const string CheckNewVersionUrl = "http://update.powereasy.net/SiteFactory/Version.aspx";
private static FileVersionInfo fvInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
protected HtmlHead Head1;
protected string IndexLeftUrl = "Profile/QuickLinks.aspx";
protected string IndexRightUrl = "Profile/MyWorktable.aspx";
protected HtmlForm myform;
public static readonly string ProductVersion = fvInfo.ProductVersion;
protected HtmlGenericControl SubMenu;
private XmlDocument xmlDoc;
private string xmlPath = "menu";
private bool CheckIsShowSubMenuLi(XmlNode child)
{
string str;
if ((child.Name == "ModifyPassword") && !PEContext.Current.Admin.AdministratorInfo.EnableModifyPassword)
{
return false;
}
if (!this.CheckPermission(this.GetAttributeValue(child, "operateCode")))
{
return false;
}
bool flag = true;
if ((!SiteConfig.SiteOption.EnablePointMoneyExp && ((str = this.GetAttributeValue(child, "id")) != null)) && (((str == "CardsManage") || (str == "PaymentLogManage")) || (((str == "BankrollItemList") || (str == "PointLog")) || (str == "ValidLog"))))
{
flag = false;
}
if (child.Attributes["title"] != null)
{
child.Attributes["title"].Value = this.GetAttributeValue(child, "title").Replace("点券", SiteConfig.UserConfig.PointName);
}
return flag;
}
private bool CheckPermission(string operateCode)
{
if (operateCode == "None")
{
return true;
}
if (string.IsNullOrEmpty(operateCode))
{
return false;
}
return RolePermissions.AccessCheck(operateCode);
}
private string GetAttributeValue(XmlNode xmlNode, string attributeName)
{
string str = "";
if (xmlNode != null)
{
XmlAttribute attribute = xmlNode.Attributes[attributeName];
if (attribute != null)
{
str = attribute.Value;
}
}
return str;
}
private void InitDivMenu(StringBuilder sb, string nodeName, string path)
{
XmlNode node = this.xmlDoc.SelectSingleNode(path);
if ((node != null) && node.HasChildNodes)
{
int num = 0;
StringBuilder builder = new StringBuilder();
builder.Append("<div id=\"PopMenu_" + nodeName + "\" onmouseover=\"show('" + nodeName + "')\" onmouseout=\"hide('" + nodeName + "')\" class=\"SubMenuDiv\" onclick=\"hide('" + nodeName + "')\">\n");
builder.Append("<dl>\n");
builder.Append("<dd>\n");
foreach (XmlNode node2 in node)
{
string str2;
if ((!this.CheckPermission(this.GetAttributeValue(node2, "operateCode")) || (this.GetAttributeValue(node2, "ShowOnMenu") == "false")) || ((!SiteConfig.SiteOption.EnablePointMoneyExp && ((str2 = this.GetAttributeValue(node2, "title")) != null)) && ((str2 == "银行账户管理") || (str2 == "在线支付平台管理"))))
{
continue;
}
if (!SiteConfig.ShopConfig.EnableCoupon)
{
switch (this.GetAttributeValue(node2, "id"))
{
case "Coupon":
case "CouponManage":
{
continue;
}
}
}
num++;
builder.Append("<span><a href=\"#\" onclick=\"ShowOperatingList('" + this.GetAttributeValue(node2, "leftUrl") + "','" + this.GetAttributeValue(node2, "rightUrl") + "')\">\n");
builder.Append(this.GetAttributeValue(node2, "title"));
builder.Append("</a></span>\n");
}
int num2 = num * 0x19;
builder.Append("</dd>\n");
builder.Append("</dl>\n");
builder.Append(string.Concat(new object[] { "<iframe id=\"iframe_", nodeName, "\" width=\"100%\" frameborder=0 height=\"", num2, "px\" style=\"position:absolute; top:0px; z-index:-1; border-style:none;\"></iframe>\n" }));
builder.Append("</div>\n");
if (num != 0)
{
sb.Append(builder.ToString());
}
else
{
sb.Append("<div id=\"PopMenu_" + nodeName + "\" onmouseover=\"show('" + nodeName + "')\" onmouseout=\"hide('" + nodeName + "')\"></div>");
}
}
}
private void InitMainMenu()
{
XmlNode node = this.xmlDoc.SelectSingleNode(this.xmlPath);
StringBuilder builder = new StringBuilder();
if (node == null)
{
AdminPage.WriteErrMsg("MainMenu.xml配置文件不存在menu根元素", "Index.aspx");
}
if (node.HasChildNodes)
{
foreach (XmlNode node2 in node)
{
if (this.CheckPermission(this.GetAttributeValue(node2, "operateCode")))
{
string attributeValue = this.GetAttributeValue(node2, "id");
builder.Append("<li id=\"" + attributeValue + "\" onclick=\"ShowHideLayer('ChannelMenu_" + attributeValue + "')\">");
builder.Append("<a href=\"#\" id=\"AChannelMenu_" + attributeValue + "\">");
builder.Append("<span id=\"SpanChannelMenu_" + attributeValue + "\">" + this.GetAttributeValue(node2, "title") + "</span></a> </li>");
}
}
}
this.ChannelMenuItems.InnerHtml = builder.ToString();
}
protected void InitMainMenuJS()
{
StringBuilder builder = new StringBuilder();
builder.Append("<script type=\"text/JavaScript\">");
builder.Append("function show(id)");
builder.Append("{\n");
builder.Append("var obj;\n");
builder.Append("obj=document.getElementById('PopMenu_'+id);\tobj.style.visibility=\"visible\";\n");
builder.Append("}\n");
builder.Append("function hide(id)");
builder.Append("{\n");
builder.Append("var obj;\n");
builder.Append("obj=document.getElementById('PopMenu_'+id);\tobj.style.visibility=\"hidden\";\n");
builder.Append("}\n");
builder.Append("function hideOthers(id)");
builder.Append("{\n");
builder.Append("\n for(var i = 0 ;i < document.all.tags('DIV').length;i++)\n");
builder.Append("{\n");
builder.Append("\tif(document.all.tags('DIV')[i].id != 'PopMenu_'+id && document.all.tags('DIV')[i].id.indexOf('PopMenu_')>=0)\n");
builder.Append("\t{");
builder.Append("\t document.all.tags('DIV')[i].style.visibility=\"hidden\";\n");
builder.Append("\t}");
builder.Append("\t}");
builder.Append("}");
builder.Append(" </script>");
if (!base.ClientScript.IsClientScriptBlockRegistered("ClientScript"))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -