Beispiel #1
0
        private void ViewNews(int newsid)
        {
            AccessWebNews news = new AccessWebNews(newsid);

            if (news.IsFilled == false)
            {
                news = (new AccessWebNews()).GetInstanceById(news.NewsID) as AccessWebNews;
            }

            #region 判断新闻有效性
            if (news != null && news.IsExist == true && news.IsFilled == true)
            {
                AccessWebChannel newsChannel = (new AccessWebChannel(news.Channel.ChannelID)).GetInstance() as AccessWebChannel;
                if (newsChannel == null || news.IsFilled == false)
                {
                    ShowMessage("获取改新闻所在的频道设置失败,生成终止!");
                    return;
                }
                else
                {
                    TempletSetting tptConfig = newsChannel.TempletConfig;
                    if (tptConfig == null)
                    {
                        ShowMessage("该频道没有配置模板,不能浏览动态内容!");
                    }
                    else
                    {
                        if (tptConfig.GenerateDetailPage == false)
                        {
                            ShowMessage("该频道模板设置关闭了详细内容显示,请先打开再浏览动态内容!");
                            return;
                        }

                        using (TempletParse tpp = new TempletParse())
                        {
                            PageTemplet pageTpt = (new PageTemplet()).GetInstanceById(tptConfig.DetailPageTemplet.TempletID) as PageTemplet;
                            tptConfig.DetailPageTemplet.FileNameConfig.FileNameTag.SetResourceDependency(news);

                            MultiResDependency newsRes = new MultiResDependency(newsChannel, news);
                            tpp.SetResourceDependency(newsRes);
                            tpp.SetTaggedObjectCollection(pageTpt.TempletRawContent);

                            string strGenFileContent = HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, tpp.ParsedResult);
                            DisplayContent(strGenFileContent);
                        }
                    }
                }
            }
            else
            {
                ShowMessage("该资讯无效!");
            }
            #endregion
        }
