public virtual string GetArchive(ArchiveDto archive, params object[] args) { #region 属性 /* //验证密码 PropertyBLL pbll = new PropertyBLL(); var a = pbll.GetProperty(category.ModuleID, "pwd"); if (a != null) { var json = archive.GetPropertiesJson(); string key = json.GetValue("pwd"); if (!String.IsNullOrEmpty(key)) { string requireKey = HttpContext.Current.Request.QueryString["pwd"]; if (requireKey != key) { HttpContext.Current.Response.Write("<div style='margin:0 auto;padding:30px 0'>请输入密码:<input type='text'/><input type='button' value='提交' onclick=\"location.replace(location.href+'?pwd='+this.previousSibling.value)\"/></div>"); HttpContext.Current.Response.End(); } } }*/ #endregion //获取模板ID string tplID = this.GetArchiveTemplateID(archive); CategoryDto category = archive.Category; //用于当前的模板共享数据 AtNet.Cms.Cms.Context.Items["archive.id"] = archive.Id; AtNet.Cms.Cms.Context.Items["category.tag"] = category.Tag; AtNet.Cms.Cms.Context.Items["module.id"] = category.ModuleId; //解析模板 string html = PageUtility.Require(tplID, page => { page.AddVariable("site",this.site); PageArchive pageArchive = new PageArchive(archive); page.AddVariable("archive", pageArchive); page.AddVariable("category", category); page.AddVariable("module", new Module { ID = category.ModuleId }); page.AddVariable("page", new PageVariable { Title = String.Format("{0}_{1}_{2}", archive.Title, category.Name, site.SeoTitle), SubTitle = site.SeoTitle, Keywords = archive.Tags, Description = pageArchive.Outline.Replace("\"", String.Empty) }); }); /* HttpRequest request = HttpContext.Current.Request; //如果包含查询,则加入标签 if (!String.IsNullOrEmpty(request.Url.Query)) { //将查询参数作为标签 html = global::AtNet.DevFw.Template.TemplateRegexUtility.Replace(html, a => { if (request[a.Groups[1].Value] != null) { return request[a.Groups[1].Value]; } return a.Value; }); } // //TODO:模板被替换成空白 // */ return html; }
public virtual string GetArchive(ArchiveDto archive, params object[] args) { #region 属性 /* * //验证密码 * PropertyBLL pbll = new PropertyBLL(); * var a = pbll.GetProperty(category.ModuleID, "pwd"); * if (a != null) * { * var json = archive.GetPropertiesJson(); * string key = json.GetValue("pwd"); * if (!String.IsNullOrEmpty(key)) * { * string requireKey = HttpContext.Current.Request.QueryString["pwd"]; * if (requireKey != key) * { * HttpContext.Current.Response.Write("<div style='margin:0 auto;padding:30px 0'>请输入密码:<input type='text'/><input type='button' value='提交' onclick=\"location.replace(location.href+'?pwd='+this.previousSibling.value)\"/></div>"); * HttpContext.Current.Response.End(); * } * * } * }*/ #endregion //获取模板ID string tplID = this.GetArchiveTemplateID(archive); CategoryDto category = archive.Category; //用于当前的模板共享数据 AtNet.Cms.Cms.Context.Items["archive.id"] = archive.Id; AtNet.Cms.Cms.Context.Items["category.tag"] = category.Tag; AtNet.Cms.Cms.Context.Items["module.id"] = category.ModuleId; //解析模板 string html = PageUtility.Require(tplID, page => { page.AddVariable("site", this.site); PageArchive pageArchive = new PageArchive(archive); page.AddVariable("archive", pageArchive); page.AddVariable("category", category); page.AddVariable("module", new Module { ID = category.ModuleId }); page.AddVariable("page", new PageVariable { Title = String.Format("{0}_{1}_{2}", archive.Title, category.Name, site.SeoTitle), SubTitle = site.SeoTitle, Keywords = archive.Tags, Description = pageArchive.Outline.Replace("\"", String.Empty) }); }); /* * HttpRequest request = HttpContext.Current.Request; * * //如果包含查询,则加入标签 * if (!String.IsNullOrEmpty(request.Url.Query)) * { * //将查询参数作为标签 * html = global::AtNet.DevFw.Template.TemplateRegexUtility.Replace(html, a => * { * if (request[a.Groups[1].Value] != null) * { * return request[a.Groups[1].Value]; * } * return a.Value; * }); * } * * // * //TODO:模板被替换成空白 * // */ return(html); }