Exemplo n.º 1
0
 protected void BtnShowTemplate_Click(object sender, EventArgs e)
 {
     if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
     {
         File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.m_LabelName + ".config", true);
     }
     SiteCache.Remove("pe_labdefing_" + this.m_LabelName);
     if (!string.IsNullOrEmpty(this.TxtTemplateTest.Text))
     {
         TemplateInfo        templateInfo = new TemplateInfo();
         NameValueCollection values       = new NameValueCollection();
         values.Add("id", "1");
         templateInfo.QueryList       = values;
         templateInfo.TemplateContent = this.TxtTemplateTest.Text;
         templateInfo.CurrentPage     = DataConverter.CLng(this.TxtTempPage.Text);
         templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
         templateInfo.PageName        = this.TxtTempPageName.Text;
         templateInfo      = TemplateTransform.GetHtml(templateInfo);
         this.LabShow.Text = templateInfo.TemplateContent;
         if (templateInfo.TotalPub > 0)
         {
             this.LabShow.Text = this.LabShow.Text + "<br/>本页取得的总数据输出量为:" + templateInfo.TotalPub.ToString();
         }
         if (templateInfo.PageNum > 0)
         {
             this.LabShow.Text = this.LabShow.Text + "<br/>本页分页数为:" + templateInfo.PageNum.ToString();
         }
     }
 }
 protected void BtnShowTemplate_Click(object sender, EventArgs e)
 {
     if (XmlManage.SaveFileNode(this.xmlfilepath, "root", "LabelTemplate", this.TxtTemplate.Text))
     {
         File.Copy(this.xmlfilepath, HttpContext.Current.Server.MapPath(this.m_LabelLibPath) + @"\" + this.labelname + ".config", true);
     }
     SiteCache.Remove("pe_labdefing_" + this.labelname);
     if (!string.IsNullOrEmpty(this.TxtTemplateTest.Text))
     {
         TemplateInfo        templateInfo = new TemplateInfo();
         NameValueCollection values       = new NameValueCollection();
         values.Add("id", "1");
         templateInfo.QueryList       = values;
         templateInfo.TemplateContent = this.TxtTemplateTest.Text;
         templateInfo.CurrentPage     = 1;
         templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
         templateInfo.PageName        = string.Empty;
         templateInfo      = TemplateTransform.GetHtml(templateInfo);
         this.LabShow.Text = templateInfo.TemplateContent;
     }
     else
     {
         this.LabShow.Text = "请输入测试标签";
     }
 }
Exemplo n.º 3
0
        protected void BtnRss_Click(object sender, EventArgs e)
        {
            TemplateInfo templateInfo = new TemplateInfo();

            templateInfo.QueryList = base.Request.QueryString;
            string path = string.Empty;

            foreach (FrontTemplate template in SiteConfig.FrontTemplateList)
            {
                if (string.Compare("RssIndex", template.Key, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    path = template.Value;
                    break;
                }
            }
            templateInfo.PageName        = "Rss.xml";
            templateInfo.CurrentPage     = 1;
            templateInfo.RootPath        = base.Request.PhysicalApplicationPath;
            templateInfo.SiteUrl         = SiteConfig.SiteInfo.SiteUrl;
            templateInfo.IsDynamicPage   = false;
            templateInfo.TemplateContent = Template.GetTemplateContent(path, base.Request.PhysicalApplicationPath);
            TemplateTransform.GetHtml(templateInfo);
            FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(base.Request.PhysicalApplicationPath) + SiteConfig.SiteOption.CreateHtmlPath + "Rss/Rss.xml", TemplateTransform.GetHtml(templateInfo).TemplateContent);
            AdminPage.WriteSuccessMsg("生成成功!");
        }
Exemplo n.º 4
0
        protected override void Render(HtmlTextWriter writer)
        {
            string producerName = BasePage.RequestStringToLower("producername");

            if (!Producer.ProducerNameExists(producerName))
            {
                WriteErrMsg("您要查看的厂商不存在!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx");
            }
            string templatePath        = this.GetTemplatePath();
            NameValueCollection values = new NameValueCollection();

            values.Add("producername", DataSecurity.FilterBadChar(producerName));
            if (!string.IsNullOrEmpty(templatePath))
            {
                TemplateInfo templateInfo = new TemplateInfo();
                templateInfo.QueryList       = values;
                templateInfo.PageName        = RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                templateInfo.TemplateContent = Template.GetTemplateContent(templatePath);
                templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                templateInfo.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                templateInfo.PageType        = 1;
                templateInfo = TemplateTransform.GetHtml(templateInfo);
                writer.Write(templateInfo.TemplateContent);
            }
            else
            {
                WriteErrMsg("您查看的厂商未设置模板!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx");
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 输出模板解析后的内容
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreInit(EventArgs e)
        {
            string templateContent;

            base.OnPreInit(e);
            this.OnInitTemplatePage(EventArgs.Empty);
            //if ((this.IsCache && (this.CacheTime > 0)) && (SiteCache.Get(this.CacheKey) != null))
            //{
            //templateContent = (string) SiteCache.Get(this.CacheKey);
            //}
            //else
            //{
            int start = Environment.TickCount;

            this.OnInitTemplateInfo(EventArgs.Empty);
            templateContent = TemplateTransform.GetHtml(this.TemplateInfo).TemplateContent;
            //if (this.IsCache && (this.CacheTime > 0))
            //{
            //SiteCache.Insert(this.CacheKey, templateContent, this.CacheTime);
            //}
            //}
            Response.Write("模板解析时间:" + (Environment.TickCount - start).ToString() + "毫秒");
            base.Response.Write(templateContent);

            base.Response.End();
        }
Exemplo n.º 6
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            base.Response.Clear();
            base.Response.Buffer  = true;
            base.Response.Charset = "utf-8";
            base.Response.AddHeader("contenttype", "text/vnd.wap.wml; charset=utf-8");
            base.Response.ContentEncoding = Encoding.GetEncoding("utf-8");
            base.Response.ContentType     = "text/vnd.wap.wml; charset=utf-8";
            TemplateInfo templateInfo = new TemplateInfo();

            templateInfo.QueryList = base.Request.QueryString;
            templateInfo.PageName  = DynamicPage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
            string path = "/其他模板/默认wap页模板.html";

            foreach (FrontTemplate template in SiteConfig.FrontTemplateList)
            {
                if (string.Compare(this.PageFileName, template.Key, true, CultureInfo.CurrentCulture) == 0)
                {
                    path = template.Value;
                    break;
                }
            }
            templateInfo.TemplateContent = Template.GetTemplateContent(path);
            templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
            templateInfo.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
            templateInfo = TemplateTransform.GetHtml(templateInfo);
            base.Response.Write(templateInfo.TemplateContent);
            base.Response.End();
        }
Exemplo n.º 7
0
 private void CreateNodeListPageHtml(NodeInfo nodeInfo, TemplateInfo templateInfo)
 {
     if (nodeInfo.NodeType != NodeType.Single)
     {
         string str  = string.Empty;
         string str2 = string.Empty;
         string str3 = SiteConfig.SiteInfo.VirtualPath + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath);
         try
         {
             templateInfo.PageName        = str3 + nodeInfo.ListHtmlPageName("{$pageid/}");
             templateInfo.TemplateContent = Template.GetTemplateContent(nodeInfo.ContainChildTemplateFile, this.PhysicalApplicationPath);
             TemplateTransform.GetHtml(templateInfo);
         }
         catch
         {
         }
         finally
         {
             str = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + nodeInfo.ListHtmlPageName("1");
             FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str, templateInfo.TemplateContent);
             str2 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str).Replace("//", "/");
             this.CreateMessage = string.Concat(new object[] { "<li>成功生成第", this.CreateCompleted + 1, "个栏目的栏目列表页,栏目名:<a target=_blank href=", str2, ">", nodeInfo.NodeName, "</a></li>", this.CreateMessage });
         }
         int pageNum = templateInfo.PageNum;
         int num2    = 1;
         for (num2 = 1; num2 < pageNum; num2++)
         {
             try
             {
                 if ((num2 % 7) == 0)
                 {
                     this.CreateMessage = "为了缓解服务器压力,暂停一秒生成";
                     Thread.Sleep(0x3e8);
                     this.CreateMessage = "";
                 }
                 templateInfo.TemplateContent = Template.GetTemplateContent(nodeInfo.ContainChildTemplateFile, this.PhysicalApplicationPath);
                 NameValueCollection values = new NameValueCollection();
                 values.Add("id", nodeInfo.NodeId.ToString());
                 values.Add("page", (num2 + 1).ToString());
                 templateInfo.QueryList   = values;
                 templateInfo.PageName    = str3 + nodeInfo.ListHtmlPageName("{$pageid/}");
                 templateInfo.CurrentPage = num2 + 1;
                 TemplateTransform.GetHtml(templateInfo);
             }
             catch
             {
                 this.CreateMessage = string.Concat(new object[] { "<li>第<font color='red'><b>", this.CreateCompleted + 1, "</b>条信息生成失败</font>&nbsp;&nbsp;栏目名:", nodeInfo.NodeName, "&nbsp;&nbsp;标签解析出现异常,跳过生成</li>", this.CreateMessage });
             }
             finally
             {
                 int num5 = num2 + 1;
                 str = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + nodeInfo.ListHtmlPageName(num5.ToString());
                 FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(this.PhysicalApplicationPath) + str, templateInfo.TemplateContent);
                 str2 = (VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteInfo.VirtualPath) + str).Replace("//", "/");
                 this.CreateMessage = string.Concat(new object[] { "<li>成功生成第", this.CreateCompleted + 1, "个栏目的栏目列表页的第", num2, "个分页,栏目名:<a target=_blank href=", str2, ">", nodeInfo.NodeName, "</a></li>", this.CreateMessage });
             }
         }
     }
 }
