Ejemplo n.º 1
0
 /// <summary>
 /// 链接到内容页
 /// </summary>
 /// <param name="_contentid">内容ID</param>
 /// <param name="_initialize">是否初始化</param>
 /// <returns></returns>
 public string Go2View(string _contentid)
 {
     SiteGroupCms.Dal.ArticleDal        articledal = new ArticleDal();
     SiteGroupCms.Entity.Article        article    = articledal.GetEntity(_contentid);
     SiteGroupCms.Entity.Normal_Channel _Channel   = new SiteGroupCms.Dal.Normal_ChannelDAL().GetEntity(article.Catalogid.ToString());
     return(ModuleCommand.GetContentLink(_contentid));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 管理中心初始,并获得频道的各项参数值
 /// </summary>
 /// <param name="powerNum">权限</param>
 /// <param name="isChannel">如果为false就表示ChannelId可以为0</param>
 protected void Admin_Load(string powerNum, string pageType, bool isChannel)
 {
     chkPower(powerNum, pageType);
     if (isChannel && ChannelId == "0")
     {
         showErrMsg("参数错误,请不要在外部提交数据", pageType);
         return;
     }
     if (ChannelId != "0")
     {
         SiteGroupCms.Entity.Normal_Channel _Channel = new SiteGroupCms.Dal.Normal_ChannelDAL().GetEntity(ChannelId);
         ChannelName   = _Channel.Title;
         ChannelDir    = _Channel.Dirname;
         ChannelType   = _Channel.Type;
         ChannelIsHtml = true;
         //去掉标签后的实际路径
         MainChannel = _Channel;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除内容页
        /// </summary>
        /// <param name="_ChannelId"></param>
        /// <param name="_ContentId"></param>
        public void DeleteContent(string _ContentId)
        {
            SiteGroupCms.Dal.ArticleDal        articledal = new ArticleDal();
            SiteGroupCms.Entity.Article        article    = articledal.GetEntity(_ContentId);
            SiteGroupCms.Entity.Normal_Channel _Channel   = new SiteGroupCms.Dal.Normal_ChannelDAL().GetEntity(article.Catalogid.ToString());

            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.ConditionExpress = "[Id]=" + _ContentId;
                object[] _value     = _doh.GetFields("yy_articleinfo", "AddDate,FirstPage");
                string   _date      = _value[0].ToString();
                string   _firstpage = _value[1].ToString();
                if (_firstpage.Length > 0)
                {
                    string _folderName = String.Format("/detail_{0}_{1}/{2}",
                                                       DateTime.Parse(_date).ToString("yyyy"),
                                                       DateTime.Parse(_date).ToString("MM"),
                                                       DateTime.Parse(_date).ToString("dd")
                                                       );
                    if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(site.Location + _Channel.Dirname + _folderName)))
                    {
                        string htmFile = HttpContext.Current.Server.MapPath(Go2View(_ContentId));
                        if (System.IO.File.Exists(htmFile))
                        {
                            System.IO.File.Delete(htmFile);
                        }
                        string[] htmFiles = System.IO.Directory.GetFiles(HttpContext.Current.Server.MapPath(site.Location + _Channel.Dirname + _folderName), _ContentId + "_*" + "htm");
                        foreach (string fileName in htmFiles)
                        {
                            if (System.IO.File.Exists(fileName))
                            {
                                System.IO.File.Delete(fileName);
                            }
                        }
                    }
                    _doh.Reset();
                    _doh.SqlCmd = "UPDATE [jcms_module_" + _Channel.Type + "] SET [FirstPage]='' WHERE [ChannelId]=" + article.Catalogid + " AND [Id]=" + _ContentId;
                    _doh.ExecuteSqlNonQuery();
                }
            }
        }
Ejemplo n.º 4
0
        public void TagEndProcess(TemplateManager manager, Tag tag, string innerContent)
        {
            Expression exp;
            string     _channelid, _contentid, _contenturl, _contentlink;

            exp = tag.AttributeValue("channelid");
            if (exp == null)
            {
                throw new Exception("没有channelid标签");
            }
            _channelid = manager.EvalExpression(exp).ToString();
            exp        = tag.AttributeValue("contentid");
            if (exp == null)
            {
                throw new Exception("没有contentid标签");
            }
            _contentid = manager.EvalExpression(exp).ToString();

            exp = tag.AttributeValue("contenturl");
            if (exp == null)
            {
                throw new Exception("没有contenturl标签");
            }
            //因为数据库没有设计存储路径的字段
            //所以没有
            // _contenturl = manager.EvalExpression(exp).ToString();
            _contenturl = "";
            SiteGroupCms.Entity.Normal_Channel _Channel = new SiteGroupCms.Dal.Normal_ChannelDAL().GetEntity(_channelid);
            if (_contenturl != "")//数据库里面有记录
            {
                _contentlink = _contenturl;
            }
            else    //数据库里面没有记录则直接索引
            {
                // _contentlink = _contenturl;
                Module_articleDAL module = new Module_articleDAL();
                _contentlink = module.GetContentLink(_contentid);
                manager.WriteValue(_contentlink);
            }
        }
Ejemplo n.º 5
0
        private SiteGroupCms.Entity.Normal_ClassTree getTree(DbOperHandler _doh, string _channelid, string _classid, bool _includechild)
        {
            SiteGroupCms.Entity.Normal_ClassTree _tree    = new SiteGroupCms.Entity.Normal_ClassTree();
            SiteGroupCms.Entity.Normal_Channel   _channel = new SiteGroupCms.Dal.Normal_ChannelDAL().GetEntity(_channelid);
            bool _channelishtml = true;

            if (_classid == "0")//表示从根节点开始
            {
                _tree.Id     = _channel.ID.ToString();
                _tree.Name   = _channel.Title;
                _tree.Link   = Go2Channel(_channelid, 0);
                _tree.RssUrl = "";
            }
            else
            {
                SiteGroupCms.Entity.Normal_Class _class = new SiteGroupCms.Dal.Normal_ClassDAL().GetEntity(_classid);
                _tree.Id   = _classid;
                _tree.Name = _class.Title;
                _tree.Link = Go2Class(1, _channelishtml, _channelid, _classid, false);
                //  _tree.RssUrl = Go2Rss(1, false, _channelid, _classid);
            }
            _tree.HasChild = HasChild(_channelid, _classid);
            List <SiteGroupCms.Entity.Normal_ClassTree> subtree = new List <SiteGroupCms.Entity.Normal_ClassTree>();

            if (_includechild)
            {
                _doh.Reset();
                _doh.SqlCmd = "SELECT Id FROM [jcms_normal_class] WHERE [ChannelId]=" + _channelid + " AND [ParentId]=" + _classid + " order by code";
                DataTable dtClass = _doh.GetDataTable();
                for (int i = 0; i < dtClass.Rows.Count; i++)
                {
                    string _subclassid = dtClass.Rows[i]["Id"].ToString();
                    subtree.Add(getTree(_doh, _channelid, _subclassid, _includechild));
                }
                dtClass.Clear();
                dtClass.Dispose();
            }
            _tree.SubChild = subtree;
            return(_tree);
        }