private SiteGroupCms.Entity.Catalogtree getTree(string _siteid, string _classid, bool _includechild)
        {
            SiteGroupCms.Entity.Catalogtree _tree = new SiteGroupCms.Entity.Catalogtree();
            SiteGroupCms.Entity.Site        _site = new SiteGroupCms.Dal.SiteDal().GetEntity(Str2Int(_siteid));
            if (_site == null)
            {
                return(null);
            }
            if (_classid == "0")//表示从根节点开始
            {
                _tree.Id   = _site.ID.ToString();
                _tree.Name = _site.Title;
            }
            else
            {
                SiteGroupCms.Entity.Catalog _catalog = new SiteGroupCms.Dal.CatalogDal().GetEntity(_classid);
                SiteGroupCms.Entity.Admin   _admin   = (SiteGroupCms.Entity.Admin)HttpContext.Current.Session["admin"];
                if (_admin.Catalogid.Trim() == "" || ((_admin.Catalogid.IndexOf(_catalog.ID + ",") >= 0) && (_catalog.Father == 0)) || _catalog.Father != 0) //超级管理或者包含该栏目则显示
                {
                    _tree.Id   = _catalog.ID.ToString();
                    _tree.Name = _catalog.Title;
                }
            }

            _tree.HasChild = HasChild(_classid);
            List <SiteGroupCms.Entity.Catalogtree> subtree = new List <SiteGroupCms.Entity.Catalogtree>();

            if (_includechild)
            {
                using (DbOperHandler _doh = new Common().Doh())
                {
                    _doh.Reset();
                    _doh.SqlCmd = "SELECT id FROM [yy_cataloginfo] WHERE [siteid]=" + _siteid + " AND [fatherid]=" + _classid + " order by sort desc";
                    DataTable dtClass = _doh.GetDataTable();
                    for (int i = 0; i < dtClass.Rows.Count; i++)
                    {
                        string _subclassid = dtClass.Rows[i]["Id"].ToString();
                        SiteGroupCms.Entity.Admin _admin = (SiteGroupCms.Entity.Admin)HttpContext.Current.Session["admin"];
                        if (_admin.Catalogid == "" || _admin.Catalogid.IndexOf(_subclassid + ",") >= 0 || _classid != "0")//超级管理或者包含该栏目则显示
                        {
                            subtree.Add(getTree(_siteid, _subclassid, _includechild));
                        }
                    }
                    dtClass.Clear();
                    dtClass.Dispose();
                }
            }
            _tree.SubChild = subtree;
            return(_tree);
        }
        public void allsite()
        {
            DataTable dt = new SiteGroupCms.Dal.CatalogDal().GetDT("siteid=" + site.ID, "sort asc");

            if (dt == null || dt.Rows.Count == 0)
            {
                return;
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                publishcatalog(dt.Rows[i]["id"].ToString(), false);
            }
            Makeindex(0);
            _response += "{\"IsError\":false,\"Message\":\"发布成功\",\"Data\":{\"art\":0}}";
            Response.Write(_response);
        }