Exemplo n.º 8
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 });
                    }
                }
            }
        }
Exemplo n.º 9
0
        private static string GetTemplateContent(string templatePath)
        {
            TemplateInfo templateInfo = new TemplateInfo();

            templateInfo.QueryList       = HttpContext.Current.Request.QueryString;
            templateInfo.PageName        = "SurveyFormCreate.aspx";
            templateInfo.TemplateContent = Template.GetTemplateContent(templatePath);
            templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
            templateInfo.CurrentPage     = DataConverter.CLng(HttpContext.Current.Request.QueryString["page"], 1);
            return(TemplateTransform.GetHtml(templateInfo).TemplateContent);
        }
Exemplo n.º 10
0
        protected virtual void InitializeTemplate()
        {
            TemplateInfo templateInfo = new TemplateInfo();

            templateInfo.QueryList = base.Request.QueryString;
            templateInfo.PageName  = RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
            if (string.IsNullOrEmpty(this.m_TemplatePath))
            {
                this.m_TemplatePath = this.GetTemplatePath();
            }
            templateInfo.TemplateContent = Template.GetTemplateContent(this.m_TemplatePath);
            templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
            templateInfo.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
            templateInfo         = TemplateTransform.GetHtml(templateInfo);
            this.TemplateContent = templateInfo.TemplateContent;
        }
