private void CreateSpecialsCategoryHtml(SpecialCategoryInfo specialCategoryInfo)
        {
            TemplateInfo        templateInfo = new TemplateInfo();
            NameValueCollection values       = new NameValueCollection();

            values.Add("id", specialCategoryInfo.SpecialCategoryId.ToString());
            templateInfo.QueryList       = values;
            templateInfo.RootPath        = this.PhysicalApplicationPath;
            templateInfo.SiteUrl         = this.SiteUrl;
            templateInfo.TemplateContent = Template.GetTemplateContent(specialCategoryInfo.SpecialTemplatePath, this.PhysicalApplicationPath);
            templateInfo.CurrentPage     = 1;
            templateInfo.PageName        = SiteConfig.SiteInfo.VirtualPath + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialCategoryInfo.CategoryHtmlPageName;
            string str = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialCategoryInfo.CategoryHtmlPageName;

            HtmlAbstract.AddHeardRunatServer(templateInfo, templateInfo.PageName);
            try
            {
                FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str, TemplateTransform.GetHtml(templateInfo).TemplateContent);
                string str2 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str).Replace("//", "/");
                this.CreateMessage = string.Concat(new object[] { "<li>成功生成第", this.CreateCompleted + 1, "个专题类别页,专题类别名:<a target=_blank href=", str2, ">", specialCategoryInfo.SpecialCategoryName, "</a></li>", this.CreateMessage });
            }
            catch
            {
                this.CreateMessage = string.Concat(new object[] { "<li>第<font color='red'><b>", this.CreateCompleted + 1, "</b>个专题类别页生成失败</font>&nbsp;&nbsp;专题类别名:", specialCategoryInfo.SpecialCategoryName, "&nbsp;&nbsp;标签解析出现异常,跳过生成</li>", this.CreateMessage });
            }
        }
示例#2
0
        public void CreateSpecialsHtml(SpecialInfo specialInfo)
        {
            TemplateInfo        templateInfo = new TemplateInfo();
            NameValueCollection values       = new NameValueCollection();

            values.Add("id", specialInfo.SpecialId.ToString());
            values.Add("page", "1");
            templateInfo.QueryList       = values;
            templateInfo.CurrentPage     = 1;
            templateInfo.RootPath        = this.PhysicalApplicationPath;
            templateInfo.SiteUrl         = this.SiteUrl;
            templateInfo.IsDynamicPage   = false;
            templateInfo.PageType        = 1;
            templateInfo.PageName        = SiteConfig.SiteInfo.VirtualPath + SiteConfig.SiteOption.CreateHtmlPath + specialInfo.ListHtmlPagePath("{$pageid/}");
            templateInfo.TemplateContent = Template.GetTemplateContent(specialInfo.SpecialTemplatePath, this.PhysicalApplicationPath);
            try
            {
                TemplateTransform.GetHtml(templateInfo);
                HtmlAbstract.AddHeardRunatServer(templateInfo, templateInfo.PageName);
                string str = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialInfo.ListHtmlPagePath("");
                FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str, templateInfo.TemplateContent);
                string str2 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str).Replace("//", "/");
                this.CreateMessage = string.Concat(new object[] { "<li>成功生成第", this.CreateCompleted + 1, "个专题的专题首页,专题名:<a target=_blank href=", str2, ">", specialInfo.SpecialName, "</a></li>", this.CreateMessage });
            }
            catch
            {
                this.CreateMessage = string.Concat(new object[] { "<li>第<font color='red'><b>", this.CreateCompleted + 1, "</b>专题的专题列表页生成失败</font>&nbsp;&nbsp;专题名:", specialInfo.SpecialName, "&nbsp;&nbsp;标签解析出现异常,跳过生成</li>", this.CreateMessage });
            }
            int pageNum = templateInfo.PageNum;

            if (pageNum > 1)
            {
                for (int i = 1; i <= pageNum; i++)
                {
                    templateInfo.TemplateContent = Template.GetTemplateContent(specialInfo.SpecialTemplatePath, this.PhysicalApplicationPath);
                    values = new NameValueCollection();
                    values.Add("id", specialInfo.SpecialId.ToString());
                    values.Add("page", i.ToString());
                    templateInfo.QueryList   = values;
                    templateInfo.CurrentPage = i;
                    templateInfo.SiteUrl     = this.SiteUrl;
                    templateInfo.PageName    = SiteConfig.SiteInfo.VirtualPath + SiteConfig.SiteOption.CreateHtmlPath + specialInfo.ListHtmlPagePath("{$pageid/}");
                    try
                    {
                        TemplateTransform.GetHtml(templateInfo);
                        HtmlAbstract.AddHeardRunatServer(templateInfo, templateInfo.PageName);
                        string str3 = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + specialInfo.ListHtmlPagePath(i.ToString());
                        FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str3, templateInfo.TemplateContent);
                        string str4 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str3).Replace("//", "/");
                        this.CreateMessage = string.Concat(new object[] { "<li>成功生成第", this.CreateCompleted + 1, "个专题的专题列表页的第", i, "个分页,专题名:<a target=_blank href=", str4, ">", specialInfo.SpecialName, "</a></li>", this.CreateMessage });
                    }
                    catch
                    {
                        this.CreateMessage = string.Concat(new object[] { "<li>第<font color='red'><b>", this.CreateCompleted + 1, "</b>个专题的专题列表页的第", i, "个分页生成失败</font>&nbsp;&nbsp;专题名:", specialInfo.SpecialName, "&nbsp;&nbsp;标签解析出现异常,跳过生成</li>", this.CreateMessage });
                    }
                }
            }
        }
