protected override void LoadContent(GraffitiContext graffitiContext) { graffitiContext["where"] = "post"; Post post = Post.GetCachedPost(PostId); if (post.IsDeleted || (!post.IsPublished && GraffitiUsers.Current == null)) { RedirectTo(new Urls().Home); } else if (PostName != null && CategoryName != null && (!Util.AreEqualIgnoreCase(PostName, post.Name) || !Util.AreEqualIgnoreCase(CategoryName, post.Category.LinkName))) { RedirectTo(post.Url); } else if (Context.Request.Cookies["Graffiti-Post-" + PostId] == null) { Post.UpdateViewCount(PostId); //SPs.UpdatePostView(PostId).Execute(); HttpCookie cookie = new HttpCookie("Graffiti-Post-" + PostId, PostId.ToString()); Context.Response.Cookies.Add(cookie); } graffitiContext["title"] = post.Title + " : " + SiteSettings.Get().Title; graffitiContext["category"] = post.Category; graffitiContext["post"] = post; graffitiContext.RegisterOnRequestDelegate("feedback", GetPostFeedback); graffitiContext.RegisterOnRequestDelegate("comments", GetPostComments); graffitiContext.RegisterOnRequestDelegate("trackbacks", GetPostTrackbacks); }
protected override void LoadContent(GraffitiContext graffitiContext) { IsIndexable = false; graffitiContext["where"] = "category"; Category category = new CategoryController().GetCachedCategory(CategoryID, false); if (CategoryName != null && !Util.AreEqualIgnoreCase(CategoryName, category.LinkName)) { RedirectTo(category.Url); } graffitiContext["title"] = category.Name + " : " + SiteSettings.Get().Title; graffitiContext["category"] = category; graffitiContext.RegisterOnRequestDelegate("posts", GetCategoryPosts); // GetCategoryPosts needs to be called so the pager works GetCategoryPosts("posts", graffitiContext); }
protected override void LoadContent(GraffitiContext graffitiContext) { IsIndexable = false; graffitiContext["where"] = "category"; Category category = new CategoryController().GetCachedCategory(CategoryID, false); if(CategoryName != null && !Util.AreEqualIgnoreCase(CategoryName,category.LinkName)) { RedirectTo(category.Url); } graffitiContext["title"] = category.Name + " : " + SiteSettings.Get().Title; graffitiContext["category"] = category; graffitiContext.RegisterOnRequestDelegate("posts", GetCategoryPosts); // GetCategoryPosts needs to be called so the pager works GetCategoryPosts("posts", graffitiContext); }
/// <summary> /// Loads/sets all global default content /// </summary> /// <param name="graffitiContext">Current context</param> /// <param name="view">Name of the view requested</param> protected virtual void SetContextDefault(GraffitiContext graffitiContext, string view) { graffitiContext["request"] = Context.Request; graffitiContext["response"] = Context.Response; graffitiContext["url"] = Context.Request.RawUrl.ToLower().Replace(Util.DEFAULT_PAGE_LOWERED, string.Empty); graffitiContext["pageIndex"] = Int32.Parse(Context.Request.QueryString["p"] ?? "1"); graffitiContext["isUser"] = Context.Request.IsAuthenticated; graffitiContext["user"] = GraffitiUsers.Current; graffitiContext["categoryID"] = CategoryID; graffitiContext["postID"] = PostId; graffitiContext["tagName"] = TagName; graffitiContext.Layout = ViewLookUp(".layout.view", "layout.view"); graffitiContext.View = view; SetDataTypeHelpers(graffitiContext); graffitiContext.RegisterOnRequestDelegate("header", NamedViewLoader); graffitiContext.RegisterOnRequestDelegate("navigation", NamedViewLoader); graffitiContext.RegisterOnRequestDelegate("sidebar", NamedViewLoader); graffitiContext.RegisterOnRequestDelegate("left-sidebar", NamedViewLoader); graffitiContext.RegisterOnRequestDelegate("right-sidebar", NamedViewLoader); graffitiContext.RegisterOnRequestDelegate("footer", NamedViewLoader); }