private void OnPreRenderPost(IContent content, CSPostEventArgs e) { if (e.ApplicationType == ApplicationType.Weblog) { WeblogPost post = content as WeblogPost; if ((post != null) && ((post.BlogPostType == BlogPostType.Post) || (post.BlogPostType == BlogPostType.Article))) { content.FormattedBody = string.Concat(content.FormattedBody, GenerateCounter(post)); } } }
private void csa_PostPostUpdate(IContent content, CSPostEventArgs e) { if (e.State == ObjectState.Create) { if (e.ApplicationType == ApplicationType.Forum) { var post = (ForumPost) content; string url; string category; if (post.ParentID != post.PostID) { category = "Discussion"; url = ForumUrls.Instance().PostPermaLink(post.ParentID, post.PostID); } else { category = "DiscussionQuestion"; url = ForumUrls.Instance().PostPermaLink(post.PostID, post.PostID); } string urlComplete = CSContext.Current.HostPath + url; SendNotification(urlComplete, category, post.Subject, post.User.CommonNameOrUserName, post.User.Email); } else if (e.ApplicationType == ApplicationType.Weblog) { var post = (WeblogPost) content; string url = string.Empty; string category = string.Empty; string description = string.Empty; bool sendRequest = false; if (post.BlogPostType == BlogPostType.Post) { category = "Blog"; url = post.ViewPostURL; description = "Blogged about: " + post.Subject; sendRequest = true; } else if (post.BlogPostType == BlogPostType.Comment) { if (post.User.CommonNameOrUserName.ToLower().Equals("anonymous")) sendRequest = false; else { category = "Feedback"; WeblogPost parentPost = WeblogPosts.GetPost(post.ParentID, false, true, true); url = parentPost.ViewPostURL + "#" + post.PostID; description = post.Subject; sendRequest = true; } } string urlComplete = CSContext.Current.HostPath + url; if (sendRequest) SendNotification(urlComplete, category, description, post.User.CommonNameOrUserName, post.User.Email); } } }