Beispiel #1
0
 /// <summary>
 /// 获得单页内容的单条记录实体
 /// </summary>
 /// <param name="_id"></param>
 public SiteGroupCms.Entity.Normal_Channel GetEntity(string _id)
 {
     SiteGroupCms.Entity.Normal_Channel channel = new SiteGroupCms.Entity.Normal_Channel();
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT * FROM [yy_cataloginfo] WHERE [Id]=" + _id;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count > 0)
         {
             channel.ID               = Str2Int(_id);
             channel.Title            = dt.Rows[0]["title"].ToString();
             channel.Father           = Str2Int(dt.Rows[0]["fatherid"].ToString());
             channel.Linkurl          = dt.Rows[0]["linkurl"].ToString();
             channel.Type             = dt.Rows[0]["type"].ToString();
             channel.Picurl           = dt.Rows[0]["picurl"].ToString();
             channel.Description      = dt.Rows[0]["description"].ToString();
             channel.Meta_description = dt.Rows[0]["meta_description"].ToString();
             channel.Meta_Keywords    = dt.Rows[0]["meta_keywords"].ToString();
             channel.IsShare          = Str2Int(dt.Rows[0]["isshare"].ToString());
             channel.Listtemplate     = Str2Int(dt.Rows[0]["listtemplate"].ToString());
             channel.Contentfileex    = dt.Rows[0]["contentfileex"].ToString();
             channel.ContentTemplate  = Str2Int(dt.Rows[0]["contenttemplate"].ToString());
             channel.Dirname          = dt.Rows[0]["dirname"].ToString();
         }
     }
     return(channel);
 }
Beispiel #2
0
        /// <summary>
        /// 得到内容页地址
        /// </summary>
        /// <param name="_contentid"></param>
        /// <param name="_truefile"></param>
        /// <returns></returns>
        public string GetContentLink(string _contentid)
        {
            SiteGroupCms.Dal.Normal_ChannelDAL _ChannelDal = new Normal_ChannelDAL();
            SiteGroupCms.Dal.ArticleDal        articledal  = new ArticleDal();
            SiteGroupCms.Entity.Article        article     = articledal.GetEntity(_contentid);
            if (article.Yyarticleid.ToString() != "" && article.Yyarticleid != 0)//如果引用文章
            {
                _contentid = article.Yyarticleid.ToString();
            }
            article = articledal.GetEntity(_contentid);           //重新取引用的文章

            if (article.Linkurl != "" && article.Linkurl != null) //如果是连接文章
            // return article.Linkurl; //这个直接得到连接地址
            {
                return("/ajaxhandler/Gethits.aspx?articleid=" + article.Id); //得到可以统计点击次数的连接地址
            }
            SiteGroupCms.Entity.Normal_Channel _Channel = _ChannelDal.GetEntity(article.Catalogid.ToString());
            site = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
            string qianstr   = "/sites/" + site.Location + "/pub";
            string centerstr = "";

            //检查对应的文件夹是否存在,若不存在则创建,若存在则以id为标题生成
            while (_Channel.Father != 0)//不为跟节点就继续往上走
            {
                centerstr = "/" + _Channel.Dirname + centerstr;
                _Channel  = _ChannelDal.GetEntity(_Channel.Father.ToString());
            }
            centerstr = "/" + _Channel.Dirname + centerstr + "/";
            string title = article.Addtime.Year.ToString() + article.Addtime.Month.ToString() + article.Addtime.Day.ToString() + _contentid;

            return(qianstr + centerstr + title + ".html");
        }
Beispiel #3
0
 public void ExecuteTags(ref string PageStr, SiteGroupCms.Entity.Normal_Channel _Channel)
 {
     PageStr = PageStr.Replace("{$ChannelId}", _Channel.ID.ToString());
     PageStr = PageStr.Replace("{$ChannelName}", _Channel.Title);
     PageStr = PageStr.Replace("{$ChannelInfo}", _Channel.Description);
     PageStr = PageStr.Replace("{$ChannelType}", _Channel.Type);
     PageStr = PageStr.Replace("{$ChannelDir}", _Channel.Dirname);
     PageStr = PageStr.Replace("{$ChannelLink}", Go2Channel(_Channel.ID.ToString(), 0));
     PageStr = PageStr.Replace("{$ChannelLinktitle}", Go2Channel(_Channel.ID.ToString(), 1));
 }
