/// <summary> /// 首页 /// </summary> public Task Index(ICompatibleHttpContext context) { // bool eventResult = false; // if (OnIndexRequest != null) // { // OnIndexRequest(base.OutputContext, ref eventResult); // } var ctx = Cms.Context; SiteDto site = ctx.CurrentSite; // 站点站点路径 if (!this.CheckSiteUrl(context, site)) { return(SafetyTask.CompletedTask); } //检测网站状态及其缓存 if (ctx.CheckSiteState() && ctx.CheckAndSetClientCache()) { DefaultWebOuput.RenderIndex(ctx); } return(SafetyTask.CompletedTask); //如果返回false,则执行默认输出 // if (!eventResult) // { // DefaultWebOuput.RenderIndex(base.OutputContext); // } }
/// <summary> /// 首页 /// </summary> public void Index() { bool eventResult = false; if (OnIndexRequest != null) { OnIndexRequest(base.OutputCntext, ref eventResult); } if (!this.CheckSiteUrl()) { return; } SiteDto site = Cms.Context.CurrentSite; //跳转 if (!String.IsNullOrEmpty(site.Location) && Request.Url != null && Request.Url.Query.Length == 0) { Response.Redirect(site.Location, true); //302 return; } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderIndex(base.OutputCntext); } }
/// <summary> /// 文档页 /// </summary> /// <returns></returns> public void Archive(string allHtml) { CmsContext ctx = base.OutputContext; //检测网站状态 if (!ctx.CheckSiteState()) { return; } //检查缓存 if (!ctx.CheckAndSetClientCache()) { return; } String archivePath = this.SubPath(allHtml, ctx.SiteAppPath); bool eventResult = false; if (OnArchiveRequest != null) { OnArchiveRequest(ctx, archivePath, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderArchive(ctx, archivePath); } }
/// <summary> /// 文档页 /// </summary> /// <returns></returns> public Task Archive(ICompatibleHttpContext context) { context.Response.ContentType("text/html;charset=utf-8"); CmsContext ctx = Cms.Context; //检测网站状态及其缓存 if (ctx.CheckSiteState() && ctx.CheckAndSetClientCache()) { context.Response.ContentType("text/html;charset=utf-8"); var path = context.Request.GetPath(); String archivePath = this.SubPath(path, ctx.SiteAppPath); archivePath = archivePath.Substring(0, archivePath.LastIndexOf(".", StringComparison.Ordinal)); DefaultWebOuput.RenderArchive(ctx, archivePath); } return(SafetyTask.CompletedTask); /* * bool eventResult = false; * if (OnArchiveRequest != null) * { * OnArchiveRequest(ctx, archivePath, ref eventResult); * } * * //如果返回false,则执行默认输出 * if (!eventResult) * { * DefaultWebOuput.RenderArchive(ctx, archivePath); * } */ }
/// <summary> /// 栏目页面 /// </summary> /// <param name="allCate"></param> /// <returns></returns> public void Category(string allCate) { CmsContext ctx = base.OutputContext; //检测网站状态 if (!ctx.CheckSiteState()) { return; } //检查缓存 if (!ctx.CheckAndSetClientCache()) { return; } String catPath = this.SubPath(allCate, ctx.SiteAppPath); //验证是否为当前站点的首页 if (catPath.Length == 0) { this.Index(); return; } int page = 1; if (catPath.IndexOf(".") != -1) { //获取页码和tag Regex paramRegex = new Regex("/*((.+)/(p(\\d+)\\.html)?|(.+))$", RegexOptions.IgnoreCase); Match mc = paramRegex.Match(catPath); if (mc.Groups[4].Value != "") { page = int.Parse(mc.Groups[4].Value); } catPath = mc.Groups[mc.Groups[2].Value != "" ? 2 : 5].Value; } // 去掉末尾的"/" if (catPath.EndsWith("/")) { catPath = catPath.Substring(0, catPath.Length - 1); } //执行 bool eventResult = false; if (OnCategoryRequest != null) { OnCategoryRequest(ctx, catPath, page, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderCategory(ctx, catPath, page); } }
/// <summary> /// 栏目页 /// </summary> /// <param name="context"></param> /// <returns></returns> public Task Category(ICompatibleHttpContext context) { context.Response.ContentType("text/html;charset=utf-8"); CmsContext ctx = Cms.Context; //检测网站状态及其缓存 if (ctx.CheckSiteState() && ctx.CheckAndSetClientCache()) { var path = context.Request.GetPath(); var sitePath = ctx.SiteAppPath; // 验证是否为当前站点的首页 if (path == sitePath) { return(this.Index(context)); } // 如果为"/site/",跳转到"/site" if (path == sitePath + "/") { context.Response.Redirect(path.Substring(0, path.Length - 1), false); return(SafetyTask.CompletedTask); } String catPath = this.SubPath(path, sitePath); int page = 1; //获取页码和tag if (catPath.EndsWith(".html")) { var ls = catPath.LastIndexOf("/", StringComparison.Ordinal); var len = catPath.Length; var begin = ls + 1 + "list_".Length; var ps = catPath.Substring(begin, len - begin - 5); int.TryParse(ps, out page); catPath = catPath.Substring(0, ls); } DefaultWebOuput.RenderCategory(ctx, catPath, page); // //执行 // bool eventResult = false; // if (OnCategoryRequest != null) // { // OnCategoryRequest(ctx, catPath, page, ref eventResult); // } // // //如果返回false,则执行默认输出 // if (!eventResult) // { // DefaultWebOuput.RenderCategory(ctx, catPath, page); // } } return(SafetyTask.CompletedTask); }
public void Archive(string allhtml, FormCollection form) { bool eventResult = false; if (OnArchivePost != null) { OnArchivePost(base.OutputCntext, allhtml, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.PostArchive(base.OutputCntext, allhtml); } }
/// <summary> /// 搜索列表 /// </summary> /// <param name="t"></param> /// <returns></returns> public void Tag(string t) { bool eventResult = false; if (OnTagRequest != null) { OnTagRequest(base.OutputCntext, t, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderTag(base.OutputCntext, t); } }
/// <summary> /// 文档页 /// </summary> /// <returns></returns> public void Archive(string allHtml) { bool eventResult = false; if (OnArchiveRequest != null) { OnArchiveRequest(base.OutputCntext, allHtml, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderArchive(base.OutputCntext, allHtml); } }
/// <summary> /// 搜索列表 /// </summary> /// <param name="w"></param> /// <returns></returns> public void Search(string c, string w) { bool eventResult = false; if (OnSearchRequest != null) { OnSearchRequest(base.OutputCntext, c, w, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderSearch(base.OutputCntext, c, w); } }
/// <summary> /// 首页 /// </summary> public void Index() { bool eventResult = false; if (OnIndexRequest != null) { OnIndexRequest(base.OutputCntext, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderIndex(base.OutputCntext); } }
/// <summary> /// 栏目页面 /// </summary> /// <param name="allCate"></param> /// <returns></returns> public void Category(string allCate) { String appPath = this.OutputCntext.SiteAppPath; //验证是否为当前站点的首页 if (appPath != "/" || allCate.LastIndexOf("/") == 0 || allCate == appPath.Substring(1)) { this.Index(); return; } int page = 1; String path = allCate; if (allCate.IndexOf(".") != -1) { //获取页码和tag Regex paramRegex = new Regex("/*((.+)/(p(\\d+)\\.html)?|(.+))$", RegexOptions.IgnoreCase); Match mc = paramRegex.Match(allCate); if (mc.Groups[4].Value != "") { page = int.Parse(mc.Groups[4].Value); } path = mc.Groups[mc.Groups[2].Value != "" ? 2 : 5].Value; } // 去掉末尾的"/" if (path.EndsWith("/")) { path = path.Substring(0, path.Length - 1); } //执行 bool eventResult = false; if (OnCategoryRequest != null) { OnCategoryRequest(base.OutputCntext, path, page, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderCategory(base.OutputCntext, path, page); } }
/// <summary> /// 栏目页面 /// </summary> /// <param name="tag"></param> /// <param name="page"></param> /// <returns></returns> public void Category(string allcate) { int page = 1; string tag; //验证是否为当前站点的首页 if (this.OutputCntext.SiteAppPath != "/" && Regex.IsMatch(allcate, "^[^/]+/{0,1}$")) { this.Index(); return; } //获取页码和tag Regex paramRegex = new Regex("/*(([^/]+)/(p(\\d+)\\.html)?|([^/]+))$", RegexOptions.IgnoreCase); Match mc = paramRegex.Match(allcate); tag = mc.Groups[mc.Groups[2].Value != "" ? 2 : 5].Value; //计算页吗:页码如:p3 if (mc.Groups[4].Value != "") { page = int.Parse(mc.Groups[4].Value); } //执行 bool eventResult = false; if (OnCategoryRequest != null) { OnCategoryRequest(base.OutputCntext, tag, page, ref eventResult); } //如果返回false,则执行默认输出 if (!eventResult) { DefaultWebOuput.RenderCategory(base.OutputCntext, tag, page); } }
public void NotFound() { DefaultWebOuput.RenderNotFound(this.OutputCntext); }