예제 #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);
        }
예제 #2
0
        private void WriteWorkers(IEnumerable <Worker> collection, XmlWriter writer)
        {
            writer.WriteStartElement("WorkersData");
            foreach (var inst in collection)
            {
                writer.WriteStartElement("Worker");
                writer.WriteElementString("Id", inst.Id.ToString());
                writer.WriteElementString("Name", inst.Name);
                int PostId;
                if (inst.Post == null)
                {
                    PostId = 0;
                }
                else
                {
                    PostId = inst.Post.Id;
                }
                writer.WriteElementString("PostId", PostId.ToString());
                writer.WriteElementString("Unit", inst.Unit);

                writer.WriteElementString("Exp", inst.Exp.ToString());
                writer.WriteElementString("Bio", inst.Bio);
                writer.WriteElementString("Kharakteristika", inst.Kharakteristika);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
예제 #3
0
 private async Task <PostResponse> Post()
 {
     return(JsonSerializerExtension.Serializer.DeserializeFromStream <PostResponse>(await(await MyHttpClient.PostAsync(
                                                                                              PostUrl, new FormUrlEncodedContent(
                                                                                                  new Dictionary <string, string> {
         { "id", PostId.ToString() }
     }))).Content.ReadAsStreamAsync()));
 }
예제 #4
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "i";
            output.Attributes.SetAttribute("class", IconClass);
            output.Attributes.SetAttribute("id", IconId + PostId.ToString());

            var user = await _accountService.GetCurrentUser(ViewContext.HttpContext.User);

            var post = await _postService.GetPostById(PostId);

            if (user != null && post != null)
            {
                var like = await _postService.GetPostLike(post, user);

                if (like != null)
                {
                    output.Attributes.SetAttribute("class", IconClass + " " + SelectedColor);
                }
            }
        }
예제 #5
0
        public void ProcessRequest(HttpContext context)
        {
            _site = null;
            if (SiteId != 0)
            {
                _site = new AWAPI_BusinessLibrary.library.SiteLibrary().Get(SiteId);
            }

            if (_site == null || !_site.isEnabled)
            {
                return;
            }

            string link = String.IsNullOrEmpty(_site.link) ? "http://awapi.com" : _site.link;

            _feed = new SyndicationFeed(_site.title + " - Blog Feed", "", new Uri(link));
            _feed.Authors.Add(new SyndicationPerson("*****@*****.**"));

            _feed.AttributeExtensions.Add(new XmlQualifiedName("site"), _site.title);
            _feed.AttributeExtensions.Add(new XmlQualifiedName("sitelink"), _site.link);
            _feed.AttributeExtensions.Add(new XmlQualifiedName("defaultculture"), _site.cultureCode);

            _feed.AttributeExtensions.Add(new XmlQualifiedName("currentpostid"), CurrentPostId.ToString());
            _feed.AttributeExtensions.Add(new XmlQualifiedName("servertime"), DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"));

            if (BlogId > 0)
            {
                _feed.AttributeExtensions.Add(new XmlQualifiedName("blogid"), BlogId.ToString());
            }
            if (BlogCategoryId > 0)
            {
                _feed.AttributeExtensions.Add(new XmlQualifiedName("blogcategoryid"), BlogCategoryId.ToString());
            }
            if (PostId > 0)
            {
                _feed.AttributeExtensions.Add(new XmlQualifiedName("postid"), PostId.ToString());
            }

            AddParamsToFeed();

            context.Response.ContentType     = "text/xml";
            context.Response.ContentEncoding = System.Text.Encoding.UTF8;

            switch (MethodName)
            {
            case "getblog":
                _feed.Title = new TextSyndicationContent(_site.title + " - Blog");
                _feed.Categories.Add(new SyndicationCategory("blogs"));
                GetBlog(SiteId, BlogId);
                break;

            case "getbloglist":
                _feed.Title = new TextSyndicationContent(_site.title + " - Blog List");
                _feed.Categories.Add(new SyndicationCategory("blogs"));
                GetBlogList(SiteId);
                break;

            case "getcategorylist":
                _feed.Title = new TextSyndicationContent(_site.title + " - Blog Category List");
                _feed.Categories.Add(new SyndicationCategory("blogs"));
                GetCategoryList(BlogId);
                break;

            case "getpost":
                _feed.Title = new TextSyndicationContent(_site.title + " - Blog Post");
                _feed.Categories.Add(new SyndicationCategory("posts"));
                GetBlogPost(SiteId, PostId);
                break;

            case "getpostfilelist":
                _feed.Title = new TextSyndicationContent(_site.title + " - Blog Post File List");
                _feed.Categories.Add(new SyndicationCategory("files"));
                GetBlogPostFileList(SiteId, PostId);
                break;

            case "getpostlist":
                _feed.Title = new TextSyndicationContent(_site.title + " - Post List");
                _feed.Categories.Add(new SyndicationCategory("posts"));
                GetBlogPostList(SiteId, BlogId, BlogCategoryId, TagId, Search, PageIndex, PageSize);
                break;

            case "getarchivedpostlist":
                _feed.Title = new TextSyndicationContent(_site.title + " - Archived Post List");
                _feed.Categories.Add(new SyndicationCategory("posts"));
                GetArchivedBlogPostList(SiteId, BlogId, Archive, PageIndex, PageSize);
                break;

            case "getarchivelist":
                _feed.Title = new TextSyndicationContent(_site.title + " - Post Archive List");
                _feed.Categories.Add(new SyndicationCategory("posts"));
                GetBlogPostArchiveList(BlogId);
                break;

            case "getcommentlist":
                _feed.Title = new TextSyndicationContent(_site.title + " - Comment List");
                _feed.Categories.Add(new SyndicationCategory("comments"));
                GetBlogCommentList(SiteId, BlogId, PostId);
                break;

            case "gettaglist":
                _feed.Title = new TextSyndicationContent(_site.title + " - Tag List");
                _feed.Categories.Add(new SyndicationCategory("tags"));
                GetBlogTagList(BlogId, PostId);
                break;

            default:
                break;
            }

            WriteFeed();
        }
예제 #6
0
 protected void ButtonChange_Click(object sender, EventArgs e)
 {
     Response.Redirect("~/PostUpdate.aspx?PostId=" + PostId.ToString());
 }