diff options
author | Joey Hess <joey@kitenet.net> | 2012-04-13 14:28:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-04-13 14:28:02 -0400 |
commit | e81e857ba62970caefd0f674d2cdfc3f9b70fe09 (patch) | |
tree | e5b960f9c3f1fd45fd2022679be5fb94b9882ebe | |
parent | 5c4d05925165e1ce1450c70b0b43282708ca7077 (diff) | |
download | ikiwiki-e81e857ba62970caefd0f674d2cdfc3f9b70fe09.tar ikiwiki-e81e857ba62970caefd0f674d2cdfc3f9b70fe09.tar.gz |
add comment subscription checkbox to editpage
Reworded template, which also called the commit message a "comment".
-rw-r--r-- | IkiWiki/Plugin/editpage.pm | 20 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/plugins/notifyemail.mdwn | 4 | ||||
-rw-r--r-- | templates/editpage.tmpl | 5 |
4 files changed, 26 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index d3c695935..d15607990 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -64,7 +64,8 @@ sub cgi_editpage ($$) { decode_cgi_utf8($q); - my @fields=qw(do rcsinfo subpage from page type editcontent editmessage); + my @fields=qw(do rcsinfo subpage from page type editcontent + editmessage subscribe); my @buttons=("Save Page", "Preview", "Cancel"); eval q{use CGI::FormBuilder}; error($@) if $@; @@ -157,6 +158,17 @@ sub cgi_editpage ($$) { noimageinline => 1, linktext => "FormattingHelp")); + my $cansubscribe=IkiWiki::Plugin::notifyemail->can("subscribe") + && IkiWiki::Plugin::comments->can("import") + && defined $session->param('name'); + if ($cansubscribe) { + $form->field(name => "subscribe", type => "checkbox", + options => [gettext("email comments to me")]); + } + else { + $form->field(name => "subscribe", type => 'hidden'); + } + my $previewing=0; if ($form->submitted eq "Cancel") { if ($form->field("do") eq "create" && defined $from) { @@ -448,6 +460,12 @@ sub cgi_editpage ($$) { # caches and get the most recent version of the page. redirect($q, $baseurl."?updated"); } + + if ($cansubscribe && length $form->field("subscribe")) { + my $subspec="comment($page)"; + IkiWiki::Plugin::notifyemail::subscribe( + $session->param('name'), $subspec); + } } exit; diff --git a/debian/changelog b/debian/changelog index 5f9472365..b994fb55e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ ikiwiki (3.20120204) UNRELEASED; urgency=low * meta: Export author information in html <meta> tag. Closes: #664779 Thanks, Martin Michlmayr * notifyemail: New plugin, sends email notifications about new and - changed pages. + changed pages, and allows subscribing to comments. * Added a "changes" hook. Renamed the "change" hook to "rendered", but the old hook name is called for now for back-compat. * meta: Support keywords header. Closes: #664780 diff --git a/doc/plugins/notifyemail.mdwn b/doc/plugins/notifyemail.mdwn index 299cab8b1..302979e6e 100644 --- a/doc/plugins/notifyemail.mdwn +++ b/doc/plugins/notifyemail.mdwn @@ -10,5 +10,5 @@ matching the PageSpec will send an email that includes the new content of the page, and a link to the page on the web. To make it easy to subscribe to comment threads when posting a comment, -there is a check box that can be used to subscribe, without needing to -manually edit the [[ikiwiki/PageSpec]]. +or a page, there is a check box that can be used to subscribe, without +needing to manually edit the [[ikiwiki/PageSpec]]. diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl index 696c8dcad..4736c95d0 100644 --- a/templates/editpage.tmpl +++ b/templates/editpage.tmpl @@ -18,13 +18,16 @@ <TMPL_VAR FIELD-EDITCONTENT><br /> </div> <TMPL_IF NAME="CAN_COMMIT"> -<label for="editmessage" class="block">Optional comment about this change:</label> +<label for="editmessage" class="block">Optional description of this change:</label> <TMPL_VAR FIELD-EDITMESSAGE><br /> </TMPL_IF> <TMPL_VAR FORM-SUBMIT> <TMPL_VAR HELPONFORMATTINGLINK> <TMPL_IF NAME="FIELD-ATTACHMENT"> <a class="toggle" href="#attachments">Attachments</a> +</TMPL_IF> +<TMPL_VAR FIELD-SUBSCRIBE> +<TMPL_IF NAME="FIELD-ATTACHMENT"> <div class="<TMPL_VAR ATTACHMENTS-CLASS>" id="attachments"> <div id="fileupload"> <script> |