, ,

Yesterday the guys at coComment updated their scripts. They also refreshed the example for Community Server, but that’s targetting CS 2.0. There are some breaking changes in the API of CS 2.1, so that code won’t work with Telligent’s latest release. Keyvan Nayyeri updated the code some time ago. I polished it a little bit and incorporated the latest changes from coComment:

<%@ Import Namespace="CommunityServer.Components" %>
<%@ Import Namespace="CommunityServer.Blogs.Components" %>

<% CSContext context = CSContext.Current; %>
<% Weblog currentBlog = Weblogs.GetWeblog(context.ApplicationKey); %>
<% BlogThreadQuery query = new BlogThreadQuery(); %>
<% query.PostID = context.PostID; %>
<% if (context.PostName != null) { %>
<%   query.PostName = context.PostName; %>
<% } %>
<% query.IncludeCategories = false; %>
<% query.ReturnFullThread = false; %>
<% query.SectionID = currentBlog.SectionID; %>
<% PostSet postSet = WeblogPosts.GetPosts(query, true); %>
<% postSet.Organize(); %>
<% WeblogPost blogPost = postSet.ThreadStarter as WeblogPost; %>
<% bool isAuthor = context.IsAuthenticated; %>

<script type="text/javascript">
coco =
{
    tool       : "<%= SiteStatistics.CommunityServerVersionVersionInfo %>",
    siteurl    : "<%= Globals.FullPath(currentBlog.Url) %>",
    sitetitle  : "<%= currentBlog.Name %>",
    pageurl    : "<%= Globals.FullPath(BlogUrls.Instance().Post(blogPost)) %>",
    pagetitle  : "<%= blogPost.Subject %>",<% if (isAuthor) { %>
    author     : "<%= context.User.DisplayName %>",<% } else{ %>
    authorID   : "<%= tbName.UniqueID %>",<% } %>
    formID     : "aspnetForm",
    textareaID : "<%= tbComment.UniqueID %>",
    buttonID   : "<%= btnSubmit.UniqueID %>"
}
</script>
<script id="cocomment-fetchlet" src="http://www.cocomment.com/js/enabler.js"
    type="text/javascript">
</script>

If you run CS 2.1 on ASP.NET 1.1, you have to change formID from aspnetForm to __aspnetForm.

What I don’t understand however is why the xxxID variables require the name of the related control instead of the ID.

Comments

Keyvan Nayyeri

Welld done Thomas :-)

I still don’t want to use their services and install it on my blog although they had great improvements.

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...