June 12, 2004

CommentThreads is working!

As you may see if you look at the comment pages on this site, you can now reply to a specific comment and it will be displayed as such when you submit your comment.

So, CommentThreads is working now. I just need to clean it and ExtendedComments up before releasing them to the public. Should only be a couple more days. Until then, here is the template code I am using on my site to display the comment threads, just to give you a taste (edited slightly for display purposes):

<MTCommentThreads>
<MTCommentThreadsIfFirst><ul></MTCommentThreadsIfFirst>
<li><div class="comment">
<a id="c<$MTCommentID$>"></a>
<h4><MTCommentTitle use_default="1"></h4>
<div class="posted">
<p class="posted">&raquo; <$MTCommentAuthorLink spam_protect="1" 
no_redirect="1"$> at <$MTCommentDate$>:</p>
<p>[ <a href="<$MTCGIPath$><$MTCommentScript$>
?__mode=preview
&entry_id=<MTEntryID>
&parent_id=<MTCommentID>
&static=1">Reply to this</a> ]</p>
</div>
<$MTCommentBody$>
</div>
<MTCommentThreadsRecurse>
</li>
<MTCommentThreadsIfLast></ul></MTCommentThreadsIfLast>
</MTCommentThreads>

Posted by rayners | Comments (5) | TrackBack

June 08, 2004

ExtendedComments Progress And Site Changes

ExtendedComments and CommentTitles are coming along well so far. I am still working up the preview portion of the comment system, but as long as you just go ahead and post, it is working just fine. Once I get preview working, CommentThreads should follow up shortly afterwards.

Update (at 1:40 on 06/08): Okay, so I got preview working now. I was expecting it to go quickly, but not that quickly.

Posted by rayners | Comments (1) | TrackBack

June 04, 2004

Some Sample ExtendedComments Code

Just to help me think things through, I am in the process of porting code from the provided MT::App::Comments class to "work" with my planned rayners::ExtendedComments class. I plan on making each and every feature available in the default comments script work as a plugin of sorts with my new script.

For example, here is the current code for the callback that operates on the entry_id parameter. It will most likely be setup as one of the first callbacks used when creating a comment. If it errors out, the process is halted and no comment is created. Otherwise, it will continue to the next callback, which can error out and halt the process there, and so on.

sub entry_id_param {
  my ($app, $comment, $entry_id) = @_;

  require MT::Entry;
  my $entry = MT::Entry->load ($entry_id) or
    return $app->error ($app->translate (
          "No such entry '[_1]'.", $entry_id));
  return $app->error($app->translate(
        "No such entry '[_1]'.", $entry_id))
    if $entry->status != RELEASE;

  unless ($entry->allow_comments eq '1') {
    return $app->handle_error($app->translate(
          "Comments are not allowed on this entry."));
  }

  $comment->blog_id ($entry->blog_id);
  $comment->entry_id ($entry_id);
  $comment;
}

What I am working towards is a setup where each of the current features of MT::App::Comments is replicated in rayners::ExtendedComments so that adding on new features (e.g. CommentTitles) will be fairly trivial.

Posted by rayners | Comments (0) | TrackBack

June 02, 2004

Coming Soon: ExtendedComments, CommentTitles, and CommentThreads

Recently, I have been talking with Imajes in #joiito about the port of a site to MT. This site currently has a threaded comment system, and he was looking to see if it was doable in MT. Currently, the only way to do it is via a hack, MTThreadedComments, but I thought there might be a better way to do that, especially after all the experience I have gained while working on the SubCategories plugin. So, I am going to announce the following plugins:

ExtendedComments

ExtendedComments, as a replacement for mt-comments.cgi, will not be so much a plugin as it will be a platform for plugins. The idea here is to give plugin authors a way to add functionality to the comment system without having to write yet another MT::App class.

I envision something like the following being used in a plugin to add a handler for a new argument to the ExtendedComments cgi script:

rayners::ExtendedComments->add_param ('param_name' => \&handler);

CommentTitles

CommentTitles will provide what you would expect, titles for comments. Mostly, it is to duplicate functionality of the MTThreadedComments hack, as well as to provide me with a very basic plugin with which to test ExtendedComments.

CommentThreads

Here is the fun part. CommentThreads will provide a threaded comment system for MT users, without having to resort to patching the core files.

All three of these are still very much in the preliminary planning stages, so any and all feedback is more than welcome.

Posted by rayners | Comments (7) | TrackBack

SubCategories

Archives:

Feeds:

Entry List