summaryrefslogtreecommitdiff
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
parent3e1e7750834edfe0062c83d66690f4fe4521b8ba (diff)
Redesign of the identities settings + add config option to disable multiple identities
-rw-r--r--CHANGELOG5
-rw-r--r--config/main.inc.php.dist3
-rwxr-xr-xprogram/include/rcube_template.php50
-rw-r--r--program/js/app.js6
-rw-r--r--program/localization/de_CH/messages.inc1
-rw-r--r--program/localization/de_DE/messages.inc1
-rw-r--r--program/localization/en_US/messages.inc1
-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
-rw-r--r--skins/default/settings.css45
-rw-r--r--skins/default/templates/addidentity.html36
-rw-r--r--skins/default/templates/editidentity.html10
-rw-r--r--skins/default/templates/identities.html10
15 files changed, 123 insertions, 83 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 6d3a3cf8e..e185a5e7c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,11 @@
CHANGELOG RoundCube Webmail
---------------------------
+2008/09/15 (thomasb)
+----------
+- Redesign of the identities settings (#1484042)
+- Add config option to disable creation/deletion of identities (#1484498)
+
2008/09/15 (alec)
----------
- Added 'sendmail_delay' option to restrict messages sending interval (#1484491)
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index ffa2d060f..5475c6108 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -298,6 +298,9 @@ $rcmail_config['address_book_type'] = 'sql';
// don't allow these settings to be overriden by the user
$rcmail_config['dont_override'] = array();
+// allow users to add and delete sender identities
+$rcmail_config['multiple_identities'] = true;
+
// try to load host-specific configuration
// see http://trac.roundcube.net/wiki/Howto_Config for more details
$rcmail_config['include_host_config'] = false;
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'
diff --git a/skins/default/settings.css b/skins/default/settings.css
index 9dee6236a..ca01b5ae7 100644
--- a/skins/default/settings.css
+++ b/skins/default/settings.css
@@ -6,12 +6,12 @@
position: absolute;
top: 50px;
left: 220px;
- right: 60px;
+ right: 40px;
height: 22px;
border-bottom: 1px solid #999999;
white-space: nowrap;
/* css hack for IE */
- width: expression((parseInt(document.documentElement.clientWidth)-280)+'px');
+ width: expression((parseInt(document.documentElement.clientWidth)-260)+'px');
}
span.tablink,
@@ -87,16 +87,42 @@ span.tablink-selected a
background-color: #FFFFA6;
}
-#identities-table
+#identities-list
{
- width: 600px;
+ bottom: 60px;
+ width: 420px;
border: 1px solid #999999;
+}
+
+#listbuttons
+{
+ position: absolute;
+ left: 20px;
+ bottom: 18px;
+}
+
+#identities-table
+{
+ width: 420px;
+ table-layout: fixed;
background-color: #F9F9F9;
}
#identities-table tbody td
{
cursor: default;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+#identities-table thead td.name
+{
+ width: 55%;
+}
+
+#identities-table thead td.email
+{
+ width: 45%;
}
#identity-frame
@@ -108,9 +134,16 @@ span.tablink-selected a
#identity-details
{
- margin-top: 30px;
- width: 600px;
+ position: absolute;
+ top: 95px;
+ left: 450px;
+ right: 40px;
+ bottom: 60px;
border: 1px solid #999999;
+ overflow: auto;
+ /* css hack for IE */
+ width: expression((parseInt(document.documentElement.clientWidth)-490)+'px');
+ height: expression((parseInt(document.documentElement.clientHeight)-160)+'px');
}
#identity-details table td.title
diff --git a/skins/default/templates/addidentity.html b/skins/default/templates/addidentity.html
deleted file mode 100644
index 8162d1cdd..000000000
--- a/skins/default/templates/addidentity.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title><roundcube:object name="pagetitle" /></title>
-<roundcube:include file="/includes/links.html" />
-<link rel="stylesheet" type="text/css" href="/settings.css" />
-</head>
-<body>
-
-<roundcube:include file="/includes/taskbar.html" />
-<roundcube:include file="/includes/header.html" />
-<roundcube:include file="/includes/settingstabs.html" />
-
-
-<div id="identities-list">
-<roundcube:object name="identitiesList" id="identities-table" class="records-table" cellspacing="0" summary="Identities list" editIcon="" />
-
-<p><roundcube:button command="add" type="input" label="newidentity" class="button" /></p>
-
-<div id="identity-details">
-<div id="identity-title"><roundcube:label name="newidentity" /></div>
-
-<div style="padding:15px;">
-<roundcube:object name="identityform" size="40" />
-
-<p><br />
-<roundcube:button command="save" type="input" class="button" label="save" />
-</p>
-</div>
-</div>
-</div>
-
-<roundcube:include file="/includes/settingscripts.html" />
-
-</body>
-</html>
diff --git a/skins/default/templates/editidentity.html b/skins/default/templates/editidentity.html
index 94c70e615..874465511 100644
--- a/skins/default/templates/editidentity.html
+++ b/skins/default/templates/editidentity.html
@@ -14,22 +14,24 @@
<div id="identities-list">
<roundcube:object name="identitiesList" id="identities-table" class="records-table" cellspacing="0" summary="Identities list" editIcon="" />
+</div>
-<p><roundcube:button command="add" type="input" label="newidentity" class="button" /></p>
+<p id="listbuttons">
+<roundcube:button command="add" type="input" label="newidentity" class="button" condition="config:multiple_identities:true" />
+</p>
<div id="identity-details">
-<div id="identity-title"><roundcube:label name="edititem" /></div>
+<div id="identity-title"><roundcube:object name="steptitle" /></div>
<div style="padding:15px;">
<roundcube:object name="identityform" size="40" />
<p><br />
-<roundcube:button command="delete" type="input" class="button" label="delete" />&nbsp;
+<roundcube:button command="delete" type="input" class="button" label="delete" condition="env:action=='edit-identity'&&config:multiple_identities:true" style="margin-right:0.5em" />
<roundcube:button command="save" type="input" class="button mainaction" label="save" />
</p>
</div>
</div>
-</div>
<roundcube:include file="/includes/settingscripts.html" />
diff --git a/skins/default/templates/identities.html b/skins/default/templates/identities.html
index f9f3436ef..1dc42d0ea 100644
--- a/skins/default/templates/identities.html
+++ b/skins/default/templates/identities.html
@@ -13,8 +13,16 @@
<div id="identities-list">
<roundcube:object name="identitiesList" id="identities-table" class="records-table" cellspacing="0" summary="Identities list" editIcon="" />
+</div>
+
+<p id="listbuttons">
+<roundcube:button command="add" type="input" label="newidentity" class="button" condition="config:multiple_identities:true" />
+</p>
-<p><roundcube:button command="add" type="input" label="newidentity" class="button" /></p>
+<div id="identity-details">
+ <div style="margin:10px auto; text-align:center">
+ <img src="/images/rcube_watermark.png" width="245" height="245" alt="RoundCube" />
+ </div>
</div>
<roundcube:include file="/includes/settingscripts.html" />