예제 #1
0
        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);
        }