From b7db3444a5d8e31bb1df60c3617f1038d93e099e Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 17 Nov 2008 10:42:01 +0000 Subject: [PATCH] smcvpostcomment: allow commenting to be closed --- IkiWiki/Plugin/smcvpostcomment.pm | 10 ++++++++-- 1 file 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')); } -- 2.39.5