Beispiel #1
0
        private string NodeToXml(NodeInfo node)
        {
            System.Text.StringBuilder stringBuilder  = new System.Text.StringBuilder();
            ContModelInfo             cacheModelByID = ContModel.GetCacheModelByID(node.ModelID);

            stringBuilder.Append(string.Concat(new object[]
            {
                "<Node name=\"",
                node.NodeName,
                "\" id=\"",
                node.UrlRewriteName,
                "\" model=\"",
                cacheModelByID.ModelName,
                "\" ismenu=\"",
                node.IsShowOnMenu ? 1 : 0,
                "\" tpindex=\"",
                node.NodeSetting.TemplateOfNodeIndex,
                "\" tplist=\"",
                node.NodeSetting.TemplateOfNodeList,
                "\" tpdetail=\"",
                node.NodeSetting.TemplateOfNodeContent,
                "\">"
            }));
            if (node.ChildCount > 0)
            {
                foreach (NodeInfo current in SinGooCMS.BLL.Node.GetCacheChildNode(node.AutoID))
                {
                    stringBuilder.Append(this.NodeToXml(current));
                }
            }
            stringBuilder.Append("</Node>");
            return(stringBuilder.ToString());
        }
Beispiel #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            ContentInfo   currentContent = base.GetCurrentContent();
            NodeInfo      cacheNodeById  = SinGooCMS.BLL.Node.GetCacheNodeById((currentContent == null) ? 0 : currentContent.NodeID);
            ContModelInfo cacheModelByID = ContModel.GetCacheModelByID((currentContent == null) ? 0 : currentContent.ModelID);

            if (currentContent == null)
            {
                base.Response.Redirect("/Include/Error/ErrorMsg_404.htm");
            }
            else if (cacheNodeById == null)
            {
                base.Alert(base.GetCaption("CMS_NodeNotExist"), base.ResolveUrl("~/"));
            }
            else if (cacheNodeById.NodeSetting.NeedLogin)
            {
                if (base.UserID.Equals(-1))
                {
                    base.Alert(base.GetCaption("CMS_NodeNeedLoginToView"), "/User/LoginExpire.html?returnurl=" + HttpUtility.UrlEncode(base.Request.RawUrl));
                }
                else
                {
                    bool   flag  = !string.IsNullOrEmpty(cacheNodeById.NodeSetting.EnableViewUGroups);
                    bool   flag2 = !string.IsNullOrEmpty(cacheNodeById.NodeSetting.EnableViewULevel);
                    string text  = StringUtils.AppendStr(cacheNodeById.NodeSetting.EnableViewUGroups, ',');
                    string text2 = StringUtils.AppendStr(cacheNodeById.NodeSetting.EnableViewULevel, ',');
                    if (ConfigUtils.GetAppSetting <string>("ViewPurviewType") == ViewPurviewType.Superior.ToString())
                    {
                        ViewPurview viewPurview = new ViewPurview();
                        new ViewPurview().GetAccessPurview(cacheNodeById, ref viewPurview);
                        flag  = !string.IsNullOrEmpty(viewPurview.GroupPurview);
                        flag2 = !string.IsNullOrEmpty(viewPurview.LevelPurview);
                        text  = StringUtils.AppendStr(viewPurview.GroupPurview, ',');
                        text2 = StringUtils.AppendStr(viewPurview.LevelPurview, ',');
                    }
                    if (flag && !text.Contains("," + base.LoginUser.GroupID.ToString() + ","))
                    {
                        this.Alert(base.GetCaption("CMS_TheUserGroupAccessDenied"), "/");
                    }
                    else if (flag2 && !text2.Contains("," + base.LoginUser.LevelID.ToString() + ","))
                    {
                        this.Alert(base.GetCaption("CMS_TheUserLevelAccessDenied"), "/");
                    }
                    else
                    {
                        this.ShowTemplate(cacheNodeById, currentContent);
                    }
                }
            }
            else
            {
                this.ShowTemplate(cacheNodeById, currentContent);
            }
        }
Beispiel #3
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.intModelID  = WebUtils.GetQueryInt("ModelID");
     this.modelParent = ContModel.GetCacheModelByID(this.intModelID);
     if (this.modelParent == null)
     {
         base.ShowMsg("没有找到内容模型信息");
     }
     else if (!base.IsPostBack)
     {
         this.BindData();
     }
 }
Beispiel #4
0
        protected void lnk_Delete_Click(object sender, System.EventArgs e)
        {
            if (!base.IsAuthorizedOp(ActionType.Delete.ToString()))
            {
                base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền");
            }
            else
            {
                int           @int           = WebUtils.GetInt((sender as LinkButton).CommandArgument);
                ContModelInfo cacheModelByID = ContModel.GetCacheModelByID(@int);
                if (cacheModelByID == null)
                {
                    base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa");
                }
                else
                {
                    ModelDeleteStatus modelDeleteStatus  = ContModel.Delete(@int);
                    ModelDeleteStatus modelDeleteStatus2 = modelDeleteStatus;
                    switch (modelDeleteStatus2)
                    {
                    case ModelDeleteStatus.Error:
                        base.ShowAjaxMsg(this.UpdatePanel1, "删除内容模型失败");
                        break;

                    case ModelDeleteStatus.ModelNotExists:
                        base.ShowAjaxMsg(this.UpdatePanel1, "模型不存在或者已经被删除");
                        break;

                    case ModelDeleteStatus.NodesRef:
                        base.ShowAjaxMsg(this.UpdatePanel1, "无法删除,模型正被栏目引用");
                        break;

                    case ModelDeleteStatus.ContentRef:
                        base.ShowAjaxMsg(this.UpdatePanel1, "无法删除,模型正被内容引用");
                        break;

                    default:
                        if (modelDeleteStatus2 == ModelDeleteStatus.Success)
                        {
                            this.BindData();
                            PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除内容模型[" + cacheModelByID.ModelName + "] thành công");
                            base.ShowAjaxMsg(this.UpdatePanel1, "删除内容模型成功");
                        }
                        break;
                    }
                }
            }
        }
