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

📄 categorybatchset.aspx.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
            info.IsCreateListPage = DataConverter.CBool(this.RadlIsListPageCreate.SelectedValue);
            info.ListPageSavePathType = (ListPagePathType) Enum.Parse(typeof(ListPagePathType), this.RadlListPageHtmlDirType.SelectedValue);
            info.ListPagePostfix = this.PagePostfix.Value;
            info.AutoCreateHtmlType = (AutoCreateHtmlType) Enum.Parse(typeof(AutoCreateHtmlType), this.RadlAutoCreateHtmlType.SelectedValue);
            info.ContentPageHtmlRule = this.TxtContentHtmlDir.Value + "/" + this.TxtContentHtmlFile.Value + "." + this.TxtContentHtmlExt.Value;
            info.RelateNode = this.GetSelectArrFromListControl(this.LstRelationNodes).ToString();
            info.RelateSpecial = this.GetSelectArrFromListControl(this.LstRelationSpecial).ToString();
            info.Settings = info2;
            info.RootId = 0;
            return info;
        }

        private StringBuilder GetSelectArrFromListControl(ListControl listControl)
        {
            StringBuilder builder = new StringBuilder();
            foreach (ListItem item in listControl.Items)
            {
                if (!item.Selected)
                {
                    continue;
                }
                if (builder.Length > 0)
                {
                    builder.Append(",");
                }
                builder.Append(item.Value);
            }
            return builder;
        }

        private void InitCreateHtmlControl()
        {
            this.RadlAutoCreateHtmlType.Items[4].Attributes.Add("onclick", "ShowSelectRelation(\"0\")");
            this.RadlAutoCreateHtmlType.Items[0].Attributes.Add("onclick", "ShowSelectRelation(\"0\")");
            this.RadlAutoCreateHtmlType.Items[1].Attributes.Add("onclick", "ShowSelectRelation(\"0\")");
            this.RadlAutoCreateHtmlType.Items[2].Attributes.Add("onclick", "ShowSelectRelation(\"0\")");
            this.RadlAutoCreateHtmlType.Items[3].Attributes.Add("onclick", "ShowSelectRelation(\"0\")");
            this.RadlAutoCreateHtmlType.Items[5].Attributes.Add("onclick", "ShowSelectRelation(\"4\")");
            if (!this.Page.IsPostBack)
            {
                string text = "列表文件分目录保存在所属栏目的文件夹中<br/><span style=\"color: blue\">例:Article/News/Index.html(栏目首页)<br /> Article/News/List_1.html<span>(栏目列表页)";
                string str2 = "列表文件统一保存在指定的“List”文件夹中<br/><span style=\"color: blue\">例:Article/List/List_236.html(栏目首页)<br /> Article/List/List_236_1.html(第二页)";
                string str3 = "列表文件统一保存在一级栏目文件夹中<br/><span style=\"color: blue\">例:Article/List_236.html(栏目首页)<br /> Article/List_236_1.html<span>(第二页)";
                this.RadlListPageHtmlDirType.Items.Add(new ListItem(text, "NodePath"));
                this.RadlListPageHtmlDirType.Items.Add(new ListItem(str2, "ListPath"));
                this.RadlListPageHtmlDirType.Items.Add(new ListItem(str3, "RootPath"));
                BasePage.SetSelectedIndexByValue(this.RadlListPageHtmlDirType, "NodePath");
            }
        }

        private void Initial()
        {
            this.InitCreateHtmlControl();
            if (!this.Page.IsPostBack)
            {
                this.RadNeedCache0.Attributes.Add("onclick", "javascript:TrSetCacheTime.style.display='none';");
                this.RadNeedCache1.Attributes.Add("onclick", "javascript:TrSetCacheTime.style.display='';");
                IList<NodeInfo> nodeNameForContainerItems = Nodes.GetNodeNameForContainerItems();
                if (nodeNameForContainerItems.Count < 1)
                {
                    ListItem item = new ListItem("无节点,请先添加节点", "0");
                    item.Enabled = false;
                }
                else
                {
                    this.LstNodes.DataSource = nodeNameForContainerItems;
                    this.LstNodes.DataBind();
                }
            }
            StringBuilder builder = new StringBuilder();
            builder.Append("<script type=\"text/javascript\">");
            builder.Append("function SelectAll(){");
            builder.Append("for(var i=0;i<document.getElementById('");
            builder.Append(this.LstNodes.ClientID);
            builder.Append("').length;i++){");
            builder.Append("document.getElementById('");
            builder.Append(this.LstNodes.ClientID);
            builder.Append("').options[i].selected=true;}}");
            builder.Append("function UnSelectAll(){");
            builder.Append("for(var i=0;i<document.getElementById('");
            builder.Append(this.LstNodes.ClientID);
            builder.Append("').length;i++){");
            builder.Append("document.getElementById('");
            builder.Append(this.LstNodes.ClientID);
            builder.Append("').options[i].selected=false;}}");
            builder.Append("</script>");
            base.ClientScript.RegisterClientScriptBlock(base.GetType(), "Select", builder.ToString());
            if (!this.Page.IsPostBack)
            {
                IList<NodeInfo> nodeNameForItemsExceptOutLinks = Nodes.GetNodeNameForItemsExceptOutLinks();
                this.LstRelationNodes.DataSource = nodeNameForItemsExceptOutLinks;
                this.LstRelationNodes.DataTextField = "NodeName";
                this.LstRelationNodes.DataValueField = "NodeId";
                this.LstRelationNodes.DataBind();
                IList<UserGroupsInfo> userGroupList = UserGroups.GetUserGroupList(0, 0);
                this.EgvPermissions.DataSource = userGroupList;
                this.EgvPermissions.DataBind();
                this.EgvRoleView.DataSource = UserRole.GetRoleList();
                this.EgvRoleView.DataBind();
                IList<ModelInfo> modelList = ModelManager.GetModelList(ModelType.Content, ModelShowType.Enable);
                this.RepContentModelTemplate.DataSource = modelList;
                this.RepContentModelTemplate.DataBind();
                this.RepShopModelTemplate.DataSource = ModelManager.GetModelList(ModelType.Shop, ModelShowType.Enable);
                this.RepShopModelTemplate.DataBind();
                IList<WorkFlowsInfo> workFlowsList = WorkFlow.GetWorkFlowsList();
                this.DropWorkFlow.DataSource = workFlowsList;
                this.DropWorkFlow.DataBind();
                this.LstRelationSpecial.DataSource = Special.GetSpecialList();
                this.LstRelationSpecial.DataBind();
            }
            bool flag = RolePermissions.AccessCheck(OperateCode.AdministratorManage);
            bool flag2 = RolePermissions.AccessCheck(OperateCode.UserGroupManage);
            if (!flag)
            {
                this.TdRolePermissions.Style.Add("display", "none");
            }
            if (!flag2)
            {
                this.TdGroupPermissions.Style.Add("display", "none");
            }
            if (!flag && !flag2)
            {
                this.TabTitle5.Style.Add("display", "none");
            }
            if (!SiteConfig.SiteOption.EnablePointMoneyExp)
            {
                this.TabTitle2.Style.Add("display", "none");
            }
        }

        private void InputPermissions(int nodeId)
        {
            string selectId = "";
            StringBuilder roleIdList = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            StringBuilder builder3 = new StringBuilder();
            for (int i = 0; i < this.EgvPermissions.Rows.Count; i++)
            {
                CheckBox box3 = (CheckBox) this.EgvPermissions.Rows[i].FindControl("ChkNodeSkim");
                CheckBox box = (CheckBox) this.EgvPermissions.Rows[i].FindControl("ChkNodeShow");
                CheckBox box2 = (CheckBox) this.EgvPermissions.Rows[i].FindControl("ChkNodeInput");
                selectId = this.EgvPermissions.DataKeys[i].Value.ToString();
                AppendSelectId(box3.Checked, builder3, selectId);
                AppendSelectId(box.Checked, roleIdList, selectId);
                AppendSelectId(box2.Checked, builder2, selectId);
            }
            UserPermissions.AddNodePermissions(builder2.ToString(), OperateCode.NodeContentInput, nodeId, 1);
            UserPermissions.AddNodePermissions(roleIdList.ToString(), OperateCode.NodeContentPreview, nodeId, 1);
            UserPermissions.AddNodePermissions(builder3.ToString(), OperateCode.NodeContentSkim, nodeId, 1);
        }

        private void InputRolePermission(int nodeId)
        {
            StringBuilder roleIdList = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            StringBuilder builder3 = new StringBuilder();
            StringBuilder builder4 = new StringBuilder();
            StringBuilder builder5 = new StringBuilder();
            StringBuilder builder6 = new StringBuilder();
            for (int i = 0; i < this.EgvRoleView.Rows.Count; i++)
            {
                CheckBox box = (CheckBox) this.EgvRoleView.Rows[i].FindControl("ChkNodePreview");
                CheckBox box2 = (CheckBox) this.EgvRoleView.Rows[i].FindControl("ChkNodeInput");
                CheckBox box3 = (CheckBox) this.EgvRoleView.Rows[i].FindControl("ChkNodeCheck");
                CheckBox box4 = (CheckBox) this.EgvRoleView.Rows[i].FindControl("ChkContentManage");
                CheckBox box5 = (CheckBox) this.EgvRoleView.Rows[i].FindControl("ChkNodeManage");
                CheckBox box6 = (CheckBox) this.EgvRoleView.Rows[i].FindControl("ChkCommentManage");
                string selectId = this.EgvRoleView.DataKeys[i].Value.ToString();
                AppendSelectId(box.Checked, roleIdList, selectId);
                AppendSelectId(box2.Checked, builder2, selectId);
                AppendSelectId(box3.Checked, builder3, selectId);
                AppendSelectId(box4.Checked, builder4, selectId);
                AppendSelectId(box5.Checked, builder5, selectId);
                AppendSelectId(box6.Checked, builder6, selectId);
            }
            RolePermissions.DeleteNodePermissionFromRoles(-1, nodeId);
            RolePermissions.AddNodePermissionToRoles(roleIdList.ToString(), nodeId, OperateCode.NodeContentPreview);
            RolePermissions.AddNodePermissionToRoles(builder2.ToString(), nodeId, OperateCode.NodeContentInput);
            RolePermissions.AddNodePermissionToRoles(builder3.ToString(), nodeId, OperateCode.NodeContentCheck);
            RolePermissions.AddNodePermissionToRoles(builder5.ToString(), nodeId, OperateCode.ChildNodesManage);
            RolePermissions.AddNodePermissionToRoles(builder4.ToString(), nodeId, OperateCode.NodeContentManage);
            RolePermissions.AddNodePermissionToRoles(builder6.ToString(), nodeId, OperateCode.NodeCommentManage);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Nodes.CheckRoleNodePurview(BasePage.RequestInt32("NodeID"), OperateCode.CurrentNodesManage))
            {
                AdminPage.WriteErrMsg("<li>对不起,您没有当前栏目的管理权限!</li>");
            }
            this.Initial();
        }

        protected void RadPurviewType_CheckedChanged(object sender, EventArgs e)
        {
            IList<UserGroupsInfo> userGroupList = UserGroups.GetUserGroupList(0, 0);
            this.EgvPermissions.DataSource = userGroupList;
            this.EgvPermissions.DataBind();
        }

        protected void RepModelTemplate_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                ModelInfo dataItem = (ModelInfo) e.Item.DataItem;
                if (!string.IsNullOrEmpty(dataItem.DefaultTemplateFile))
                {
                    ((TextBox) e.Item.FindControl("FileCTemplate")).Text = dataItem.DefaultTemplateFile;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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