diff --git a/NEWS.mdtext b/NEWS.mdtext
index fb43272..a558b7a 100644
--- a/NEWS.mdtext
+++ b/NEWS.mdtext
@@ -12,6 +12,8 @@ by the friendly folks from Scilab !
implementations of this web hook as this setting is likely to be removed
in future versions of Indefero.
- Indefero now needs PHP's zip module which is not enabled by default.
+- Existing email notifications now have to be explicitely activated in the
+ project's administrative area.
## New Features
diff --git a/src/IDF/Form/TabsConf.php b/src/IDF/Form/TabsConf.php
index 8ba3c2a..d41863b 100644
--- a/src/IDF/Form/TabsConf.php
+++ b/src/IDF/Form/TabsConf.php
@@ -57,20 +57,44 @@ class IDF_Form_TabsConf extends Pluf_Form
'widget' => 'Pluf_Form_Widget_SelectInput',
));
}
- $ak = array('downloads_notification_email',
- 'review_notification_email',
- 'wiki_notification_email',
- 'source_notification_email',
- 'issues_notification_email',);
- foreach ($ak as $key) {
- $this->fields[$key] = new IDF_Form_Field_EmailList(
- array('required' => false,
- 'label' => $key,
- 'initial' => $this->conf->getVal($key, ''),
- 'widget_attrs' => array('size' => 40),
- ));
- }
+ $sections = array(
+ 'downloads_notification',
+ 'review_notification',
+ 'wiki_notification',
+ 'source_notification',
+ 'issues_notification',
+ );
+
+ foreach ($sections as $section) {
+ $this->fields[$section.'_owners_enabled'] = new Pluf_Form_Field_Boolean(
+ array('required' => false,
+ 'label' => __('Project owners'),
+ 'initial' => $this->conf->getVal($section.'_owners_enabled', false),
+ 'widget' => 'Pluf_Form_Widget_CheckboxInput',
+ ));
+ $this->fields[$section.'_members_enabled'] = new Pluf_Form_Field_Boolean(
+ array('required' => false,
+ 'label' => __('Project members'),
+ 'initial' => $this->conf->getVal($section.'_members_enabled', false),
+ 'widget' => 'Pluf_Form_Widget_CheckboxInput',
+ ));
+ $this->fields[$section.'_email_enabled'] = new Pluf_Form_Field_Boolean(
+ array('required' => false,
+ 'label' => __('Others'),
+ 'initial' => $this->conf->getVal($section.'_email_enabled', false),
+ 'widget' => 'Pluf_Form_Widget_CheckboxInput',
+ ));
+ if ($this->conf->getVal($section.'_email_enabled', false)) {
+ $attrs['readonly'] = 'readonly';
+ }
+ $this->fields[$section.'_email'] = new IDF_Form_Field_EmailList(
+ array('required' => false,
+ 'label' => null,
+ 'initial' => $this->conf->getVal($section.'_email', ''),
+ 'widget_attrs' => array('size' => 20),
+ ));
+ }
$this->fields['private_project'] = new Pluf_Form_Field_Boolean(
array('required' => false,
diff --git a/src/IDF/Views/Project.php b/src/IDF/Views/Project.php
index 5ed03e2..1ea7718 100644
--- a/src/IDF/Views/Project.php
+++ b/src/IDF/Views/Project.php
@@ -508,21 +508,24 @@ class IDF_Views_Project
}
}
$form->save(); // Save the authorized users.
- $request->user->setMessage(__('The project tabs access rights have been saved.'));
+ $request->user->setMessage(__('The project tabs access rights and notification settings have been saved.'));
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::adminTabs',
array($prj->shortname));
return new Pluf_HTTP_Response_Redirect($url);
}
} else {
$params = array();
- $keys = array('downloads_access_rights', 'source_access_rights',
- 'issues_access_rights', 'review_access_rights',
- 'wiki_access_rights',
- 'downloads_notification_email',
- 'review_notification_email',
- 'wiki_notification_email',
- 'source_notification_email',
- 'issues_notification_email');
+ $sections = array('downloads', 'wiki', 'source', 'issues', 'review');
+ $keys = array();
+
+ foreach ($sections as $section) {
+ $keys[] = $section.'_access_rights';
+ $keys[] = $section.'_notification_owners_enabled';
+ $keys[] = $section.'_notification_members_enabled';
+ $keys[] = $section.'_notification_email_enabled';
+ $keys[] = $section.'_notification_email';
+ }
+
foreach ($keys as $key) {
$_val = $request->conf->getVal($key, false);
if ($_val !== false) {
diff --git a/src/IDF/templates/idf/admin/tabs.html b/src/IDF/templates/idf/admin/tabs.html
index f221d61..10ae8dc 100644
--- a/src/IDF/templates/idf/admin/tabs.html
+++ b/src/IDF/templates/idf/admin/tabs.html
@@ -10,11 +10,11 @@
{/if}