summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-11-17 10:42:01 +0000
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2008-12-11 21:14:02 +0000
commitb7db3444a5d8e31bb1df60c3617f1038d93e099e (patch)
treed62e4dc28fc71768ccfce9033ee411317c0de65e /IkiWiki/Plugin
parentf49603bf8638ab539151114445e0b132fb518941 (diff)
smcvpostcomment: allow commenting to be closed
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/smcvpostcomment.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/smcvpostcomment.pm b/IkiWiki/Plugin/smcvpostcomment.pm
index 40ffe8164..22958c84a 100644
--- a/IkiWiki/Plugin/smcvpostcomment.pm
+++ b/IkiWiki/Plugin/smcvpostcomment.pm
@@ -48,7 +48,9 @@ sub preprocess (@) { #{{{
}
my $page = $params{page};
- $pagestate{$page}{PLUGIN()}{comments} = 1;
+ $pagestate{$page}{PLUGIN()}{comments} = defined $params{closed}
+ ? (not IkiWiki::yesno($params{closed}))
+ : 1;
$pagestate{$page}{PLUGIN()}{allowhtml} = IkiWiki::yesno($params{allowhtml});
$pagestate{$page}{PLUGIN()}{allowdirectives} = IkiWiki::yesno($params{allowdirectives});
$pagestate{$page}{PLUGIN()}{commit} = defined $params{commit}
@@ -60,7 +62,11 @@ sub preprocess (@) { #{{{
$formtemplate->param(cgiurl => $config{cgiurl});
$formtemplate->param(page => $params{page});
- if ($params{preview}) {
+ if (not $pagestate{$page}{PLUGIN()}{comments}) {
+ $formtemplate->param("disabled" =>
+ gettext('comments are closed'));
+ }
+ elsif ($params{preview}) {
$formtemplate->param("disabled" =>
gettext('not available during Preview'));
}