Added the notification of changes for the documentation pages.

dev
Loic d'Anterroches 2009-01-28 14:59:51 +01:00
parent ee5044fb1c
commit be7cbabe8d
4 changed files with 75 additions and 0 deletions

View File

@ -199,6 +199,25 @@ Add your content here. Format your content with:
$rev->submitter = $this->user;
$rev->summary = __('Initial page creation');
$rev->create();
// send the notification
if ('' != $this->project->getConf()->getVal('wiki_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'page' => $page,
'rev' => $rev,
'project' => $this->project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/wiki/wiki-created-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$this->project->getConf()->getVal('wiki_notification_email'),
sprintf(__('New Documentation Page %s - %s (%s)'),
$page->title, $page->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
return $page;
}
}

View File

@ -236,6 +236,25 @@ class IDF_Form_WikiUpdate extends Pluf_Form
$rev->summary = $this->cleaned_data['comment'];
$rev->changes = $changes;
$rev->create();
// send the notification
if ('' != $this->project->getConf()->getVal('wiki_notification_email', '')) {
$context = new Pluf_Template_Context(
array(
'page' => $this->page,
'rev' => $rev,
'project' => $this->project,
'url_base' => Pluf::f('url_base'),
)
);
$tmpl = new Pluf_Template('idf/wiki/wiki-updated-email.txt');
$text_email = $tmpl->render($context);
$email = new Pluf_Mail(Pluf::f('from_email'),
$this->project->getConf()->getVal('wiki_notification_email'),
sprintf(__('Documentation Page Changed %s - %s (%s)'),
$this->page->title, $this->page->summary, $this->project->shortname));
$email->addTextMessage($text_email);
$email->sendMail();
}
return $this->page;
}
}

View File

@ -0,0 +1,16 @@
{trans 'Hello,'}
{blocktrans}A new documentation page has been created:{/blocktrans}
{$page.title|safe} - {$page.summary|safe}
{trans 'Project:'} {$project.name|safe}
{trans 'Created by:'} {$rev.get_submitter|safe}
{assign $tags = $page.get_tags_list()}{if $tags.count()}{trans 'Labels:'}
{foreach $tags as $tag} {$tag.class|safe}:{$tag.name|safe}
{/foreach}{/if}
{trans 'Content:'}
{$rev.content}
--
{trans 'Documentation page:'} {$url_base}{url 'IDF_Views_Wiki::view', array($project.shortname, $page.title)}

View File

@ -0,0 +1,21 @@
{trans 'Hello,'}
{blocktrans}The following documentation page has been updated:{/blocktrans}
{$page.title|safe} - {$page.summary|safe}
{trans 'Project:'} {$project.name|safe}
{trans 'Summary:'} {$rev.summary|safe}
{trans 'Updated by:'} {$page.get_submitter|safe}
{trans 'Created by:'} {$rev.get_submitter|safe}
{assign $tags = $page.get_tags_list()}{if $tags.count()}{trans 'Labels:'}
{foreach $tags as $tag} {$tag.class|safe}:{$tag.name|safe}
{/foreach}{/if}{if $rev.changedRevision()}{trans 'Changes:'}
{foreach $rev.changes as $w => $v}
{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if} {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}{/foreach}{/if}
{trans 'New content:'}
{$rev.content}
--
{trans 'Documentation page:'} {$url_base}{url 'IDF_Views_Wiki::view', array($project.shortname, $page.title)}