Beispiel #4
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;
     }
 }
Beispiel #5
0
 /// <summary>
 /// 绑定记录至频道实体
 /// </summary>
 /// <param name="_id"></param>
 public SiteGroupCms.Entity.Normal_Channel GetEntity(DataRow dr)
 {
     SiteGroupCms.Entity.Normal_Channel channel = new SiteGroupCms.Entity.Normal_Channel();
     channel.ID               = Str2Int(dr["id"].ToString());
     channel.Title            = dr["title"].ToString();
     channel.Father           = Str2Int(dr["fatherid"].ToString());
     channel.Linkurl          = dr["linkurl"].ToString();
     channel.Type             = dr["type"].ToString();
     channel.Picurl           = dr["picurl"].ToString();
     channel.Description      = dr["description"].ToString();
     channel.Meta_description = dr["meta_description"].ToString();
     channel.Meta_Keywords    = dr["meta_keywords"].ToString();
     channel.IsShare          = Str2Int(dr["isshare"].ToString());
     channel.Listtemplate     = Str2Int(dr["listtemplate"].ToString());
     channel.Contentfileex    = dr["contentfileex"].ToString();
     channel.ContentTemplate  = Str2Int(dr["contenttemplate"].ToString());
     channel.Dirname          = dr["dirname"].ToString();
     return(channel);
 }
        /// <summary>
        /// 生成栏目文件
        /// </summary>
        /// <param name="_classId"></param>
        /// <param name="CreateParent"></param>

        protected void CreateClassFile(SiteGroupCms.Entity.Normal_Channel _channel, string _classId, bool CreateParent)
        {
            /*  SiteGroupCms.Dal.TemplateEngineDAL teDAL = new SiteGroupCms.Dal.TemplateEngineDAL(_channel.ID.ToString());
             * int pageCount = new SiteGroupCms.Dal.Normal_ClassDAL().GetContetPageCount(_channel.ID.ToString(), _classId, true);
             * //int maxPage = SiteGroupCms.Utils.Int.Min(site.CreatePages, pageCount);
             * int maxPage = SiteGroupCms.Utils.Int.Min(12, pageCount);
             * string PageStr = string.Empty;
             * for (int i = 1; i < (maxPage + 1); i++)
             * {
             *    PageStr = teDAL.GetSiteClassPage(_classId, i);
             *    SiteGroupCms.Utils.DirFile.SaveFile(PageStr, Go2Class(i, true, _channel.ID.ToString(), _classId, true));
             * }
             * doh.Reset();
             * doh.SqlCmd = "SELECT Id, ParentId FROM [jcms_normal_class] WHERE [IsOut]=0 AND [ChannelId]=" + _channel.ID + " AND [Id]=" + _classId;
             * DataTable dtClass = doh.GetDataTable();
             * if (dtClass.Rows.Count > 0 && dtClass.Rows[0]["ParentId"].ToString() != "0" && CreateParent == true)
             * {
             *    CreateClassFile(_channel, dtClass.Rows[0]["ParentId"].ToString(), true);
             * }
             * dtClass.Clear();
             * dtClass.Dispose();
             */
        }
Beispiel #7
0
 /// <summary>
 /// 解析频道标签
 /// </summary>
 /// <param name="pagestr">原内容</param>
 /// <param name="_channelid">ChannelId不能为0</param>
 public void ExecuteTags(ref string PageStr, string _channelid)
 {
     SiteGroupCms.Entity.Normal_Channel _Channel = GetEntity(_channelid);
     ExecuteTags(ref PageStr, _Channel);
 }