Beispiel #5
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.intModelID  = WebUtils.GetQueryInt("ModelID");
     this.modelParent = ContModel.GetCacheModelByID(this.intModelID);
     if (this.modelParent == null)
     {
         base.ClientScript.RegisterClientScriptBlock(base.GetType(), "alertandredirect", "<script>alert('Không tìm thấy kiểu dữ liệu信息');history.go(-1);</script>");
     }
     else
     {
         this.labModelName.Text = this.modelParent.ModelName;
         if (base.IsEdit && !base.IsPostBack)
         {
             this.InitForModify();
         }
     }
 }
Beispiel #6
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.strType  = WebUtils.GetQueryString("ListType", "Normal");
     this.contNode = SinGooCMS.BLL.Node.GetCacheNodeById(WebUtils.GetQueryInt("NodeID"));
     if (base.IsEdit)
     {
         this.contInit = SinGooCMS.BLL.Content.GetContentById(base.OpID);
         this.contNode = SinGooCMS.BLL.Node.GetCacheNodeById((this.contInit == null) ? 0 : this.contInit.NodeID);
     }
     if (this.contNode == null)
     {
         base.ShowMsgAndRdirect("没有找到栏目信息", string.Concat(new object[]
         {
             "ContentList.aspx?CatalogID=",
             base.CurrentCatalogID,
             "&Module=",
             base.CurrentModuleCode,
             "&action=View&ListType=",
             this.strType
         }));
     }
     else if (base.IsEdit && this.contInit == null)
     {
         base.ShowMsgAndRdirect("没有找到内容信息", string.Concat(new object[]
         {
             "ContentList.aspx?CatalogID=",
             base.CurrentCatalogID,
             "&Module=",
             base.CurrentModuleCode,
             "&action=View&ListType=",
             this.strType
         }));
     }
     else
     {
         this.contModel = (base.IsEdit ? ContModel.GetCacheModelByID(this.contInit.ModelID) : ContModel.GetCacheModelByID(this.contNode.ModelID));
         if (!base.IsPostBack)
         {
             this.BindData();
         }
     }
 }
Beispiel #7
0
        protected void btnok_Click(object sender, System.EventArgs e)
        {
            if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString()))
            {
                base.ShowMsg("Không có thẩm quyền");
            }
            else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString()))
            {
                base.ShowMsg("Không có thẩm quyền");
            }
            else
            {
                ContModelInfo contModelInfo = new ContModelInfo();
                if (base.IsEdit)
                {
                    contModelInfo = ContModel.GetCacheModelByID(base.OpID);
                }
                contModelInfo.ModelName = WebUtils.GetString(this.TextBox1.Text);
                contModelInfo.TableName = "cms_C_" + WebUtils.GetString(this.TextBox2.Text);
                contModelInfo.ModelDesc = WebUtils.GetString(this.TextBox3.Text);
                contModelInfo.IsUsing   = true;
                contModelInfo.Creator   = base.LoginAccount.AccountName;
                if (string.IsNullOrEmpty(contModelInfo.ModelName))
                {
                    base.ShowMsg("模型名称不能为空");
                }
                else if (string.IsNullOrEmpty(this.TextBox2.Text))
                {
                    base.ShowMsg("数据表名不能为空");
                }
                else
                {
                    if (base.Action.Equals(ActionType.Add.ToString()))
                    {
                        contModelInfo.AutoTimeStamp = System.DateTime.Now;
                        ModelAddState modelAddState  = ContModel.Add(contModelInfo);
                        ModelAddState modelAddState2 = modelAddState;
                        switch (modelAddState2)
                        {
                        case ModelAddState.Error:
                            base.ShowMsg("添加模型失败");
                            break;

                        case ModelAddState.ModelNameExists:
                            base.ShowMsg("模型名称已经存在");
                            break;

                        case ModelAddState.TableNameIsUsing:
                            base.ShowMsg("已经存在相同的自定义表名称");
                            break;

                        case ModelAddState.TableExists:
                            base.ShowMsg("自定义表已经存在");
                            break;

                        case ModelAddState.CreateTableError:
                            base.ShowMsg("创建自定义表失败");
                            break;

                        default:
                            if (modelAddState2 == ModelAddState.Success)
                            {
                                PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加模型[" + contModelInfo.ModelName + "] thành công");
                                MessageUtils.DialogCloseAndParentReload(this);
                            }
                            break;
                        }
                    }
                    if (base.Action.Equals(ActionType.Modify.ToString()))
                    {
                        if (ContModel.Update(contModelInfo))
                        {
                            PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改模型[" + contModelInfo.ModelName + "] thành công");
                            MessageUtils.DialogCloseAndParentReload(this);
                        }
                        else
                        {
                            base.ShowMsg("修改模型失败");
                        }
                    }
                }
            }
        }
Beispiel #8
0
 public string GetModelName(int intModelID)
 {
     return(ContModel.GetCacheModelByID(intModelID).ModelName);
 }