Project owners can now enter multiple email addresses for each notification type.
Each email must be separated by a comma from the other. (Based on a patch from Pierre Marechal, fixes issue 372).
This commit is contained in:
parent
784c9718eb
commit
51c42a65c5
@ -44,9 +44,9 @@ class IDF_Commit extends Pluf_Model
|
|||||||
'id' =>
|
'id' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Sequence',
|
'type' => 'Pluf_DB_Field_Sequence',
|
||||||
'blank' => true,
|
'blank' => true,
|
||||||
),
|
),
|
||||||
'project' =>
|
'project' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'IDF_Project',
|
'model' => 'IDF_Project',
|
||||||
@ -54,7 +54,7 @@ class IDF_Commit extends Pluf_Model
|
|||||||
'verbose' => __('project'),
|
'verbose' => __('project'),
|
||||||
'relate_name' => 'commits',
|
'relate_name' => 'commits',
|
||||||
),
|
),
|
||||||
'author' =>
|
'author' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'Pluf_User',
|
'model' => 'Pluf_User',
|
||||||
@ -118,7 +118,7 @@ class IDF_Commit extends Pluf_Model
|
|||||||
{
|
{
|
||||||
IDF_Search::index($this);
|
IDF_Search::index($this);
|
||||||
if ($create) {
|
if ($create) {
|
||||||
IDF_Timeline::insert($this, $this->get_project(),
|
IDF_Timeline::insert($this, $this->get_project(),
|
||||||
$this->get_author(), $this->creation_dtime);
|
$this->get_author(), $this->creation_dtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,13 +200,13 @@ class IDF_Commit extends Pluf_Model
|
|||||||
* Returns the timeline fragment for the commit.
|
* Returns the timeline fragment for the commit.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param Pluf_HTTP_Request
|
* @param Pluf_HTTP_Request
|
||||||
* @return Pluf_Template_SafeString
|
* @return Pluf_Template_SafeString
|
||||||
*/
|
*/
|
||||||
public function timelineFragment($request)
|
public function timelineFragment($request)
|
||||||
{
|
{
|
||||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit',
|
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$this->scm_id));
|
$this->scm_id));
|
||||||
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
||||||
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
||||||
@ -222,24 +222,24 @@ class IDF_Commit extends Pluf_Model
|
|||||||
</tr>
|
</tr>
|
||||||
<tr class="extra">
|
<tr class="extra">
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="helptext right">'.sprintf(__('Commit %s, by %s'), '<a href="'.$url.'" class="mono">'.$this->scm_id.'</a>', $user).'</div></td></tr>';
|
<div class="helptext right">'.sprintf(__('Commit %s, by %s'), '<a href="'.$url.'" class="mono">'.$this->scm_id.'</a>', $user).'</div></td></tr>';
|
||||||
return Pluf_Template::markSafe($out);
|
return Pluf_Template::markSafe($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the feed fragment for the commit.
|
* Returns the feed fragment for the commit.
|
||||||
*
|
*
|
||||||
* @param Pluf_HTTP_Request
|
* @param Pluf_HTTP_Request
|
||||||
* @return Pluf_Template_SafeString
|
* @return Pluf_Template_SafeString
|
||||||
*/
|
*/
|
||||||
public function feedFragment($request)
|
public function feedFragment($request)
|
||||||
{
|
{
|
||||||
$url = Pluf::f('url_base')
|
$url = Pluf::f('url_base')
|
||||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit',
|
.Pluf_HTTP_URL_urlForView('IDF_Views_Source::commit',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$this->scm_id));
|
$this->scm_id));
|
||||||
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
|
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
|
||||||
$author = ($this->get_author()) ?
|
$author = ($this->get_author()) ?
|
||||||
$this->get_author() : $this->origauthor;
|
$this->get_author() : $this->origauthor;
|
||||||
$cproject = $this->get_project();
|
$cproject = $this->get_project();
|
||||||
$context = new Pluf_Template_Context_Request(
|
$context = new Pluf_Template_Context_Request(
|
||||||
@ -298,7 +298,7 @@ class IDF_Commit extends Pluf_Model
|
|||||||
|
|
||||||
$current_locale = Pluf_Translation::getLocale();
|
$current_locale = Pluf_Translation::getLocale();
|
||||||
$langs = Pluf::f('languages', array('en'));
|
$langs = Pluf::f('languages', array('en'));
|
||||||
Pluf_Translation::loadSetLocale($langs[0]);
|
Pluf_Translation::loadSetLocale($langs[0]);
|
||||||
|
|
||||||
$context = new Pluf_Template_Context(
|
$context = new Pluf_Template_Context(
|
||||||
array(
|
array(
|
||||||
@ -309,13 +309,16 @@ class IDF_Commit extends Pluf_Model
|
|||||||
);
|
);
|
||||||
$tmpl = new Pluf_Template('idf/source/commit-created-email.txt');
|
$tmpl = new Pluf_Template('idf/source/commit-created-email.txt');
|
||||||
$text_email = $tmpl->render($context);
|
$text_email = $tmpl->render($context);
|
||||||
$email = new Pluf_Mail(Pluf::f('from_email'),
|
$addresses = explode(',', $conf->getVal('source_notification_email'));
|
||||||
$conf->getVal('source_notification_email'),
|
foreach ($addresses as $address) {
|
||||||
sprintf(__('New Commit %s - %s (%s)'),
|
$email = new Pluf_Mail(Pluf::f('from_email'),
|
||||||
$this->scm_id, $this->summary,
|
$address,
|
||||||
$this->get_project()->shortname));
|
sprintf(__('New Commit %s - %s (%s)'),
|
||||||
$email->addTextMessage($text_email);
|
$this->scm_id, $this->summary,
|
||||||
$email->sendMail();
|
$this->get_project()->shortname));
|
||||||
|
$email->addTextMessage($text_email);
|
||||||
|
$email->sendMail();
|
||||||
|
}
|
||||||
Pluf_Translation::loadSetLocale($current_locale);
|
Pluf_Translation::loadSetLocale($current_locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
51
src/IDF/Form/Field/EmailList.php
Normal file
51
src/IDF/Form/Field/EmailList.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
# This file is part of InDefero, an open source project management application.
|
||||||
|
# Copyright (C) 2010 Céondo Ltd and contributors.
|
||||||
|
#
|
||||||
|
# Plume Framework is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Plume Framework is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Similar to Pluf_Form_Field_Email, this form field validates one or more
|
||||||
|
* email addresses separated by a comma
|
||||||
|
*/
|
||||||
|
class IDF_Form_Field_EmailList extends Pluf_Form_Field
|
||||||
|
{
|
||||||
|
public $widget = 'Pluf_Form_Widget_TextInput';
|
||||||
|
|
||||||
|
public function clean($value)
|
||||||
|
{
|
||||||
|
parent::clean($value);
|
||||||
|
if (in_array($value, $this->empty_values)) {
|
||||||
|
$value = '';
|
||||||
|
}
|
||||||
|
if ($value == '') {
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
$emails = preg_split('/\s*,\s*/', $value, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
foreach ($emails as $email) {
|
||||||
|
if (!Pluf_Utils::isValidEmail($email)) {
|
||||||
|
throw new Pluf_Form_Invalid(__(
|
||||||
|
'Please enter one or more valid email addresses.'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return implode(',', $emails);
|
||||||
|
}
|
||||||
|
}
|
@ -45,7 +45,7 @@ class IDF_Form_TabsConf extends Pluf_Form
|
|||||||
array('required' => true,
|
array('required' => true,
|
||||||
'label' => $label,
|
'label' => $label,
|
||||||
'initial' => $this->conf->getVal($key, 'all'),
|
'initial' => $this->conf->getVal($key, 'all'),
|
||||||
'widget_attrs' => array('choices' =>
|
'widget_attrs' => array('choices' =>
|
||||||
array(
|
array(
|
||||||
__('Open to all') => 'all',
|
__('Open to all') => 'all',
|
||||||
__('Signed in users') => 'login',
|
__('Signed in users') => 'login',
|
||||||
@ -63,10 +63,11 @@ class IDF_Form_TabsConf extends Pluf_Form
|
|||||||
'source_notification_email',
|
'source_notification_email',
|
||||||
'issues_notification_email',);
|
'issues_notification_email',);
|
||||||
foreach ($ak as $key) {
|
foreach ($ak as $key) {
|
||||||
$this->fields[$key] = new Pluf_Form_Field_Email(
|
$this->fields[$key] = new IDF_Form_Field_EmailList(
|
||||||
array('required' => false,
|
array('required' => false,
|
||||||
'label' => $key,
|
'label' => $key,
|
||||||
'initial' => $this->conf->getVal($key, ''),
|
'initial' => $this->conf->getVal($key, ''),
|
||||||
|
'widget_attrs' => array('size' => 40),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@ class IDF_Issue extends Pluf_Model
|
|||||||
'id' =>
|
'id' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Sequence',
|
'type' => 'Pluf_DB_Field_Sequence',
|
||||||
'blank' => true,
|
'blank' => true,
|
||||||
),
|
),
|
||||||
'project' =>
|
'project' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'IDF_Project',
|
'model' => 'IDF_Project',
|
||||||
@ -59,7 +59,7 @@ class IDF_Issue extends Pluf_Model
|
|||||||
'size' => 250,
|
'size' => 250,
|
||||||
'verbose' => __('summary'),
|
'verbose' => __('summary'),
|
||||||
),
|
),
|
||||||
'submitter' =>
|
'submitter' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'Pluf_User',
|
'model' => 'Pluf_User',
|
||||||
@ -67,7 +67,7 @@ class IDF_Issue extends Pluf_Model
|
|||||||
'verbose' => __('submitter'),
|
'verbose' => __('submitter'),
|
||||||
'relate_name' => 'submitted_issue',
|
'relate_name' => 'submitted_issue',
|
||||||
),
|
),
|
||||||
'owner' =>
|
'owner' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'Pluf_User',
|
'model' => 'Pluf_User',
|
||||||
@ -76,7 +76,7 @@ class IDF_Issue extends Pluf_Model
|
|||||||
'verbose' => __('owner'),
|
'verbose' => __('owner'),
|
||||||
'relate_name' => 'owned_issue',
|
'relate_name' => 'owned_issue',
|
||||||
),
|
),
|
||||||
'interested' =>
|
'interested' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Manytomany',
|
'type' => 'Pluf_DB_Field_Manytomany',
|
||||||
'model' => 'Pluf_User',
|
'model' => 'Pluf_User',
|
||||||
@ -86,14 +86,14 @@ class IDF_Issue extends Pluf_Model
|
|||||||
),
|
),
|
||||||
'tags' =>
|
'tags' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Manytomany',
|
'type' => 'Pluf_DB_Field_Manytomany',
|
||||||
'blank' => true,
|
'blank' => true,
|
||||||
'model' => 'IDF_Tag',
|
'model' => 'IDF_Tag',
|
||||||
'verbose' => __('labels'),
|
'verbose' => __('labels'),
|
||||||
),
|
),
|
||||||
'status' =>
|
'status' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'blank' => false,
|
'blank' => false,
|
||||||
'model' => 'IDF_Tag',
|
'model' => 'IDF_Tag',
|
||||||
'verbose' => __('status'),
|
'verbose' => __('status'),
|
||||||
@ -111,7 +111,7 @@ class IDF_Issue extends Pluf_Model
|
|||||||
'verbose' => __('modification date'),
|
'verbose' => __('modification date'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$this->_a['idx'] = array(
|
$this->_a['idx'] = array(
|
||||||
'modif_dtime_idx' =>
|
'modif_dtime_idx' =>
|
||||||
array(
|
array(
|
||||||
'col' => 'modif_dtime',
|
'col' => 'modif_dtime',
|
||||||
@ -120,7 +120,7 @@ class IDF_Issue extends Pluf_Model
|
|||||||
);
|
);
|
||||||
$table = $this->_con->pfx.'idf_issue_idf_tag_assoc';
|
$table = $this->_con->pfx.'idf_issue_idf_tag_assoc';
|
||||||
$this->_a['views'] = array(
|
$this->_a['views'] = array(
|
||||||
'join_tags' =>
|
'join_tags' =>
|
||||||
array(
|
array(
|
||||||
'join' => 'LEFT JOIN '.$table
|
'join' => 'LEFT JOIN '.$table
|
||||||
.' ON idf_issue_id=id',
|
.' ON idf_issue_id=id',
|
||||||
@ -164,7 +164,7 @@ class IDF_Issue extends Pluf_Model
|
|||||||
// that the issue as at least one comment in the database when
|
// that the issue as at least one comment in the database when
|
||||||
// doing the indexing.
|
// doing the indexing.
|
||||||
if ($create) {
|
if ($create) {
|
||||||
IDF_Timeline::insert($this, $this->get_project(),
|
IDF_Timeline::insert($this, $this->get_project(),
|
||||||
$this->get_submitter());
|
$this->get_submitter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,12 +177,12 @@ class IDF_Issue extends Pluf_Model
|
|||||||
* as such create links to other items etc. You can consider that
|
* as such create links to other items etc. You can consider that
|
||||||
* if displayed, you can create a link to it.
|
* if displayed, you can create a link to it.
|
||||||
*
|
*
|
||||||
* @param Pluf_HTTP_Request
|
* @param Pluf_HTTP_Request
|
||||||
* @return Pluf_Template_SafeString
|
* @return Pluf_Template_SafeString
|
||||||
*/
|
*/
|
||||||
public function timelineFragment($request)
|
public function timelineFragment($request)
|
||||||
{
|
{
|
||||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$this->id));
|
$this->id));
|
||||||
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
||||||
@ -193,14 +193,14 @@ class IDF_Issue extends Pluf_Model
|
|||||||
$ic = (in_array($this->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
|
$ic = (in_array($this->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
|
||||||
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a>, %4$s'), $url, $ic, $this->id, Pluf_esc($this->summary)).'</td>';
|
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a>, %4$s'), $url, $ic, $this->id, Pluf_esc($this->summary)).'</td>';
|
||||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%s" class="%s">issue %d</a>, by %s'), $url, $ic, $this->id, $user).'</div></td></tr>';
|
<div class="helptext right">'.sprintf(__('Creation of <a href="%s" class="%s">issue %d</a>, by %s'), $url, $ic, $this->id, $user).'</div></td></tr>';
|
||||||
return Pluf_Template::markSafe($out);
|
return Pluf_Template::markSafe($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function feedFragment($request)
|
public function feedFragment($request)
|
||||||
{
|
{
|
||||||
$url = Pluf::f('url_base')
|
$url = Pluf::f('url_base')
|
||||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
.Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$this->id));
|
$this->id));
|
||||||
$title = sprintf(__('%s: Issue %d created - %s'),
|
$title = sprintf(__('%s: Issue %d created - %s'),
|
||||||
@ -241,15 +241,17 @@ class IDF_Issue extends Pluf_Model
|
|||||||
$prj = $this->get_project();
|
$prj = $this->get_project();
|
||||||
$to_email = array();
|
$to_email = array();
|
||||||
if ('' != $conf->getVal('issues_notification_email', '')) {
|
if ('' != $conf->getVal('issues_notification_email', '')) {
|
||||||
$langs = Pluf::f('languages', array('en'));
|
$langs = Pluf::f('languages', array('en'));
|
||||||
$to_email[] = array($conf->getVal('issues_notification_email'),
|
$addresses = explode(',', $conf->getVal('issues_notification_email'));
|
||||||
$langs[0]);
|
foreach ($addresses as $address) {
|
||||||
|
$to_email[] = array($address, $langs[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$current_locale = Pluf_Translation::getLocale();
|
$current_locale = Pluf_Translation::getLocale();
|
||||||
$id = '<'.md5($this->id.md5(Pluf::f('secret_key'))).'@'.Pluf::f('mail_host', 'localhost').'>';
|
$id = '<'.md5($this->id.md5(Pluf::f('secret_key'))).'@'.Pluf::f('mail_host', 'localhost').'>';
|
||||||
if ($create) {
|
if ($create) {
|
||||||
if (null != $this->get_owner() and $this->owner != $this->submitter) {
|
if (null != $this->get_owner() and $this->owner != $this->submitter) {
|
||||||
$email_lang = array($this->get_owner()->email,
|
$email_lang = array($this->get_owner()->email,
|
||||||
$this->get_owner()->language);
|
$this->get_owner()->language);
|
||||||
if (!in_array($email_lang, $to_email)) {
|
if (!in_array($email_lang, $to_email)) {
|
||||||
$to_email[] = $email_lang;
|
$to_email[] = $email_lang;
|
||||||
|
@ -197,14 +197,17 @@ class IDF_Review_Patch extends Pluf_Model
|
|||||||
);
|
);
|
||||||
$tmpl = new Pluf_Template('idf/review/review-created-email.txt');
|
$tmpl = new Pluf_Template('idf/review/review-created-email.txt');
|
||||||
$text_email = $tmpl->render($context);
|
$text_email = $tmpl->render($context);
|
||||||
$email = new Pluf_Mail(Pluf::f('from_email'),
|
$addresses = explode(';',$conf->getVal('review_notification_email'));
|
||||||
$conf->getVal('review_notification_email'),
|
foreach ($addresses as $address) {
|
||||||
sprintf(__('New Code Review %s - %s (%s)'),
|
$email = new Pluf_Mail(Pluf::f('from_email'),
|
||||||
$this->get_review()->id,
|
$address,
|
||||||
$this->get_review()->summary,
|
sprintf(__('New Code Review %s - %s (%s)'),
|
||||||
$this->get_review()->get_project()->shortname));
|
$this->get_review()->id,
|
||||||
$email->addTextMessage($text_email);
|
$this->get_review()->summary,
|
||||||
$email->sendMail();
|
$this->get_review()->get_project()->shortname));
|
||||||
|
$email->addTextMessage($text_email);
|
||||||
|
$email->sendMail();
|
||||||
|
}
|
||||||
Pluf_Translation::loadSetLocale($current_locale);
|
Pluf_Translation::loadSetLocale($current_locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ class IDF_Upload extends Pluf_Model
|
|||||||
'id' =>
|
'id' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Sequence',
|
'type' => 'Pluf_DB_Field_Sequence',
|
||||||
'blank' => true,
|
'blank' => true,
|
||||||
),
|
),
|
||||||
'project' =>
|
'project' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'IDF_Project',
|
'model' => 'IDF_Project',
|
||||||
@ -77,7 +77,7 @@ class IDF_Upload extends Pluf_Model
|
|||||||
'default' => 0,
|
'default' => 0,
|
||||||
'verbose' => __('file size in bytes'),
|
'verbose' => __('file size in bytes'),
|
||||||
),
|
),
|
||||||
'submitter' =>
|
'submitter' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'Pluf_User',
|
'model' => 'Pluf_User',
|
||||||
@ -87,7 +87,7 @@ class IDF_Upload extends Pluf_Model
|
|||||||
),
|
),
|
||||||
'tags' =>
|
'tags' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Manytomany',
|
'type' => 'Pluf_DB_Field_Manytomany',
|
||||||
'blank' => true,
|
'blank' => true,
|
||||||
'model' => 'IDF_Tag',
|
'model' => 'IDF_Tag',
|
||||||
'verbose' => __('labels'),
|
'verbose' => __('labels'),
|
||||||
@ -112,7 +112,7 @@ class IDF_Upload extends Pluf_Model
|
|||||||
'verbose' => __('modification date'),
|
'verbose' => __('modification date'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$this->_a['idx'] = array(
|
$this->_a['idx'] = array(
|
||||||
'modif_dtime_idx' =>
|
'modif_dtime_idx' =>
|
||||||
array(
|
array(
|
||||||
'col' => 'modif_dtime',
|
'col' => 'modif_dtime',
|
||||||
@ -121,7 +121,7 @@ class IDF_Upload extends Pluf_Model
|
|||||||
);
|
);
|
||||||
$table = $this->_con->pfx.'idf_tag_idf_upload_assoc';
|
$table = $this->_con->pfx.'idf_tag_idf_upload_assoc';
|
||||||
$this->_a['views'] = array(
|
$this->_a['views'] = array(
|
||||||
'join_tags' =>
|
'join_tags' =>
|
||||||
array(
|
array(
|
||||||
'join' => 'LEFT JOIN '.$table
|
'join' => 'LEFT JOIN '.$table
|
||||||
.' ON idf_upload_id=id',
|
.' ON idf_upload_id=id',
|
||||||
@ -150,7 +150,7 @@ class IDF_Upload extends Pluf_Model
|
|||||||
function postSave($create=false)
|
function postSave($create=false)
|
||||||
{
|
{
|
||||||
if ($create) {
|
if ($create) {
|
||||||
IDF_Timeline::insert($this, $this->get_project(),
|
IDF_Timeline::insert($this, $this->get_project(),
|
||||||
$this->get_submitter(), $this->creation_dtime);
|
$this->get_submitter(), $this->creation_dtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,13 +173,13 @@ class IDF_Upload extends Pluf_Model
|
|||||||
* Returns the timeline fragment for the file.
|
* Returns the timeline fragment for the file.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @param Pluf_HTTP_Request
|
* @param Pluf_HTTP_Request
|
||||||
* @return Pluf_Template_SafeString
|
* @return Pluf_Template_SafeString
|
||||||
*/
|
*/
|
||||||
public function timelineFragment($request)
|
public function timelineFragment($request)
|
||||||
{
|
{
|
||||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$this->id));
|
$this->id));
|
||||||
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
$out = '<tr class="log"><td><a href="'.$url.'">'.
|
||||||
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
Pluf_esc(Pluf_Template_dateAgo($this->creation_dtime, 'without')).
|
||||||
@ -189,15 +189,15 @@ class IDF_Upload extends Pluf_Model
|
|||||||
$out .= sprintf(__('<a href="%1$s" title="View download">Download %2$d</a>, %3$s'), $url, $this->id, Pluf_esc($this->summary)).'</td>';
|
$out .= sprintf(__('<a href="%1$s" title="View download">Download %2$d</a>, %3$s'), $url, $this->id, Pluf_esc($this->summary)).'</td>';
|
||||||
$out .= '</tr>';
|
$out .= '</tr>';
|
||||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||||
<div class="helptext right">'.sprintf(__('Addition of <a href="%s">download %d</a>, by %s'), $url, $this->id, $user).'</div></td></tr>';
|
<div class="helptext right">'.sprintf(__('Addition of <a href="%s">download %d</a>, by %s'), $url, $this->id, $user).'</div></td></tr>';
|
||||||
return Pluf_Template::markSafe($out);
|
return Pluf_Template::markSafe($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function feedFragment($request)
|
public function feedFragment($request)
|
||||||
{
|
{
|
||||||
$url = Pluf::f('url_base')
|
$url = Pluf::f('url_base')
|
||||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
.Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$this->id));
|
$this->id));
|
||||||
$title = sprintf(__('%s: Download %d added - %s'),
|
$title = sprintf(__('%s: Download %d added - %s'),
|
||||||
$request->project->name,
|
$request->project->name,
|
||||||
@ -227,7 +227,7 @@ class IDF_Upload extends Pluf_Model
|
|||||||
}
|
}
|
||||||
$current_locale = Pluf_Translation::getLocale();
|
$current_locale = Pluf_Translation::getLocale();
|
||||||
$langs = Pluf::f('languages', array('en'));
|
$langs = Pluf::f('languages', array('en'));
|
||||||
Pluf_Translation::loadSetLocale($langs[0]);
|
Pluf_Translation::loadSetLocale($langs[0]);
|
||||||
|
|
||||||
$context = new Pluf_Template_Context(
|
$context = new Pluf_Template_Context(
|
||||||
array('file' => $this,
|
array('file' => $this,
|
||||||
@ -237,14 +237,16 @@ class IDF_Upload extends Pluf_Model
|
|||||||
));
|
));
|
||||||
$tmpl = new Pluf_Template('idf/downloads/download-created-email.txt');
|
$tmpl = new Pluf_Template('idf/downloads/download-created-email.txt');
|
||||||
$text_email = $tmpl->render($context);
|
$text_email = $tmpl->render($context);
|
||||||
$email = new Pluf_Mail(Pluf::f('from_email'),
|
$addresses = explode(',', $conf->getVal('downloads_notification_email'));
|
||||||
$conf->getVal('downloads_notification_email'),
|
foreach ($addresses as $address) {
|
||||||
sprintf(__('New download - %s (%s)'),
|
$email = new Pluf_Mail(Pluf::f('from_email'),
|
||||||
$this->summary,
|
$address,
|
||||||
$this->get_project()->shortname));
|
sprintf(__('New download - %s (%s)'),
|
||||||
$email->addTextMessage($text_email);
|
$this->summary,
|
||||||
$email->sendMail();
|
$this->get_project()->shortname));
|
||||||
|
$email->addTextMessage($text_email);
|
||||||
|
$email->sendMail();
|
||||||
|
}
|
||||||
Pluf_Translation::loadSetLocale($current_locale);
|
Pluf_Translation::loadSetLocale($current_locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -38,9 +38,9 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
'id' =>
|
'id' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Sequence',
|
'type' => 'Pluf_DB_Field_Sequence',
|
||||||
'blank' => true,
|
'blank' => true,
|
||||||
),
|
),
|
||||||
'wikipage' =>
|
'wikipage' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'IDF_WikiPage',
|
'model' => 'IDF_WikiPage',
|
||||||
@ -55,7 +55,7 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
'default' => false,
|
'default' => false,
|
||||||
'help_text' => 'If this revision is the latest, we mark it as being the head revision.',
|
'help_text' => 'If this revision is the latest, we mark it as being the head revision.',
|
||||||
'index' => true,
|
'index' => true,
|
||||||
|
|
||||||
),
|
),
|
||||||
'summary' =>
|
'summary' =>
|
||||||
array(
|
array(
|
||||||
@ -71,7 +71,7 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
'blank' => false,
|
'blank' => false,
|
||||||
'verbose' => __('content'),
|
'verbose' => __('content'),
|
||||||
),
|
),
|
||||||
'submitter' =>
|
'submitter' =>
|
||||||
array(
|
array(
|
||||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||||
'model' => 'Pluf_User',
|
'model' => 'Pluf_User',
|
||||||
@ -92,7 +92,7 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
'verbose' => __('creation date'),
|
'verbose' => __('creation date'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
$this->_a['idx'] = array(
|
$this->_a['idx'] = array(
|
||||||
'creation_dtime_idx' =>
|
'creation_dtime_idx' =>
|
||||||
array(
|
array(
|
||||||
'col' => 'creation_dtime',
|
'col' => 'creation_dtime',
|
||||||
@ -138,7 +138,7 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
$sql = new Pluf_SQL('wikipage=%s', array($this->wikipage));
|
$sql = new Pluf_SQL('wikipage=%s', array($this->wikipage));
|
||||||
$rev = Pluf::factory('IDF_WikiRevision')->getList(array('filter'=>$sql->gen()));
|
$rev = Pluf::factory('IDF_WikiRevision')->getList(array('filter'=>$sql->gen()));
|
||||||
if ($rev->count() > 1) {
|
if ($rev->count() > 1) {
|
||||||
IDF_Timeline::insert($this, $this->get_wikipage()->get_project(),
|
IDF_Timeline::insert($this, $this->get_wikipage()->get_project(),
|
||||||
$this->get_submitter());
|
$this->get_submitter());
|
||||||
foreach ($rev as $r) {
|
foreach ($rev as $r) {
|
||||||
if ($r->id != $this->id and $r->is_head) {
|
if ($r->id != $this->id and $r->is_head) {
|
||||||
@ -156,7 +156,7 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
public function timelineFragment($request)
|
public function timelineFragment($request)
|
||||||
{
|
{
|
||||||
$page = $this->get_wikipage();
|
$page = $this->get_wikipage();
|
||||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$page->title));
|
$page->title));
|
||||||
$out = "\n".'<tr class="log"><td><a href="'.$url.'">'.
|
$out = "\n".'<tr class="log"><td><a href="'.$url.'">'.
|
||||||
@ -186,7 +186,7 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
}
|
}
|
||||||
$out .= '</td></tr>';
|
$out .= '</td></tr>';
|
||||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||||
<div class="helptext right">'.sprintf(__('Change of <a href="%s">%s</a>, by %s'), $url, Pluf_esc($page->title), $user).'</div></td></tr>';
|
<div class="helptext right">'.sprintf(__('Change of <a href="%s">%s</a>, by %s'), $url, Pluf_esc($page->title), $user).'</div></td></tr>';
|
||||||
return Pluf_Template::markSafe($out);
|
return Pluf_Template::markSafe($out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,13 +195,13 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
$page = $this->get_wikipage();
|
$page = $this->get_wikipage();
|
||||||
if (!$this->is_head) {
|
if (!$this->is_head) {
|
||||||
$url = Pluf::f('url_base')
|
$url = Pluf::f('url_base')
|
||||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$page->title),
|
$page->title),
|
||||||
array('rev' => $this->id));
|
array('rev' => $this->id));
|
||||||
} else {
|
} else {
|
||||||
$url = Pluf::f('url_base')
|
$url = Pluf::f('url_base')
|
||||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
||||||
array($request->project->shortname,
|
array($request->project->shortname,
|
||||||
$page->title));
|
$page->title));
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
}
|
}
|
||||||
$current_locale = Pluf_Translation::getLocale();
|
$current_locale = Pluf_Translation::getLocale();
|
||||||
$langs = Pluf::f('languages', array('en'));
|
$langs = Pluf::f('languages', array('en'));
|
||||||
Pluf_Translation::loadSetLocale($langs[0]);
|
Pluf_Translation::loadSetLocale($langs[0]);
|
||||||
$context = new Pluf_Template_Context(
|
$context = new Pluf_Template_Context(
|
||||||
array(
|
array(
|
||||||
'page' => $this->get_wikipage(),
|
'page' => $this->get_wikipage(),
|
||||||
@ -260,23 +260,28 @@ class IDF_WikiRevision extends Pluf_Model
|
|||||||
if ($create) {
|
if ($create) {
|
||||||
$template = 'idf/wiki/wiki-created-email.txt';
|
$template = 'idf/wiki/wiki-created-email.txt';
|
||||||
$title = sprintf(__('New Documentation Page %s - %s (%s)'),
|
$title = sprintf(__('New Documentation Page %s - %s (%s)'),
|
||||||
$this->get_wikipage()->title,
|
$this->get_wikipage()->title,
|
||||||
$this->get_wikipage()->summary,
|
$this->get_wikipage()->summary,
|
||||||
$this->get_wikipage()->get_project()->shortname);
|
$this->get_wikipage()->get_project()->shortname);
|
||||||
} else {
|
} else {
|
||||||
$template = 'idf/wiki/wiki-updated-email.txt';
|
$template = 'idf/wiki/wiki-updated-email.txt';
|
||||||
$title = sprintf(__('Documentation Page Changed %s - %s (%s)'),
|
$title = sprintf(__('Documentation Page Changed %s - %s (%s)'),
|
||||||
$this->get_wikipage()->title,
|
$this->get_wikipage()->title,
|
||||||
$this->get_wikipage()->summary,
|
$this->get_wikipage()->summary,
|
||||||
$this->get_wikipage()->get_project()->shortname);
|
$this->get_wikipage()->get_project()->shortname);
|
||||||
}
|
}
|
||||||
$tmpl = new Pluf_Template($template);
|
$tmpl = new Pluf_Template($template);
|
||||||
$text_email = $tmpl->render($context);
|
$text_email = $tmpl->render($context);
|
||||||
$email = new Pluf_Mail(Pluf::f('from_email'),
|
|
||||||
$conf->getVal('wiki_notification_email'),
|
$addresses = explode(',', $conf->getVal('wiki_notification_email'));
|
||||||
$title);
|
foreach ($addresses as $address) {
|
||||||
$email->addTextMessage($text_email);
|
$email = new Pluf_Mail(Pluf::f('from_email'),
|
||||||
$email->sendMail();
|
$address,
|
||||||
|
$title);
|
||||||
|
$email->addTextMessage($text_email);
|
||||||
|
$email->sendMail();
|
||||||
|
}
|
||||||
|
|
||||||
Pluf_Translation::loadSetLocale($current_locale);
|
Pluf_Translation::loadSetLocale($current_locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
<td colspan="2" class="helptext">
|
<td colspan="2" class="helptext">
|
||||||
{blocktrans}
|
{blocktrans}
|
||||||
Only project members and admins have write access to the source.<br />
|
Only project members and admins have write access to the source.<br />
|
||||||
If you restrict the access to the source, anonymous access is<br />
|
If you restrict the access to the source, anonymous access is<br />
|
||||||
not provided and the users must authenticate themselves with their<br />
|
not provided and the users must authenticate themselves with their<br />
|
||||||
password or SSH key.{/blocktrans}
|
password or SSH key.{/blocktrans}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
@ -86,7 +86,7 @@ password or SSH key.{/blocktrans}
|
|||||||
<tr>
|
<tr>
|
||||||
<td> </td>
|
<td> </td>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<input type="submit" value="{trans 'Save Changes'}" name="submit" />
|
<input type="submit" value="{trans 'Save Changes'}" name="submit" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -96,7 +96,7 @@ password or SSH key.{/blocktrans}
|
|||||||
<div class="issue-submit-info">
|
<div class="issue-submit-info">
|
||||||
<p><strong>{trans 'Instructions:'}</strong></p>
|
<p><strong>{trans 'Instructions:'}</strong></p>
|
||||||
<p>{blocktrans}You can configure here the project tabs access rights and notification emails.{/blocktrans}</p>
|
<p>{blocktrans}You can configure here the project tabs access rights and notification emails.{/blocktrans}</p>
|
||||||
<p>{blocktrans}Notification emails will be sent from the <strong>{$from_email}</strong> address, if you send the email to a mailing list, you may need to register this email address. If you do not want to send emails for a given type of changes, simply leave the corresponding field empty.{/blocktrans}</p>
|
<p>{blocktrans}Notification emails will be sent from the <strong>{$from_email}</strong> address, if you send the email to a mailing list, you may need to register this email address. Multiple email addresses must be separated through commas (','). If you do not want to send emails for a given type of changes, simply leave the corresponding field empty.{/blocktrans}</p>
|
||||||
<p>{blocktrans}If you mark a project as private, only the project members and administrators, together with the extra authorized users you provide will have access to the project. You will still be able to define further access rights for the different tabs but the "Open to all" and "Signed in users" will default to authorized users only.{/blocktrans}</p>
|
<p>{blocktrans}If you mark a project as private, only the project members and administrators, together with the extra authorized users you provide will have access to the project. You will still be able to define further access rights for the different tabs but the "Open to all" and "Signed in users" will default to authorized users only.{/blocktrans}</p>
|
||||||
<p>{blocktrans}Specify each person by its login. Each person must have already registered with the given login. Separate the logins with commas and/or new lines.{/blocktrans}</p>
|
<p>{blocktrans}Specify each person by its login. Each person must have already registered with the given login. Separate the logins with commas and/or new lines.{/blocktrans}</p>
|
||||||
</div>
|
</div>
|
||||||
@ -111,7 +111,7 @@ $(document).ready(function(){
|
|||||||
$("#id_private_project").click(function(){
|
$("#id_private_project").click(function(){
|
||||||
if ($("#id_private_project").is(":checked")) {
|
if ($("#id_private_project").is(":checked")) {
|
||||||
$("#authorized-users-row").show();
|
$("#authorized-users-row").show();
|
||||||
} else {
|
} else {
|
||||||
$("#authorized-users-row").hide();
|
$("#authorized-users-row").hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user