[Update] I've updated my code to use Thomas Freudenberg's solution, which can be found in the trackbacks of this post.
I posted earlier about CoComment, which is an online tool that allows you to track comments you make on other blogs (if you go plug in your email address on their site, you’ll get a beta key within a day or so if you want to try it out, which I highly recommend doing). At the time of that posting, CoComment only supported the big name blogging engines, and from what I gathered somewhat poorly at that. So I emailed the development team asking if there was anything I could do from my end to expedite the process of getting more blogging engines in the mix, namely Community Server of course.
Lo and behold I get an email back from them a couple of days later stating they had gutted the approach they were taking (screen scraping) and were moving to a tag based system, and about a day after that I received another message pointing me towards this post on their site which outlines the implementation they came up with. Within half an hour I had this hammered out on my own site and am pleased to announce that it works quite nicely, so kudos to the folks over at CoComment. CS purists probably would have taken a CSModule based approach, but seeing as A) this is still very beta software and thus might change quite often, and B) that it’s literally 10 lines of code, I simply plugged it into the Skin-CommentForm.ascx control. Here’s the code:
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="CommunityServer.Blogs.Components" %>
<% WeblogPost currentPost = WeblogPosts.GetWeblogEntry(CSContext.Current.BlogGroupID, CSContext.Current.PostID); %>
<% bool isAuthor = CSContext.Current.IsAuthenticated && CSContext.Current.User.UserID == currentPost.AuthorID; %>
<script type="text/javascript">
var blogTool = "<%=SiteStatistics.CommunityServerVersionVersionInfo %>";
var blogURL = "<%=Globals.FullPath(currentPost.Weblog.HomePage) %>";
var blogTitle = "<%=currentPost.Weblog.Name %>";
var postURL = "<%=Globals.FullPath(BlogUrls.Instance().Post(currentPost)) %>";
var postTitle = "<%=currentPost.Subject %>";
var commentAuthorLoggedIn = "<%=isAuthor %>";
<% if (isAuthor) { %>
var commentAuthor = "<%=CSContext.Current.User.DisplayName %>";
<% } else{ %>
var commentAuthorFieldName = "<%=tbName.UniqueID %>";
<% } %>
var commentFormName = "__aspnetForm";
var commentTextFieldName = "<%=tbComment.UniqueID %>";
var commentButtonID = "<%=btnSubmit.UniqueID %>";
</script>
Voila, your blog is now CoComment enabled. To actually use CoComment, you’ll need to get an account, and there is a bookmarklet available from their site that sits in your links toolbar of your browser of choice (it looks like the big 4 are supported). My next feature request will be some sort of visual cue that lets the commenter know that the site is CoComment-enabled…other than that, it works beautifully.
Share this post: 
|

|

|

|

|
