Example #1
0
        public override void OnInitTemplateInfo(EventArgs e)
        {
            string sourceName = BasePage.RequestString("copyfrom");

            if (!Source.ExistsPassedSource(sourceName))
            {
                TemplatePage.WriteErrMsg("指定的来源不存在!");
            }
            string dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath(Path.GetFileNameWithoutExtension(this.Page.Request.FilePath));
            NameValueCollection values       = new NameValueCollection();

            values.Add("copyfrom", DataSecurity.FilterBadChar(sourceName));
            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                TemplateInfo info = new TemplateInfo();
                info.QueryList       = values;
                info.PageName        = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.PageType        = 1;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("您查看的来源未设置模板!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx");
            }
        }
Example #2
0
        public override void OnInitTemplateInfo(EventArgs e)
        {
            string dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath(Path.GetFileNameWithoutExtension(this.Page.Request.FilePath));

            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                TemplateInfo info = new TemplateInfo();
                info.QueryList       = base.Request.QueryString;
                info.PageName        = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.PageType        = 1;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("您查看的作者列表页未设置模板!", "Default.aspx");
            }
        }
        public override void OnInitTemplateInfo(EventArgs e)
        {
            string   str      = BasePage.RequestString("updatetime");
            DateTime?nullable = null;

            if (!string.IsNullOrEmpty(str))
            {
                nullable = new DateTime?(DataConverter.CDate(str));
            }
            string dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath(Path.GetFileNameWithoutExtension(this.Page.Request.FilePath));
            NameValueCollection values       = new NameValueCollection();

            values.Add("authorname", DataSecurity.FilterBadChar(BasePage.RequestString("authorname")));
            if (!nullable.HasValue)
            {
                values.Add("updatetime", string.Empty);
            }
            else
            {
                values.Add("updatetime", nullable.Value.ToString("yyyy-MM-dd"));
            }
            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                TemplateInfo info = new TemplateInfo();
                info.QueryList       = values;
                info.PageName        = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.PageType        = 1;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("您查看的作者未设置模板!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx");
            }
        }
        public override void OnInitTemplateInfo(EventArgs e)
        {
            string str = BasePage.RequestStringToLower("action");
            string dynamicConfigTemplatePath = "";
            string str4 = str;

            if (str4 != null)
            {
                if (!(str4 == "special"))
                {
                    if (str4 == "specialcategory")
                    {
                        if (this.specialCategoryInfo.IsNull)
                        {
                            TemplatePage.WriteErrMsg("您查看的专题类别不存在!", base.BasePath + "Default.aspx");
                        }
                        dynamicConfigTemplatePath = this.specialCategoryInfo.SpecialTemplatePath;
                        goto Label_00AF;
                    }
                }
                else
                {
                    if (this.specialInfo.IsNull)
                    {
                        TemplatePage.WriteErrMsg("您查看的专题不存在!", base.BasePath + "Default.aspx");
                    }
                    dynamicConfigTemplatePath = this.specialInfo.SpecialTemplatePath;
                    goto Label_00AF;
                }
            }
            string fileName = "Special";

            dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath(fileName);
Label_00AF:
            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                TemplateInfo info = new TemplateInfo();
                info.QueryList = base.Request.QueryString;
                NameValueCollection queryString = base.Request.QueryString;
                StringBuilder       builder     = new StringBuilder();
                if (queryString.Count > 3)
                {
                    for (int i = 2; i < queryString.Count; i++)
                    {
                        builder.Append(queryString[i]);
                        builder.Append("&");
                    }
                }
                info.PageName = "index_{$pageid/}.aspx";
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    info.PageName = info.PageName + "?" + builder.ToString();
                }
                info.PageType        = 1;
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.IsDynamicPage   = true;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("您查看的专题未设置模板!", base.BasePath + "Default.aspx");
            }
        }
        public override void OnInitTemplateInfo(EventArgs e)
        {
            TemplateInfo        info    = new TemplateInfo();
            int                 num     = BasePage.RequestInt32("searchtype");
            string              str     = DataSecurity.FilterBadChar(base.Request.QueryString["keyword"]);
            int                 modelId = BasePage.RequestInt32("ModelId");
            string              dynamicConfigTemplatePath = "";
            NameValueCollection queryString = new NameValueCollection();

            switch (num)
            {
            case 0:
                if (!string.IsNullOrEmpty(str))
                {
                    this.SaveKeyword(str);
                }
                queryString = base.Request.QueryString;
                dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath("Search");
                break;

            case 1:
                if ((DataSecurity.FilterBadChar(base.Request.QueryString["fieldoption"]) == "keyword") && !string.IsNullOrEmpty(str))
                {
                    this.SaveKeyword(str);
                }
                queryString = base.Request.QueryString;
                dynamicConfigTemplatePath = this.GetTemplateFile(modelId);
                break;

            case 2:
                if (BasePage.RequestInt32("showtype") != 1)
                {
                    dynamicConfigTemplatePath = this.GetAdvanceTemplateForm(modelId);
                    break;
                }
                queryString = base.Request.QueryString;
                dynamicConfigTemplatePath = this.GetAdvanceTemplateFile(modelId);
                break;

            case 3:
            {
                string[] strArray          = DataSecurity.FilterBadChar(base.Request.QueryString["specialid"]).Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                int      specialid         = DataConverter.CLng(strArray[1]);
                int      specialcategoryid = DataConverter.CLng(strArray[0]);
                queryString.Add("specialid", specialid.ToString());
                queryString.Add("specialcategoryid", specialcategoryid.ToString());
                string str5 = DataSecurity.FilterBadChar(base.Request.QueryString["fieldoption"]);
                queryString.Add("fieldoption", str5);
                if ((str5 == "keyword") && !string.IsNullOrEmpty(str))
                {
                    this.SaveKeyword(str);
                }
                queryString.Add("keyword", str);
                dynamicConfigTemplatePath = this.GetSpecialTemplate(specialid, specialcategoryid);
                break;
            }

            default:
                queryString = base.Request.QueryString;
                if (!string.IsNullOrEmpty(str))
                {
                    this.SaveKeyword(str);
                }
                dynamicConfigTemplatePath = this.GetTemplatePath("Search");
                break;
            }
            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                info.QueryList       = queryString;
                info.PageName        = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.IsDynamicPage   = true;
                info.PageType        = 1;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("全站搜索结果页未设置模板!", "Default.aspx");
            }
        }