Exemplo n.º 1
0
        //通过NodeCode和SiteID获取Nodeid
        private string GetNodeId()
        {
            string strResult = string.Empty;

            KingTop.BLL.SysManage.ModuleNode bll = new KingTop.BLL.SysManage.ModuleNode();
            DataTable dt = bll.GetModeNodeFromCache();

            DataRow[] dr = dt.Select("NodeCode='" + NodeCode + "' and webSiteID=" + SiteID);
            if (dr.Length > 0)
            {
                strResult = dr[0]["NodeID"].ToString();
            }
            return(strResult);
        }
Exemplo n.º 2
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            string    returnMsg       = "";
            string    editSelfMenuUrl = "";
            DataTable dtNodeCode      = null;

            #region 实体类赋值

            mode.NodeID   = new Guid(txtNodeID.Text);
            mode.NodeName = txtNodeName.Text.Trim();
            if (txtLinkURL.Text.Length > 0)
            {
                //mode.LinkURL = Utils.HtmlEncode(txtLinkURL.Text.Trim());
                mode.LinkURL = txtLinkURL.Text.Trim();
            }
            if (ddlModel.SelectedValue != "0")
            {
                mode.ModuleID = new Guid(ddlModel.SelectedValue.Trim());
            }
            mode.IsLeftDisplay  = Utils.ParseBool(chkIsLeftDisplay.Checked);
            mode.IsTopMenuShow  = Utils.ParseBool(chkIsTopMenuShow.Checked);
            mode.IsLeftMenuShow = Utils.ParseBool(chkIsLeftMenuShow.Checked);
            mode.IsValid        = Utils.ParseBool(RBL_IsValid.SelectedValue);
            mode.IsWeb          = true;
            mode.NodelOrder     = Utils.HtmlEncode(txtNodelOrder.Text.Trim());
            //mode.NodelDesc = Utils.HtmlEncode(txtNodelDesc.Text.Trim());
            mode.NodelDesc        = Editor1.Content;
            mode.CustomManageLink = "";
            mode.NodelEngDesc     = txtNodelEngDesc.Text.Trim();
            mode.NodelIcon        = txtNodelIcon.Text.Trim();
            mode.CurrentImg       = Utils.HtmlEncode(txtCurrentImg.Text.Trim());
            mode.MouseOverImg     = Utils.HtmlEncode(txtMouseOverImg.Text.Trim());
            mode.WebSiteID        = Convert.ToInt32(this.SiteID);
            mode.Creater          = base.GetLoginAccountId();
            mode.NodeDir          = txtNodeDir.Text;
            mode.Settings         = "";
            mode.Tips             = Utils.HtmlEncode(txtTips.Text);
            mode.PageTitle        = Utils.HtmlEncode(txtPageTitle.Text);
            mode.Meta_Keywords    = Utils.HtmlEncode(txtKeyWords.Text);
            mode.Meta_Description = Utils.HtmlEncode(txtMetaDesc.Text);
            mode.DefaultTemplate  = Utils.HtmlEncode(txtDefaultTemplate.Text);
            mode.ListPageTemplate = Utils.HtmlEncode(txtListPageTemplate.Text);
            mode.ContentTemplate  = Utils.HtmlEncode(txtContentTemplate.Text);
            mode.SubDomain        = txtSubDomain.Text;
            mode.EnableSubDomain  = Utils.ParseBool(RbtEnableSubDomain.SelectedValue);
            mode.CreateDate       = DateTime.Now;
            if (ddlReviewFlow.SelectedValue != "0")
            {
                mode.ReviewFlowID = this.ddlReviewFlow.SelectedValue;
            }
            mode.OpenType = radSelf.Checked ? 1 : 2;
            if (radkf.Checked)
            {
                mode.PurviewType = 1;
            }
            else if (radbkf.Checked)
            {
                mode.PurviewType = 2;
            }
            else if (radrz.Checked)
            {
                mode.PurviewType = 3;
            }
            else
            {
                mode.PurviewType = 4;
            }
            mode.IsEnableComment        = Utils.ParseBool(chkIsEnableComment.Checked);
            mode.IsCreateListPage       = radCreateListPageTrue.Checked ? false : true;
            mode.IncrementalUpdatePages = Utils.ParseInt(txtIncrementalUpdatePages.Text, 0);
            mode.IsEnableIndexCache     = Utils.ParseBool(chkIsEnableIndexCache.Checked);
            if (radListPageSavePathType1.Checked)
            {
                mode.ListPageSavePathType = 1;
            }
            else if (radListPageSavePathType2.Checked)
            {
                mode.ListPageSavePathType = 2;
            }
            else
            {
                mode.ListPageSavePathType = 3;
            }
            if (ddlListPagePostFix.SelectedValue != "")
            {
                mode.ListPagePostFix = this.ddlListPagePostFix.SelectedValue;
            }
            mode.IsCreateContentPage = radCreateContentPageTrue.Checked ? false : true;

            if (radContentPageSavePathType1.Checked)
            {
                mode.ContentPageHtmlRule = "1";
            }
            else if (radContentPageSavePathType2.Checked)
            {
                mode.ContentPageHtmlRule = "2";
            }
            else if (radContentPageSavePathType3.Checked)
            {
                mode.ContentPageHtmlRule = "3";
            }
            else if (radContentPageSavePathType4.Checked)
            {
                mode.ContentPageHtmlRule = "4";
            }
            else if (radContentPageSavePathType5.Checked)
            {
                mode.ContentPageHtmlRule = "5";
            }
            else if (radContentPageSavePathType6.Checked)
            {
                mode.ContentPageHtmlRule = "6";
            }
            else if (radContentPageSavePathType8.Checked)
            {
                mode.ContentPageHtmlRule = "8";
            }
            else if (radContentPageSavePathType7.Checked)
            {
                if (txtzdyURL.Text.Trim() == "")
                {
                    Utils.RunJavaScript(this, "type=2;errmsg='内容页路径规则你选择的是自定义,必须填写自定义路径';showMessage();");
                    return;
                }
                string zdyURL = "/" + txtzdyURL.Text + "/";
                zdyURL = zdyURL.Replace("//", "/");
                mode.ContentPageHtmlRule = "7";
                mode.CustomManageLink    = zdyURL;
            }

            //检测伪静态路径是否存在重复
            if (chkIsFolder.Checked == false)
            {
                string[] checkDirArr = CheckDirPath(mode.NodeName.Replace(" ", ""), mode.NodeDir.Replace(" ", ""), mode.ContentPageHtmlRule, mode.CustomManageLink, mode.ModuleID.ToString());
                if (checkDirArr[0] == "True")
                {
                    if (txtzdyURL.Text.Trim() == "")
                    {
                        Utils.RunJavaScript(this, "type=2;errmsg='根据你设置的内容页路径(路径是“" + checkDirArr[1] + "”选项,存在重复,请重新设置';showMessage();");
                        return;
                    }
                }
                mode.CustomManageLink = checkDirArr[1];
            }

            if (radAutoCreateHtmlType1.Checked)
            {
                mode.AutoCreateHtmlType = 1;
            }
            else if (radAutoCreateHtmlType2.Checked)
            {
                mode.AutoCreateHtmlType = 2;
            }
            else if (radAutoCreateHtmlType3.Checked)
            {
                mode.AutoCreateHtmlType = 3;
            }
            else if (radAutoCreateHtmlType4.Checked)
            {
                mode.AutoCreateHtmlType = 4;
            }
            else if (radAutoCreateHtmlType5.Checked)
            {
                mode.AutoCreateHtmlType = 5;
            }
            else
            {
                mode.AutoCreateHtmlType = 6;
            }
            mode.ColumnType = 1;

            //自定义内容赋值

            //取自定义数量
            int CustomContentCount = Utils.ParseInt(ddlCustomContentCount.SelectedValue, 1);
            //自定义内容,初始化为第一个TextBox.Text
            string strCustomContent = txtCustomContent1.Text + "<hqb>" + Utils.ParseInt(Request.Form["chkIsHtmlEditor1"], 0);
            for (int i = 2; i <= CustomContentCount; i++)
            {
                string strTemp = Request.Form["txtCustomContent" + i.ToString()];
                strCustomContent += "###" + strTemp + "<hqb>" + Utils.ParseInt(Request.Form["chkIsHtmlEditor" + i.ToString()], 0);
            }
            mode.Custom_Content = strCustomContent;
            mode.Banner         = txtBanner.Text;
            #endregion

            if (Action == "EDIT")
            {
                #region 修改节点
                // 权限验证,是否具有修改权限

                if (IsHaveRightByOperCode("Edit"))
                {
                    mode.NodeCode   = Utils.HtmlEncode(txtNodeCode.Text.Trim());
                    mode.ParentNode = NCode.Substring(0, NCode.Length - 3);


                    //根据NodeCode判断它下面是否有子栏目

                    dtNodeCode = bllModuleNode.GetList("ALLBY", Utils.getTwoParams(SiteID.ToString(), NCode));
                    if (dtNodeCode.Rows.Count == 0)
                    {
                        //如果没有子栏目,用户可随意修改[父级栏目]属性,如果有子栏目,则不给它赋值

                        mode.NodeType = (Utils.ParseBoolToInt(chkIsFolder.Checked)).ToString();
                    }
                    else  //如果有子栏目,则NodeType必须为1
                    {
                        mode.NodeType = "1";
                    }

                    if (mode.ParentNode == "")
                    {
                        mode.ParentNode = "0";
                    }

                    returnMsg = bllModuleNode.Save("EDIT", mode);
                    string logTitle = Request.Form["hidLogTitle"];
                    if (logTitle != txtNodeName.Text)
                    {
                        logTitle = logTitle + " => " + txtNodeName.Text;
                    }
                    returnMsg = bllModuleNode.Save("EDIT", mode);
                    if (Utils.ParseInt(returnMsg, 0) > 0)
                    {
                        DataTable parentDt = bllModuleNode.GetModeNodeFromCache();
                        string    parentNodeCode;
                        if (NCode.Length > 3)
                        {
                            parentNodeCode = NCode.Substring(0, NCode.Length - 3);
                        }
                        else
                        {
                            parentNodeCode = NCode;
                        }

                        DataRow[] parentdr = parentDt.Select("NodeCode='" + parentNodeCode + "'");
                        if (parentdr.Length > 0)
                        {
                            editSelfMenuUrl = "ColumnEdit.aspx?Action=New&NodeID=" + parentdr[0]["NodeId"].ToString() + "&ID=" + parentdr[0]["NodeId"].ToString() + "&NCode=" + parentNodeCode + "&NodeCode=" + NodeCode + "&IsParent=1";
                        }
                        WriteLog(GetLogValue(logTitle, "Update", "ModelNodeEdit", true), "", 2); //写日志
                        Utils.RunJavaScript(this, "type=1;title='" + txtNodeName.Text.Trim().Replace("'", "\\'") + "';editSelfMenuUrl='" + editSelfMenuUrl + "';showMessage();");
                    }
                    else
                    {
                        WriteLog(GetLogValue(logTitle, "Update", "ModelNodeEdit", false), returnMsg, 3); //写日志
                        Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "';showMessage();");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有修改栏目的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }
            else
            {
                #region 新增节点
                //判断是否有新增权限

                if (IsHaveRightByOperCode("New"))
                {
                    //根据IsParent判断它是不是父节点,如果不是则不能添加子节点
                    if (IsParent == "1")
                    {
                        //如果是子栏目,则必须要选择栏目类型
                        if (!chkIsFolder.Checked && ddlModel.SelectedValue == "0")
                        {
                            Utils.RunJavaScript(this, "alert({msg:'请选择栏目类型!',title:'提示信息'})");
                            return;
                        }
                        //根据NodeCode得到子栏目下最大的NodeCode
                        dtNodeCode = bllModuleNode.GetList("MAXCODE", Utils.getOneParams(this.NCode));
                        if (dtNodeCode != null && dtNodeCode.Rows.Count == 1)
                        {
                            if (dtNodeCode.Rows[0]["NodeCode"].ToString() != "")
                            {
                                mode.NodeCode = dtNodeCode.Rows[0]["NodeCode"].ToString();
                            }
                            else  //如果没有NodeCode后面三位从001开始

                            {
                                mode.NodeCode = this.NCode + "001";
                            }
                        }

                        mode.NodeType   = (Utils.ParseBoolToInt(chkIsFolder.Checked)).ToString();
                        mode.ParentNode = NCode;

                        //如果是添加一级栏目,得到一级栏目最大的NodeCode+1
                        if (NCode == "0")
                        {
                            DataTable dt = bllModuleNode.GetList("MAXPCODE", Utils.getOneParams(""));
                            if (dt.Rows.Count < 1)
                            {
                                mode.NodeCode   = this.NCode;
                                mode.ParentNode = "0";
                            }
                        }

                        returnMsg       = bllModuleNode.Save("NEW", mode);
                        editSelfMenuUrl = "ColumnEdit.aspx?Action=Edit&NodeID=" + mode.NodeID + "&ID=" + mode.NodeID + "&NCode=" + mode.NodeCode + "&NodeCode=" + NodeCode + "&ColumnType=1";
                        if (Utils.ParseInt(returnMsg, 0) > 0)
                        {
                            WriteLog("新增栏目" + txtNodeName.Text + "成功!", "", 2);//写入操作日志
                            Utils.RunJavaScript(this, "type=0;title='" + txtNodeName.Text.Trim().Replace("'", "\\'") + "';editSelfMenuUrl='" + editSelfMenuUrl + "';showMessage();");
                        }
                        else
                        {
                            WriteLog("新增栏目" + txtNodeName.Text + "失败!", returnMsg, 2);//写入操作日志
                            Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "';showMessage();");
                        }
                    }
                    else//如果不是则不能添加子节点
                    {
                        Utils.RunJavaScript(this, "alert({msg:'上级栏目不是父栏目,不能添加子栏目!',title:'提示信息'})");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有新增栏目的权限,请联系站点管理员!',title:'提示信息'})");
                }

                //当JS报错,不弹出框,用户可能会重复点击新增,避免产生的NodeID重复
                txtNodeID.Text = Guid.NewGuid().ToString();

                #endregion
            }

            //保存权限
            SaveRightDate(mode.NodeID.ToString());
        }
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            string    returnMsg       = "";
            string    editSelfMenuUrl = "";
            DataTable dtNodeCode      = null;

            #region 实体类赋值

            mode.NodeID       = new Guid(txtNodeID.Text);
            mode.NodeName     = txtNodeName.Text.Trim();
            mode.NodeDir      = txtNodeDir.Text;
            mode.NodelIcon    = txtNodelIcon.Text.Trim();
            mode.CurrentImg   = Utils.HtmlEncode(txtCurrentImg.Text.Trim());
            mode.MouseOverImg = Utils.HtmlEncode(txtMouseOverImg.Text.Trim());
            if (txtLinkURL.Text.Length > 0)
            {
                mode.LinkURL = txtLinkURL.Text.Trim();
            }
            //if (ddlModel.SelectedValue != "0")
            //{
            //    mode.ModuleID = new Guid(ddlModel.SelectedValue.Trim());
            //}
            mode.ModuleID         = new Guid(Request.Form["ddlModel"]);
            mode.IsValid          = Utils.ParseBool(RBL_IsValid.SelectedValue);
            mode.IsWeb            = true;
            mode.NodelOrder       = Utils.HtmlEncode(txtNodelOrder.Text.Trim());
            mode.IsLeftDisplay    = Utils.ParseBool(chkIsLeftDisplay.Checked);
            mode.IsTopMenuShow    = Utils.ParseBool(chkIsTopMenuShow.Checked);
            mode.IsLeftMenuShow   = Utils.ParseBool(chkIsLeftMenuShow.Checked);
            mode.NodelDesc        = Editor1.Content;
            mode.NodelEngDesc     = txtNodelEngDesc.Text.Trim();
            mode.WebSiteID        = Convert.ToInt32(this.SiteID);
            mode.Creater          = base.GetLoginAccountId();
            mode.Settings         = "";
            mode.Tips             = Utils.HtmlEncode(txtTips.Text);
            mode.PageTitle        = Utils.HtmlEncode(txtPageTitle.Text);
            mode.Meta_Keywords    = Utils.HtmlEncode(txtKeyWords.Text);
            mode.Meta_Description = Utils.HtmlEncode(txtMetaDesc.Text);
            mode.SubDomain        = txtSubDomain.Text;
            mode.CreateDate       = DateTime.Now;
            mode.OpenType         = radSelf.Checked ? 1 : 2;
            mode.ColumnType       = 2;
            mode.DefaultTemplate  = txtDefaultTemplate.Text;

            if (ddlListPagePostFix.SelectedValue != "")
            {
                mode.ListPagePostFix = this.ddlListPagePostFix.SelectedValue;
            }
            mode.IsCreateContentPage = radCreateContentPageTrue.Checked ? false : true;

            //自定义内容赋值

            //取自定义数量
            int CustomContentCount = Utils.ParseInt(ddlCustomContentCount.SelectedValue, 1);
            //自定义内容,初始化为第一个TextBox.Text
            string strCustomContent = txtCustomContent1.Text + "<hqb>" + Utils.ParseInt(Request.Form["chkIsHtmlEditor1"], 0);
            for (int i = 2; i <= CustomContentCount; i++)
            {
                string strTemp = Request.Form["txtCustomContent" + i.ToString()];
                strCustomContent += "###" + strTemp + "<hqb>" + Utils.ParseInt(Request.Form["chkIsHtmlEditor" + i.ToString()], 0);
            }
            mode.Custom_Content = strCustomContent;
            mode.Banner         = txtBanner.Text;
            #endregion

            if (Action == "EDIT")
            {
                #region 修改节点
                // 权限验证,是否具有修改权限

                if (IsHaveRightByOperCode("Edit"))
                {
                    mode.NodeCode   = Utils.HtmlEncode(txtNodeCode.Text.Trim());
                    mode.ParentNode = NCode.Substring(0, NCode.Length - 3);
                    //根据NodeCode判断它下面是否有子栏目

                    dtNodeCode = bllModuleNode.GetList("ALLBY", Utils.getTwoParams(SiteID.ToString(), NCode));
                    if (dtNodeCode.Rows.Count == 0)
                    {
                        //如果没有子栏目,用户可随意修改[父级栏目]属性,如果有子栏目,则不给它赋值

                        mode.NodeType = (Utils.ParseBoolToInt(chkIsFolder.Checked)).ToString();
                    }
                    else
                    {
                        mode.NodeType = "1";
                    }
                    if (mode.ParentNode == "")
                    {
                        mode.ParentNode = "0";
                    }

                    returnMsg = bllModuleNode.Save("EDIT", mode);
                    string logTitle = Request.Form["hidLogTitle"];
                    if (logTitle != txtNodeName.Text)
                    {
                        logTitle = logTitle + " => " + txtNodeName.Text;
                    }
                    returnMsg = bllModuleNode.Save("EDIT", mode);
                    if (Utils.ParseInt(returnMsg, 0) > 0)
                    {
                        DataTable parentDt = bllModuleNode.GetModeNodeFromCache();
                        string    parentNodeCode;
                        if (NCode.Length > 3)
                        {
                            parentNodeCode = NCode.Substring(0, NCode.Length - 3);
                        }
                        else
                        {
                            parentNodeCode = NCode;
                        }

                        DataRow[] parentdr = parentDt.Select("NodeCode='" + parentNodeCode + "'");
                        if (parentdr.Length > 0)
                        {
                            editSelfMenuUrl = "SingleColumn.aspx?Action=New&NodeID=" + parentdr[0]["NodeId"].ToString() + "&ID=" + parentdr[0]["NodeId"].ToString() + "&NCode=" + parentNodeCode + "&NodeCode=" + NodeCode + "&IsParent=1";
                        }
                        //Utils.RunJavaScript(this, "alertClose({msg:'修改栏目成功!',title:'提示信息'},function(){location.href='ColumnManage.aspx?nodeid=" + NodeID + "'})");
                        WriteLog(GetLogValue(logTitle, "Update", "ModelNodeEdit", true), "", 2); //写日志
                        Utils.RunJavaScript(this, "type=1;title='" + txtNodeName.Text.Trim().Replace("'", "\\'") + "';editSelfMenuUrl='" + editSelfMenuUrl + "'");
                    }

                    else
                    {
                        WriteLog(GetLogValue(logTitle, "Update", "ModelNodeEdit", false), returnMsg, 3); //写日志
                        Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "'");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有修改栏目的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }
            else
            {
                #region 新增节点
                //判断是否有新增权限

                if (IsHaveRightByOperCode("New"))
                {
                    //根据IsParent判断它是不是父节点,如果不是则不能添加子节点
                    if (IsParent == "1")
                    {
                        //如果是子栏目,则必须要选择栏目类型
                        //if (!chkIsFolder.Checked)
                        //{
                        //    Utils.RunJavaScript(this, "alert({msg:'请选择栏目类型!',title:'提示信息'})");
                        //    return;
                        //}
                        //根据NodeCode得到子栏目下最大的NodeCode
                        dtNodeCode = bllModuleNode.GetList("MAXCODE", Utils.getOneParams(this.NCode));
                        if (dtNodeCode != null && dtNodeCode.Rows.Count == 1)
                        {
                            if (dtNodeCode.Rows[0]["NodeCode"].ToString() != "")
                            {
                                mode.NodeCode = dtNodeCode.Rows[0]["NodeCode"].ToString();
                            }
                            else  //如果没有NodeCode后面三位从001开始

                            {
                                mode.NodeCode = this.NCode + "001";
                            }
                        }

                        mode.NodeType   = (Utils.ParseBoolToInt(chkIsFolder.Checked)).ToString();
                        mode.ParentNode = NCode;

                        //如果是添加一级栏目,得到一级栏目最大的NodeCode+1
                        if (NCode == "0")
                        {
                            DataTable dt = bllModuleNode.GetList("MAXPCODE", Utils.getOneParams(""));
                            if (dt.Rows.Count < 1)
                            {
                                mode.NodeCode   = this.NCode;
                                mode.ParentNode = "0";
                            }
                        }

                        returnMsg       = bllModuleNode.Save("NEW", mode);
                        editSelfMenuUrl = "SingleColumn.aspx?Action=Edit&NodeID=" + mode.NodeID + "&ID=" + mode.NodeID + "&NCode=" + mode.NodeCode + "&NodeCode=" + NodeCode + "&ColumnType=1";
                        if (Utils.ParseInt(returnMsg, 0) > 0)
                        {
                            WriteLog("新增栏目" + txtNodeName.Text + "成功!", "", 2);//写入操作日志
                            Utils.RunJavaScript(this, "type=0;title='" + txtNodeName.Text.Trim().Replace("'", "\\'") + "';editSelfMenuUrl='" + editSelfMenuUrl + "'");
                        }
                        else
                        {
                            WriteLog("新增栏目" + txtNodeName.Text + "成功!", returnMsg, 2);//写入操作日志
                            Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "'");
                        }
                    }
                    else//如果不是则不能添加子节点
                    {
                        Utils.RunJavaScript(this, "alert({msg:'上级栏目不是父栏目,不能添加子栏目!',title:'提示信息'})");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有新增栏目的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }

            //判断是否生成静态页面
            if (Utils.XmlRead(System.Web.HttpContext.Current.Server.MapPath("/config/SiteParam.config"), "SiteParamConfig/PublishType", "") == "2")
            {
                //动态转静态
                KingTop.WEB.SysAdmin.SysManage.AspxToHtml_Publish publish = new KingTop.WEB.SysAdmin.SysManage.AspxToHtml_Publish();
                string        nodeList = "''";
                List <string> lstMenu  = new List <string>();
                for (int i = 6; i <= NodeCode.Length; i = i + 3)
                {
                    nodeList += ",'" + NodeCode.Substring(0, i) + "'";
                    lstMenu.Add(NodeCode.Substring(0, i));
                }
                publish.IsBar        = false;
                publish.IsContent    = false;
                publish.IsIndex      = true;
                publish.IsMenuList   = true;
                publish.nodeCodeList = nodeList;
                publish.PublishType  = 0;
                publish.ListMenu     = lstMenu;
                publish.siteDir      = SiteDir;
                publish.siteID       = SiteID;

                try
                {
                    publish.Execute();
                }
                catch
                {
                    Utils.RunJavaScript(this, "alert({msg:'HTML页生成失败!你可以到“内容发布”栏目中重新发布本栏目',title:'提示信息'})");
                }
            }
        }
Exemplo n.º 4
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            string    returnMsg       = "";
            string    editSelfMenuUrl = "";
            DataTable dtNodeCode      = null;

            #region 实体类赋值

            mode.NodeID       = new Guid(txtNodeID.Text);
            mode.NodeName     = Utils.HtmlEncode(txtNodeName.Text.Trim());
            mode.NodelIcon    = Utils.HtmlEncode(txtNodelIcon.Text.Trim());
            mode.CurrentImg   = Utils.HtmlEncode(txtCurrentImg.Text.Trim());
            mode.MouseOverImg = Utils.HtmlEncode(txtMouseOverImg.Text.Trim());
            if (txtLinkURL.Text.Length > 0)
            {
                mode.LinkURL = txtLinkURL.Text.Trim();
            }
            mode.IsValid          = Utils.ParseBool(RBL_IsValid.SelectedValue);
            mode.IsLeftDisplay    = Utils.ParseBool(chkIsLeftDisplay.Checked);
            mode.IsTopMenuShow    = Utils.ParseBool(chkIsTopMenuShow.Checked);
            mode.IsLeftMenuShow   = Utils.ParseBool(chkIsLeftMenuShow.Checked);
            mode.IsWeb            = true;
            mode.NodelOrder       = Utils.HtmlEncode(txtNodelOrder.Text.Trim());
            mode.NodelDesc        = Editor1.Content;
            mode.NodelEngDesc     = Utils.HtmlEncode(txtNodelEngDesc.Text.Trim());
            mode.WebSiteID        = Convert.ToInt32(this.SiteID);
            mode.Creater          = base.GetLoginAccountId();
            mode.Settings         = "";
            mode.Tips             = Utils.HtmlEncode(txtTips.Text);
            mode.PageTitle        = Utils.HtmlEncode(txtPageTitle.Text);
            mode.Meta_Keywords    = Utils.HtmlEncode(txtKeyWords.Text);
            mode.Meta_Description = Utils.HtmlEncode(txtMetaDesc.Text);
            mode.CreateDate       = DateTime.Now;
            mode.OpenType         = radSelf.Checked ? 1 : 2;
            mode.ColumnType       = 3;
            mode.NodeType         = "0";
            mode.CustomManageLink = "../sysmanage/OutLinkShow.aspx";
            mode.Banner           = txtBanner.Text;
            #endregion

            if (Action == "EDIT")
            {
                #region 修改节点
                // 权限验证,是否具有修改权限

                if (IsHaveRightByOperCode("Edit"))
                {
                    mode.NodeCode   = Utils.HtmlEncode(txtNodeCode.Text.Trim());
                    mode.ParentNode = NCode.Substring(0, NCode.Length - 3);
                    if (mode.ParentNode == "")
                    {
                        mode.ParentNode = "0";
                    }

                    returnMsg = bllModuleNode.Save("EDIT", mode);
                    string logTitle = Request.Form["hidLogTitle"];
                    if (logTitle != txtNodeName.Text)
                    {
                        logTitle = logTitle + " => " + txtNodeName.Text;
                    }
                    returnMsg = bllModuleNode.Save("EDIT", mode);
                    if (Utils.ParseInt(returnMsg, 0) > 0)
                    {
                        DataTable parentDt = bllModuleNode.GetModeNodeFromCache();
                        string    parentNodeCode;
                        if (NCode.Length > 3)
                        {
                            parentNodeCode = NCode.Substring(0, NCode.Length - 3);
                        }
                        else
                        {
                            parentNodeCode = NCode;
                        }

                        DataRow[] parentdr = parentDt.Select("NodeCode='" + parentNodeCode + "'");
                        if (parentdr.Length > 0)
                        {
                            editSelfMenuUrl = "OutLinkColumn.aspx?Action=New&NodeID=" + parentdr[0]["NodeId"].ToString() + "&ID=" + parentdr[0]["NodeId"].ToString() + "&NCode=" + parentNodeCode + "&NodeCode=" + NodeCode + "&IsParent=1";
                        }
                        //Utils.RunJavaScript(this, "alertClose({msg:'修改栏目成功!',title:'提示信息'},function(){location.href='ColumnManage.aspx?nodeid=" + NodeID + "'})");
                        WriteLog(GetLogValue(logTitle, "Update", "ModelNodeEdit", true), "", 2); //写日志
                        Utils.RunJavaScript(this, "type=1;title='" + txtNodeName.Text.Trim().Replace("'", "\\'") + "';editSelfMenuUrl='" + editSelfMenuUrl + "'");
                    }
                    else
                    {
                        WriteLog(GetLogValue(logTitle, "Update", "ModelNodeEdit", false), returnMsg, 3); //写日志
                        Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "'");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有修改栏目的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }
            else
            {
                #region 新增节点
                //判断是否有新增权限

                if (IsHaveRightByOperCode("New"))
                {
                    //根据IsParent判断它是不是父节点,如果不是则不能添加子节点
                    if (IsParent == "1")
                    {
                        //根据NodeCode得到子栏目下最大的NodeCode
                        dtNodeCode = bllModuleNode.GetList("MAXCODE", Utils.getOneParams(this.NCode));
                        if (dtNodeCode != null && dtNodeCode.Rows.Count == 1)
                        {
                            if (dtNodeCode.Rows[0]["NodeCode"].ToString() != "")
                            {
                                mode.NodeCode = dtNodeCode.Rows[0]["NodeCode"].ToString();
                            }
                            else  //如果没有NodeCode后面三位从001开始

                            {
                                mode.NodeCode = this.NCode + "001";
                            }
                        }
                        mode.ParentNode = NCode;

                        //如果是添加一级栏目,得到一级栏目最大的NodeCode+1
                        if (NCode == "0")
                        {
                            DataTable dt = bllModuleNode.GetList("MAXPCODE", Utils.getOneParams(""));
                            if (dt.Rows.Count < 1)
                            {
                                mode.NodeCode   = this.NCode;
                                mode.ParentNode = "0";
                            }
                        }

                        returnMsg       = bllModuleNode.Save("NEW", mode);
                        editSelfMenuUrl = "OutLinkColumn.aspx?Action=Edit&NodeID=" + mode.NodeID + "&ID=" + mode.NodeID + "&NCode=" + mode.NodeCode + "&NodeCode=" + NodeCode + "&ColumnType=1";
                        if (Utils.ParseInt(returnMsg, 0) > 0)
                        {
                            WriteLog("新增栏目" + txtNodeName.Text + "成功!", "", 2);//写入操作日志
                            Utils.RunJavaScript(this, "type=0;title='" + txtNodeName.Text.Trim().Replace("'", "\\'") + "';editSelfMenuUrl='" + editSelfMenuUrl + "'");
                        }
                        else
                        {
                            WriteLog("新增栏目" + txtNodeName.Text + "成功!", returnMsg, 2);//写入操作日志
                            Utils.RunJavaScript(this, "type=2;errmsg='" + returnMsg.Replace("'", "\\'").Replace("\r\n", "<br>") + "'");
                        }
                    }
                    else//如果不是则不能添加子节点
                    {
                        Utils.RunJavaScript(this, "alert({msg:'上级栏目不是父栏目,不能添加子栏目!',title:'提示信息'})");
                    }
                }
                else
                {
                    Utils.RunJavaScript(this, "alert({msg:'你没有新增栏目的权限,请联系站点管理员!',title:'提示信息'})");
                }
                #endregion
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 循环生成树
        /// </summary>
        /// <param name="strParCode">父级节点编码,一开始是"",循环得到所有文件夹节点</param>
        /// <param name="objParCell">父级放树控件的容器</param>
        /// <param name="ParentGropID">父节点ID,CreateTreeLeaf()方法的参数</param>
        public void CreateTree(string strParCode, ref System.Web.UI.WebControls.TableCell objParCell, string ParentGropID, DataTable TreeDt, string accountId, string userGroup)
        {
            string strNodeType = "";
            string strCode = "", strName = "";
            string strNodeCode = "";
            string flowState   = "";
            string tableName   = "";
            bool   isShowCheck = true;

            //循环得到文件夹节点数据(strParCode开始是"")
            if (TreeDt == null)
            {
                KingTop.BLL.SysManage.ModuleNode objNode = new ModuleNode();
                TreeDt = objNode.GetModeNodeFromCache();
            }
            //DataTable DTtree = dal.GetTreeData(strParCode,Utils.ParseInt(SiteID,0));
            DataRow[] dr;
            if (strParCode == "")
            {
                dr = TreeDt.Select("len(NodeCode)=3 and WebSiteID=" + SiteID, "NodelOrder ASC,NodeCode ASC");
            }
            else
            {
                dr = TreeDt.Select("NodeCode like '" + strParCode + "%' AND len(NodeCode)=" + (strParCode.Length + 3) + " and WebSiteID=" + SiteID, "NodelOrder ASC,NodeCode ASC");
            }

            //得到父用户组中所有节点编码
            //DataTable DParentNod = dal.GetParentGropNodeID(ParentGropID);
            System.Web.UI.WebControls.Table     objTbl  = new Table();
            System.Web.UI.WebControls.TableRow  objRow  = new TableRow();
            System.Web.UI.WebControls.TableCell objCell = new TableCell();

            try
            {
                for (int i = 0; i < dr.Length; i++)
                {
                    strNodeType = dr[i]["NodeType"].ToString().Trim().ToLower();
                    strCode     = dr[i]["NodeCode"].ToString().Trim();
                    strName     = dr[i]["NodeName"].ToString().Trim();
                    strNodeCode = dr[i]["NodeID"].ToString().Trim();
                    flowState   = dr[i]["ReviewFlowID"].ToString();
                    tableName   = (dr[i]["TableName"].ToString() + "aaaa").ToLower().Replace("k_f_", "k_u_"); //加aaaaa防null值报错
                    //if (flowState == "000000000000000" && tableName.Substring(0, 4) == "k_u_") 不明白为什么要加tableName.Substring(0, 4) == "k_u_"条件
                    if (flowState == "000000000000000")
                    {
                        isShowCheck = true;
                    }
                    else
                    {
                        isShowCheck = false;
                    }

                    if (!HasLeftMenuRights(int.Parse(accountId), userGroup, strCode))
                    {
                        continue;
                    }

                    //如果是文件夹类型
                    if (strNodeType == "1")
                    {
                        objTbl  = new Table();
                        objRow  = new TableRow();
                        objCell = new TableCell();
                        objTbl  = this.CreateTable(objParCell, "tbl" + strParCode);
                        objRow  = this.CreateRow(ref objTbl);



                        //生成树单元格
                        objCell = this.CreateTreeCell(ref objRow, true, strName, strCode);
                        //循环得到下一级节点

                        this.CreateTree(strCode, ref objCell, ParentGropID, TreeDt, accountId, userGroup);
                    }
                    else
                    {
                        //如果父用户组节点编码有数据(即该用户组有父用户组且父用户组权限不为空)
                        if (ParentGropID != "")
                        {
                            //只有该节点是父用户组节点的子集时才生成叶子节点
                            if (CheckHasParentNodeRight(ParentGropID, strCode))
                            {
                                objTbl  = new Table();
                                objRow  = new TableRow();
                                objCell = new TableCell();
                                objTbl  = this.CreateTable(objParCell, "tbl" + strParCode);
                                objRow  = this.CreateRow(ref objTbl);
                                //生成树单元格
                                objCell = this.CreateTreeCell(ref objRow, true, strName, strCode);
                                //生成叶子节点
                                CreateTreeLeaf(strCode, ref objCell, strNodeCode, ParentGropID, isShowCheck, accountId, userGroup);
                                //找到了就跳出循环,不用继续froeache()
                                continue;
                            }
                        }
                        //父用户组节点编码没有数据,表明该用户组是一级用户组,直接生成叶子节点
                        else
                        {
                            objTbl  = new Table();
                            objRow  = new TableRow();
                            objCell = new TableCell();
                            objTbl  = this.CreateTable(objParCell, "tbl" + strParCode);
                            objRow  = this.CreateRow(ref objTbl);
                            //生成树单元格
                            objCell = this.CreateTreeCell(ref objRow, true, strName, strCode);
                            //生成叶子节点
                            CreateTreeLeaf(strCode, ref objCell, strNodeCode, ParentGropID, isShowCheck, accountId, userGroup);
                        }
                    }
                }
            }
            catch (System.Exception exp)
            {
                throw new Exception(exp.Message);
            }
        }