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

📄 purview.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
                Label_019B:
                    this.InitMainMenu(sb, xpath + "/mainMenu[@id='" + this.GetAttributeValue(node2, "id") + "']", subModel);
                }
            }
        }

        private void InitData()
        {
            IList<RoleNodePermissionsInfo> roleNodePermissionsList = new List<RoleNodePermissionsInfo>();
            roleNodePermissionsList = RolePermissions.GetNodePermissionsById(this.m_RoleId, -2);
            this.SetContentNodeAll(roleNodePermissionsList);
            this.SetContentNode(roleNodePermissionsList);
            this.SetNodeAll(roleNodePermissionsList);
            this.SetNode(roleNodePermissionsList);
            this.SetNodeCommentAll(roleNodePermissionsList);
            this.SetNodeComment(roleNodePermissionsList);
        }

        private void InitMainMenu(StringBuilder sb, string path, string subModel)
        {
            XmlNode node = this.xmlDoc.SelectSingleNode(path);
            if ((node != null) && node.HasChildNodes)
            {
                foreach (XmlNode node2 in node)
                {
                    string attributeValue = this.GetAttributeValue(node2, "operateCode");
                    if (!Enum.IsDefined(typeof(OperateCode), attributeValue) || !(this.GetAttributeValue(node2, "ShowOnForm") == "true"))
                    {
                        continue;
                    }
                    string purviewModel = subModel + "_" + attributeValue;
                    string str3 = this.Checked(node2);
                    sb.Append("<tr>");
                    sb.Append("  <td style='padding-left:60px;'>");
                    sb.Append("     <input type='checkbox' name='ModelPurview' value='" + attributeValue + "' id='" + purviewModel + "' " + str3 + " onclick=\"javascript:CheckModel(this);\" />&nbsp;");
                    sb.Append(this.GetAttributeValue(node2, "title"));
                    string str4 = attributeValue;
                    if (str4 != null)
                    {
                        if (!(str4 == "CategoryInfoManage"))
                        {
                            if (str4 == "SpecialInfoManage")
                            {
                                goto Label_0130;
                            }
                        }
                        else
                        {
                            sb.Append("&nbsp;&nbsp;&lt;=【<a onclick=\"javascript:ShowTabs(1)\" href='#' ><span style='color:red'>详细设置</span></a>】");
                        }
                    }
                    goto Label_013C;
                Label_0130:
                    sb.Append("&nbsp;&nbsp;&lt;=【<a onclick=\"javascript:ShowTabs(2)\" href='#' ><span style='color:red'>详细设置</span></a>】");
                Label_013C:
                    sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;" + this.Description(node2));
                    sb.Append("  </td>");
                    sb.Append("</tr>");
                    this.InitSubMenu(sb, path + "/subMenu[@id='" + this.GetAttributeValue(node2, "id") + "']", purviewModel);
                }
            }
        }

        private void InitPurview()
        {
            string str;
            this.xmlDoc = new XmlDocument();
            HttpContext current = HttpContext.Current;
            if (current != null)
            {
                str = current.Server.MapPath("~/Admin/Common/MainMenu.xml");
            }
            else
            {
                str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Admin/Common/MainMenu.xml");
            }
            try
            {
                this.xmlDoc.Load(str);
            }
            catch (XmlException exception)
            {
                BaseUserControl.WriteErrMsg("MainMenu.xml配置文件不符合XML规范,具体错误信息:" + exception.Message);
            }
            XmlNode node = this.xmlDoc.SelectSingleNode(this.xmlPath);
            StringBuilder sb = new StringBuilder();
            if (node == null)
            {
                BaseUserControl.WriteErrMsg("MainMenu.xml配置文件不存在menu根元素");
            }
            if ((this.m_Action == "Modify") && !this.Page.IsPostBack)
            {
                foreach (RoleModulePermissionsInfo info in RolePermissions.GetModelPermissionsById(this.m_RoleId))
                {
                    string name = Enum.GetName(typeof(OperateCode), info.OperateCode);
                    foreach (XmlNode node2 in this.xmlDoc.SelectNodes("//*[@operateCode='" + name + "']"))
                    {
                        if (node2 != null)
                        {
                            ((XmlElement) node2).SetAttribute("IsChoose", "true");
                        }
                    }
                }
            }
            if (node.HasChildNodes)
            {
                foreach (XmlNode node3 in node)
                {
                    string str3 = this.Checked(node3);
                    string attributeValue = this.GetAttributeValue(node3, "id");
                    if ((attributeValue != "MenuMyDeskTop") && (this.GetAttributeValue(node3, "ShowOnForm") == "true"))
                    {
                        sb.Append("<tr>");
                        sb.Append("  <td style='width:100%;'>");
                        sb.Append("     <input type='checkbox' name='ModelPurview' value='" + this.GetAttributeValue(node3, "operateCode") + "' " + str3 + " id='" + attributeValue + "'  onclick=\"javascript:CheckModel(this);\" />&nbsp;");
                        sb.Append(this.GetAttributeValue(node3, "title"));
                        sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;" + this.Description(node3));
                        sb.Append("  </td>");
                        sb.Append("</tr>");
                        this.InitChannelMenuLi(sb, attributeValue);
                    }
                }
            }
            this.LblModelPurview.Text = sb.ToString();
        }

        private void InitSubMenu(StringBuilder sb, string path, string purviewModel)
        {
            XmlNode node = this.xmlDoc.SelectSingleNode(path);
            if ((node != null) && node.HasChildNodes)
            {
                foreach (XmlNode node2 in node)
                {
                    string attributeValue = this.GetAttributeValue(node2, "operateCode");
                    if (Enum.IsDefined(typeof(OperateCode), attributeValue) && (this.GetAttributeValue(node2, "ShowOnForm") == "true"))
                    {
                        string str2 = purviewModel + "_" + attributeValue;
                        string str3 = this.Checked(node2);
                        sb.Append("<tr>");
                        sb.Append("  <td style='padding-left:90px;'>");
                        sb.Append("     <input type='checkbox' name='ModelPurview' value='" + attributeValue + "' id='" + str2 + "' " + str3 + " onclick=\"javascript:CheckModel(this);\" />&nbsp;");
                        sb.Append(node2.Attributes["title"].Value);
                        sb.Append("&nbsp;&nbsp;&nbsp;&nbsp;" + this.Description(node2));
                        sb.Append("  </td>");
                        sb.Append("</tr>");
                    }
                }
            }
        }

        private void InitTabsArray()
        {
            this.m_ArrTabs.Append("\"" + this.Tabs0.ClientID + "\",");
            this.m_ArrTabs.Append("\"" + this.Tabs1.ClientID + "\",");
            this.m_ArrTabs.Append("\"" + this.Tabs2.ClientID + "\",");
            this.m_ArrTabs.Append("\"" + this.Tabs3.ClientID + "\",");
            this.m_ArrTabs.Append("\"" + this.Tabs4.ClientID + "\",");
            this.m_ArrTabs.Append("\"" + this.Tabs5.ClientID + "\"");
        }

        private void InitTitleArray()
        {
            this.m_ArrTitle.Append("\"" + this.TabTitle0.ClientID + "\",");
            this.m_ArrTitle.Append("\"" + this.TabTitle1.ClientID + "\",");
            this.m_ArrTitle.Append("\"" + this.TabTitle2.ClientID + "\",");
            this.m_ArrTitle.Append("\"" + this.TabTitle3.ClientID + "\",");
            this.m_ArrTitle.Append("\"" + this.TabTitle4.ClientID + "\",");
            this.m_ArrTitle.Append("\"" + this.TabTitle5.ClientID + "\"");
        }

        public void InputPermissions()
        {
            if (this.m_RoleId != 0)
            {
                RolePermissions.DeleteNodePermissionFromRoles(this.m_RoleId, -2);
                this.GetContentNodeSelectPermission();
                this.GetNodeSelectPermission();
                this.GetNodeCommentSelectPermission();
                this.GetSpecialPermissions();
                this.GetFieldPermission();
                this.GetModelPermission();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.InitTabsArray();
            this.InitTitleArray();
            this.InitPurview();
            if ((this.m_Action == "Modify") && !this.Page.IsPostBack)
            {
                this.InitData();
            }
        }

        protected void RptModelList1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                HtmlTableRow row = (HtmlTableRow) e.Item.FindControl("ModelTr");
                if (this.m_ArrModelTr.Length == 0)
                {
                    this.m_ArrModelTr.Append("\"" + row.ClientID + "\"");
                }
                else
                {
                    this.m_ArrModelTr.Append(",\"" + row.ClientID + "\"");
                }
                if (e.Item.ItemIndex > 0)
                {
                    row.Attributes.Add("class", "tdbg");
                }
                else
                {
                    row.Attributes.Add("class", "title");
                }
                if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
                {
                    Label label = (Label) e.Item.FindControl("modellist");
                    label.Text = "<a href=\"javascript:Hidd(" + e.Item.ItemIndex.ToString() + ")\">" + ((ModelInfo) e.Item.DataItem).ModelName + "</a>";
                }
            }
        }

        protected void RptModelList2_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                Repeater repeater = (Repeater) e.Item.FindControl("RptFieldList");
                repeater.DataSource = ModelManager.GetFieldListByModelId(((ModelInfo) e.Item.DataItem).ModelId);
                repeater.DataBind();
                IList<RoleFieldPermissionsInfo> fieldPermissionsById = new List<RoleFieldPermissionsInfo>();
                fieldPermissionsById = RolePermissions.GetFieldPermissionsById(this.m_RoleId);
                HiddenField field = e.Item.FindControl("HdnModelId") as HiddenField;
                int num = DataConverter.CLng(field.Value);
                foreach (RepeaterItem item in repeater.Items)
                {
                    HiddenField field2 = item.FindControl("HdnFieldName") as HiddenField;
                    CheckBox box = item.FindControl("ChkFieldPurview") as CheckBox;
                    foreach (RoleFieldPermissionsInfo info in fieldPermissionsById)
                    {
                        if ((info.FieldName == field2.Value) && (info.ModelId == num))

⌨️ 快捷键说明

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