comments: Added commentmoderation directive for easy linking to the comment moderatio...
authorJoey Hess <joey@kitenet.net>
Tue, 6 Jul 2010 00:19:31 +0000 (20:19 -0400)
committerJoey Hess <joey@kitenet.net>
Tue, 6 Jul 2010 00:19:31 +0000 (20:19 -0400)
IkiWiki/Plugin/comments.pm
debian/changelog
doc/examples/blog/comments.mdwn
doc/ikiwiki/directive/commentmoderation.mdwn [new file with mode: 0644]

index 30ade56348c10aad8c77a6c3213bc7244209f187..f0eec9ace54ca4dc06fe74c866034f84c0bc8388 100644 (file)
@@ -22,6 +22,7 @@ sub import {
        hook(type => "checkconfig", id => 'comments',  call => \&checkconfig);
        hook(type => "getsetup", id => 'comments',  call => \&getsetup);
        hook(type => "preprocess", id => 'comment', call => \&preprocess);
+       hook(type => "preprocess", id => 'commentmoderation', call => \&preprocess_moderation);
        # here for backwards compatability with old comments
        hook(type => "preprocess", id => '_comment', call => \&preprocess);
        hook(type => "sessioncgi", id => 'comment', call => \&sessioncgi);
@@ -251,6 +252,22 @@ sub preprocess {
        return $content;
 }
 
+sub preprocess_moderation {
+       my %params = @_;
+
+       $params{desc}=gettext("Comment Moderation")
+               unless defined $params{desc};
+
+       if (length $config{cgiurl}) {
+               return '<a href="'.
+                       IkiWiki::cgiurl(do => 'commentmoderation').
+                       '">'.$params{desc}.'</a>';
+       }
+       else {
+               return $params{desc};
+       }
+}
+
 sub sessioncgi ($$) {
        my $cgi=shift;
        my $session=shift;
index d426be0196a6f35bd3b34202f5da63268ecc6419..18db7c0c26178751ebcf1aa92bb231ce8e259bec 100644 (file)
@@ -1,6 +1,8 @@
 ikiwiki (3.20100705) UNRELEASED; urgency=low
 
   * img: Add a margin around images displayed by this directive.
+  * comments: Added commentmoderation directive for easy linking to the
+    comment moderation queue.
 
  -- Joey Hess <joeyh@debian.org>  Mon, 05 Jul 2010 13:59:42 -0400
 
index 52c7d31328c4e776f18e3a9cd532a8aa720fc4b8..e22b50a3474435222d6179b496162cff42e2afaa 100644 (file)
@@ -1,7 +1,7 @@
 [[!sidebar content="""
 [[!inline pages="comment_pending(./posts/*)" feedfile=pendingmoderation
 description="comments pending moderation" show=-1]]
-Comments in the moderation queue:
+Comments in the [[!commentmoderation desc="moderation queue"]]:
 [[!pagecount pages="comment_pending(./posts/*)"]]
 """]]
 
diff --git a/doc/ikiwiki/directive/commentmoderation.mdwn b/doc/ikiwiki/directive/commentmoderation.mdwn
new file mode 100644 (file)
index 0000000..8553b5b
--- /dev/null
@@ -0,0 +1,9 @@
+The `commentmoderation` directive is supplied by the
+[[!iki plugins/comments desc=comments]] plugin, and is used to link
+to the comment moderation queue.
+
+Example:
+
+       \[[!commentmoderation desc="here is the comment moderation queue"]]
+
+[[!meta robots="noindex, follow"]]