Beispiel #3
0
 public void getcataloginfo()
 {
     SiteGroupCms.Dal.CatalogDal catalogdal = new SiteGroupCms.Dal.CatalogDal();
     SiteGroupCms.Entity.Catalog catalog    = new SiteGroupCms.Entity.Catalog();
     if (id != "0")
     {
         catalog = catalogdal.GetEntity(id);
     }
     if (catalog != null)
     {
         _response += "{\"IsError\":false,\"Message\":\"加载成功\",\"Data\":{\"id\":" + catalog.ID + ",";
         _response += "\"title\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(catalog.Title) + ",\"fathercatalog_val\":\"" + catalog.Father + "\",";
         _response += "\"dirname\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(catalog.Dirname) + ",\"desctiption\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(catalog.Description) + ",\"isshare\":\"" + catalog.IsShare + "\",";
         _response += "\"listtemplate_val\":\"" + catalog.Listtemplate + "\",\"contenttemplate_val\":\"" + catalog.ContentTemplate + "\"";
         _response += "}}";
     }
     Response.Write(_response);
 }
        public void loadcatalog()
        {
            SiteGroupCms.Dal.CatalogDal catalogdal = new SiteGroupCms.Dal.CatalogDal();
            DataTable dt = catalogdal.GetDT("fatherid=0", "sort asc");

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (i == 0)
                {
                    catalogs += " {display:'" + dt.Rows[i]["title"].ToString() + "',name:'catalog" + dt.Rows[i]["id"].ToString() + "',newline:true,labelWidth:200,width:200,space:30,type:'checkbox',group:'频道权限', groupicon:groupicon},";
                }
                else if (i < dt.Rows.Count - 1)
                {
                    catalogs += " {display:'" + dt.Rows[i]["title"].ToString() + "',name:'catalog" + dt.Rows[i]["id"].ToString() + "',newline:true,labelWidth:200,width:200,space:30,type:'checkbox', groupicon:groupicon},";
                }
                else
                {
                    catalogs += " {display:'" + dt.Rows[i]["title"].ToString() + "',name:'catalog" + dt.Rows[i]["id"].ToString() + "',newline:true,labelWidth:200,width:200,space:30,type:'checkbox', groupicon:groupicon}";
                }
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Admin_Load("1", "json");
                SiteGroupCms.Entity.Admin       _admin = (SiteGroupCms.Entity.Admin)Session["admin"];
                SiteGroupCms.Entity.Catalogtree tree   = new SiteGroupCms.Dal.CatalogDal().GetClassTree(_admin.CurrentSite.ToString(), "0", true);
                // if(type=="notincludeshare")
                //     Response.Write("[" + SiteGroupCms.Dal.Treejson.tree2json(tree, true) + "]");
                // else
                // Response.Write("[" + SiteGroupCms.Dal.Treejson.tree2json(tree, true) + ",{text:'共享文档库',url:'22',id:'0'}]");


                //以下代码解决ie中不可更新栏目的问题,不保留缓存
                Response.Buffer          = true;
                Response.ExpiresAbsolute = System.DateTime.Now.AddMonths(-120);
                Response.Expires         = 0;
                Response.CacheControl    = "no-cache";
                Response.AddHeader("pragma", "no=cache");
                Response.Write("[" + SiteGroupCms.Dal.Treejson.tree2json(tree, true) + "]");
            }
        }
        public void publishcatalog(string catalogid, bool isdepend) //isdepend=true 表示是独立发布的, isdepen=false 表示是是发布上级调用的
        {
            SiteGroupCms.Entity.Catalogtree catalogtree = new SiteGroupCms.Dal.CatalogDal().GetClassTree(site.ID.ToString(), catalogid, true);
            if (catalogtree.HasChild)
            {
                for (int i = 0; i < catalogtree.SubChild.Count; i++)
                {
                    publishcatalog(catalogtree.SubChild[i].Id, false);
                }
            }

            DataTable dt = new SiteGroupCms.Dal.ArticleDal().getDT("catalogid=" + catalogid + " and ispassed=1");

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    MakeView(dt.Rows[i]["id"].ToString());
                }
            }
            MakeList(catalogid, 0);
        }
Beispiel #7
0
        public string GetChannelLink(string _channelid, int type) //type=0 输出a标签 type=1 不输出a标签
        {
            string linkurl = "";

            SiteGroupCms.Entity.Site site = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
            string linkurltitle           = "";

            SiteGroupCms.Entity.Catalog catalog = new SiteGroupCms.Dal.CatalogDal().GetEntity(_channelid);
            while (catalog.Father != 0)
            {
                if (type == 0)
                {
                    linkurl = "&raquo;<a href=" + GetChannelLink(catalog.ID.ToString(), 1) + ">" + catalog.Title + "</a>" + linkurl;
                }
                else
                {
                    linkurltitle = catalog.Dirname + "/" + linkurltitle;
                }
                catalog = new SiteGroupCms.Dal.CatalogDal().GetEntity(catalog.Father.ToString());
            }
            if (type == 0)
            {
                linkurl = "<a href=" + GetChannelLink(catalog.ID.ToString(), 1) + ">" + catalog.Title + "</a>" + linkurl;
            }
            else
            {
                linkurltitle = "/sites/" + site.Location + "/pub/" + catalog.Dirname + "/" + linkurltitle;
            }
            if (type == 0)
            {
                return(linkurl);
            }
            else
            {
                return(linkurltitle);
            }
        }
