Example #1
0
 /// <summary>
 /// 解析栏目标签
 /// </summary>
 /// <param name="_pagestr"></param>
 /// <param name="_classid"></param>
 /// <returns></returns>
 private void executeTag_Class(ref string _pagestr, string _classid)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT [Id],[Title],[Info],[Img],[TopicNum],[Code],len(code) as len,[ChannelId],[ParentId] FROM [jcms_normal_class] WHERE [IsOut]=0 AND [Id]=" + _classid;
         DataTable _dt = _doh.GetDataTable();
         if (_dt.Rows.Count > 0)
         {
             string _channelid = _dt.Rows[0]["ChannelId"].ToString();
             string _parentid = _dt.Rows[0]["ParentId"].ToString();
             if (_channelid == this.MainChannel.Id)//说明是当前
                 this.ThisChannel = this.MainChannel;
             else
                 this.ThisChannel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
             _pagestr = _pagestr.Replace("{$ClassId}", _dt.Rows[0]["Id"].ToString());
             _pagestr = _pagestr.Replace("{$ClassName}", _dt.Rows[0]["Title"].ToString());
             _pagestr = _pagestr.Replace("{$ClassInfo}", _dt.Rows[0]["Info"].ToString());
             _pagestr = _pagestr.Replace("{$ClassImg}", _dt.Rows[0]["Img"].ToString());
             _pagestr = _pagestr.Replace("{$ClassTopicNum}", _dt.Rows[0]["TopicNum"].ToString());
             _pagestr = _pagestr.Replace("{$ClassLink}", Go2Class(1, this.ThisChannel.IsHtml, _channelid, _classid, false));
             _pagestr = _pagestr.Replace("{$ClassCode}", _dt.Rows[0]["Code"].ToString());
             _pagestr = _pagestr.Replace("{$ClassDepth}", (Str2Int(_dt.Rows[0]["Len"].ToString()) / 4).ToString());
             _pagestr = _pagestr.Replace("{$ClassParentId}", _dt.Rows[0]["ParentId"].ToString());
             if (_dt.Rows[0]["ParentId"].ToString() != "0")
             {
                 JumboTCMS.Entity.Normal_Class _parentclass = new JumboTCMS.DAL.Normal_ClassDAL().GetEntity(_parentid);
                 _pagestr = _pagestr.Replace("{$ClassParentName}", _parentclass.Title);
                 _pagestr = _pagestr.Replace("{$ClassParentLink}", Go2Class(1, this.ThisChannel.IsHtml, _channelid, _parentid, false));
                 _pagestr = _pagestr.Replace("{$ClassParentCode}", _parentclass.Code);
             }
             else
             {
                 _pagestr = _pagestr.Replace("{$ClassParentName}", this.ThisChannel.Title);
                 _pagestr = _pagestr.Replace("{$ClassParentLink}", Go2Channel(this.ThisChannel.IsHtml, _channelid, false));
                 _pagestr = _pagestr.Replace("{$ClassParentCode}", "");
             }
         }
         _dt.Clear();
         _dt.Dispose();
     }
 }
Example #2
0
 /// <summary>
 /// 获得栏目页内容(频道ID只能从外部传入,频道ID不能为0)
 /// </summary>
 /// <param name="_classid"></param>
 /// <param name="_currentpage"></param>
 /// <returns></returns>
 public string GetSiteClassPage(string _classid, int _currentpage)
 {
     Normal_Class _class = new JumboTCMS.DAL.Normal_ClassDAL().GetEntity(_classid, "[IsOut]=0 AND [ChannelId]=" + this.MainChannel.Id);
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         string pStr = " [ClassId] in (Select id FROM [jcms_normal_class] WHERE [IsOut]=0 AND [Code] LIKE '" + _class.Code + "%') and [IsPass]=1 AND [ChannelId]=" + this.MainChannel.Id;
         _doh.ConditionExpress = pStr;
         int _totalcount = _doh.Count("jcms_module_" + this.MainChannel.Type);
         int _pagecount = JumboTCMS.Utils.Int.PageCount(_totalcount, _class.PageSize);
         System.Collections.ArrayList ContentList = getClassSinglePage(_class, _pagecount, _currentpage);
         string _pagestr = ContentList[0].ToString();
         if (ContentList.Count > 2)
         {
             string ViewStr = ContentList[1].ToString();
             _pagestr = _pagestr.Replace(ViewStr, ContentList[2].ToString());
         }
         _pagestr = _pagestr.Replace("{$_getPageBar()}",
             getPageBar(1, "html", 2, _totalcount, _class.PageSize, _currentpage, Go2Class(1, this.MainChannel.IsHtml, this.MainChannel.Id.ToString(), _classid, false), Go2Class(-1, this.MainChannel.IsHtml, this.MainChannel.Id.ToString(), _classid, false), Go2Class(-1, false, this.MainChannel.Id.ToString(), _classid, false), site.CreatePages)
             );
         ExcuteLastHTML(ref _pagestr);
         return _pagestr;
     }
 }
Example #3
0
 private JumboTCMS.Entity.Normal_ClassTree getTree(DbOperHandler _doh, string _channelid, string _classid, bool _includechild)
 {
     JumboTCMS.Entity.Normal_ClassTree _tree = new JumboTCMS.Entity.Normal_ClassTree();
     JumboTCMS.Entity.Normal_Channel _channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
     bool _channelishtml = site.IsHtml && _channel.IsHtml;
     if (_classid == "0")//表示从根节点开始
     {
         _tree.Id = _channel.Id;
         _tree.Name = _channel.Title;
         _tree.Link = Go2Channel(site.IsHtml, _channelid, false);
         _tree.RssUrl = "";
     }
     else
     {
         JumboTCMS.Entity.Normal_Class _class = new JumboTCMS.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<JumboTCMS.Entity.Normal_ClassTree> subtree = new List<JumboTCMS.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;
 }
Example #4
0
 /// <summary>
 /// 生成栏目文件
 /// </summary>
 /// <param name="_classId"></param>
 /// <param name="CreateParent"></param>
 protected void CreateClassFile(JumboTCMS.Entity.Normal_Channel _channel, string _classId, bool CreateParent)
 {
     JumboTCMS.DAL.TemplateEngineDAL teDAL = new JumboTCMS.DAL.TemplateEngineDAL(_channel.Id);
     int pageCount = new JumboTCMS.DAL.Normal_ClassDAL().GetContetPageCount(_channel.Id, _classId, true);
     int maxPage = JumboTCMS.Utils.Int.Min(site.CreatePages, pageCount);
     string PageStr = string.Empty;
     for (int i = 1; i < (maxPage + 1); i++)
     {
         PageStr = teDAL.GetSiteClassPage(_classId, i);
         JumboTCMS.Utils.DirFile.SaveFile(PageStr, Go2Class(i, true, _channel.Id, _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();
 }
Example #5
0
 /// <summary>
 /// 链接到栏目页
 /// </summary>
 /// <param name="_page"></param>
 /// <param name="_ishtml"></param>
 /// <param name="_channelid"></param>
 /// <param name="_classid"></param>
 /// <returns></returns>
 public string GetClassLink(int _page, bool _ishtml, string _channelid, string _classid, bool _truefile)
 {
     JumboTCMS.Entity.Normal_Class _Class = new JumboTCMS.DAL.Normal_ClassDAL().GetEntity(_classid);
     if (!_Class.IsOut)
     {
         JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
         string TempUrl = JumboTCMS.Common.PageFormat.Class(_ishtml, site.Dir, site.UrlReWriter, _page);
         if ((_Channel.SubDomain.Length > 0) && (!_truefile))
             TempUrl = TempUrl.Replace("<#SiteDir#><#ChannelDir#>", _Channel.SubDomain);
         TempUrl = TempUrl.Replace("<#SiteDir#>", site.Dir);
         TempUrl = TempUrl.Replace("<#SiteStaticExt#>", site.StaticExt);
         TempUrl = TempUrl.Replace("<#ChannelId#>", _channelid);
         TempUrl = TempUrl.Replace("<#ChannelDir#>", _Channel.Dir.ToLower());
         TempUrl = TempUrl.Replace("<#ChannelType#>", _Channel.Type.ToLower());
         TempUrl = TempUrl.Replace("<#ClassFilePath#>", _Class.FilePath.ToLower());
         TempUrl = TempUrl.Replace("<#id#>", _classid);
         if (_page > 0) TempUrl = TempUrl.Replace("<#page#>", _page.ToString());
         return TempUrl;
     }
     else
         return _Class.FirstPage;
 }