From f12585297974a994bd9b081cd1d70e8ab8d2365e Mon Sep 17 00:00:00 2001
From: jeremie kornobis <jkornobis@linagora.com>
Date: Mon, 26 Nov 2012 08:17:20 -0500
Subject: [PATCH] Add new identity level: one identity with edit only signature

---
 program/steps/settings/save_identity.inc |    2 +-
 config/main.inc.php.dist                 |    1 +
 program/steps/settings/edit_identity.inc |    7 +++++++
 3 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index dafee72..c8490a1 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -357,6 +357,7 @@
 // 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 aa1aeea..7e7be1f 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -97,6 +97,13 @@
     $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 8515c44..7ca54a1 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -26,7 +26,7 @@
 $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');

--
Gitblit v1.9.1