⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contentselecttreexml.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.User.Contents
{
    using PowerEasy.AccessManage;
    using PowerEasy.Common;
    using PowerEasy.Components;
    using PowerEasy.Contents;
    using PowerEasy.Enumerations;
    using PowerEasy.Model.Contents;
    using PowerEasy.Web.UI;
    using System;
    using System.Text;
    using System.Web;
    using System.Web.UI.HtmlControls;

    public class ContentSelectTreeXml : DynamicPage
    {
        protected HtmlForm form1;

        private static void CheckTreePermission(StringBuilder xmlBuilder, NodeInfo nodeInfo, ref string arrModelName, ref string icon, ref string action)
        {
            bool flag = UserPermissions.AccessCheck(OperateCode.NodeContentInput, nodeInfo.NodeId);
            string str = UserPermissions.GetRoleNodeId(PEContext.Current.User.RoleId, OperateCode.NodeContentInput, PEContext.Current.User.UserInfo.IsInheritGroupRole ? 1 : 0);
            string arrChildId = nodeInfo.NodeId.ToString();
            bool flag2 = false;
            if ((nodeInfo.ArrChildId.IndexOf(",") > 0) && !flag)
            {
                if (!string.IsNullOrEmpty(nodeInfo.ArrChildId))
                {
                    arrChildId = nodeInfo.ArrChildId;
                }
                if (RolePermissions.CheckNodePurview(str, arrChildId))
                {
                    flag2 = true;
                }
            }
            if ((nodeInfo.ParentId > 0) && !flag)
            {
                arrChildId = nodeInfo.ParentPath + "," + nodeInfo.NodeId.ToString();
                flag = RolePermissions.CheckNodePurview(str, arrChildId);
            }
            StringBuilder builder = new StringBuilder();
            if (string.IsNullOrEmpty(action))
            {
                action = " ContentManage.aspx";
            }
            object obj2 = action;
            action = string.Concat(new object[] { obj2, "?NodeID=", nodeInfo.NodeId, "&NodeName=", HttpContext.Current.Server.UrlEncode(DataSecurity.XmlEncode(nodeInfo.NodeName)) });
            if (flag || flag2)
            {
                xmlBuilder.Append("<tree ");
                xmlBuilder.Append("text=\"" + DataSecurity.XmlEncode(nodeInfo.NodeName) + "\" ");
                xmlBuilder.Append("arrModelId=\"");
                xmlBuilder.Append(builder.ToString());
                xmlBuilder.Append("\" ");
                xmlBuilder.Append("arrModelName=\"");
                xmlBuilder.Append((string) arrModelName);
                xmlBuilder.Append("\" ");
                xmlBuilder.Append("nodeId=\"");
                xmlBuilder.Append(nodeInfo.NodeId);
                xmlBuilder.Append("\" ");
                xmlBuilder.Append("target=\"\" ");
                xmlBuilder.Append("expand=\"0\" ");
                if (nodeInfo.Child > 0)
                {
                    xmlBuilder.Append("src=\"ContentSelectTreeXml.aspx?Action=Content&amp;NodeID=" + nodeInfo.NodeId + "\" ");
                }
                xmlBuilder.Append("action=\"#\" ");
                if (!flag)
                {
                    icon = "Forbid";
                    xmlBuilder.Append(" anchorType=\"0\" ");
                }
                else
                {
                    switch (nodeInfo.PurviewType)
                    {
                        case 0:
                            icon = "Container";
                            break;

                        case 1:
                            icon = "HalfOpen";
                            break;

                        case 2:
                            icon = "Purview";
                            break;

                        default:
                            icon = "Container";
                            break;
                    }
                    if (!nodeInfo.Settings.EnableAddWhenHasChild && (nodeInfo.Child > 0))
                    {
                        icon = "Forbid";
                        xmlBuilder.Append(" anchorType=\"0\" ");
                    }
                    else
                    {
                        xmlBuilder.Append(" anchorType=\"2\" ");
                    }
                }
                xmlBuilder.Append("icon=\"");
                xmlBuilder.Append((string) icon);
                xmlBuilder.Append("\" ");
                xmlBuilder.Append(" />");
            }
        }

        public static string ContentXml()
        {
            StringBuilder xmlBuilder = new StringBuilder();
            xmlBuilder.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
            xmlBuilder.Append("<tree>");
            foreach (NodeInfo info in Nodes.GetNodesListByParentId(DataConverter.CLng(HttpContext.Current.Request.QueryString["NodeID"])))
            {
                string arrModelName = "";
                string icon = "";
                string action = "";
                if (info.NodeType == NodeType.Container)
                {
                    CheckTreePermission(xmlBuilder, info, ref arrModelName, ref icon, ref action);
                }
            }
            xmlBuilder.Append("</tree>\n");
            return xmlBuilder.ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            string str2;
            base.Response.Clear();
            base.Response.ContentType = "text/xml; charset=UTF-8";
            base.Response.CacheControl = "no-cache";
            string s = "";
            if (((str2 = BasePage.RequestStringToLower("Action")) != null) && (str2 == "content"))
            {
                s = ContentXml();
            }
            base.Response.Write(s);
            base.Response.End();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -