Esempio n. 1
0
        private void getClassSinglePageListBody(Normal_Class _class, ref System.Collections.ArrayList ContentList, int _pagecount, int _page)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                string whereStr = string.Empty;
                string _pagestr = ContentList[0].ToString();
                whereStr = " [ClassId] in (SELECT ID FROM [jcms_normal_class] WHERE [IsOut]=0 AND [Code] LIKE '" + _class.Code + "%')";
                whereStr += " AND [IsPass]=1 AND [ChannelId]=" + this.MainChannel.Id;
                int _pagesize = (_class.PageSize < 1) ? 20 : _class.PageSize;

                System.Collections.ArrayList TagArray = JumboTCMS.Utils.Strings.GetHtmls(_pagestr, "{$jcms:class(", "{$/jcms:class}", false, false);
                if (TagArray.Count > 0)//标签存在
                {
                    string LoopBody = string.Empty;
                    string TempStr = string.Empty;
                    string FiledsStr = string.Empty;
                    int StartTag, EndTag;

                    StartTag = TagArray[0].ToString().IndexOf(")}", 0);
                    FiledsStr = TagArray[0].ToString().Substring(0, StartTag).ToLower();
                    if (!("," + FiledsStr + ",").Contains(",adddate,")) FiledsStr += ",adddate";
                    EndTag = TagArray[0].ToString().Length;
                    LoopBody = "{$jcms:class(" + TagArray[0].ToString() + "{$/jcms:class}";
                    TempStr = TagArray[0].ToString().Substring(StartTag + 2, EndTag - StartTag - 2).Replace("<#foreach content>", "<#foreach collection=\"${contents}\" var=\"field\" index=\"i\">");//需要循环的部分
                    ContentList.Add(LoopBody);

                    if (_pagecount > 0)
                    {
                        if (_page == 0)
                        {
                            for (int i = 1; i < _pagecount + 1; i++)
                            {
                                NameValueCollection orders = new NameValueCollection();
                                orders.Add("AddDate", "desc");
                                orders.Add("Id", "desc");
                                string wStr = JumboTCMS.Utils.SqlHelp.GetMultiOrderPagerSQL("Id,ChannelId,ClassId,[IsPass],[FirstPage]," + FiledsStr,
                                    "jcms_module_" + this.MainChannel.Type,
                                    _pagesize,
                                    i,
                                    orders,
                                    whereStr);
                                _doh.Reset();
                                _doh.SqlCmd = wStr;
                                DataTable dtContent = _doh.GetDataTable();

                                ContentList.Add(operateContentTag(this.MainChannel.Type, dtContent, TempStr));
                                dtContent.Clear();
                                dtContent.Dispose();

                            }
                        }
                        else
                        {
                            _page = _page == 0 ? 1 : _page;
                            NameValueCollection orders = new NameValueCollection();
                            orders.Add("AddDate", "desc");
                            orders.Add("Id", "desc");
                            string wStr = JumboTCMS.Utils.SqlHelp.GetMultiOrderPagerSQL("Id,ChannelId,ClassId,[IsPass],[FirstPage]," + FiledsStr,
                                "jcms_module_" + this.MainChannel.Type,
                                _pagesize,
                                _page,
                                orders,
                                whereStr);
                            _doh.Reset();
                            _doh.SqlCmd = wStr;
                            DataTable dtContent = _doh.GetDataTable();
                            ContentList.Add(operateContentTag(this.MainChannel.Type, dtContent, TempStr));
                            dtContent.Clear();
                            dtContent.Dispose();
                        }
                    }
                    else
                        ContentList.Add("  ");
                }
            }
        }
Esempio n. 2
0
        private System.Collections.ArrayList getClassSinglePage(Normal_Class _class, int _pagecount, int _page)
        {
            string pId = string.Empty;
            string _pagestr = string.Empty;

            //得到模板方案组ID/主题ID/模板内容
            new JumboTCMS.DAL.Normal_TemplateDAL().GetTemplateContent(_class.TemplateId, ref pId, ref _pagestr);
            this.PageNav = "<script type=\"text/javascript\" src=\"" + site.Dir + this.MainChannel.Dir + "/js/classnav_" + _class.Id + ".js\"></script>";
            if (this.MainChannel.IsTop)
                this.PageTitle = _class.Title + "_" + this.MainChannel.Title + "_" + site.Name + site.TitleTail;
            else
                this.PageTitle = _class.Title + "_" + site.Name + site.TitleTail;
            this.PageKeywords = site.Keywords;
            this.PageDescription = JumboTCMS.Utils.Strings.SimpleLineSummary(_class.Info);
            ReplacePublicTag(ref _pagestr);
            ReplaceChannelTag(ref _pagestr, this.MainChannel.Id);
            _pagestr = _pagestr.Replace("{$ChannelClassId}", _class.Id);
            ReplaceChannelClassLoopTag(ref _pagestr);
            ReplaceClassTag(ref _pagestr, _class.Id);
            ReplaceContentLoopTag(ref _pagestr);
            System.Collections.ArrayList ContentList = new System.Collections.ArrayList();
            ContentList.Add(_pagestr);
            getClassSinglePageListBody(_class, ref ContentList, _pagecount, _page);

            return ContentList;
        }