summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-11-28 23:36:50 -0800
committerAleksander Machniak <alec@alec.pl>2012-11-28 23:36:50 -0800
commit48ef1334ff2deca06ce29a73724ea2f40c77a11c (patch)
treecb2fcca393d708a93c5cd7bf530c87ab4917fd7c
parent0247b89c38c7f7ef1a2111239c6a1c8c13394d93 (diff)
parentc753bc4a8bc96680e0534ab115cb2f0f1fc67512 (diff)
Merge pull request #49 from linagora/master
Add new identity level: one identity with edit only signature
-rw-r--r--config/main.inc.php.dist1
-rw-r--r--program/steps/settings/edit_identity.inc7
-rw-r--r--program/steps/settings/save_identity.inc13
3 files changed, 19 insertions, 2 deletions
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index 3e7630cd3..4805b95df 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -356,6 +356,7 @@ $rcmail_config['send_format_flowed'] = true;
// 1 - many identities with possibility to edit all params but not email address
// 2 - one identity with possibility to edit all params
// 3 - one identity with possibility to edit all params but not email address
+// 4 - one identity with possibility to edit only signature
$rcmail_config['identities_level'] = 0;
// Mimetypes supported by the browser.
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc
index 39076f408..d70a7aef7 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -99,6 +99,13 @@ function rcube_identity_form($attrib)
$form['addressing']['content']['email']['class'] = 'disabled';
}
+ if (IDENTITIES_LEVEL == 4) {
+ foreach($form['addressing']['content'] as $formfield => $value){
+ $form['addressing']['content'][$formfield]['disabled'] = true;
+ $form['addressing']['content'][$formfield]['class'] = 'disabled';
+ }
+ }
+
$IDENTITY_RECORD['email'] = rcube_idn_to_utf8($IDENTITY_RECORD['email']);
// Allow plugins to modify identity form content
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index d579ee61f..88adc795e 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -26,7 +26,7 @@ $a_boolean_cols = array('standard', 'html_signature');
$updated = $default_id = false;
// check input
-if (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3))
+if (IDENTITIES_LEVEL != 4 && (empty($_POST['_name']) || (empty($_POST['_email']) && IDENTITIES_LEVEL != 1 && IDENTITIES_LEVEL != 3)))
{
$OUTPUT->show_message('formincomplete', 'warning');
rcmail_overwrite_action('edit-identity');
@@ -52,9 +52,18 @@ foreach ($a_boolean_cols as $col)
}
// unset email address if user has no rights to change it
-if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3)
+if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3 )
unset($save_data['email']);
+if (IDENTITIES_LEVEL == 4 ){
+ unset($save_data['name']);
+ unset($save_data['email']);
+ unset($save_data['organization']);
+ unset($save_data['reply-to']);
+ unset($save_data['bcc']);
+ unset($save_data['standard']);
+}
+
// Validate e-mail addresses
$email_checks = array(rcube_idn_to_ascii($save_data['email']));
foreach (array('reply-to', 'bcc') as $item) {