Beispiel #8
0
        protected void loadlist()
        {
            switch (view)
            {
            case "catalogtree":    //加载树形栏目目录
                SiteGroupCms.Entity.Catalogtree tree = new SiteGroupCms.Dal.CatalogDal().GetClassTree(_admin.CurrentSite.ToString(), "0", true);
                Response.Write("[" + SiteGroupCms.Dal.Treejson.tree2json2(tree, true) + "]");
                break;

            case "cataloglist":    //加载列表型栏目目录
                SiteGroupCms.Dal.CatalogDal catalogda = new SiteGroupCms.Dal.CatalogDal();
                dt = catalogda.GetDT("siteid=" + _admin.CurrentSite, "sort asc");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (_admin.Catalogid == "" || _admin.Catalogid.IndexOf(dt.Rows[i]["id"].ToString() + ",") >= 0)    //超级管理或者包含该栏目则显示
                    {
                        if (i < dt.Rows.Count - 1)
                        {
                            _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(dt.Rows[i]["title"].ToString()) + "},";
                        }
                        else
                        {
                            _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(dt.Rows[i]["title"].ToString()) + "}";
                        }
                    }
                }
                Response.Write("[" + _response + "]");
                break;

            case "deptlist":    //加载部门列表
                SiteGroupCms.Dal.DepartDal deptdal = new SiteGroupCms.Dal.DepartDal();
                dt = deptdal.GetDT("1=1");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (i < dt.Rows.Count - 1)
                    {
                        _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(dt.Rows[i]["dept"].ToString()) + "},";
                    }
                    else
                    {
                        _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(dt.Rows[i]["dept"].ToString()) + "}";
                    }
                }
                Response.Write("[" + _response + "]");
                break;

            case "sitelist":    //加载站点列表
                SiteGroupCms.Dal.SiteDal sitedal = new SiteGroupCms.Dal.SiteDal();
                dt = sitedal.GetDT("1=1");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (i < dt.Rows.Count - 1)
                    {
                        _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(dt.Rows[i]["title"].ToString()) + "},";
                    }
                    else
                    {
                        _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(dt.Rows[i]["title"].ToString()) + "}";
                    }
                }
                Response.Write("[" + _response + "]");
                break;

            case "rolelist":    //加载角色列表
                SiteGroupCms.Dal.RoleDal roledal = new SiteGroupCms.Dal.RoleDal();
                dt = roledal.GetDT("1=1");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (i < dt.Rows.Count - 1)
                    {
                        _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":\"" + dt.Rows[i]["role"].ToString() + "\"},";
                    }
                    else
                    {
                        _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":\"" + dt.Rows[i]["role"].ToString() + "\"}";
                    }
                }
                Response.Write("[" + _response + "]");
                break;

            case "templatelist":    //加载模板列表
                loadtemplatelist(type);
                break;

            case "favorite":    //记载我的操作收藏列表
                SiteGroupCms.Dal.FavoriteDal favdal = new SiteGroupCms.Dal.FavoriteDal();
                dt = favdal.GetDT("1=1");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (i < dt.Rows.Count - 1)
                    {
                        if (_admin.Rights.Contains(dt.Rows[i]["rightid"].ToString()))
                        {
                            _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":\"" + dt.Rows[i]["title"].ToString() + "\"},";
                        }
                    }

                    else
                    {
                        if (_admin.Rights.Contains(dt.Rows[i]["rightid"].ToString()))
                        {
                            _response += "{\"id\":" + dt.Rows[i]["id"].ToString() + ",\"text\":\"" + dt.Rows[i]["title"].ToString() + "\"}";
                        }
                    }
                }
                Response.Write("[" + _response + "]");
                break;
            }
        }