integrate comments plugin with notifyemail
parent
e07b876486
commit
1916f97472
|
@ -301,7 +301,8 @@ sub editcomment ($$) {
|
||||||
|
|
||||||
my @buttons = (POST_COMMENT, PREVIEW, CANCEL);
|
my @buttons = (POST_COMMENT, PREVIEW, CANCEL);
|
||||||
my $form = CGI::FormBuilder->new(
|
my $form = CGI::FormBuilder->new(
|
||||||
fields => [qw{do sid page subject editcontent type author url}],
|
fields => [qw{do sid page subject editcontent type author
|
||||||
|
url subscribe}],
|
||||||
charset => 'utf-8',
|
charset => 'utf-8',
|
||||||
method => 'POST',
|
method => 'POST',
|
||||||
required => [qw{editcontent}],
|
required => [qw{editcontent}],
|
||||||
|
@ -346,7 +347,15 @@ sub editcomment ($$) {
|
||||||
$form->field(name => "type", value => $type, force => 1,
|
$form->field(name => "type", value => $type, force => 1,
|
||||||
type => 'select', options => \@page_types);
|
type => 'select', options => \@page_types);
|
||||||
|
|
||||||
$form->tmpl_param(username => $session->param('name'));
|
my $username=$session->param('name');
|
||||||
|
$form->tmpl_param(username => $username);
|
||||||
|
if (defined $username && IkiWiki::Plugin::notifyemail->can("subscribe")) {
|
||||||
|
$form->field(name => "subscribe",
|
||||||
|
options => [gettext("email replies to me")]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$form->field(name => "subscribe", type => 'hidden');
|
||||||
|
}
|
||||||
|
|
||||||
if ($config{comments_allowauthor} and
|
if ($config{comments_allowauthor} and
|
||||||
! defined $session->param('name')) {
|
! defined $session->param('name')) {
|
||||||
|
@ -490,6 +499,12 @@ sub editcomment ($$) {
|
||||||
|
|
||||||
if ($form->submitted eq POST_COMMENT && $form->validate) {
|
if ($form->submitted eq POST_COMMENT && $form->validate) {
|
||||||
IkiWiki::checksessionexpiry($cgi, $session);
|
IkiWiki::checksessionexpiry($cgi, $session);
|
||||||
|
|
||||||
|
if (defined $username && length $form->field("subscribe") &&
|
||||||
|
IkiWiki::Plugin::notifyemail->can("subscribe")) {
|
||||||
|
IkiWiki::Plugin::notifyemail::subscribe($username,
|
||||||
|
"comment($page)");
|
||||||
|
}
|
||||||
|
|
||||||
$postcomment=1;
|
$postcomment=1;
|
||||||
my $ok=IkiWiki::check_content(content => $form->field('editcontent'),
|
my $ok=IkiWiki::check_content(content => $form->field('editcontent'),
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
<TMPL_VAR FIELD-SUBJECT><br />
|
<TMPL_VAR FIELD-SUBJECT><br />
|
||||||
<label for="editcontent" class="block">Comment:</label>
|
<label for="editcontent" class="block">Comment:</label>
|
||||||
<TMPL_VAR FIELD-EDITCONTENT><br />
|
<TMPL_VAR FIELD-EDITCONTENT><br />
|
||||||
<TMPL_VAR FORM-SUBMIT> <TMPL_VAR FIELD-TYPE> <TMPL_VAR HELPONFORMATTINGLINK><br />
|
<TMPL_VAR FORM-SUBMIT> <TMPL_VAR FIELD-TYPE> <TMPL_VAR HELPONFORMATTINGLINK>
|
||||||
|
<TMPL_VAR FIELD-SUBSCRIBE><br />
|
||||||
<TMPL_VAR NAME="FORM-END">
|
<TMPL_VAR NAME="FORM-END">
|
||||||
<TMPL_VAR WMD_PREVIEW>
|
<TMPL_VAR WMD_PREVIEW>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue