Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CSBlogs : Making post view and comment handling more like dotText

This would fall under the category of making CSBlogs more like dotText.  Specifically I want the CSBlogs Post View and Comment Handling page to work more like dotText. Maybe people like CSBlogs Post and Comments handling better than dotText.  That's fine.  But for me, I don't like it when I click the "Add Comment" link to enter a comment and all prior comments are removed from the page and I am left with the original post only.  That doesn't make sense to me as I am often commenting to other comments.  Doesn't everyone? 

Another thing I miss from dotText was the ability to click on the post title and refresh the page.  In dotText the title was a hyperlink, in CSBlogs it's a literal.  I wanted my hyperlink back.

Finally in dotText the comment form (if comments were enabled, of course) always appeared at the bottom of the comment list.  Simple, consistent.  CSBlogs uses a smart BlogToolBar control which lists the Add Comment link to display the comment form as well as support other functions (for registered users) like post rating and tracking.  I like the CS BlogToolBar and don't have any intention of getting rid of it.  I'll live with the extra click to display the comment form.  But I did move the toolbar to below the comment list where the dotText comment form used to always appear.  That makes more sense than displaying it with the original post and above the comments.  Otherwise readers would read the post, read through the comments, then scroll up again to click on the "Add Comment" link. 

Since I was now displaying the comment list with the comment form, the final update I made was to add an anchor to the comment form title so the user didn't have to scroll down through the comments to get to the comment form after clicking the "Add Comment" link.

Okay, to display comments with the comment form we add the Blog:EntryComments control to Skin-EntryPostCommentContainer.ascx. We then add EntryComments to the EntryPostCommentContainer control class, which originally contained the EntryView and CommentForm controls only.  Declare it and add it to the list of child controls being loaded.

private EntryComments comments = null;  

protected override void AttachChildControls()
{
comments = FindControl( "Comments" ) as EntryComments; 
....}

Then in the EntryPostCommentContainer.BindData() method we add the following code (from the EntryComments control).

BlogPostQuery query = new BlogPostQuery();
query.PostID = csContext.PostID;

string name = Context.Request.QueryString["PostName"];
if(!Globals.IsNullorEmpty(name))
 query.Name = name;

query.IncludeCategories = false;
query.ReturnFullThread = true;
query.BlogID = CurrentWeblog.SectionID;

comments.DataSource = WeblogPosts.GetPosts(query,true);
comments.DataBind();

Done.  We've got comments with our post and comment form.  The complete modified EntryPostCommentContainer class is here.

Next, to get our dotText title hyperlink back we go to EntryView.cs and .ascx and change the EntryTitle Literal to a HyperLink.  To add the NavigateURL property, DataSource.TitleUrl at this point is null, so we could either populate it in the WeblogPost component or assign it the following:

EntryTitle.NavigateUrl = BlogUrls.Instance().Post(DataSource,CurrentWeblog);

Okay, now to change the "Add a Comment" action to jump to the Comment Form we add an HTML anchor to the comment form heading in Skin-CommentForm.ascx. Then we go into the SiteURLs.config file and change the value of the WeblogCommentsPage path as follows.  Don't change the pattern or vanity values.

url name = "WeblogCommentsPage" location = "weblogs" path="comments/{1}.aspx#commentform" pattern = "comments/(\d+)\.aspx" vanity = "comments.aspx?PostID=$1"

And at that point we've got something that not only works very much like dotText, but has the CSBlogs Cool as well.

Comments (6) | Post RSS RSS comment feed

Posted on 3/28/2005 12:40:00 AM by Dave Burke
Categories: Community Server
Tags: No tags for this post

Related posts

Comments

3/28/2005 1:53:00 AM Permalink

So when am I going to be able to download Community Server Burke Version?  Everything you're doing sounds good to me.

Tim Haines |

3/28/2005 8:21:00 AM Permalink

A CSBurke you mean? Heh! Happy Monday Morning to you, Tim! Since none of the mods I'm writing about are online, I could be making them up. Thanks for your comments.

Dave Burke |

3/28/2005 7:48:00 PM Permalink

CSBurke - that's a good name for it.  It's Tuesday here BTW - remember you guys are a day behind.

LoverBoy69 |

3/28/2005 7:50:00 PM Permalink

You don't have to remind me that New Zealand is ahead of us in the States.  I DID see Lord of the Rings, you know.

Dave Burke |

4/10/2005 3:53:53 PM Permalink

Trying to implement this mod, getting an error when trying to post a comment;
UnknownError
1 total
Last @ 4/10/2005 3:46:04 PM  Message: Exception of type System.Web.HttpUnhandledException was thrown.
System.NullReferenceException: Object reference not set to an instance of an object. at CommunityServer.Blogs.Controls.EntryPostCommentContainer.BindData() in c:\documents and settings\vhgill\my documents\visual studio projects\az-community server\blogs\controls\entrypostcommentcontainer.cs:line 75 at CommunityServer.Blogs.Controls.EntryPostCommentContainer.AttachChildControls() in c:\documents and settings\vhgill\my documents\visual studio projects\az-community server\blogs\controls\entrypostcommentcontainer.cs:line 44 at CommunityServer.Blogs.Controls.WeblogThemedControl.CreateChildControls() in C:\Documents and Settings\vhgill\My Documents\Visual Studio Projects\AZ-Community Server\blogs\Controls\BaseControls\WeblogThemedControl.cs:line 71 at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain()

User Agent / IP Address
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Maxthon; .NET / 192.168.0.105

Path
/comments.aspx?PostID=11 as HTTP GET

Referrer:
/archive/2005/04/10/11.aspx

The 2 line numbers specified are these:

blogs\controls\entrypostcommentcontainer.cs:
line 75 - comments.DataSource = WeblogPosts.GetPosts(query,true);
line 44 - BindData();

blogs\Controls\BaseControls\WeblogThemedControl.cs:
line 71 - AttachChildControls();

This mean anything to you? Any idea how to fix it?

THANKS! Love your mods!
Also having an issue w/ your email function, but I like to burn one bridge at a time...

vgblog AT the gill family DOT us

vern |

4/10/2005 6:22:36 PM Permalink

Vern,  Your Skin-entrypostcommentcontainer.ascx control is missing the EntryComments control.  Add the following line and it should do the trick.

daveburke |

Comments are closed

This site was built with the Sueetie .NET Open Source Community Framework. Learn more about Sueetie at Sueetie.com.