示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        B_ARoleAuth.CheckEx(ZLEnum.Auth.model, "NodeEdit");
        if (function.isAjax())
        {
            #region AJAX
            M_Node nodeMod = nodeBll.SelReturnModel(NodeID);
            if (NodeID < 1)
            {
                nodeMod.ParentID = ParentID;
            }
            string action = Request.Form["action"];
            string value  = Request.Form["value"];
            int    result = M_APIResult.Success;
            switch (action)
            {
            case "nodename":
            {
                nodeMod.NodeName = value;
                result           = nodeBll.CheckNodeName(nodeMod)?M_APIResult.Success:M_APIResult.Failed;
            }
            break;

            case "nodedir":
            {
                nodeMod.NodeDir = value;
                result          = nodeBll.CheckNodeDir(nodeMod) ? M_APIResult.Success : M_APIResult.Failed;
            }
            break;
            }
            Response.Write(result); Response.Flush(); Response.End();
            #endregion
        }
        if (!IsPostBack)
        {
            M_AdminInfo adminMod  = B_Admin.GetLogin();
            M_Node      nodeMod   = nodeBll.SelReturnModel(NodeID);
            M_Node      parentMod = nodeBll.SelReturnModel(ParentID > 0 ? ParentID : nodeMod.ParentID);
            LblNodeName.Text = parentMod.NodeName;
            if (NodeID < 1)
            {
                Title_T.Text = "添加节点";
                CDate_T.Text = DateTime.Now.ToString();
                CUser_T.Text = adminMod.AdminName;
                ModelArr    += parentMod.ContentModel;
                function.Script(this, "BindPY();");
            }
            else if (NodeID > 0)
            {
                Title_T.Text        = "修改节点";
                Release_Btn.Visible = true;
                #region 节点信息填充
                if (nodeMod.IsNull)
                {
                    function.WriteErrMsg("指定要编辑的节点不存在");
                }
                //LblNodeName.Text = nodeMod.NodeName;
                //EDHid.Value = nodeMod.Viewinglimit;
                //HdnDepth.Value = nodeMod.Depth.ToString();
                //HdnParentId.Value = nodeMod.ParentID.ToString();
                //HdnOrderID.Value = nodeMod.OrderID.ToString();
                //HdnChild.Value = nodeMod.Child.ToString();
                TxtNodeName.Text        = nodeMod.NodeName;
                TxtNodeDir.Text         = nodeMod.NodeDir;
                TxtNodePicUrl.Text      = nodeMod.NodePic;
                TxtTips.Text            = nodeMod.Tips;
                TxtMetaKeywords.Text    = nodeMod.Meta_Keywords;
                TxtMetaDescription.Text = nodeMod.Meta_Description;
                TxtDescription.Text     = nodeMod.Description;
                //RBLOpenType.SelectedValue = DataConverter.CLng(node.OpenNew).ToString();
                RBLPurviewType.SelectedValue       = nodeMod.PurviewType ? "1" : "0";
                SiteContentAudit_Rad.SelectedValue = nodeMod.SiteContentAudit.ToString();
                RBLCommentType.SelectedValue       = nodeMod.CommentType;
                TxtHitsOfHot.Text = nodeMod.HitsOfHot.ToString();

                TxtTemplate_hid.Value      = nodeMod.ListTemplateFile;
                IndexTemplate_hid.Value    = nodeMod.IndexTemplate;
                LastinfoTemplate_hid.Value = nodeMod.LastinfoTemplate;
                ProposeTemplate_hid.Value  = nodeMod.ProposeTemplate;
                HotinfoTemplate_hid.Value  = nodeMod.HotinfoTemplate;

                ListPageHtmlEx_Rad.SelectedValue = nodeMod.ListPageHtmlEx.ToString();
                ContentFileEx_Rad.SelectedValue  = nodeMod.ContentFileEx.ToString();
                ListPageEx_Rad.SelectedValue     = nodeMod.ListPageEx.ToString();
                LastinfoPageEx_Rad.SelectedValue = nodeMod.LastinfoPageEx.ToString();
                HotinfoPageEx.SelectedValue      = nodeMod.HotinfoPageEx.ToString();
                ProposePageEx.SelectedValue      = nodeMod.ProposePageEx.ToString();
                DDLContentRule.SelectedValue     = nodeMod.ContentPageHtmlRule.ToString();
                RBLPosition.SelectedValue        = nodeMod.HtmlPosition.ToString();
                RBLItemOpenType.SelectedValue    = nodeMod.ItemOpenTypeTrue.ToString();
                RBLOpenType.SelectedValue        = nodeMod.OpenTypeTrue.ToString();
                TxtAddMoney.Text           = nodeMod.AddMoney.ToString();
                TxtAddPoint.Text           = nodeMod.AddPoint.ToString();
                ClickTimeout.SelectedValue = nodeMod.ClickTimeout.ToString();
                txtAddExp.Text             = nodeMod.AddUserExp.ToString();
                txtDeducExp.Text           = nodeMod.DeducUserExp.ToString();
                ConsumeType_Hid.Value      = nodeMod.ConsumeType.ToString();
                CDate_T.Text = nodeMod.CDate.ToString();
                CUser_T.Text = nodeMod.CUName;
                DataTable auitDt = nodeBll.GetNodeAuitDT(nodeMod.Purview);
                //组权限绑定
                GroupAuthDT = psll.SelByNid(NodeID);
                DataTable tinfo = bGll.GetGroupList();
                GroupAuth_EGV.DataSource = tinfo;
                GroupAuth_EGV.DataBind();
                for (int i = 0; i < tinfo.Rows.Count; i++)
                {
                    ViewGroup_Chk.Items.Add(new ListItem(tinfo.Rows[i]["GroupName"].ToString(), tinfo.Rows[i]["GroupID"].ToString()));
                    ViewGroup2_Chk.Items.Add(new ListItem(tinfo.Rows[i]["GroupName"].ToString(), tinfo.Rows[i]["GroupID"].ToString()));
                    input_Chk.Items.Add(new ListItem(tinfo.Rows[i]["GroupName"].ToString(), tinfo.Rows[i]["GroupID"].ToString()));
                }
                //节点权限
                if (auitDt != null && auitDt.Rows.Count > 0)
                {
                    DataRow auitdr = auitDt.Rows[0];
                    SelCheck_RadioList.SelectedValue = auitdr["View"].ToString();
                    string ViewGroup    = auitdr["ViewGroup"].ToString();
                    string ViewSunGroup = auitdr["ViewSunGroup"].ToString();
                    string input        = auitdr["input"].ToString();
                    string forum        = auitdr["forum"].ToString();
                    foreach (ListItem item in ViewGroup_Chk.Items)
                    {
                        if (("," + ViewGroup + ",").Contains("," + item.Value + ","))
                        {
                            item.Selected = true;
                        }
                    }
                    foreach (ListItem item in ViewGroup2_Chk.Items)
                    {
                        if (("," + ViewSunGroup + ",").Contains("," + item.Value + ","))
                        {
                            item.Selected = true;
                        }
                    }
                    foreach (ListItem item in input_Chk.Items)
                    {
                        if (("," + input + ",").Contains("," + item.Value + ","))
                        {
                            item.Selected = true;
                        }
                    }
                    foreach (ListItem item in forum_Chk.Items)
                    {
                        if (("," + forum + ",").Contains("," + item.Value + ","))
                        {
                            item.Selected = true;
                        }
                    }
                }
                TxtConsumeCount.Text = nodeMod.ConsumeCount.ToString();
                TxtConsumePoint.Text = nodeMod.ConsumePoint.ToString();
                TxtConsumeTime.Text  = nodeMod.ConsumeTime.ToString();
                TxtShares.Text       = nodeMod.Shares.ToString();
                SetCustom(nodeMod.Custom);
                ModelArr            = nodeMod.ContentModel;
                isSimple_CH.Checked = nodeMod.Contribute == 1;
                SafeGuard.Checked   = nodeMod.SafeGuard == 1 ? true : false;
                #endregion
            }
            //添加工作流
            ddlState.DataSource     = bf.GetFlowAll();
            ddlState.DataTextField  = "flowName";
            ddlState.DataValueField = "id";
            ddlState.DataBind();
            ddlState.Items.Insert(0, new ListItem("不指定", "0"));
            droMod = droBll.SelByNodeID(NodeID);
            ddlState.SelectedValue = droMod == null ? "0" : droMod.FID.ToString();
            BGroup.DataSource      = bGll.GetGroupList();
            BGroup.DataBind();
            //内容模型列表
            DataTable dt = bllmodel.GetList();
            Model_RPT.DataSource = dt;
            Model_RPT.DataBind();
            //角色列表
            DataTable Rt = B_Role.SelectNodeRoleNode(NodeID);
            AdminRole_EGV.DataSource = Rt;
            AdminRole_EGV.DataBind();

            #region 互动
            DataTable dp = pll.GetPubModelPublic();
            DropDownList1.DataSource     = dp;
            DropDownList1.DataTextField  = "PubName";
            DropDownList1.DataValueField = "Pubid";
            DropDownList1.DataBind();
            DropDownList1.Items.Insert(0, new ListItem("选择绑定", "0"));
            M_Pub pp = pll.GetSelectNode(NodeID.ToString());
            if (pp.Pubid > 0)
            {
                DropDownList1.SelectedValue = pp.Pubid.ToString();
            }
            #endregion
            string bread = "<li><a href='" + customPath2 + "Config/SiteInfo.aspx'>系统设置</a></li><li><a href='NodeManage.aspx'>节点管理</a></li>";
            bread += "<li class='active'><a href='" + Request.RawUrl + "'>" + Title_T.Text + "</a></li>";
            bread += Call.GetHelp(103);
            bread += "<div class='pull-right' style='margin-right:10px;'><a href='" + Request.RawUrl + "' title='刷新'><i class='fa fa-refresh'></i></a></div>";
            Call.SetBreadCrumb(Master, bread);
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            B_Admin badmin = new B_Admin();

            if (!IsPostBack)
            {
                B_ARoleAuth.CheckEx(ZLEnum.Auth.model, "NodeEdit");
                this.DropDownList1.DataSource     = pll.SelectNode(5);
                this.DropDownList1.DataTextField  = "PubName";
                this.DropDownList1.DataValueField = "Pubid";
                this.DropDownList1.DataBind();
                this.DropDownList1.Items.Insert(0, new ListItem("选择绑定", "0"));
                if (NodeID < 1)
                {
                    if (ParentID == 0)
                    {
                        this.LblNodeName.Text = "根节点";
                    }
                    else
                    {
                        M_Node parentMod = this.bll.GetNodeXML(ParentID);
                        this.LblNodeName.Text = parentMod.NodeName;
                    }
                    function.Script(this, "BindPY();");
                }
                else
                {
                    M_Node nodeMod = this.bll.GetNodeXML(NodeID);
                    if (nodeMod.IsNull)
                    {
                        function.WriteErrMsg("指定要编辑的节点不存在");
                    }
                    if (nodeMod.ParentID == 0)
                    {
                        this.LblNodeName.Text = "根节点";
                    }
                    else
                    {
                        M_Node parentMod = this.bll.GetNodeXML(nodeMod.ParentID);
                        this.LblNodeName.Text = parentMod.NodeName;
                    }
                    //this.HdnNodeID.Value = mNodeID;
                    //this.HdnDepth.Value = node.Depth.ToString();
                    //this.HdnParentId.Value = node.ParentID.ToString();
                    //this.HdnOrderID.Value = node.OrderID.ToString();
                    this.TxtNodeName.Text          = nodeMod.NodeName;
                    this.TxtNodeDir.Text           = nodeMod.NodeDir;
                    this.TxtNodePicUrl.Text        = nodeMod.NodePic;
                    this.TxtTips.Text              = nodeMod.Tips;
                    this.RBLPosition.SelectedValue = nodeMod.HtmlPosition.ToString();
                    this.TxtMetaKeywords.Text      = nodeMod.Meta_Keywords;
                    this.TxtMetaDescription.Text   = nodeMod.Meta_Description;
                    this.RBLOpenType.SelectedValue = DataConverter.CLng(nodeMod.OpenNew).ToString();
                    //this.TxtSinglepageTemplate_hid.Value = nodeMod.IndexTemplate;
                    //-----模板
                    TxtTemplate_hid.Value            = nodeMod.ListTemplateFile;
                    IndexTemplate_hid.Value          = nodeMod.IndexTemplate;
                    LastinfoTemplate_hid.Value       = nodeMod.LastinfoTemplate;
                    ProposeTemplate_hid.Value        = nodeMod.ProposeTemplate;
                    HotinfoTemplate_hid.Value        = nodeMod.HotinfoTemplate;
                    this.RBLListEx.SelectedValue     = nodeMod.ListPageHtmlEx.ToString();
                    LastinfoPageEx_Rad.SelectedValue = nodeMod.LastinfoPageEx.ToString();
                    HotinfoPageEx.SelectedValue      = nodeMod.HotinfoPageEx.ToString();
                    ProposePageEx.SelectedValue      = nodeMod.ProposePageEx.ToString();
                    LastinfoPageEx_Rad.SelectedValue = nodeMod.LastinfoPageEx.ToString();

                    this.SafeGuard.SelectedValue       = nodeMod.SafeGuard.ToString();
                    this.RBLItemOpenType.SelectedValue = nodeMod.ItemOpenType.ToString();;
                    this.RBLOpenType.SelectedValue     = nodeMod.OpenTypeTrue.ToString();
                    this.RBLItemOpenType.SelectedValue = nodeMod.ItemOpenTypeTrue.ToString();
                    M_Pub pubMod = pll.GetSelectNode(NodeID.ToString());
                    if (pubMod.Pubid > 0)
                    {
                        this.DropDownList1.SelectedValue = pubMod.Pubid.ToString();
                    }
                }
                Call.SetBreadCrumb(Master, "<li>工作台</li><li><a href='" + customPath2 + "Config/SiteInfo.aspx'>系统设置</a></li><li>" + (ViewMode.Equals("design") ? "<a href='DesignNodeManage.aspx'>动力节点</a>" : "<a href='NodeManage.aspx'>节点管理</a>") + "</li><li class=\"active\">修改单页节点</li>");
            }
        }