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.