Allow the fine-grained configuration of notification settings for
each section and reword the help texts quite a bit. This will later be used to collect the correct set of email addresses to notify a particular audience about changes in a particular section. Notice that a project admin will have to explicitely opt-in for "Others" notifications, i.e. unless the checkbox is checked, existing email addresses won't be notified anymore. This is surely debatable for existing setups, but makes much more sense for new setups. Eventually we'll write a small migration script to add the specific enabled setting for those (existing) projects that have a non-empty mail list configured. This commit has been sponsored by SciLab.
This commit is contained in:
parent
099e4888e8
commit
2b5efb7fee
@ -12,6 +12,8 @@ by the friendly folks from Scilab <http://www.scilab.org/>!
|
||||
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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -10,11 +10,11 @@
|
||||
</div>
|
||||
{/if}
|
||||
<form method="post" action=".">
|
||||
<table class="form" summary="">
|
||||
<table class="form access-rights" summary="">
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th class="a-c"><strong>{trans 'Access Rights'}</strong></th>
|
||||
<th class="a-c"><strong>{trans 'Notification Email'}</strong></th>
|
||||
<th class="left"><strong>{trans 'Access Rights'}</strong></th>
|
||||
<th class="left"><strong>{trans 'Notifications'}</strong></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong>{$form.f.downloads_access_rights.labelTag}:</strong></th>
|
||||
@ -22,6 +22,12 @@
|
||||
{$form.f.downloads_access_rights|unsafe}
|
||||
</td>
|
||||
<td>{if $form.f.downloads_notification_email.errors}{$form.f.downloads_notification_email.fieldErrors}{/if}
|
||||
{$form.f.downloads_notification_owners_enabled|unsafe}
|
||||
{$form.f.downloads_notification_owners_enabled.labelTag}
|
||||
{$form.f.downloads_notification_members_enabled|unsafe}
|
||||
{$form.f.downloads_notification_members_enabled.labelTag}
|
||||
{$form.f.downloads_notification_email_enabled|unsafe}
|
||||
{$form.f.downloads_notification_email_enabled.labelTag}
|
||||
{$form.f.downloads_notification_email|unsafe}
|
||||
</td>
|
||||
</tr>
|
||||
@ -31,6 +37,12 @@
|
||||
{$form.f.wiki_access_rights|unsafe}
|
||||
</td>
|
||||
<td>{if $form.f.wiki_notification_email.errors}{$form.f.wiki_notification_email.fieldErrors}{/if}
|
||||
{$form.f.wiki_notification_owners_enabled|unsafe}
|
||||
{$form.f.wiki_notification_owners_enabled.labelTag}
|
||||
{$form.f.wiki_notification_members_enabled|unsafe}
|
||||
{$form.f.wiki_notification_members_enabled.labelTag}
|
||||
{$form.f.wiki_notification_email_enabled|unsafe}
|
||||
{$form.f.wiki_notification_email_enabled.labelTag}
|
||||
{$form.f.wiki_notification_email|unsafe}
|
||||
</td>
|
||||
</tr>
|
||||
@ -40,6 +52,12 @@
|
||||
{$form.f.issues_access_rights|unsafe}
|
||||
</td>
|
||||
<td>{if $form.f.issues_notification_email.errors}{$form.f.issues_notification_email.fieldErrors}{/if}
|
||||
{$form.f.issues_notification_owners_enabled|unsafe}
|
||||
{$form.f.issues_notification_owners_enabled.labelTag}
|
||||
{$form.f.issues_notification_members_enabled|unsafe}
|
||||
{$form.f.issues_notification_members_enabled.labelTag}
|
||||
{$form.f.issues_notification_email_enabled|unsafe}
|
||||
{$form.f.issues_notification_email_enabled.labelTag}
|
||||
{$form.f.issues_notification_email|unsafe}
|
||||
</td>
|
||||
</tr>
|
||||
@ -49,32 +67,37 @@
|
||||
{$form.f.source_access_rights|unsafe}
|
||||
</td>
|
||||
<td>{if $form.f.source_notification_email.errors}{$form.f.source_notification_email.fieldErrors}{/if}
|
||||
{$form.f.source_notification_owners_enabled|unsafe}
|
||||
{$form.f.source_notification_owners_enabled.labelTag}
|
||||
{$form.f.source_notification_members_enabled|unsafe}
|
||||
{$form.f.source_notification_members_enabled.labelTag}
|
||||
{$form.f.source_notification_email_enabled|unsafe}
|
||||
{$form.f.source_notification_email_enabled.labelTag}
|
||||
{$form.f.source_notification_email|unsafe}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td colspan="2" class="helptext">
|
||||
{blocktrans}
|
||||
Only project members and admins have write access to the source.<br />
|
||||
If you restrict the access to the source, anonymous access is<br />
|
||||
not provided and the users must authenticate themselves with their<br />
|
||||
password or SSH key.{/blocktrans}
|
||||
</td></tr>
|
||||
<tr>
|
||||
<th><strong>{$form.f.review_access_rights.labelTag}:</strong></th>
|
||||
<td>{if $form.f.review_access_rights.errors}{$form.f.review_access_rights.fieldErrors}{/if}
|
||||
{$form.f.review_access_rights|unsafe}
|
||||
</td>
|
||||
<td>{if $form.f.review_notification_email.errors}{$form.f.review_notification_email.fieldErrors}{/if}
|
||||
{$form.f.review_notification_owners_enabled|unsafe}
|
||||
{$form.f.review_notification_owners_enabled.labelTag}
|
||||
{$form.f.review_notification_members_enabled|unsafe}
|
||||
{$form.f.review_notification_members_enabled.labelTag}
|
||||
{$form.f.review_notification_email_enabled|unsafe}
|
||||
{$form.f.review_notification_email_enabled.labelTag}
|
||||
{$form.f.review_notification_email|unsafe}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{if $form.f.private_project.errors}{$form.f.private_project.fieldErrors}{/if}
|
||||
<th> </th>
|
||||
<td>
|
||||
{if $form.f.private_project.errors}{$form.f.private_project.fieldErrors}{/if}
|
||||
{$form.f.private_project|unsafe}
|
||||
</th>
|
||||
<td>{$form.f.private_project.labelTag}</td>
|
||||
{$form.f.private_project.labelTag}
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="authorized-users-row">
|
||||
<td> </td>
|
||||
@ -94,27 +117,45 @@ password or SSH key.{/blocktrans}
|
||||
{/block}
|
||||
{block context}
|
||||
<div class="issue-submit-info">
|
||||
<p><strong>{trans 'Instructions:'}</strong></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. 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}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}This section allows you to configure project tabs access rights and notifications.{/blocktrans}</p>
|
||||
<p><strong>{trans 'Access Rights'}</strong></p>
|
||||
<p>{blocktrans}Tab access controls whether a single user can navigate into a particular section of your project via the main menu or automatically generated object links.{/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 as a whole. 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}For the extra authorized user list, 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}Only project members and admins have write access to the source. If you restrict the access to the source, anonymous access is not provided and the users must authenticate themselves with their password or SSH key.{/blocktrans}</p>
|
||||
<p><strong>{trans 'Notifications'}</strong></p>
|
||||
<p>{blocktrans}Here you can configure who should be notified about changes in a particular section. You can also configure additional addresses, like the one of a mailing list, that should be notified. (Keep in mind that you might have to register the sender address <strong>{$from_email}</strong> to let the mailing list actually accept notification emails.) Multiple email addresses must be separated through commas (',').{/blocktrans}</p>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block javascript}{literal}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
// If not checked, hide
|
||||
if (!$("#id_private_project").is(":checked"))
|
||||
$(document).ready(function() {
|
||||
// if not checked, hide
|
||||
if (!$("#id_private_project").is(":checked")) {
|
||||
$("#authorized-users-row").hide();
|
||||
$("#id_private_project").click(function(){
|
||||
if ($("#id_private_project").is(":checked")) {
|
||||
$("#authorized-users-row").show();
|
||||
}
|
||||
$("#id_private_project").click(function() {
|
||||
if ($("#id_private_project").is(":checked")) {
|
||||
$("#authorized-users-row").show();
|
||||
} else {
|
||||
$("#authorized-users-row").hide();
|
||||
}
|
||||
});
|
||||
|
||||
// if not checked, hide
|
||||
$.each(['downloads', 'wiki', 'issues', 'source', 'review'], function(index, section) {
|
||||
if (!$("#id_" + section + "_notification_email_enabled").is(":checked")) {
|
||||
$("#id_" + section + "_notification_email").hide();
|
||||
}
|
||||
$("#id_" + section + "_notification_email_enabled").click(function() {
|
||||
if ($("#id_" + section + "_notification_email_enabled").is(":checked")) {
|
||||
$("#id_" + section + "_notification_email").show();
|
||||
} else {
|
||||
$("#authorized-users-row").hide();
|
||||
$("#id_" + section + "_notification_email").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}{/block}
|
||||
|
@ -43,8 +43,12 @@ a:active{
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
.left {
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.a-c {
|
||||
@ -1232,3 +1236,19 @@ table.issue-summary td.graph-color {
|
||||
table.issue-summary td.graph-percent {
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
table.form.access-rights {}
|
||||
|
||||
table.form.access-rights th + th,
|
||||
table.form.access-rights td + td {
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
table.form.access-rights td + td label {
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
table.form.access-rights th *,
|
||||
table.form.access-rights td * {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user