diff options
author | Joey Hess <joey@kitenet.net> | 2010-07-05 20:19:31 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-07-05 20:19:31 -0400 |
commit | 7e3fb8b8a230a725df7814c15745c6fee9ddd5b1 (patch) | |
tree | 15434e781f615d4ef46e84c59d2fd09ea61ba899 /IkiWiki | |
parent | d89e2be91d79fca0a062744ff1dee630962cba7d (diff) |
comments: Added commentmoderation directive for easy linking to the comment moderation queue.
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 30ade5634..f0eec9ace 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -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; |