Beispiel #2
0
        /// <summary>
        /// 生成网站栏目/频道静态文件
        /// </summary>
        /// <param name="aWebChannel">指定了ChannelID的实体</param>
        public void Generate(AccessWebChannel aWebChannel, ChannelGeneratorOptions options)
        {
            if (aWebChannel.IsFilled == false)
            {
                aWebChannel = (new AccessWebChannel()).GetInstanceById(aWebChannel.ChannelID) as AccessWebChannel;
            }

            if (aWebChannel != null && aWebChannel.IsExist == true && aWebChannel.IsFilled == true)
            {
                if (aWebChannel.StaticFileGenDir.IndexOf("/") == -1)
                {
                    ShowMessage("生成文件目录设置有错误,系统终止!");
                    return;
                }

                TempletSetting tptConfig = aWebChannel.TempletConfig;
                if (tptConfig == null)
                {
                    ShowMessage("该频道没有配置模板,不能生成相关文件!");
                }
                else
                {
                    string strGenFilePath, strFileName, strFileExt, strGenResult = "";
                    if (aWebChannel.StaticFileGenDir.IndexOf("{#$ChannelID$#}") != -1)
                    {
                        aWebChannel.StaticFileGenDir = aWebChannel.StaticFileGenDir.Replace("{#$ChannelID$#}", aWebChannel.ChannelID.ToString());
                    }
                    strGenFilePath = Util.ParseAppPath(aWebChannel.StaticFileGenDir);
                    //ShowMessage(strGenFilePath);
                    if (!strGenFilePath.EndsWith("\\"))
                    {
                        strGenFilePath += "\\";
                    }

                    //最终页面内容
                    string strGenFileContent = "";
                    string trackPath         = "";

                    this.UTCDateBegin = DateTime.Now.ToUniversalTime();

                    if (options != null && options.GenerateSinglePage == false)
                    {
                        ShowMessage("* 已禁止单页综合内容页生成!");
                    }
                    else
                    {
                        #region 单页综合生成
                        if (tptConfig.GenerateSinglePage == true)
                        {
                            strFileName = tptConfig.MixedSingleTemplet.FileNameConfig.FileNameTag.GetTagValue().ToString();
                            strFileExt  = tptConfig.MixedSingleTemplet.FileNameConfig.FileExtentionName;

                            PageTemplet pageTpt = (new PageTemplet()).GetInstanceById(tptConfig.MixedSingleTemplet.TempletID) as PageTemplet;
                            if (pageTpt != null && pageTpt.IsExist == true && pageTpt.IsFilled == true)
                            {
                                if (pageTpt.IsMixedSyntax == false)
                                {
                                    if (!pageTpt.SiteBaseDir.EndsWith("/"))
                                    {
                                        pageTpt.SiteBaseDir += "/";
                                    }
                                    strGenResult = OleDbHelper.SetTextFileContent(strGenFilePath + strFileName + strFileExt,
                                                                                  "utf-8",
                                                                                  HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, pageTpt.TempletRawContent));

                                    if (strGenResult == "0")
                                    {
                                        FireGeneratorFileFinished(strGenFilePath + strFileName + strFileExt);
                                    }
                                }
                                else
                                {
                                    TempletParse tpp = new TempletParse();
                                    tpp.Caller = this;
                                    tpp.SetResourceDependency(aWebChannel);
                                    tpp.TagTrack = new System.Collections.Generic.Dictionary <string, string>();
                                    tpp.TagTrack.Add("T" + pageTpt.TempletID.ToString(), pageTpt.ModifiedTime.ToString("yyyyMMddHHmmss"));
                                    tpp.SetTaggedObjectCollection(pageTpt.TempletRawContent);

                                    strGenFileContent = HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, tpp.ParsedResult);
                                    //插入Track代码
                                    trackPath = GetSiteRelativeUrl(strGenFilePath + strFileName + strFileExt);
                                    GetTrackHtmlInSertCode(tpp.TagTrack, trackPath, "</body>", ref strGenFileContent);

                                    strGenResult = OleDbHelper.SetTextFileContent(trackPath, "utf-8", strGenFileContent);

                                    if (strGenResult == "0")
                                    {
                                        FireGeneratorFileFinished(trackPath);
                                    }
                                }

                                if (strGenResult == "0")
                                {
                                    TrackUnit.RemoveUpdateRecord(0, trackPath);
                                    ShowMessage(string.Format("单页内容生成成功!<a href=\"{0}\" target=\"_blank\">{0}</a>", GetSiteRelativeUrl(strGenFilePath + strFileName + strFileExt)));
                                }
                            }
                            else
                            {
                                ShowMessage("页面模板实体还原失败,请检查配置是否正确!");
                            }
                        }
                        #endregion
                    }

                    if (options != null && options.GenerateListPage == false)
                    {
                        ShowMessage("* 已禁止列表页生成!");
                    }
                    else
                    {
                        #region 列表页面生成
                        if (tptConfig.GenerateListPage == true)
                        {
                            strFileExt = tptConfig.ListPageTemplet.FileNameConfig.FileExtentionName;
                            tptConfig.ListPageTemplet.FileNameConfig.FileNameTag.SetResourceDependency(aWebChannel);
                            strFileName = tptConfig.ListPageTemplet.FileNameConfig.FileNameTag.GetTagValue().ToString();

                            PageTemplet pageTpt = (new PageTemplet()).GetInstanceById(tptConfig.ListPageTemplet.TempletID) as PageTemplet;
                            if (pageTpt != null && pageTpt.IsExist == true && pageTpt.IsFilled == true)
                            {
                                strGenResult = "";
                                #region 根据模板内的列表动态生成多个页
                                if (pageTpt.IsMixedSyntax == false)
                                {
                                    if (!pageTpt.SiteBaseDir.EndsWith("/"))
                                    {
                                        pageTpt.SiteBaseDir += "/";
                                    }
                                    strGenResult = OleDbHelper.SetTextFileContent(strGenFilePath + strFileName + strFileExt,
                                                                                  "utf-8",
                                                                                  HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, pageTpt.TempletRawContent));

                                    if (strGenResult == "0")
                                    {
                                        FireGeneratorFileFinished(strGenFilePath + strFileName + strFileExt);
                                        ShowMessage(string.Format("文件生成成功!<a href=\"{0}\" target=\"_blank\">{0}</a>", GetSiteRelativeUrl(strGenFilePath + strFileName + strFileExt)));
                                    }
                                }
                                else
                                {
                                    string       realContent = "", myPageHtml = "";
                                    TempletParse tpp = new TempletParse();

                                    //获取要分页变化的模块内容(含Pager)
                                    //替换分页变化的内容 + 生成多页

                                    tpp.Caller = this;
                                    tpp.SetResourceDependency(aWebChannel);

                                    tpp.TagTrack = new System.Collections.Generic.Dictionary <string, string>();
                                    tpp.TagTrack.Add("T" + pageTpt.TempletID.ToString(), pageTpt.ModifiedTime.ToString("yyyyMMddHHmmss"));
                                    tpp.SetTaggedObjectCollection(pageTpt.TempletRawContent);

                                    if (this.PagedObject == null)
                                    {
                                        myPageHtml = tpp.ParsedResult;
                                        //处理分页导航内容
                                        if (this.PagerDic.Count > 0)
                                        {
                                            foreach (string pagerKey in PagerDic.Keys)
                                            {
                                                myPageHtml = myPageHtml.Replace(pagerKey, "");
                                            }
                                        }

                                        strGenFileContent = HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, myPageHtml);
                                        //插入Track代码
                                        trackPath = GetSiteRelativeUrl(strGenFilePath + TagBase.TrimTagDefine(strFileName, '_', '-') + strFileExt);
                                        GetTrackHtmlInSertCode(tpp.TagTrack, trackPath, "</body>", ref strGenFileContent);
                                        strGenResult = OleDbHelper.SetTextFileContent(trackPath, "utf-8", strGenFileContent);
                                        if (strGenResult == "0")
                                        {
                                            FireGeneratorFileFinished(trackPath);
                                        }
                                        TrackUnit.RemoveUpdateRecord(0, trackPath);
                                    }
                                    else
                                    {
                                        string dynTpt = tpp.ParsedResult;
                                        PagedObject.SetResourceDependency(aWebChannel);
                                        while (PagedObject.CurrentPageIndex <= PagedObject.GetPageCount())
                                        {
                                            #region 处理分页内容
                                            realContent = PagedObject.GetCurrentPageContent();
                                            //处理当前页内容
                                            myPageHtml = dynTpt.Replace(PagedContentAlia, realContent);

                                            //处理分页导航内容
                                            if (this.PagerDic.Count > 0)
                                            {
                                                foreach (string pagerKey in PagerDic.Keys)
                                                {
                                                    PagerTag Pager = PagerDic[pagerKey];
                                                    Pager.TotalRecordCount  = PagedObject.GetTotalRecordCount();
                                                    Pager.CurrentPage       = PagedObject.CurrentPageIndex;
                                                    Pager.StartIndex        = PagedObject.StartIndex;
                                                    Pager.EndIndex          = PagedObject.EndIndex;
                                                    Pager.PageSize          = PagedObject.PageSize;
                                                    Pager.DefaultPageFormat = aWebChannel.StaticFileGenDir + strFileName.Replace("{#$CIDX$#}", "{0}") + strFileExt;

                                                    //Util.Debug(false, Pager.ToString());
                                                    myPageHtml = myPageHtml.Replace(pagerKey, Pager.ToString());
                                                    //Util.Debug(false, this.PagerDic[pagerKey].OuterDefineText);
                                                }
                                            }
                                            int    currentPage     = PagedObject.CurrentPageIndex;
                                            string currentFileName = strFileName.Replace("{#$CIDX$#}", currentPage.ToString());

                                            strGenFileContent = HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, myPageHtml);
                                            //插入Track代码
                                            trackPath = GetSiteRelativeUrl(strGenFilePath + currentFileName + strFileExt);
                                            GetTrackHtmlInSertCode(tpp.TagTrack, trackPath, "</body>", ref strGenFileContent);
                                            strGenResult = OleDbHelper.SetTextFileContent(trackPath, "utf-8", strGenFileContent);
                                            //清除更新请求
                                            TrackUnit.RemoveUpdateRecord(0, trackPath);

                                            if (strGenResult == "0")
                                            {
                                                FireGeneratorFileFinished(trackPath);
                                                ShowMessage(string.Format("列表页文件生成成功!<a href=\"{0}\" target=\"_blank\">{0}</a>", trackPath));
                                            }

                                            if (currentPage == 1)
                                            {
                                                trackPath = strGenFilePath + currentFileName.Trim('1', '-', '_') + strFileExt;
                                                OleDbHelper.SetTextFileContent(trackPath, "utf-8", strGenFileContent);
                                                FireGeneratorFileFinished(trackPath);
                                                TrackUnit.RemoveUpdateRecord(0, trackPath);
                                            }
                                            PagedObject.MoveNextPage();
                                            #endregion
                                        }
                                    }
                                    tpp.Dispose();
                                }
                                #endregion
                                if (strGenResult == "0")
                                {
                                    ShowMessage("列表页内容生成成功完成。");
                                }
                            }
                            else
                            {
                                ShowMessage("页面模板实体还原失败,请检查配置是否正确!");
                            }
                        }
                        #endregion
                    }

                    if (options != null && options.GenerateDetailPage == false)
                    {
                        ShowMessage("* 已禁止详细内容页生成!");
                    }
                    else
                    {
                        #region 详细页面生成
                        if (tptConfig.GenerateDetailPage == true)
                        {
                            strFileExt = tptConfig.DetailPageTemplet.FileNameConfig.FileExtentionName;
                            PageTemplet pageTpt = (new PageTemplet()).GetInstanceById(tptConfig.DetailPageTemplet.TempletID) as PageTemplet;
                            if (pageTpt != null && pageTpt.IsExist == true && pageTpt.IsFilled == true)
                            {
                                if (pageTpt.IsMixedSyntax == false)
                                {
                                    strFileName = tptConfig.DetailPageTemplet.FileNameConfig.FileNameTag.GetTagValue().ToString();
                                    if (!pageTpt.SiteBaseDir.EndsWith("/"))
                                    {
                                        pageTpt.SiteBaseDir += "/";
                                    }
                                    strGenResult = OleDbHelper.SetTextFileContent(strGenFilePath + strFileName + strFileExt,
                                                                                  "utf-8",
                                                                                  HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, pageTpt.TempletRawContent));

                                    if (strGenResult == "0")
                                    {
                                        FireGeneratorFileFinished(strGenFilePath + strFileName + strFileExt);
                                    }
                                }
                                else
                                {
                                    TempletParse tpp = new TempletParse();
                                    OleDbHelper  hp  = FanmaquerOleDbModule.GetOleDbInstance(FanmaquarConfig.ConnectionKey);

                                    DataTable dTab = hp.GetDataTable(string.Format("select * from Tbl_Articles where Pubed=True and Archived=false and TypeID={0} order by Sort asc,NewsID desc",
                                                                                   aWebChannel.ChannelID));

                                    if (dTab != null && dTab.Rows.Count > 0)
                                    {
                                        for (int i = 0; i < dTab.Rows.Count; i++)
                                        {
                                            AccessWebNews news = AccessWebNews.LoadFromDataRow(dTab.Rows[i]);
                                            tptConfig.DetailPageTemplet.FileNameConfig.FileNameTag.SetResourceDependency(news);
                                            strFileName = tptConfig.DetailPageTemplet.FileNameConfig.FileNameTag.GetTagValue().ToString();

                                            MultiResDependency newsRes = new MultiResDependency(aWebChannel, news);
                                            tpp.SetResourceDependency(newsRes);
                                            tpp.TagTrack = new System.Collections.Generic.Dictionary <string, string>();
                                            tpp.TagTrack.Add("T" + pageTpt.TempletID.ToString(), pageTpt.ModifiedTime.ToString("yyyyMMddHHmmss"));
                                            tpp.SetTaggedObjectCollection(pageTpt.TempletRawContent);

                                            string newsfileWithFullPath = strGenFilePath + strFileName + strFileExt;
                                            if (news.VirtualPath.Length > 5)
                                            {
                                                newsfileWithFullPath = Util.ParseAppPath(news.VirtualPath);
                                            }
                                            else
                                            {
                                                news.VirtualPath = aWebChannel.StaticFileGenDir + strFileName + strFileExt;
                                                news.RefreshVirtualPath();
                                            }

                                            strGenFileContent = HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, tpp.ParsedResult);
                                            //插入Track代码
                                            trackPath = GetSiteRelativeUrl(newsfileWithFullPath);
                                            GetTrackHtmlInSertCode(tpp.TagTrack, trackPath, "</body>", ref strGenFileContent);

                                            strGenResult = OleDbHelper.SetTextFileContent(newsfileWithFullPath, "utf-8", strGenFileContent);
                                            if (strGenResult == "0")
                                            {
                                                TrackUnit.RemoveUpdateRecord(0, trackPath);
                                                FireGeneratorFileFinished(trackPath);
                                                ShowMessage(string.Format("内容页文件生成成功!<a href=\"{0}\" target=\"_blank\">{0}</a>", trackPath));
                                            }
                                        }
                                    }

                                    tpp.Dispose();
                                }

                                if (strGenResult == "0")
                                {
                                    ShowMessage("详细页面内容生成成功完成。");
                                }
                            }
                            else
                            {
                                ShowMessage("页面模板实体还原失败,请检查配置是否正确!");
                            }
                        }
                        #endregion
                    }
                }

                ShowMessage("已完成所有处理,如没有任何消息显示,这可能是该栏目没有内容或配置错误!");
                ShowMessage("$end$");
            }
        }