示例#3
0
        public void CreateContentHtml(CommonModelInfo commonModelInfo)
        {
            NodeInfo cacheNodeById = EasyOne.Contents.Nodes.GetCacheNodeById(commonModelInfo.NodeId);

            if (cacheNodeById.IsCreateContentPage && (cacheNodeById.PurviewType <= 0))
            {
                TemplateInfo        templateInfo = new TemplateInfo();
                NameValueCollection values       = new NameValueCollection();
                values.Add("id", commonModelInfo.GeneralId.ToString());
                values.Add("page", "1");
                templateInfo.QueryList       = values;
                templateInfo.CurrentPage     = 1;
                templateInfo.RootPath        = this.PhysicalApplicationPath;
                templateInfo.SiteUrl         = this.SiteUrl;
                templateInfo.IsDynamicPage   = false;
                templateInfo.PageType        = 0;
                templateInfo.PageName        = this.TemplatePageName(commonModelInfo, cacheNodeById);
                templateInfo.TemplateContent = Template.GetTemplateContent(ItemTemplateFilePath(commonModelInfo), this.PhysicalApplicationPath);
                int pageNum = 0;
                try
                {
                    TemplateTransform.GetHtml(templateInfo);
                }
                catch
                {
                    this.CreateMessage = string.Concat(new object[] { "<li>第<font color='red'><b>", this.CreateCompleted + 1, "</b></font>条信息生成失败。&nbsp;&nbsp;ID:", commonModelInfo.GeneralId.ToString(), "&nbsp;&nbsp;标题:<a target=_blank href=#>", commonModelInfo.Title, "</a>内容解析出现异常,跳过生成</li>", this.CreateMessage });
                }
                finally
                {
                    string str      = string.Empty;
                    string pageName = string.Empty;
                    pageNum = templateInfo.PageNum;
                    HtmlAbstract.AddHeardRunatServer(templateInfo, pageName);
                    if (templateInfo.TemplateContent.IndexOf("$$$EasyOne.ChargeTips$$$", StringComparison.Ordinal) > 0)
                    {
                        string newValue = ChargeTipsMessage(commonModelInfo.GeneralId, commonModelInfo.ModelId);
                        templateInfo.TemplateContent = templateInfo.TemplateContent.Replace("$$$EasyOne.ChargeTips$$$", newValue);
                        pageNum = 0;
                    }
                    pageName = ContentManage.ContentHtmlName(commonModelInfo, cacheNodeById, 0);
                    str      = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + pageName;
                    FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str, templateInfo.TemplateContent);
                    string str4 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str).Replace("//", "/");
                    this.CreateMessage = string.Concat(new object[] { "<li>成功生成第<font color='blue'><b>", this.CreateCompleted + 1, "</b></font>条信息。&nbsp;&nbsp;ID:", commonModelInfo.GeneralId.ToString(), "&nbsp;&nbsp;标题:<a target=_blank href=", str4, ">", commonModelInfo.Title, "</a></li>", this.CreateMessage });
                }
                if (pageNum > 1)
                {
                    for (int i = 1; i < pageNum; i++)
                    {
                        templateInfo.TemplateContent = Template.GetTemplateContent(ItemTemplateFilePath(commonModelInfo), this.PhysicalApplicationPath);
                        values = new NameValueCollection();
                        values.Add("id", commonModelInfo.GeneralId.ToString());
                        values.Add("page", (i + 1).ToString());
                        templateInfo.QueryList   = values;
                        templateInfo.PageName    = this.TemplatePageName(commonModelInfo, cacheNodeById);
                        templateInfo.CurrentPage = i + 1;
                        TemplateTransform.GetHtml(templateInfo);
                        string str5 = ContentManage.ContentHtmlName(commonModelInfo, cacheNodeById, i + 1);
                        HtmlAbstract.AddHeardRunatServer(templateInfo, str5);
                        string str6 = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + str5;
                        FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str6, templateInfo.TemplateContent);
                        string str7 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str6).Replace("//", "/");
                        this.CreateMessage = string.Concat(new object[] { "<li>成功生成第<font color='blue'><b>", this.CreateCompleted + 1, "</b></font>篇文章的第<font color='red'><b>", i, "</b></font>个分页。。&nbsp;&nbsp;ID:", commonModelInfo.GeneralId.ToString(), "&nbsp;&nbsp;标题:<a target=_blank href=", str7, ">", commonModelInfo.Title, "</a></li>", this.CreateMessage });
                        if ((i % 20) == 0)
                        {
                            this.CreateMessage = "为了缓解服务器压力,暂停一秒生成";
                            Thread.Sleep(0x3e8);
                        }
                    }
                }
                ContentManage.UpdateCreateTime(commonModelInfo.GeneralId, new DateTime?(DateTime.Now));
                if (this.m_EnableCreateNodePage)
                {
                    HtmlCategory category = new HtmlCategory();
                    category.PhysicalApplicationPath = this.PhysicalApplicationPath;
                    category.SiteUrl = this.SiteUrl;
                    category.CreateNodesHtml(cacheNodeById);
                }
                if (this.m_EnableCreateIndexPage)
                {
                    HtmlCategory category2 = new HtmlCategory();
                    category2.PhysicalApplicationPath = this.PhysicalApplicationPath;
                    category2.SiteUrl = this.SiteUrl;
                    NodeInfo nodeInfo = EasyOne.Contents.Nodes.GetCacheNodeById(-2);
                    category2.CreateNodesHtml(nodeInfo);
                }
            }
        }