summaryrefslogtreecommitdiff
path: root/program/steps/settings
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2008-09-15 14:53:57 +0000
committerthomascube <thomas@roundcube.net>2008-09-15 14:53:57 +0000
commitf645ce169e11339d45cbc0b5b4cf6154346fd4c7 (patch)
tree119de2f39e224d28c5fc8be0967bfb43e4320a27 /program/steps/settings
parent3e1e7750834edfe0062c83d66690f4fe4521b8ba (diff)
Redesign of the identities settings + add config option to disable multiple identities
Diffstat (limited to 'program/steps/settings')
-rw-r--r--program/steps/settings/delete_identity.inc17
-rw-r--r--program/steps/settings/edit_identity.inc14
-rw-r--r--program/steps/settings/func.inc3
-rw-r--r--program/steps/settings/save_identity.inc4
4 files changed, 25 insertions, 13 deletions
diff --git a/program/steps/settings/delete_identity.inc b/program/steps/settings/delete_identity.inc
index a5f3d4445..87bac13ea 100644
--- a/program/steps/settings/delete_identity.inc
+++ b/program/steps/settings/delete_identity.inc
@@ -21,15 +21,18 @@
if (($ids = get_input_value('_iid', RCUBE_INPUT_GET)) && preg_match('/^[0-9]+(,[0-9]+)*$/', $ids))
{
-
- if ($USER->delete_identity($ids))
- {
- $OUTPUT->show_message('deletedsuccessfully', 'confirmation');
+ if ($RCMAIL->config->get('multiple_identities', true)) {
+ if ($USER->delete_identity($ids)) {
+ $OUTPUT->show_message('deletedsuccessfully', 'confirmation');
+ }
+ else {
+ $OUTPUT->show_message('nodeletelastidentity', 'error');
+ }
}
- else
- {
- $OUTPUT->show_message('nodeletelastidentity', 'error');
+ else {
+ $OUTPUT->show_message('opnotpermitted', 'error');
}
+
// send response
if ($OUTPUT->ajax_call)
$OUTPUT->send();
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc
index 46918cb9e..1e3fa3494 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -21,14 +21,18 @@
$OUTPUT->set_pagetitle(rcube_label('identities'));
-if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='edit-identity')
- {
+if (($_GET['_iid'] || $_POST['_iid']) && $RCMAIL->action=='edit-identity') {
$IDENTITY_RECORD = $USER->get_identity(get_input_value('_iid', RCUBE_INPUT_GPC));
if (is_array($IDENTITY_RECORD))
$OUTPUT->set_env('iid', $IDENTITY_RECORD['identity_id']);
- }
-
+}
+else if (!$RCMAIL->config->get('multiple_identities', true)) {
+ $OUTPUT->show_message('opnotpermitted', 'error');
+ // go to identities page
+ rcmail_overwrite_action('identities');
+ return;
+}
$OUTPUT->include_script('list.js');
@@ -136,6 +140,8 @@ function rcube_identity_form($attrib)
$OUTPUT->add_handler('identityform', 'rcube_identity_form');
+$OUTPUT->set_pagetitle(rcube_label(($RCMAIL->action=='add-identity' ? 'newidentity' : 'edititem')));
+
if ($RCMAIL->action=='add-identity' && $OUTPUT->template_exists('addidentity'))
$OUTPUT->send('addidentity');
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index ef2befd84..1b399de8c 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -301,7 +301,7 @@ function rcmail_identities_list($attrib)
$attrib['id'] = 'rcmIdentitiesList';
// define list of cols to be displayed
- $a_show_cols = array('name', 'email', 'organization', 'reply-to');
+ $a_show_cols = array('name', 'email');
// create XHTML table
$out = rcube_table_output($attrib, $USER->list_identities(), $a_show_cols, 'identity_id');
@@ -366,6 +366,7 @@ function rcmail_get_skins()
return $skins;
}
+$OUTPUT->set_env('multiple_identities', $RCMAIL->config->get('multiple_identities', true));
// register UI objects
$OUTPUT->add_handlers(array(
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index 1eb9a9026..de2b4fc19 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -77,7 +77,7 @@ if ($_POST['_iid'])
}
// insert a new identity record
-else
+else if ($RCMAIL->config->get('multiple_identities', true))
{
if ($insert_id = $USER->insert_identity($save_data))
{
@@ -96,6 +96,8 @@ else
return;
}
}
+else
+ $OUTPUT->show_message('opnotpermitted', 'error');
// mark all other identities as 'not-default'