Beispiel #3
0
        /// <summary>
        /// 生成新闻静态文件
        /// </summary>
        /// <param name="news">仅指定了NewsID的新闻实体</param>
        public void Generate(AccessWebNews news)
        {
            if (news.IsFilled == false)
            {
                news = (new AccessWebNews()).GetInstanceById(news.NewsID) as AccessWebNews;
            }

            #region 判断新闻有效性
            if (news != null && news.IsExist == true && news.IsFilled == true)
            {
                AccessWebChannel newsChannel = (new AccessWebChannel(news.Channel.ChannelID)).GetInstance() as AccessWebChannel;
                if (newsChannel == null || news.IsFilled == false)
                {
                    ShowMessage("获取改新闻所在的频道设置失败,生成终止!");
                    return;
                }
                else
                {
                    TempletSetting tptConfig = newsChannel.TempletConfig;
                    if (tptConfig == null)
                    {
                        ShowMessage("该频道没有配置模板,不能生成相关文件!");
                    }
                    else
                    {
                        if (tptConfig.GenerateDetailPage == false)
                        {
                            ShowMessage("该频道模板设置关闭了生成详细文件,请先打开再执行生成操作!");
                            return;
                        }

                        string strGenFilePath, strFileName, strFileExt, strGenResult = "";
                        if (newsChannel.StaticFileGenDir.IndexOf("{#$ChannelID$#}") != -1)
                        {
                            newsChannel.StaticFileGenDir = newsChannel.StaticFileGenDir.Replace("{#$ChannelID$#}", newsChannel.ChannelID.ToString());
                        }
                        strGenFilePath = Util.ParseAppPath(newsChannel.StaticFileGenDir);
                        if (!strGenFilePath.EndsWith("\\"))
                        {
                            strGenFilePath += "\\";
                        }

                        #region 单篇新闻生成
                        using (TempletParse tpp = new TempletParse())
                        {
                            PageTemplet pageTpt = (new PageTemplet()).GetInstanceById(tptConfig.DetailPageTemplet.TempletID) as PageTemplet;
                            tptConfig.DetailPageTemplet.FileNameConfig.FileNameTag.SetResourceDependency(news);
                            strFileName = tptConfig.DetailPageTemplet.FileNameConfig.FileNameTag.GetTagValue().ToString();
                            strFileExt  = tptConfig.DetailPageTemplet.FileNameConfig.FileExtentionName;

                            MultiResDependency newsRes = new MultiResDependency(newsChannel, news);
                            tpp.SetResourceDependency(newsRes);
                            tpp.TagTrack = new System.Collections.Generic.Dictionary <string, string>();
                            tpp.TagTrack.Add("T" + pageTpt.TempletID.ToString(), pageTpt.ModifiedTime.ToString("yyyyMMddHHmmss"));
                            tpp.SetTaggedObjectCollection(pageTpt.TempletRawContent);

                            string newsfileWithFullPath = strGenFilePath + strFileName + strFileExt;
                            if (news.VirtualPath.Length > 5)
                            {
                                newsfileWithFullPath = Util.ParseAppPath(news.VirtualPath);
                            }
                            else
                            {
                                news.VirtualPath = newsChannel.StaticFileGenDir + strFileName + strFileExt;
                                news.RefreshVirtualPath();
                            }

                            string strGenFileContent = HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, tpp.ParsedResult);
                            //插入Track代码
                            string trackPath = GetSiteRelativeUrl(newsfileWithFullPath);
                            GetTrackHtmlInSertCode(tpp.TagTrack, trackPath, "</body>", ref strGenFileContent);
                            strGenResult = OleDbHelper.SetTextFileContent(newsfileWithFullPath, "utf-8", strGenFileContent);
                            TrackUnit.RemoveUpdateRecord(0, trackPath);

                            if (strGenResult == "0")
                            {
                                FireGeneratorFileFinished(newsfileWithFullPath);
                            }

                            ShowMessage((strGenResult == "0") ? string.Format("新闻内容页文件生成成功!<a href=\"{0}\" target=\"_blank\">{0}</a>", GetSiteRelativeUrl(newsfileWithFullPath)) : "生成失败:" + strGenResult);
                        }
                        #endregion
                    }
                }
            }
            #endregion

            ShowMessage("已完成处理,如没有任何消息显示,这可能是该栏目没有内容或配置错误!");
            ShowMessage("$end$");
        }
Beispiel #4
0
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest Request = context.Request;

            if (Util.IsNumerical(Request.QueryString["ChannelID"]))
            {
                AccessWebChannel aWebChannel = new AccessWebChannel(Int32.Parse(Request.QueryString["ChannelID"]));
                if (aWebChannel.IsFilled == false)
                {
                    aWebChannel = (new AccessWebChannel()).GetInstanceById(aWebChannel.ChannelID) as AccessWebChannel;
                }

                if (aWebChannel != null && aWebChannel.IsExist == true && aWebChannel.IsFilled == true)
                {
                    TempletSetting tptConfig = aWebChannel.TempletConfig;
                    if (tptConfig == null)
                    {
                        ShowMessage("该频道没有配置模板,不能动态显示相关内容!");
                        return;
                    }

                    if (Request.QueryString["Action"] == "list")
                    {
                        if (tptConfig.GenerateListPage == true)
                        {
                            #region 列表页面生成
                            PageTemplet pageTpt = (new PageTemplet()).GetInstanceById(tptConfig.ListPageTemplet.TempletID) as PageTemplet;
                            if (pageTpt != null && pageTpt.IsExist == true && pageTpt.IsFilled == true)
                            {
                                #region 根据模板内的列表动态显示当前页内容
                                if (pageTpt.IsMixedSyntax == false)
                                {
                                    DisplayContent(HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, pageTpt.TempletRawContent));
                                    return;
                                }
                                else
                                {
                                    string       realContent = "", myPageHtml = "";
                                    TempletParse tpp = new TempletParse();

                                    tpp.Caller = this;
                                    tpp.SetResourceDependency(aWebChannel);
                                    tpp.SetTaggedObjectCollection(pageTpt.TempletRawContent);

                                    if (this.PagedObject == null)
                                    {
                                        myPageHtml = tpp.ParsedResult;
                                        //处理分页导航内容
                                        if (this.PagerDic.Count > 0)
                                        {
                                            foreach (string pagerKey in PagerDic.Keys)
                                            {
                                                myPageHtml = myPageHtml.Replace(pagerKey, "");
                                            }
                                        }
                                        DisplayContent(HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, myPageHtml));
                                    }
                                    else
                                    {
                                        string dynTpt           = tpp.ParsedResult;
                                        string currentPageMatch = "";
                                        PagedObject.SetResourceDependency(aWebChannel);
                                        if (Request.QueryString["Page"] != null && Util.IsMatch(@"^(\d+)$", Request.QueryString["Page"], 1, 1, PagedObject.GetPageCount(), out currentPageMatch))
                                        {
                                            PagedObject.CurrentPageIndex = int.Parse(Request.QueryString["Page"]);
                                        }
                                        else
                                        {
                                            PagedObject.CurrentPageIndex = 1;
                                        }

                                        #region 显示分页内容
                                        realContent = PagedObject.GetCurrentPageContent();
                                        //处理当前页内容
                                        myPageHtml = dynTpt.Replace(PagedContentAlia, realContent);

                                        //处理分页导航内容
                                        if (this.PagerDic.Count > 0)
                                        {
                                            foreach (string pagerKey in PagerDic.Keys)
                                            {
                                                PagerTag Pager = PagerDic[pagerKey];
                                                Pager.TotalRecordCount = PagedObject.GetTotalRecordCount();
                                                Pager.CurrentPage      = PagedObject.CurrentPageIndex;
                                                Pager.StartIndex       = PagedObject.StartIndex;
                                                Pager.EndIndex         = PagedObject.EndIndex;
                                                Pager.PageSize         = PagedObject.PageSize;

                                                Pager.DefaultPageFormat = Request.ServerVariables["SCRIPT_NAME"] + "?ChannelID=" + aWebChannel.ChannelID.ToString() + "&action=list&Page={0}";
                                                myPageHtml = myPageHtml.Replace(pagerKey, Pager.ToString());
                                            }
                                        }
                                        DisplayContent(HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, myPageHtml));
                                        #endregion
                                    }
                                    tpp.Dispose();
                                }
                                #endregion
                            }
                            else
                            {
                                ShowMessage("页面模板实体还原失败,请检查配置是否正确!");
                            }
                            #endregion
                        }
                        else
                        {
                            ShowMessage("没有可以直接查看的分页内容!");
                        }
                    }
                    else
                    {
                        if (tptConfig.GenerateSinglePage == true)
                        {
                            #region 单页综合生成
                            PageTemplet pageTpt = (new PageTemplet()).GetInstanceById(tptConfig.MixedSingleTemplet.TempletID) as PageTemplet;
                            if (pageTpt != null && pageTpt.IsExist == true && pageTpt.IsFilled == true)
                            {
                                if (pageTpt.IsMixedSyntax == false)
                                {
                                    DisplayContent(HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, pageTpt.TempletRawContent));
                                }
                                else
                                {
                                    TempletParse tpp = new TempletParse();
                                    tpp.Caller = this;
                                    tpp.SetResourceDependency(aWebChannel);
                                    tpp.SetTaggedObjectCollection(pageTpt.TempletRawContent);
                                    DisplayContent(HtmlTextGenerator.GetRightHtmlText(pageTpt.SiteBaseDir, tpp.ParsedResult));
                                }
                            }
                            else
                            {
                                ShowMessage("页面模板实体还原失败,请检查配置是否正确!");
                            }
                            #endregion
                        }
                        else
                        {
                            ShowMessage("没有可以直接查看的单页综合内容!");
                        }
                    }
                }
                else
                {
                    ShowMessage("频道资料无效!");
                }
            }
            else
            {
                //根据ID找到频道、 应用频道模板、分析模板内容输出
                if (Util.IsNumerical(Request.QueryString["ID"]))
                {
                    ViewNews(Int32.Parse(Request.QueryString["ID"]));
                }
                else
                {
                    ShowMessage("请指定要查看的动态内容!");
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// 获取完整的HTML代码输出
 /// </summary>
 public string GetHtmlOutPut()
 {
     return(HtmlTextGenerator.GetRightHtmlText(this.SiteBaseDir, this.Content));
 }