From 0d9b63e9c022c48b98ec1542dccb50f1b28f80b8 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 4 Sep 2013 11:13:26 +0200 Subject: Add canned response UI elements to classic skin --- skins/classic/common.css | 29 ++++++++++++++++++- skins/classic/images/mail_toolbar.png | Bin 40806 -> 39276 bytes skins/classic/includes/settingstabs.html | 1 + skins/classic/mail.css | 4 +++ skins/classic/settings.css | 15 ++++++++++ skins/classic/templates/compose.html | 11 +++++++ skins/classic/templates/responseedit.html | 24 ++++++++++++++++ skins/classic/templates/responses.html | 46 ++++++++++++++++++++++++++++++ 8 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 skins/classic/templates/responseedit.html create mode 100644 skins/classic/templates/responses.html (limited to 'skins/classic') diff --git a/skins/classic/common.css b/skins/classic/common.css index 3c322f0ed..accdf7166 100644 --- a/skins/classic/common.css +++ b/skins/classic/common.css @@ -511,7 +511,8 @@ body.iframe .boxtitle margin: 3px -4px; } -.popupmenu li a +.popupmenu li a, +.popupmenu li label { display: block; color: #a0a0a0; @@ -521,6 +522,14 @@ body.iframe .boxtitle background: transparent; } +.popupmenu li label.comment +{ + color: #999; + font-style: italic; + padding-top: 4px; + padding-bottom: 3px; +} + .popupmenu li a.active, .popupmenu li a.active:active, .popupmenu li a.active:visited @@ -704,6 +713,24 @@ ul.treelist li div.expanded outline: none; } +.propform div.prop +{ + margin-bottom: 0.5em; +} + +.propform div.prop.block label +{ + display: block; + margin-bottom: 2px; +} + +.propform div.prop.block input, +.propform div.prop.block textarea +{ + width: 97%; +} + + /***** roundcube webmail pre-defined classes *****/ #rcmversion diff --git a/skins/classic/images/mail_toolbar.png b/skins/classic/images/mail_toolbar.png index 4a8431715..3ef003f23 100644 Binary files a/skins/classic/images/mail_toolbar.png and b/skins/classic/images/mail_toolbar.png differ diff --git a/skins/classic/includes/settingstabs.html b/skins/classic/includes/settingstabs.html index 0aea80b67..e44eb5b8b 100644 --- a/skins/classic/includes/settingstabs.html +++ b/skins/classic/includes/settingstabs.html @@ -2,6 +2,7 @@ + diff --git a/skins/classic/mail.css b/skins/classic/mail.css index b8cc9f351..d472d6d07 100644 --- a/skins/classic/mail.css +++ b/skins/classic/mail.css @@ -171,6 +171,10 @@ background-position: -480px -32px; } +#messagetoolbar a.responses { + background-position: -512px 0; +} + #messagetoolbar select.mboxlist { position: relative; diff --git a/skins/classic/settings.css b/skins/classic/settings.css index 2433f5040..0e4f796a4 100644 --- a/skins/classic/settings.css +++ b/skins/classic/settings.css @@ -81,6 +81,7 @@ } #identity-details table td.title, +#response-details table td.title, #folder-details table td.title { font-weight: bold; @@ -89,6 +90,14 @@ white-space: nowrap; } +#response-details table td.title +{ + text-align: left; + vertical-align: top; + width: 140px; + padding-top: 5px; +} + #bottomboxes { position: absolute; @@ -149,6 +158,12 @@ body.iframe, float: right; } +#formfooter .footerindent +{ + padding: 10px 0; + margin-left: 155px; +} + #quota { position: absolute; diff --git a/skins/classic/templates/compose.html b/skins/classic/templates/compose.html index 5e259e11c..7ed9fac36 100644 --- a/skins/classic/templates/compose.html +++ b/skins/classic/templates/compose.html @@ -40,6 +40,7 @@ +   @@ -191,6 +192,16 @@ +
+
    +
  • + +
  • +
  • +
  • +
+
+
diff --git a/skins/classic/templates/responseedit.html b/skins/classic/templates/responseedit.html new file mode 100644 index 000000000..fbc5f663d --- /dev/null +++ b/skins/classic/templates/responseedit.html @@ -0,0 +1,24 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + +
+ +
+ + +
+
+ +
+
+
+ + + diff --git a/skins/classic/templates/responses.html b/skins/classic/templates/responses.html new file mode 100644 index 000000000..14087d82e --- /dev/null +++ b/skins/classic/templates/responses.html @@ -0,0 +1,46 @@ + + + +<roundcube:object name="pagetitle" /> + + + + + + + + + + + + +
+ +
+
+
+ +
+
+ +
+
+ + + +
+ +
+ +
+ + + -- cgit v1.2.3 From cc041fe11c1997902f68f4ca8e95577e963a0053 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 4 Sep 2013 14:18:12 +0200 Subject: Use the correct label for responses list header --- skins/classic/templates/responses.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'skins/classic') diff --git a/skins/classic/templates/responses.html b/skins/classic/templates/responses.html index 14087d82e..2459827b0 100644 --- a/skins/classic/templates/responses.html +++ b/skins/classic/templates/responses.html @@ -22,7 +22,7 @@
-
+
-- cgit v1.2.3 From 9c41ba3c9ebbb14d01abe961c420f71f9463e61a Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 19 Sep 2013 17:56:14 +0200 Subject: Allow sysadmins to define static responses which are immutable for the user --- config/defaults.inc.php | 6 ++++++ program/include/rcmail.php | 15 ++++++++++++++- program/js/app.js | 2 +- program/steps/settings/edit_response.inc | 19 +++++++++---------- program/steps/settings/responses.inc | 8 +++++--- skins/classic/settings.css | 5 +++++ skins/classic/templates/responseedit.html | 2 +- skins/larry/settings.css | 4 ++++ skins/larry/templates/responseedit.html | 2 +- 9 files changed, 46 insertions(+), 17 deletions(-) (limited to 'skins/classic') diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 2a51b0805..a5bf34415 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -586,6 +586,12 @@ $config['upload_progress'] = false; // Setting it to 0, disables the feature. $config['undo_timeout'] = 0; +// A static list of canned responses which are immutable for the user +$config['compose_responses_static'] = array( +// array('name' => 'Canned Response 1', 'text' => 'Static Response One'), +// array('name' => 'Canned Response 2', 'text' => 'Static Response Two'), +); + // ---------------------------------- // ADDRESSBOOK SETTINGS // ---------------------------------- diff --git a/program/include/rcmail.php b/program/include/rcmail.php index f58235cbf..4a07e0b69 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -351,11 +351,24 @@ class rcmail extends rcube * These are stored in local config and user preferences. * * @param boolean True to sort the list alphabetically + * @param boolean True if only this user's responses shall be listed * @return array List of the current user's stored responses */ - public function get_compose_responses($sorted = false) + public function get_compose_responses($sorted = false, $user_only = false) { $responses = array(); + + if (!$user_only) { + foreach ($this->config->get('compose_responses_static', array()) as $response) { + if (empty($response['key'])) + $response['key'] = substr(md5($response['name']), 0, 16); + $response['static'] = true; + $response['class'] = 'readonly'; + $k = $sorted ? '0000-' . strtolower($response['name']) : $response['key']; + $responses[$k] = $response; + } + } + foreach ($this->config->get('compose_responses', array()) as $response) { if (empty($response['key'])) $response['key'] = substr(md5($response['name']), 0, 16); diff --git a/program/js/app.js b/program/js/app.js index abe267a6d..5943ad0fd 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -447,7 +447,7 @@ function rcube_webmail() this.responses_list = new rcube_list_widget(this.gui_objects.responseslist, {multiselect:false, draggable:false, keyboard:false}); this.responses_list.addEventListener('select', function(list){ var win, id = list.get_single_selection(); - p.enable_command('delete', !!id); + p.enable_command('delete', !!id && $.inArray(id, p.env.readonly_responses) < 0); if (id && (win = p.get_frame_window(p.env.contentframe))) { p.set_busy(true); p.location_href({ _action:'edit-response', _key:id, _framed:1 }, win); diff --git a/program/steps/settings/edit_response.inc b/program/steps/settings/edit_response.inc index 26f7e6e48..49856775a 100644 --- a/program/steps/settings/edit_response.inc +++ b/program/steps/settings/edit_response.inc @@ -24,8 +24,6 @@ $responses = $RCMAIL->get_compose_responses(); // edit-response if (($key = get_input_value('_key', RCUBE_INPUT_GPC))) { foreach ($responses as $i => $response) { - if (empty($response['key'])) - $response['key'] = substr(md5($response['name']), 0, 16); if ($response['key'] == $key) { $RESPONSE_RECORD = $response; $RESPONSE_RECORD['index'] = $i; @@ -35,13 +33,10 @@ if (($key = get_input_value('_key', RCUBE_INPUT_GPC))) { } // save response -if ($RCMAIL->action == 'save-response' && isset($_POST['_name'])) { +if ($RCMAIL->action == 'save-response' && isset($_POST['_name']) && !$RESPONSE_RECORD['static']) { $name = trim(get_input_value('_name', RCUBE_INPUT_POST)); $text = trim(get_input_value('_text', RCUBE_INPUT_POST)); - if (!empty($_REQUEST['_framed'])) - $RCMAIL->output->framed = 1; - if (!empty($name) && !empty($text)) { $dupes = 0; foreach ($responses as $i => $resp) { @@ -62,9 +57,11 @@ if ($RCMAIL->action == 'save-response' && isset($_POST['_name'])) { $responses[] = $response; } - if ($RCMAIL->user->save_prefs(array('compose_responses' => $responses))) { + $responses = array_filter($responses, function($item){ return empty($item['static']); }); + if ($RCMAIL->user->save_prefs(array('compose_responses' => array_values($responses)))) { $RCMAIL->output->show_message('successfullysaved', 'confirmation'); - $RCMAIL->output->command('update_response_row', $response, $key); + $RCMAIL->output->command('parent.update_response_row', $response, $key); + $RCMAIL->overwrite_action('edit-response'); $RESPONSE_RECORD = $response; } } @@ -79,6 +76,7 @@ function rcube_response_form($attrib) global $RCMAIL, $OUTPUT, $RESPONSE_RECORD; // Set form tags and hidden fields + $disabled = !empty($RESPONSE_RECORD['static']); $key = $RESPONSE_RECORD['key']; list($form_start, $form_end) = get_form_tags($attrib, 'save-response', $key, array('name' => '_key', 'value' => $key)); unset($attrib['form'], $attrib['id']); @@ -90,10 +88,10 @@ function rcube_response_form($attrib) $label = rcube_label('responsename'); $table->add('title', html::label('ffname', Q(rcube_label('responsename')))); - $table->add(null, rcube_output::get_edit_field('name', $RESPONSE_RECORD['name'], array('id' => 'ffname', 'size' => $attrib['size']), 'text')); + $table->add(null, rcube_output::get_edit_field('name', $RESPONSE_RECORD['name'], array('id' => 'ffname', 'size' => $attrib['size'], 'disabled' => $disabled), 'text')); $table->add('title', html::label('fftext', Q(rcube_label('responsetext')))); - $table->add(null, rcube_output::get_edit_field('text', $RESPONSE_RECORD['text'], array('id' => 'fftext', 'size' => $attrib['textareacols'], 'rows' => $attrib['textarearows']), 'textarea')); + $table->add(null, rcube_output::get_edit_field('text', $RESPONSE_RECORD['text'], array('id' => 'fftext', 'size' => $attrib['textareacols'], 'rows' => $attrib['textarearows'], 'disabled' => $disabled), 'textarea')); $out .= $table->show($attrib); $out .= $form_end; @@ -101,6 +99,7 @@ function rcube_response_form($attrib) return $out; } +$OUTPUT->set_env('readonly', !empty($RESPONSE_RECORD['static'])); $OUTPUT->add_handler('responseform', 'rcube_response_form'); $OUTPUT->set_pagetitle(rcube_label(($RCMAIL->action=='add-response' ? 'savenewresponse' : 'editresponse'))); diff --git a/program/steps/settings/responses.inc b/program/steps/settings/responses.inc index 330b4fde4..cfc4148c3 100644 --- a/program/steps/settings/responses.inc +++ b/program/steps/settings/responses.inc @@ -26,7 +26,7 @@ if (!empty($_POST['_insert'])) { if (!empty($name) && !empty($text)) { $dupes = 0; - $responses = $RCMAIL->get_compose_responses(); + $responses = $RCMAIL->get_compose_responses(false, true); foreach ($responses as $resp) { if (strcasecmp($name, preg_replace('/\s\(\d+\)$/', '', $resp['name'])) == 0) $dupes++; @@ -54,7 +54,7 @@ if (!empty($_POST['_insert'])) { if ($RCMAIL->action == 'delete-response') { if ($key = get_input_value('_key', RCUBE_INPUT_GPC)) { - $responses = $RCMAIL->get_compose_responses(); + $responses = $RCMAIL->get_compose_responses(false, true); foreach ($responses as $i => $response) { if (empty($response['key'])) $response['key'] = substr(md5($response['name']), 0, 16); @@ -67,7 +67,7 @@ if ($RCMAIL->action == 'delete-response') { } if ($deleted) { - $RCMAIL->output->command('display_message', rcube_label('successfullydeleted'), 'confirmation'); + $RCMAIL->output->command('display_message', rcube_label('deletedsuccessfully'), 'confirmation'); $RCMAIL->output->command('remove_response', $key); } @@ -99,6 +99,8 @@ function rcmail_responses_list($attrib) // set client env $OUTPUT->add_gui_object('responseslist', $attrib['id']); + $OUTPUT->set_env('readonly_responses', array_values(array_map(function($rec){ return $rec['key']; }, + array_filter($plugin['list'], function($item){ return !empty($item['static']); })))); return $out; } diff --git a/skins/classic/settings.css b/skins/classic/settings.css index 0e4f796a4..acd0b9fd0 100644 --- a/skins/classic/settings.css +++ b/skins/classic/settings.css @@ -34,6 +34,11 @@ height: 18px; } +#identities-table tbody tr.readonly td +{ + font-style: italic; +} + #subscription-table tr.virtual td { color: #666; diff --git a/skins/classic/templates/responseedit.html b/skins/classic/templates/responseedit.html index fbc5f663d..67ba35bac 100644 --- a/skins/classic/templates/responseedit.html +++ b/skins/classic/templates/responseedit.html @@ -15,7 +15,7 @@
- +
diff --git a/skins/larry/settings.css b/skins/larry/settings.css index 8deb24716..920376a96 100644 --- a/skins/larry/settings.css +++ b/skins/larry/settings.css @@ -194,6 +194,10 @@ text-overflow: ellipsis; } +#identities-table tbody tr.readonly td { + font-style: italic; +} + #folder-details, #identity-details { position: absolute; diff --git a/skins/larry/templates/responseedit.html b/skins/larry/templates/responseedit.html index d2f031b34..8f180fe7f 100644 --- a/skins/larry/templates/responseedit.html +++ b/skins/larry/templates/responseedit.html @@ -13,7 +13,7 @@
- +
-- cgit v1.2.3