Merge branch 'notifications'
This commit is contained in:
commit
2ec653ad43
@ -159,6 +159,22 @@ class IDF_Form_Upload extends Pluf_Form
|
|||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
$upload->setAssoc($tag);
|
$upload->setAssoc($tag);
|
||||||
}
|
}
|
||||||
|
// Send the notification
|
||||||
|
if ('' != $this->project->getConf()->getVal('downloads_notification_email', '')) {
|
||||||
|
$context = new Pluf_Template_Context(
|
||||||
|
array('file' => $upload,
|
||||||
|
'urlfile' => $upload->getAbsoluteUrl($this->project),
|
||||||
|
'project' => $this->project,
|
||||||
|
'tags' => $upload->get_tags_list(),
|
||||||
|
));
|
||||||
|
$tmpl = new Pluf_Template('idf/downloads/download-created-email.txt');
|
||||||
|
$text_email = $tmpl->render($context);
|
||||||
|
$email = new Pluf_Mail(Pluf::f('from_email'), $this->project->getConf()->getVal('downloads_notification_email'),
|
||||||
|
sprintf(__('New download - %s (%s)'),
|
||||||
|
$upload->summary, $this->project->shortname));
|
||||||
|
$email->addTextMessage($text_email);
|
||||||
|
$email->sendMail();
|
||||||
|
}
|
||||||
return $upload;
|
return $upload;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
src/IDF/templates/idf/downloads/download-created-email.txt
Normal file
12
src/IDF/templates/idf/downloads/download-created-email.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{trans 'Hello,'}
|
||||||
|
|
||||||
|
{blocktrans}A new file is available for download:{/blocktrans}
|
||||||
|
|
||||||
|
{$file.summary|safe}
|
||||||
|
{$file} - {$file.filesize|ssize}
|
||||||
|
{trans 'Project:'} {$project.name|safe}
|
||||||
|
{trans 'Submitted by:'} {$file.get_submitter|safe}
|
||||||
|
{if $tags.count()}{trans 'Labels:'}
|
||||||
|
{foreach $tags as $tag} {$tag.class|safe}:{$tag.name|safe}
|
||||||
|
{/foreach}{/if}
|
||||||
|
{trans 'Download:'} {$urlfile}
|
Loading…
Reference in New Issue
Block a user