diff options
author | thomascube <thomas@roundcube.net> | 2008-09-15 14:53:57 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-09-15 14:53:57 +0000 |
commit | f645ce169e11339d45cbc0b5b4cf6154346fd4c7 (patch) | |
tree | 119de2f39e224d28c5fc8be0967bfb43e4320a27 /program | |
parent | 3e1e7750834edfe0062c83d66690f4fe4521b8ba (diff) |
Redesign of the identities settings + add config option to disable multiple identities
Diffstat (limited to 'program')
-rwxr-xr-x | program/include/rcube_template.php | 50 | ||||
-rw-r--r-- | program/js/app.js | 6 | ||||
-rw-r--r-- | program/localization/de_CH/messages.inc | 1 | ||||
-rw-r--r-- | program/localization/de_DE/messages.inc | 1 | ||||
-rw-r--r-- | program/localization/en_US/messages.inc | 1 | ||||
-rw-r--r-- | program/steps/settings/delete_identity.inc | 17 | ||||
-rw-r--r-- | program/steps/settings/edit_identity.inc | 14 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 3 | ||||
-rw-r--r-- | program/steps/settings/save_identity.inc | 4 |
9 files changed, 61 insertions, 36 deletions
diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php index 4441b0a41..98e29e74e 100755 --- a/program/include/rcube_template.php +++ b/program/include/rcube_template.php @@ -106,6 +106,28 @@ class rcube_template extends rcube_html_page $this->pagetitle = $title; } + + /** + * Getter for the current page title + * + * @return string The page title + */ + public function get_pagetitle() + { + if (!empty($this->pagetitle)) { + $title = $this->pagetitle; + } + else if ($this->env['task'] == 'login') { + $title = rcube_label(array('name' => 'welcome', 'vars' => array('product' => $this->config['product_name']))); + } + else { + $title = ucfirst($this->env['task']); + } + + return $title; + } + + /** * Set skin */ @@ -357,13 +379,7 @@ class rcube_template extends rcube_html_page implode(',', $args) ); } - // add command to set page title - if ($this->ajax_call && !empty($this->pagetitle)) { - $out .= sprintf( - "this.set_pagetitle('%s');\n", - JQ((!empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : '') . $this->pagetitle) - ); - } + return $out; } @@ -455,13 +471,13 @@ class rcube_template extends rcube_html_page $condition = preg_replace( array( '/session:([a-z0-9_]+)/i', - '/config:([a-z0-9_]+)/i', + '/config:([a-z0-9_]+)(:([a-z0-9_]+))?/i', '/env:([a-z0-9_]+)/i', '/request:([a-z0-9_]+)/ie' ), array( "\$_SESSION['\\1']", - "\$this->config['\\1']", + "\$this->app->config->get('\\1',get_boolean('\\3'))", "\$this->env['\\1']", "get_input_value('\\1', RCUVE_INPUT_GPC)" ), @@ -591,20 +607,12 @@ class rcube_template extends rcube_html_page } return $ver; } + if ($object=='steptitle') { + return Q($this->get_pagetitle()); + } if ($object=='pagetitle') { - $task = $this->env['task']; $title = !empty($this->config['product_name']) ? $this->config['product_name'].' :: ' : ''; - - if (!empty($this->pagetitle)) { - $title .= $this->pagetitle; - } - else if ($task == 'login') { - $title = rcube_label(array('name' => 'welcome', 'vars' => array('product' => $this->config['product_name']))); - } - else { - $title .= ucfirst($task); - } - + $title .= $this->get_pagetitle(); return Q($title); } break; diff --git a/program/js/app.js b/program/js/app.js index 31be5f765..83b3972bf 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -295,8 +295,10 @@ function rcube_webmail() case 'settings': this.enable_command('preferences', 'identities', 'save', 'folders', true); - if (this.env.action=='identities' || this.env.action=='edit-identity' || this.env.action=='add-identity') - this.enable_command('edit', 'add', 'delete', true); + if (this.env.action=='identities' || this.env.action=='edit-identity' || this.env.action=='add-identity') { + this.enable_command('add', 'delete', this.env.multiple_identities); + this.enable_command('edit', true); + } if (this.env.action=='edit-identity' || this.env.action=='add-identity') this.enable_command('save', true); diff --git a/program/localization/de_CH/messages.inc b/program/localization/de_CH/messages.inc index 201bf9469..7357dc81b 100644 --- a/program/localization/de_CH/messages.inc +++ b/program/localization/de_CH/messages.inc @@ -85,5 +85,6 @@ $messages['addresswriterror'] = 'Das gewählte Adressbuch kann nicht verändert $messages['importwait'] = 'Daten werden importiert, bitte warten...'; $messages['importerror'] = 'Import fehlgeschlagen! Die hochgeladene Datei ist nicht im vCard-Format.'; $messages['importconfirm'] = '<b>Es wurden $inserted Adressen erfolgreich importiert und $skipped bestehende Einträge übersprungen</b>:<p><em>$names</em></p>'; +$messages['opnotpermitted'] = 'Operation nicht erlaubt!'; ?> diff --git a/program/localization/de_DE/messages.inc b/program/localization/de_DE/messages.inc index 36892db09..646ac7ded 100644 --- a/program/localization/de_DE/messages.inc +++ b/program/localization/de_DE/messages.inc @@ -85,5 +85,6 @@ $messages['addresswriterror'] = 'Das ausgewählte Adressbuch kann nicht verände $messages['importwait'] = 'Daten werden importiert, bitte warten...'; $messages['importerror'] = 'Import fehlgeschlagen! Die hochgeladene Datei ist nicht im vCard-Format.'; $messages['importconfirm'] = 'Es wurden $inserted Adressen erfolgreich importiert und $skipped bestehende Einträge übersprungen:$names'; +$messages['opnotpermitted'] = 'Operation nicht erlaubt!'; ?> diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index 9373be88e..26e107f58 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -86,5 +86,6 @@ $messages['addresswriterror'] = 'The selected address book is not writeable'; $messages['importwait'] = 'Importing, please wait...'; $messages['importerror'] = 'Import failed! The uploaded file is not a valid vCard file.'; $messages['importconfirm'] = '<b>Successfully imported $inserted contacts, $skipped existing entries skipped</b>:<p><em>$names</em></p>'; +$messages['opnotpermitted'] = 'Operation not permitted!'; ?>
\ No newline at end of file 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' |