Exemplo n.º 11
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            base.Response.Clear();
            base.Response.Buffer  = true;
            base.Response.Charset = "utf-8";
            base.Response.AddHeader("contenttype", "text/vnd.wap.wml");
            base.Response.ContentEncoding = Encoding.GetEncoding("utf-8");
            base.Response.ContentType     = "text/vnd.wap.wml";
            this.m_GeneralId = BasePage.RequestInt32("id");
            if (this.m_GeneralId <= 0)
            {
                base.Response.End();
            }
            this.m_ItemInfo = ContentManage.GetCommonModelInfoById(this.m_GeneralId);
            if (this.m_ItemInfo.IsNull)
            {
                base.Response.End();
            }
            else
            {
                this.m_ModelInfo = ModelManager.GetModelInfoById(this.m_ItemInfo.ModelId);
                if (!this.m_ModelInfo.IsEshop && (this.m_ItemInfo.Status != 0x63))
                {
                    base.Response.End();
                }
            }
            TemplateInfo templateInfo = new TemplateInfo();

            templateInfo.QueryList = base.Request.QueryString;
            templateInfo.PageName  = DynamicPage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
            string path = "/其他模板/Wap内容页模板.html";

            foreach (FrontTemplate template in SiteConfig.FrontTemplateList)
            {
                if (string.Compare(this.PageFileName, template.Key, true, CultureInfo.CurrentCulture) == 0)
                {
                    path = template.Value;
                    break;
                }
            }
            templateInfo.TemplateContent = Template.GetTemplateContent(path);
            templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
            templateInfo.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
            templateInfo = TemplateTransform.GetHtml(templateInfo);
            base.Response.Write(templateInfo.TemplateContent);
            base.Response.End();
        }
