From 0b1de8a487034724e8acbdccf8a7b506d1ecaeed Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 25 Jul 2013 17:39:35 +0200 Subject: Add new feature to save and recall text snippets (aka canned responses) when composing messages --- program/lib/Roundcube/html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/lib') diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php index a36711281..2086aaa85 100644 --- a/program/lib/Roundcube/html.php +++ b/program/lib/Roundcube/html.php @@ -33,7 +33,7 @@ class html public static $doctype = 'xhtml'; public static $lc_tags = true; public static $common_attrib = array('id','class','style','title','align'); - public static $containers = array('iframe','div','span','p','h1','h2','h3','form','textarea','table','thead','tbody','tr','th','td','style','script'); + public static $containers = array('iframe','div','span','p','h1','h2','h3','ul','form','textarea','table','thead','tbody','tr','th','td','style','script'); /** -- cgit v1.2.3 From 0933d66b591056358b5e645cbd563814308998d2 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 4 Sep 2013 10:08:42 +0200 Subject: Keep current selection on IE browsers by adding unselectable=on to link elements --- program/include/rcmail_output_html.php | 2 +- program/js/app.js | 7 ++++--- program/lib/Roundcube/html.php | 4 ++-- program/steps/mail/compose.inc | 1 + skins/larry/images/buttons.png | Bin 38670 -> 53350 bytes skins/larry/templates/compose.html | 6 +++--- 6 files changed, 11 insertions(+), 9 deletions(-) (limited to 'program/lib') diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index a2ec29ca3..006b89c64 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -1171,7 +1171,7 @@ class rcmail_output_html extends rcmail_output // generate html code for button if ($btn_content) { - $attrib_str = html::attrib_string($attrib, $link_attrib); + $attrib_str = html::attrib_string($attrib, array_merge(html::$common_attrib, $link_attrib)); $out = sprintf('%s', $attrib_str, $btn_content); } diff --git a/program/js/app.js b/program/js/app.js index cef688204..5233d9c9a 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -258,12 +258,12 @@ function rcube_webmail() this.env.address_group_stack = []; this.env.compose_commands = ['send-attachment', 'remove-attachment', 'send', 'cancel', 'toggle-editor', 'list-adresses', 'pushgroup', 'search', 'reset-search', 'extwin', - 'insert-response', 'save-response', 'edit-responses']; + 'insert-response', 'save-response']; if (this.env.drafts_mailbox) this.env.compose_commands.push('savedraft') - this.enable_command(this.env.compose_commands, 'identities', true); + this.enable_command(this.env.compose_commands, 'identities', 'responses', true); // add more commands (not enabled) $.merge(this.env.compose_commands, ['add-recipient', 'firstpage', 'previouspage', 'nextpage', 'lastpage']); @@ -277,6 +277,7 @@ function rcube_webmail() // init canned response functions if (this.gui_objects.responseslist) { $('a.insertresponse', this.gui_objects.responseslist) + .attr('unselectable', 'on') .mousedown(function(e){ return rcube_event.cancel(e); }) .mouseup(function(e){ ref.command('insert-response', $(this).attr('rel')); @@ -3458,7 +3459,7 @@ function rcube_webmail() this.edit_responses = function() { - // TODO: decide what to do here... + // TODO: implement inline editing of responses }; this.delete_response = function(key) diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php index 2086aaa85..4295f26d6 100644 --- a/program/lib/Roundcube/html.php +++ b/program/lib/Roundcube/html.php @@ -3,7 +3,7 @@ /* +-----------------------------------------------------------------------+ | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2011, The Roundcube Dev Team | + | Copyright (C) 2005-2013, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -32,7 +32,7 @@ class html public static $doctype = 'xhtml'; public static $lc_tags = true; - public static $common_attrib = array('id','class','style','title','align'); + public static $common_attrib = array('id','class','style','title','align','unselectable'); public static $containers = array('iframe','div','span','p','h1','h2','h3','ul','form','textarea','table','thead','tbody','tr','th','td','style','script'); diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 282a2fd3e..bce4fd313 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -1713,6 +1713,7 @@ function rcmail_compose_responses_list($attrib) $item = html::a(array( 'href '=> '#'.urlencode($response['name']), 'class' => rtrim('insertresponse ' . $attrib['itemclass']), + 'unselectable' => 'on', 'rel' => $key, ), Q($response['name'])); diff --git a/skins/larry/images/buttons.png b/skins/larry/images/buttons.png index 3e28d128d..03c61ed93 100644 Binary files a/skins/larry/images/buttons.png and b/skins/larry/images/buttons.png differ diff --git a/skins/larry/templates/compose.html b/skins/larry/templates/compose.html index 0e4568bdd..863570cd1 100644 --- a/skins/larry/templates/compose.html +++ b/skins/larry/templates/compose.html @@ -30,7 +30,7 @@ - + @@ -200,8 +200,8 @@
  • -
  • -
  • +
  • +
  • -- cgit v1.2.3 From 4f432f880afeb078c2b60ce594872ec3eb1713e7 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 4 Sep 2013 12:07:58 +0200 Subject: Make result of rcmail::get_compose_responses() always an (indexed) array; add plugin hook for updating user prefs: 'preferences_update' --- program/include/rcmail.php | 6 +++--- program/lib/Roundcube/rcube_user.php | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'program/lib') diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 62f6254b5..f58235cbf 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -355,6 +355,7 @@ class rcmail extends rcube */ public function get_compose_responses($sorted = false) { + $responses = array(); foreach ($this->config->get('compose_responses', array()) as $response) { if (empty($response['key'])) $response['key'] = substr(md5($response['name']), 0, 16); @@ -362,13 +363,12 @@ class rcmail extends rcube $responses[$k] = $response; } + // sort list by name if ($sorted) { - // sort list by name ksort($responses, SORT_LOCALE_STRING); - return array_values($responses); } - return $responses; + return array_values($responses); } diff --git a/program/lib/Roundcube/rcube_user.php b/program/lib/Roundcube/rcube_user.php index 5e9c9af80..57f63361d 100644 --- a/program/lib/Roundcube/rcube_user.php +++ b/program/lib/Roundcube/rcube_user.php @@ -163,8 +163,16 @@ class rcube_user if (!$this->ID) return false; - $config = $this->rc->config; - $old_prefs = (array)$this->get_prefs(); + $plugin = $this->rc->plugins->exec_hook('preferences_update', array( + 'userid' => $this->ID, 'prefs' => $a_user_prefs, 'old' => (array)$this->get_prefs())); + + if (!empty($plugin['abort'])) { + return; + } + + $a_user_prefs = $plugin['prefs']; + $old_prefs = $plugin['old']; + $config = $this->rc->config; // merge (partial) prefs array with existing settings $save_prefs = $a_user_prefs + $old_prefs; -- cgit v1.2.3