Exemplo n.º 12
0
        private void CreateNodeDefalutPageHtml(NodeInfo nodeInfo, TemplateInfo templateInfo)
        {
            string path = string.Empty;
            string str2 = SiteConfig.SiteInfo.VirtualPath + VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath);

            if (string.IsNullOrEmpty(nodeInfo.DefaultTemplateFile))
            {
                path = nodeInfo.ContainChildTemplateFile;
                templateInfo.PageName = str2 + nodeInfo.ListHtmlPageName("{$pageid/}");
            }
            else
            {
                templateInfo.PageName = str2 + nodeInfo.ListHtmlPageName("0");
                path = nodeInfo.DefaultTemplateFile;
            }
            try
            {
                templateInfo.CurrentPage     = 1;
                templateInfo.TemplateContent = Template.GetTemplateContent(path, this.PhysicalApplicationPath);
                TemplateTransform.GetHtml(templateInfo);
            }
            catch
            {
                this.CreateMessage = string.Concat(new object[] { "<li>第<font color='red'><b>", this.CreateCompleted + 1, "</b>条信息生成失败</font>&nbsp;&nbsp;栏目名:", nodeInfo.NodeName, "&nbsp;&nbsp;标签解析出现异常</li>", this.CreateMessage });
            }
            finally
            {
                string str3;
                if (nodeInfo.NodeId == -2)
                {
                    str3 = nodeInfo.ListHtmlPageName("0");
                }
                else
                {
                    str3 = VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.CreateHtmlPath) + nodeInfo.ListHtmlPageName("0");
                }
                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, "个栏目的栏目首页,栏目名:<a target=_blank href=", str4, ">", nodeInfo.NodeName, "</a></li>", this.CreateMessage });
            }
        }
Exemplo n.º 13
0
        protected override void Render(HtmlTextWriter writer)
        {
            string templatePath = base.TemplatePath;

            if (!string.IsNullOrEmpty(templatePath))
            {
                TemplateInfo templateInfo = new TemplateInfo();
                templateInfo.QueryList       = base.Request.QueryString;
                templateInfo.PageName        = DynamicPage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                templateInfo.TemplateContent = Template.GetTemplateContent(templatePath);
                templateInfo.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                templateInfo.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                templateInfo.PageType        = 1;
                templateInfo = TemplateTransform.GetHtml(templateInfo);
                writer.Write(templateInfo.TemplateContent);
            }
            else
            {
                DynamicPage.WriteErrMsg("您查看的品牌列表页未设置模板!", "Default.aspx");
            }
        }
Exemplo n.º 14
0
        protected void BtnGoogle_Click(object sender, EventArgs e)
        {
            TemplateInfo templateInfo = new TemplateInfo();

            templateInfo.QueryList = base.Request.QueryString;
            string path = "/其他模板/Google地图模板.html";

            templateInfo.PageName        = "GoogleSiteMap_Index.xml";
            templateInfo.IsDynamicPage   = false;
            templateInfo.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
            templateInfo.RootPath        = base.Request.PhysicalApplicationPath;
            templateInfo.SiteUrl         = SiteConfig.SiteInfo.SiteUrl;
            templateInfo.TemplateContent = Template.GetTemplateContent(path);
            TemplateTransform.GetHtml(templateInfo);
            FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(base.Request.PhysicalApplicationPath) + SiteConfig.SiteOption.CreateHtmlPath + templateInfo.PageName, TemplateTransform.GetHtml(templateInfo).TemplateContent);
            if (templateInfo.PageNum > 1)
            {
                int pageNum = templateInfo.PageNum;
                for (int i = 2; i < pageNum; i++)
                {
                    templateInfo.QueryList = base.Request.QueryString;
                    path = "/其他模板/Google地图模板.html";
                    templateInfo.PageName        = "GoogleSiteMap_Index_" + i.ToString() + ".xml";
                    templateInfo.IsDynamicPage   = false;
                    templateInfo.CurrentPage     = i;
                    templateInfo.RootPath        = base.Request.PhysicalApplicationPath;
                    templateInfo.SiteUrl         = SiteConfig.SiteInfo.SiteUrl;
                    templateInfo.TemplateContent = Template.GetTemplateContent(path);
                    TemplateTransform.GetHtml(templateInfo);
                    FileSystemObject.WriteFile(VirtualPathUtility.AppendTrailingSlash(base.Request.PhysicalApplicationPath) + SiteConfig.SiteOption.CreateHtmlPath + templateInfo.PageName, TemplateTransform.GetHtml(templateInfo).TemplateContent);
                }
            }
            this.HypGoogleMap.Visible     = true;
            this.HypGoogleMap.Text        = "生成成功,点击提交地图!";
            this.HypGoogleMap.NavigateUrl = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" + templateInfo.SiteUrl + "/" + templateInfo.PageName;
        }
        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 });
            }
        }
Exemplo n.º 16
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);
                }
            }
        }