From d9f109b56af2015eae7aadc5e87c06365854eda0 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 11 Dec 2012 08:30:49 +0100 Subject: Allow forwarding of multiple emails (#1486854) --- program/js/app.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index 955c77ff5..4db7fa0c8 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -224,9 +224,10 @@ function rcube_webmail() this.set_button_titles(); - this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', 'forward', - 'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', 'download', - 'print', 'load-attachment', 'show-headers', 'hide-headers', 'forward-attachment']; + this.env.message_commands = ['show', 'reply', 'reply-all', 'reply-list', + 'moveto', 'copy', 'delete', 'open', 'mark', 'edit', 'viewsource', + 'print', 'load-attachment', 'show-headers', 'hide-headers', 'download', + 'forward', 'forward-inline', 'forward-attachment']; if (this.env.action == 'show' || this.env.action == 'preview') { this.enable_command(this.env.message_commands, this.env.uid); @@ -999,10 +1000,12 @@ function rcube_webmail() break; case 'forward-attachment': + case 'forward-inline': case 'forward': - if (uid = this.get_single_uid()) { - url = { _forward_uid: uid, _mbox: this.env.mailbox }; - if (command == 'forward-attachment' || (!props && this.env.forward_attachment)) + var uids = this.env.uid ? [this.env.uid] : (this.message_list ? this.message_list.get_selection() : []); + if (uids.length) { + url = { _forward_uid: this.uids_to_list(uids), _mbox: this.env.mailbox }; + if (command == 'forward-attachment' || (!props && this.env.forward_attachment) || uids.length > 1) url._attachment = 1; this.open_compose_step(url); } @@ -1526,7 +1529,7 @@ function rcube_webmail() if (selected) { // Hide certain command buttons when Drafts folder is selected if (this.env.mailbox == this.env.drafts_mailbox) - this.enable_command('reply', 'reply-all', 'reply-list', 'forward', 'forward-attachment', false); + this.enable_command('reply', 'reply-all', 'reply-list', 'forward', 'forward-attachment', 'forward-inline', false); // Disable reply-list when List-Post header is not set else { var msg = this.env.messages[list.get_single_selection()]; @@ -1535,7 +1538,7 @@ function rcube_webmail() } } // Multi-message commands - this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); + this.enable_command('delete', 'moveto', 'copy', 'mark', 'forward', 'forward-attachment', list.selection.length > 0); // reset all-pages-selection if (selected || (list.selection.length && list.selection.length != list.rowcount)) -- cgit v1.2.3 From 463ce6848da1d699031ea0cbd892e00a62fac979 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 11 Dec 2012 14:43:15 +0100 Subject: Fix bug where all messages in a folder were copied on copy action, if search was active and user choose select-all feature. Code improvements. --- program/js/app.js | 110 +++++++++++++++++++++++++++--------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index 4db7fa0c8..f599f7a64 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2553,27 +2553,18 @@ function rcube_webmail() if (mbox && typeof mbox === 'object') mbox = mbox.id; - // exit if current or no mailbox specified or if selection is empty - if (!mbox || mbox == this.env.mailbox || (!this.env.uid && (!this.message_list || !this.message_list.get_selection().length))) + // exit if current or no mailbox specified + if (!mbox || mbox == this.env.mailbox) return; - var a_uids = [], n, selection, - lock = this.display_message(this.get_label('copyingmessage'), 'loading'), - post_data = {_mbox: this.env.mailbox, _target_mbox: mbox, _from: (this.env.action ? this.env.action : '')}; + var post_data = this.selection_post_data({_target_mbox: mbox}); - if (this.env.uid) - a_uids[0] = this.env.uid; - else { - selection = this.message_list.get_selection(); - for (n in selection) { - a_uids.push(selection[n]); - } - } - - post_data._uid = this.uids_to_list(a_uids); + // exit if selection is empty + if (!post_data._uid) + return; // send request to server - this.http_post('copy', post_data, lock); + this.http_post('copy', post_data, this.display_message(this.get_label('copyingmessage'), 'loading')); }; // move selected messages to the specified mailbox @@ -2582,12 +2573,15 @@ function rcube_webmail() if (mbox && typeof mbox === 'object') mbox = mbox.id; - // exit if current or no mailbox specified or if selection is empty - if (!mbox || mbox == this.env.mailbox || (!this.env.uid && (!this.message_list || !this.message_list.get_selection().length))) + // exit if current or no mailbox specified + if (!mbox || mbox == this.env.mailbox) return; - var lock = false, - add_post = {_target_mbox: mbox, _from: (this.env.action ? this.env.action : '')}; + var lock = false, post_data = this.selection_post_data({_target_mbox: mbox}); + + // exit if selection is empty + if (!post_data._uid) + return; // show wait message if (this.env.action == 'show') @@ -2598,7 +2592,7 @@ function rcube_webmail() // Hide message command buttons until a message is selected this.enable_command(this.env.message_commands, false); - this._with_selected_messages('moveto', lock, add_post); + this._with_selected_messages('moveto', post_data, lock); }; // delete selected messages from the current mailbox @@ -2606,7 +2600,7 @@ function rcube_webmail() { var uid, i, len, trash = this.env.trash_mailbox, list = this.message_list, - selection = list ? $.merge([], list.get_selection()) : []; + selection = list.get_selection(); // exit if no mailbox specified or if selection is empty if (!this.env.uid && !selection.length) @@ -2625,7 +2619,6 @@ function rcube_webmail() return false; } // if there isn't a defined trash mailbox or we are in it - // @TODO: we should check if defined trash mailbox exists else if (!trash || this.env.mailbox == trash) this.permanently_remove_messages(); // we're in Junk folder and delete_junk is enabled @@ -2648,32 +2641,29 @@ function rcube_webmail() // delete the selected messages permanently this.permanently_remove_messages = function() { - // exit if no mailbox specified or if selection is empty - if (!this.env.uid && (!this.message_list || !this.message_list.get_selection().length)) + var post_data = this.selection_post_data(); + + // exit if selection is empty + if (!post_data._uid) return; this.show_contentframe(false); - this._with_selected_messages('delete', false, {_from: this.env.action ? this.env.action : ''}); + this._with_selected_messages('delete', post_data); }; // Send a specifc moveto/delete request with UIDs of all selected messages // @private - this._with_selected_messages = function(action, lock, post_data) + this._with_selected_messages = function(action, post_data, lock) { - var a_uids = [], count = 0, msg, lock; + var count = 0, msg; - if (typeof(post_data) != 'object') - post_data = {}; - - if (this.env.uid) - a_uids[0] = this.env.uid; - else { + // update the list (remove rows, clear selection) + if (this.message_list) { var n, id, root, roots = [], selection = this.message_list.get_selection(); for (n=0, len=selection.length; n 0) this.delete_excessive_thread_rows(); - post_data._uid = this.uids_to_list(a_uids); - post_data._mbox = this.env.mailbox; - if (!lock) { msg = action == 'moveto' ? 'movingmessage' : 'deletingmessage'; lock = this.display_message(this.get_label(msg), 'loading'); @@ -2718,22 +2701,39 @@ function rcube_webmail() this.http_post(action, post_data, lock); }; + // build post data for message delete/move/copy requests + this.selection_post_data = function(data) + { + var a_uids = this.env.uid ? this.env.uid : this.message_list.get_selection(); + + if (typeof(data) != 'object') + data = {}; + + data._uid = this.uids_to_list(a_uids); + data._mbox = this.env.mailbox; + + if (this.env.action) + data._from = this.env.action; + + // also send search request to get the right messages + if (this.env.search_request) + data._search = this.env.search_request; + + return data; + }; + // set a specific flag to one or more messages this.mark_message = function(flag, uid) { - var a_uids = [], r_uids = [], len, n, id, selection, + var a_uids = [], r_uids = [], len, n, id, list = this.message_list; if (uid) a_uids[0] = uid; else if (this.env.uid) a_uids[0] = this.env.uid; - else if (list) { - selection = list.get_selection(); - for (n=0, len=selection.length; n Date: Tue, 11 Dec 2012 15:12:59 +0100 Subject: More code unification using selection_post_data() --- program/js/app.js | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index f599f7a64..4094a67ad 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2701,17 +2701,19 @@ function rcube_webmail() this.http_post(action, post_data, lock); }; - // build post data for message delete/move/copy requests + // build post data for message delete/move/copy/flag requests this.selection_post_data = function(data) { - var a_uids = this.env.uid ? this.env.uid : this.message_list.get_selection(); - if (typeof(data) != 'object') data = {}; - data._uid = this.uids_to_list(a_uids); data._mbox = this.env.mailbox; + if (!data._uid) { + var uids = this.env.uid ? this.env.uid : this.message_list.get_selection(); + data._uid = this.uids_to_list(uids); + } + if (this.env.action) data._from = this.env.action; @@ -2777,16 +2779,12 @@ function rcube_webmail() this.toggle_read_status = function(flag, a_uids) { var i, len = a_uids.length, - post_data = {_uid: this.uids_to_list(a_uids), _flag: flag}, + post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: flag}), lock = this.display_message(this.get_label('markingmessage'), 'loading'); // mark all message rows as read/unread for (i=0; i Date: Wed, 12 Dec 2012 19:59:08 +0100 Subject: Fix so compacting of non-empty folder is possible also when messages list is empty (#1488858) --- CHANGELOG | 1 + program/js/app.js | 11 ++++++----- program/steps/mail/check_recent.inc | 4 +++- program/steps/mail/folders.inc | 1 + program/steps/mail/list.inc | 1 + program/steps/mail/move_del.inc | 7 +++---- program/steps/mail/search.inc | 1 + 7 files changed, 16 insertions(+), 10 deletions(-) (limited to 'program/js') diff --git a/CHANGELOG b/CHANGELOG index 8fd17b407..095a240d4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix so compacting of non-empty folder is possible also when messages list is empty (#1488858) - Allow forwarding of multiple emails (#1486854) - Fix big memory consumption of DB layer (#1488856) - Add workaround for IE<=8 bug where Content-Disposition:inline was ignored (#1488844) diff --git a/program/js/app.js b/program/js/app.js index 4094a67ad..b5bf1840a 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -651,13 +651,13 @@ function rcube_webmail() break; case 'expunge': - if (this.env.messagecount) + if (this.env.exists) this.expunge_mailbox(this.env.mailbox); break; case 'purge': case 'empty-mailbox': - if (this.env.messagecount) + if (this.env.exists) this.purge_mailbox(this.env.mailbox); break; @@ -2971,7 +2971,7 @@ function rcube_webmail() // test if purge command is allowed this.purge_mailbox_test = function() { - return (this.env.messagecount && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox + return (this.env.exists && (this.env.mailbox == this.env.trash_mailbox || this.env.mailbox == this.env.junk_mailbox || this.env.mailbox.match('^' + RegExp.escape(this.env.trash_mailbox) + RegExp.escape(this.env.delimiter)) || this.env.mailbox.match('^' + RegExp.escape(this.env.junk_mailbox) + RegExp.escape(this.env.delimiter)))); }; @@ -6228,7 +6228,7 @@ function rcube_webmail() case 'purge': case 'expunge': if (this.task == 'mail') { - if (!this.env.messagecount) { + if (!this.env.exists) { // clear preview pane content if (this.env.contentframe) this.show_contentframe(false); @@ -6248,7 +6248,8 @@ function rcube_webmail() this.env.qsearch = null; case 'list': if (this.task == 'mail') { - this.enable_command('show', 'expunge', 'select-all', 'select-none', (this.env.messagecount > 0)); + this.enable_command('show', 'select-all', 'select-none', this.env.messagecount > 0); + this.enable_command('expunge', this.env.exists); this.enable_command('purge', this.purge_mailbox_test()); this.enable_command('expand-all', 'expand-unread', 'collapse-all', this.env.threading && this.env.messagecount); diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc index 61693b4ed..4befbf275 100644 --- a/program/steps/mail/check_recent.inc +++ b/program/steps/mail/check_recent.inc @@ -75,13 +75,15 @@ foreach ($a_mailboxes as $mbox_name) { if (!empty($_GET['_quota'])) $OUTPUT->command('set_quota', rcmail_quota_content()); + $OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS')); + // "No-list" mode, don't get messages if (empty($_GET['_list'])) continue; // get overall message count; allow caching because rcube_storage::folder_status() did a refresh $list_mode = $RCMAIL->storage->get_threading() ? 'THREADS' : 'ALL'; - $all_count = $RCMAIL->storage->count(null, $list_mode, false, false); + $all_count = $RCMAIL->storage->count($mbox_name, $list_mode, false, false); $page = $RCMAIL->storage->get_page(); $page_size = $RCMAIL->storage->get_pagesize(); diff --git a/program/steps/mail/folders.inc b/program/steps/mail/folders.inc index c56c914cd..574d6e975 100644 --- a/program/steps/mail/folders.inc +++ b/program/steps/mail/folders.inc @@ -65,6 +65,7 @@ else if ($RCMAIL->action == 'purge') if (!empty($_REQUEST['_reload'])) { $OUTPUT->set_env('messagecount', 0); $OUTPUT->set_env('pagecount', 0); + $OUTPUT->set_env('exists', 0); $OUTPUT->command('message_list.clear'); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text(), $mbox); $OUTPUT->command('set_unread_count', $mbox, 0); diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index b433f81fc..b8c3ee021 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -95,6 +95,7 @@ $OUTPUT->set_env('messagecount', $count); $OUTPUT->set_env('pagecount', $pages); $OUTPUT->set_env('threading', $threading); $OUTPUT->set_env('current_page', $count ? $RCMAIL->storage->get_page() : 1); +$OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS')); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count), $mbox_name); $OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text()); diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index da43b4000..3e2252683 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -38,7 +38,7 @@ if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_targe if (!$moved) { // send error message - if ($_POST['_from'] != 'show') + if ($_POST['_from'] != 'show') $OUTPUT->command('list_mailbox'); rcmail_display_server_error('errormoving'); $OUTPUT->send(); @@ -59,7 +59,7 @@ else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) { if (!$del) { // send error message - if ($_POST['_from'] != 'show') + if ($_POST['_from'] != 'show') $OUTPUT->command('list_mailbox'); rcmail_display_server_error('errordeleting'); $OUTPUT->send(); @@ -111,6 +111,7 @@ else $OUTPUT->set_env('messagecount', $msg_count); $OUTPUT->set_env('current_page', $page); $OUTPUT->set_env('pagecount', $pages); + $OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox, 'EXISTS', true)); // update mailboxlist $mbox = $RCMAIL->storage->get_folder(); @@ -144,5 +145,3 @@ else // send response $OUTPUT->send(); - - diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index db5424b3b..f9b8f9e67 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -143,5 +143,6 @@ else { $OUTPUT->set_env('search_request', $search_str ? $search_request : ''); $OUTPUT->set_env('messagecount', $count); $OUTPUT->set_env('pagecount', ceil($count/$RCMAIL->storage->get_pagesize())); +$OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox_name, 'EXISTS')); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count, 1), $mbox); $OUTPUT->send(); -- cgit v1.2.3 From 5c421d9927c973049bfaea69609cdf760f8f7332 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 14 Dec 2012 13:50:39 +0100 Subject: Fix delete button regression in message view (#1488867) --- program/js/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index b5bf1840a..00a47f4b8 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2600,7 +2600,7 @@ function rcube_webmail() { var uid, i, len, trash = this.env.trash_mailbox, list = this.message_list, - selection = list.get_selection(); + selection = list ? list.get_selection() : []; // exit if no mailbox specified or if selection is empty if (!this.env.uid && !selection.length) @@ -2710,7 +2710,7 @@ function rcube_webmail() data._mbox = this.env.mailbox; if (!data._uid) { - var uids = this.env.uid ? this.env.uid : this.message_list.get_selection(); + var uids = this.env.uid ? [this.env.uid] : this.message_list.get_selection(); data._uid = this.uids_to_list(uids); } -- cgit v1.2.3 From ff4a92c8e2f11711975f9697a057cd96ce370bc5 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 14 Dec 2012 19:41:07 +0100 Subject: Fix contact copy/add-to-group operations on search result (#1488862) --- CHANGELOG | 1 + program/js/app.js | 88 +++++++++++++++++++++++------------- program/steps/addressbook/func.inc | 28 ++++++------ program/steps/addressbook/groups.inc | 13 +++--- 4 files changed, 79 insertions(+), 51 deletions(-) (limited to 'program/js') diff --git a/CHANGELOG b/CHANGELOG index 039d833c3..2deecd233 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix contact copy/add-to-group operations on search result (#1488862) - Use matching identity in MDN response (#1488864) - Fix unwanted horizontal scrollbar in message preview header (#1488866) - Fix handling of signatures on draft edit (#1488798) diff --git a/program/js/app.js b/program/js/app.js index 00a47f4b8..a0cf5f834 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1386,8 +1386,8 @@ function rcube_webmail() // over the folders for (k in this.env.folder_coords) { pos = this.env.folder_coords[k]; - if (mouse.x >= pos.x1 && mouse.x < pos.x2 && mouse.y >= pos.y1 && mouse.y < pos.y2){ - if ((check = this.check_droptarget(k))) { + if (mouse.x >= pos.x1 && mouse.x < pos.x2 && mouse.y >= pos.y1 && mouse.y < pos.y2) { + if (check = this.check_droptarget(k)) { li = this.get_folder_li(k); div = $(li.getElementsByTagName('div')[0]); @@ -1401,7 +1401,8 @@ function rcube_webmail() rcmail.command('collapse-folder', rcmail.folder_auto_expand); rcmail.drag_start(null); }, 1000); - } else if (this.folder_auto_timer) { + } + else if (this.folder_auto_timer) { clearTimeout(this.folder_auto_timer); this.folder_auto_timer = null; this.folder_auto_expand = null; @@ -1411,9 +1412,10 @@ function rcube_webmail() this.env.folder_coords[k].on = 1; this.env.last_folder_target = k; layerclass = 'draglayer' + (check > 1 ? 'copy' : 'normal'); - } else { // Clear target, otherwise drag end will trigger move into last valid droptarget - this.env.last_folder_target = null; } + // Clear target, otherwise drag end will trigger move into last valid droptarget + else + this.env.last_folder_target = null; } else if (pos.on) { $(this.get_folder_li(k)).removeClass('droptarget'); @@ -1640,27 +1642,31 @@ function rcube_webmail() this.check_droptarget = function(id) { - var allow = false, copy = false; - if (this.task == 'mail') - allow = (this.env.mailboxes[id] && this.env.mailboxes[id].id != this.env.mailbox && !this.env.mailboxes[id].virtual); - else if (this.task == 'settings') - allow = (id != this.env.mailbox); - else if (this.task == 'addressbook') { + return (this.env.mailboxes[id] && this.env.mailboxes[id].id != this.env.mailbox && !this.env.mailboxes[id].virtual) ? 1 : 0; + + if (this.task == 'settings') + return id != this.env.mailbox ? 1 : 0; + + if (this.task == 'addressbook') { if (id != this.env.source && this.env.contactfolders[id]) { + // droptarget is a group - contact add to group action if (this.env.contactfolders[id].type == 'group') { var target_abook = this.env.contactfolders[id].source; - allow = this.env.contactfolders[id].id != this.env.group && !this.env.contactfolders[target_abook].readonly; - copy = target_abook != this.env.source; + if (this.env.contactfolders[id].id != this.env.group && !this.env.contactfolders[target_abook].readonly) { + // search result may contain contacts from many sources + return (this.env.selection_sources.length > 1 || $.inArray(target_abook, this.env.selection_sources) == -1) ? 2 : 1; + } } - else { - allow = !this.env.contactfolders[id].readonly; - copy = true; + // droptarget is a (writable) addressbook - contact copy action + else if (!this.env.contactfolders[id].readonly) { + // search result may contain contacts from many sources + return (this.env.selection_sources.length > 1 || $.inArray(id, this.env.selection_sources) == -1) ? 2 : 0; } } } - return allow ? (copy ? 2 : 1) : 0; + return 0; }; this.open_window = function(url, width, height) @@ -4082,19 +4088,24 @@ function rcube_webmail() else if (this.env.contentframe) this.show_contentframe(false); - // no source = search result, we'll need to detect if any of - // selected contacts are in writable addressbook to enable edit/delete if (list.selection.length) { + // no source = search result, we'll need to detect if any of + // selected contacts are in writable addressbook to enable edit/delete + // we'll also need to know sources used in selection for copy + // and group-addmember operations (drag&drop) + this.env.selection_sources = []; if (!source) { for (n in list.selection) { sid = String(list.selection[n]).replace(/^[^-]+-/, ''); - if (sid && this.env.address_sources[sid] && !this.env.address_sources[sid].readonly) { - writable = true; - break; + if (sid && this.env.address_sources[sid]) { + writable = writable || !this.env.address_sources[sid].readonly; + this.env.selection_sources.push(sid); } } + this.env.selection_sources = $.unique(this.env.selection_sources); } else { + this.env.selection_sources.push(this.env.source); writable = !source.readonly; } } @@ -4245,22 +4256,35 @@ function rcube_webmail() // copy a contact to the specified target (group or directory) this.copy_contact = function(cid, to) { + var n, dest = to.type == 'group' ? to.source : to.id, + source = this.env.source, + group = this.env.group ? this.env.group : ''; + if (!cid) cid = this.contact_list.get_selection().join(','); - if (to.type == 'group' && to.source == this.env.source) - this.group_member_change('add', cid, to.source, to.id); - else if (to.type == 'group' && !this.env.address_sources[to.source].readonly) { - var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), - post_data = {_cid: cid, _source: this.env.source, _to: to.source, _togid: to.id, - _gid: (this.env.group ? this.env.group : '')}; + if (!cid || !this.env.address_sources[dest] || this.env.address_sources[dest].readonly) + return; - this.http_post('copy', post_data, lock); + // search result may contain contacts from many sources, but if there is only one... + if (source == '' && this.env.selection_sources.length == 1) + source = this.env.selection_sources[0]; + + // tagret is a group + if (to.type == 'group') { + if (dest == source) + this.group_member_change('add', cid, dest, to.id); + else { + var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), + post_data = {_cid: cid, _source: source, _to: dest, _togid: to.id, _gid: group}; + + this.http_post('copy', post_data, lock); + } } - else if (to.id != this.env.source && cid && this.env.address_sources[to.id] && !this.env.address_sources[to.id].readonly) { + // target is an addressbook + else if (to.id != source) { var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), - post_data = {_cid: cid, _source: this.env.source, _to: to.id, - _gid: (this.env.group ? this.env.group : '')}; + post_data = {_cid: cid, _source: source, _to: to.id, _gid: group}; this.http_post('copy', post_data, lock); } diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index fded9a819..2f47483de 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -756,7 +756,7 @@ function rcmail_contact_key($row, $sort_col) * * @return array List of contact IDs per-source */ -function rcmail_get_cids() +function rcmail_get_cids($filter = null) { // contact ID (or comma-separated list of IDs) is provided in two // forms. If _source is an empty string then the ID is a string @@ -765,24 +765,25 @@ function rcmail_get_cids() $cid = get_input_value('_cid', RCUBE_INPUT_GPC); $source = (string) get_input_value('_source', RCUBE_INPUT_GPC); + if (is_array($cid)) { + return $cid; + } + if (!preg_match('/^[a-zA-Z0-9\+\/=_-]+(,[a-zA-Z0-9\+\/=_-]+)*$/', $cid)) { return array(); } - $cid = explode(',', $cid); - $got_source = strlen($source); - $result = array(); + $cid = explode(',', $cid); + $result = array(); // create per-source contact IDs array foreach ($cid as $id) { - // if _source is not specified we'll find it from decoded ID - if (!$got_source) { - if ($sep = strrpos($id, '-')) { - $contact_id = substr($id, 0, $sep); - $source_id = substr($id, $sep+1); - if (strlen($source_id)) { - $result[(string)$source_id][] = $contact_id; - } + // get source from decoded ID + if ($sep = strrpos($id, '-')) { + $contact_id = substr($id, 0, $sep); + $source_id = substr($id, $sep+1); + if (strlen($source_id)) { + $result[(string)$source_id][] = $contact_id; } } else { @@ -790,9 +791,10 @@ function rcmail_get_cids() } } - return $result; + return $filter !== null ? $result[$filter] : $result; } + // register UI objects $OUTPUT->add_handlers(array( 'directorylist' => 'rcmail_directory_list', diff --git a/program/steps/addressbook/groups.inc b/program/steps/addressbook/groups.inc index b70453889..3b9288a2b 100644 --- a/program/steps/addressbook/groups.inc +++ b/program/steps/addressbook/groups.inc @@ -20,7 +20,7 @@ */ $source = get_input_value('_source', RCUBE_INPUT_GPC); -$CONTACTS = rcmail_contact_source($source, true); +$CONTACTS = rcmail_contact_source($source); if ($CONTACTS->readonly || !$CONTACTS->groups) { $OUTPUT->show_message('sourceisreadonly', 'warning'); @@ -28,11 +28,11 @@ if ($CONTACTS->readonly || !$CONTACTS->groups) { } if ($RCMAIL->action == 'group-addmembers') { - if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) { + if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = rcmail_get_cids($source))) { $plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source)); $CONTACTS->set_group($gid); - $num2add = count(explode(',', $plugin['ids'])); + $num2add = count($plugin['ids']); if (!$plugin['abort']) { if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + $num2add > $maxnum)) { @@ -55,7 +55,7 @@ if ($RCMAIL->action == 'group-addmembers') { } else if ($RCMAIL->action == 'group-delmembers') { - if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = get_input_value('_cid', RCUBE_INPUT_POST))) { + if (($gid = get_input_value('_gid', RCUBE_INPUT_POST)) && ($ids = rcmail_get_cids($source))) { $plugin = $RCMAIL->plugins->exec_hook('group_delmembers', array('group_id' => $gid, 'ids' => $ids, 'source' => $source)); if (!$plugin['abort']) @@ -63,10 +63,11 @@ else if ($RCMAIL->action == 'group-delmembers') { else $result = $plugin['result']; - if ($result){ + if ($result) { $OUTPUT->show_message('contactremovedfromgroup'); $OUTPUT->command('remove_group_contacts',array('source' => $source, 'gid' => $gid)); - }else{ + } + else { $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error'); } } -- cgit v1.2.3 From a2b638320425309dd9af9ec8d53b925890628783 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 17 Dec 2012 08:13:28 +0100 Subject: Fix keep-alive interval reset on AJAX request --- program/js/app.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index a0cf5f834..f1df73cee 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -6128,14 +6128,14 @@ function rcube_webmail() // send request this.log('HTTP GET: ' + url); + // reset keep-alive interval + this.start_keepalive(); + return $.ajax({ type: 'GET', url: url, data: { _unlock:(lock?lock:0) }, dataType: 'json', success: function(data){ ref.http_response(data); }, error: function(o, status, err) { ref.http_error(o, status, err, lock, action); } }); - - // reset keep-alive interval - this.start_keepalive(); }; // send a http POST request to the server @@ -6163,14 +6163,14 @@ function rcube_webmail() // send request this.log('HTTP POST: ' + url); + // reset keep-alive interval + this.start_keepalive(); + return $.ajax({ type: 'POST', url: url, data: postdata, dataType: 'json', success: function(data){ ref.http_response(data); }, error: function(o, status, err) { ref.http_error(o, status, err, lock, action); } }); - - // reset keep-alive interval - this.start_keepalive(); }; // aborts ajax request -- cgit v1.2.3 From 4fe8f923a99b1c1b26e83e3f4b1e557deb131a34 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 21 Dec 2012 13:50:18 +0100 Subject: Small optimization --- program/js/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index f1df73cee..6295aee06 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1525,16 +1525,16 @@ function rcube_webmail() if (this.preview_read_timer) clearTimeout(this.preview_read_timer); - var selected = list.get_single_selection() != null; + var selected = list.get_single_selection(); - this.enable_command(this.env.message_commands, selected); + this.enable_command(this.env.message_commands, selected != null); if (selected) { // Hide certain command buttons when Drafts folder is selected if (this.env.mailbox == this.env.drafts_mailbox) this.enable_command('reply', 'reply-all', 'reply-list', 'forward', 'forward-attachment', 'forward-inline', false); // Disable reply-list when List-Post header is not set else { - var msg = this.env.messages[list.get_single_selection()]; + var msg = this.env.messages[selected]; if (!msg.ml) this.enable_command('reply-list', false); } -- cgit v1.2.3 From 0a9d414084b5c0bef3b319afeddf7e634333a9b1 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 21 Dec 2012 14:31:35 +0100 Subject: Update changelog, set version to 6.1 --- plugins/managesieve/Changelog | 3 +++ plugins/managesieve/managesieve.php | 2 +- plugins/managesieve/package.xml | 4 ++-- program/js/app.js | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'program/js') diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index aa89e69a3..50e51a6c2 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -1,7 +1,10 @@ +* version 6.1 [2012-12-21] +----------------------------------------------------------- - Fixed filter activation/deactivation confirmation message (#1488765) - Moved rcube_* classes to /lib/Roundcube for compat. with Roundcube Framework autoloader - Fixed filter selection after filter deletion (#1488832) - Fixed compatibility with jQueryUI-1.9 +- Don't force 'stop' action on last rule in a script * version 6.0 [2012-10-03] ----------------------------------------------------------- diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index 1d8248ed2..1579d6243 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -62,7 +62,7 @@ class managesieve extends rcube_plugin "x-beenthere", ); - const VERSION = '6.0'; + const VERSION = '6.1'; const PROGNAME = 'Roundcube (Managesieve)'; const PORT = 4190; diff --git a/plugins/managesieve/package.xml b/plugins/managesieve/package.xml index e8e8102b0..d4a7af6b8 100644 --- a/plugins/managesieve/package.xml +++ b/plugins/managesieve/package.xml @@ -17,9 +17,9 @@ alec@alec.pl yes - 2012-10-03 + 2012-12-21 - 6.0 + 6.1 6.0 diff --git a/program/js/app.js b/program/js/app.js index 6295aee06..4935dce24 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -990,7 +990,7 @@ function rcube_webmail() if (uid = this.get_single_uid()) { url = {_reply_uid: uid, _mbox: this.env.mailbox}; if (command == 'reply-all') - // do reply-list, when list is detected and popup menu wasn't used + // do reply-list, when list is detected and popup menu wasn't used url._all = (!props && this.commands['reply-list'] ? 'list' : 'all'); else if (command == 'reply-list') url._all = 'list'; -- cgit v1.2.3 From 8809a1828477101ade03b261662df089e268ecb4 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 27 Dec 2012 14:58:06 +0100 Subject: Fix regression in handling of content frames (#1488884) --- program/js/app.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index 4935dce24..5b8c2cd2f 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -441,10 +441,11 @@ function rcube_webmail() this.enable_command('login', true); break; + } - default: - break; - } + // unset contentframe variable if preview_pane is enabled + if (this.env.contentframe && !$('#' + this.env.contentframe).is(':visible')) + this.env.contentframe = null; // prevent from form submit with Enter key in file input fields if (bw.ie) -- cgit v1.2.3 From 83f7077ec930952cdc9cfc8982b80cd4dad06b5f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 7 Jan 2013 14:21:25 +0100 Subject: Fix searching by date in address book (#1488888) --- CHANGELOG | 1 + program/js/app.js | 11 ++++--- program/lib/Roundcube/rcube_addressbook.php | 50 ++++++++++++++++++++++++++--- program/lib/Roundcube/rcube_contacts.php | 25 +++------------ program/lib/Roundcube/rcube_ldap.php | 17 ++-------- program/steps/addressbook/search.inc | 6 +++- 6 files changed, 65 insertions(+), 45 deletions(-) (limited to 'program/js') diff --git a/CHANGELOG b/CHANGELOG index dd249885d..fe98dd00f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix searching by date in address book (#1488888) - Improve charset detection by prioritizing charset according to user language (#1485669) - Fix handling of escaped separator in vCard file (#1488896) - Fix #countcontrols issue in IE<=8 when text is very long (#1488890) diff --git a/program/js/app.js b/program/js/app.js index 5b8c2cd2f..c627983f4 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -361,7 +361,7 @@ function rcube_webmail() if (this.gui_objects.editform) { this.enable_command('save', true); - if (this.env.action == 'add' || this.env.action == 'edit') + if (this.env.action == 'add' || this.env.action == 'edit' || this.env.action == 'search') this.init_contact_form(); } @@ -4396,10 +4396,11 @@ function rcube_webmail() { var ref = this, col; - this.set_photo_actions($('#ff_photo').val()); - - for (col in this.env.coltypes) - this.init_edit_field(col, null); + if (this.env.coltypes) { + this.set_photo_actions($('#ff_photo').val()); + for (col in this.env.coltypes) + this.init_edit_field(col, null); + } $('.contactfieldgroup .row a.deletebutton').click(function() { ref.delete_edit_field(this); diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php index 98d8f98ee..ffe35097a 100644 --- a/program/lib/Roundcube/rcube_addressbook.php +++ b/program/lib/Roundcube/rcube_addressbook.php @@ -46,6 +46,7 @@ abstract class rcube_addressbook public $sort_order = 'ASC'; public $coltypes = array('name' => array('limit'=>1), 'firstname' => array('limit'=>1), 'surname' => array('limit'=>1), 'email' => array('limit'=>1)); + protected $date_types = array(); protected $error; /** @@ -222,7 +223,6 @@ abstract class rcube_addressbook return true; } - /** * Create a new contact record * @@ -407,7 +407,6 @@ abstract class rcube_addressbook return array(); } - /** * Utility function to return all values of a certain data column * either as flat list or grouped by subtype @@ -440,7 +439,6 @@ abstract class rcube_addressbook return $out; } - /** * Normalize the given string for fulltext search. * Currently only optimized for Latin-1 characters; to be extended @@ -488,7 +486,6 @@ abstract class rcube_addressbook return $fn; } - /** * Compose the name to display in the contacts list for the given contact record. * This respects the settings parameter how to list conacts. @@ -526,5 +523,50 @@ abstract class rcube_addressbook return $fn; } + /** + * Compare search value with contact data + * + * @param string $colname Data name + * @param string|array $value Data value + * @param string $search Search value + * @param int $mode Search mode + * + * @return bool Comparision result + */ + protected function compare_search_value($colname, $value, $search, $mode) + { + // The value is a date string, for date we'll + // use only strict comparison (mode = 1) + // @TODO: partial search, e.g. match only day and month + if (in_array($colname, $this->date_types)) { + return (($value = rcube_utils::strtotime($value)) + && ($search = rcube_utils::strtotime($search)) + && date('Ymd', $value) == date('Ymd', $search)); + } + + // composite field, e.g. address + foreach ((array)$value as $val) { + $val = mb_strtolower($val); + switch ($mode) { + case 1: + $got = ($val == $search); + break; + + case 2: + $got = ($search == substr($val, 0, strlen($search))); + break; + + default: + $got = (strpos($val, $search) !== false); + } + + if ($got) { + return true; + } + } + + return false; + } + } diff --git a/program/lib/Roundcube/rcube_contacts.php b/program/lib/Roundcube/rcube_contacts.php index a98b13865..062bd1e19 100644 --- a/program/lib/Roundcube/rcube_contacts.php +++ b/program/lib/Roundcube/rcube_contacts.php @@ -45,6 +45,7 @@ class rcube_contacts extends rcube_addressbook private $fulltext_cols = array('name', 'firstname', 'surname', 'middlename', 'nickname', 'jobtitle', 'organization', 'department', 'maidenname', 'email', 'phone', 'address', 'street', 'locality', 'zipcode', 'region', 'country', 'website', 'im', 'notes'); + protected $date_types = array('birthday', 'anniversary'); // public properties public $primary_key = 'contact_id'; @@ -401,32 +402,16 @@ class rcube_contacts extends rcube_addressbook for ($i=0; $i<$pages; $i++) { $this->list_records(null, $i, true); while ($row = $this->result->next()) { - $id = $row[$this->primary_key]; + $id = $row[$this->primary_key]; $found = array(); foreach (preg_grep($regexp, array_keys($row)) as $col) { $pos = strpos($col, ':'); $colname = $pos ? substr($col, 0, $pos) : $col; $search = $post_search[$colname]; foreach ((array)$row[$col] as $value) { - // composite field, e.g. address - foreach ((array)$value as $val) { - $val = mb_strtolower($val); - switch ($mode) { - case 1: - $got = ($val == $search); - break; - case 2: - $got = ($search == substr($val, 0, strlen($search))); - break; - default: - $got = (strpos($val, $search) !== false); - break; - } - - if ($got) { - $found[$colname] = true; - break 2; - } + if ($this->compare_search_value($colname, $value, $search, $mode)) { + $found[$colname] = true; + break 2; } } } diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index d4bc669fd..700c6f60c 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -794,27 +794,14 @@ class rcube_ldap extends rcube_addressbook $this->_debug("S: ".ldap_count_entries($this->conn, $this->ldap_result)." record(s)"); // get all entries of this page and post-filter those that really match the query - $search = mb_strtolower($value); + $search = mb_strtolower($value); $entries = ldap_get_entries($this->conn, $this->ldap_result); for ($i = 0; $i < $entries['count']; $i++) { $rec = $this->_ldap2result($entries[$i]); foreach ($fields as $f) { foreach ((array)$rec[$f] as $val) { - $val = mb_strtolower($val); - switch ($mode) { - case 1: - $got = ($val == $search); - break; - case 2: - $got = ($search == substr($val, 0, strlen($search))); - break; - default: - $got = (strpos($val, $search) !== false); - break; - } - - if ($got) { + if ($this->compare_search_value($f, $val, $search, $mode)) { $this->result->add($rec); $this->result->count++; break 2; diff --git a/program/steps/addressbook/search.inc b/program/steps/addressbook/search.inc index 851325070..bbd9b9a76 100644 --- a/program/steps/addressbook/search.inc +++ b/program/steps/addressbook/search.inc @@ -300,9 +300,13 @@ function rcmail_contact_search_form($attrib) $label = isset($colprop['label']) ? $colprop['label'] : rcube_label($col); $category = $colprop['category'] ? $colprop['category'] : 'other'; - if ($ftype == 'text') + // load jquery UI datepicker for date fields + if ($colprop['type'] == 'date') + $colprop['class'] .= ($colprop['class'] ? ' ' : '') . 'datepicker'; + else if ($ftype == 'text') $colprop['size'] = $i_size; + $content = html::div('row', html::div('contactfieldlabel label', Q($label)) . html::div('contactfieldcontent', rcmail_get_edit_field('search_'.$col, '', $colprop, $ftype))); -- cgit v1.2.3 From 9a6c38e14895bd093627e12f2fcf2c6ff1e3af3c Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Fri, 11 Jan 2013 14:39:23 +0100 Subject: New feature to export only selected contacts from addressbook (by Phil Weir) --- CHANGELOG | 1 + program/js/app.js | 8 ++++++++ program/localization/en_US/labels.inc | 2 ++ program/steps/addressbook/export.inc | 23 +++++++++++++++++++++++ skins/classic/addressbook.css | 8 ++++++++ skins/classic/templates/addressbook.html | 10 ++++++++++ skins/larry/styles.css | 2 +- skins/larry/templates/addressbook.html | 12 +++++++++++- 8 files changed, 64 insertions(+), 2 deletions(-) (limited to 'program/js') diff --git a/CHANGELOG b/CHANGELOG index 25d79d1e2..ecc45c220 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Feature to export only selected contacts from addressbook (by Phil Weir) - Force autocommit mode in mysql database driver (#1488902) RELEASE 0.9-beta diff --git a/program/js/app.js b/program/js/app.js index c627983f4..2804e88df 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1090,6 +1090,12 @@ function rcube_webmail() } break; + case 'export-selected': + if (this.contact_list.rowcount > 0) { + this.goto_url('export', { _source: this.env.source, _gid: this.env.group, _cid: this.contact_list.get_selection().join(',') }); + } + break; + case 'upload-photo': this.upload_contact_photo(props || this.gui_objects.uploadform); break; @@ -4115,6 +4121,7 @@ function rcube_webmail() // thend we can enable the group-remove-selected command this.enable_command('group-remove-selected', this.env.group && list.selection.length > 0); this.enable_command('compose', this.env.group || list.selection.length > 0); + this.enable_command('export-selected', list.selection.length > 0); this.enable_command('edit', id && writable); this.enable_command('delete', list.selection.length && writable); @@ -6238,6 +6245,7 @@ function rcube_webmail() this.enable_command('compose', (uid && this.contact_list.rows[uid])); this.enable_command('delete', 'edit', writable); this.enable_command('export', (this.contact_list && this.contact_list.rowcount > 0)); + this.enable_command('export-selected', false); } case 'moveto': diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index 9deaa6677..a0b6e6a31 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -335,6 +335,8 @@ $labels['composeto'] = 'Compose mail to'; $labels['contactsfromto'] = 'Contacts $from to $to of $count'; $labels['print'] = 'Print'; $labels['export'] = 'Export'; +$labels['exportall'] = 'Export all'; +$labels['exportsel'] = 'Export selected'; $labels['exportvcards'] = 'Export contacts in vCard format'; $labels['newcontactgroup'] = 'Create new contact group'; $labels['grouprename'] = 'Rename group'; diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc index 850795c85..bf0657b74 100644 --- a/program/steps/addressbook/export.inc +++ b/program/steps/addressbook/export.inc @@ -56,6 +56,29 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search $result = new rcube_result_set($count); $result->records = array_values($records); } +// selected contacts +else if (!empty($_REQUEST['_cid'])) { + $sort_col = $RCMAIL->config->get('addressbook_sort_col', 'name'); + $records = array(); + + $cids = explode(',', get_input_value('_cid', RCUBE_INPUT_GET)); + $CONTACTS = rcmail_contact_source(null, true); + + // Get records from all sources + foreach ($cids as $cid) { + $record = $CONTACTS->get_record($cid, true); + $key = rcmail_contact_key($record, $sort_col); + $records[$key] = $record; + unset($record); + } + + ksort($records, SORT_LOCALE_STRING); + + // create resultset object + $count = count($records); + $result = new rcube_result_set($count); + $result->records = array_values($records); +} // selected directory/group else { $CONTACTS = rcmail_contact_source(null, true); diff --git a/skins/classic/addressbook.css b/skins/classic/addressbook.css index a398325b4..1bb1e2c61 100644 --- a/skins/classic/addressbook.css +++ b/skins/classic/addressbook.css @@ -67,6 +67,14 @@ background-position: -128px -32px; } +#abooktoolbar a.exportAll { + background-position: -128px 0; +} + +#abooktoolbar a.exportAllSel { + background-position: -128px -32px; +} + #abooktoolbar span.separator { width: 5px; background-position: -162px 0; diff --git a/skins/classic/templates/addressbook.html b/skins/classic/templates/addressbook.html index 74673007a..404fb2c11 100644 --- a/skins/classic/templates/addressbook.html +++ b/skins/classic/templates/addressbook.html @@ -27,7 +27,10 @@   + + + @@ -38,6 +41,13 @@ +
+
    +
  • +
  • +
+
+
  • diff --git a/skins/larry/styles.css b/skins/larry/styles.css index 9386c79d7..773ef23d4 100644 --- a/skins/larry/styles.css +++ b/skins/larry/styles.css @@ -1680,6 +1680,7 @@ ul.proplist li { } .toolbar a.button.export { + min-width: 74px; background-position: center -1054px; } @@ -1695,7 +1696,6 @@ ul.proplist li { background-position: 0 -1745px; } - a.menuselector { display: inline-block; border: 1px solid #ababab; diff --git a/skins/larry/templates/addressbook.html b/skins/larry/templates/addressbook.html index 9a9a2d747..7904f6f3a 100644 --- a/skins/larry/templates/addressbook.html +++ b/skins/larry/templates/addressbook.html @@ -13,7 +13,11 @@
    - + + + + + @@ -75,6 +79,12 @@
    +
    +
      +
    • +
    • +
    +
      -- cgit v1.2.3 From 64afb530a2c80ef54ff6495e427e86c7098df41a Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Fri, 11 Jan 2013 15:12:33 +0100 Subject: Fix opener check in extwin (avoid JS errors in IE when opener is gone); always close extwin, even if opener isn't available anymore --- program/js/app.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index 2804e88df..de0d2b71a 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3043,7 +3043,7 @@ function rcube_webmail() ac_props; // close compose step in opener - if (window.opener && opener.rcmail && opener.rcmail.env.action == 'compose') { + if (window.opener && !window.opener.closed && opener.rcmail && opener.rcmail.env.action == 'compose') { setTimeout(function(){ opener.history.back(); }, 100); this.env.opened_extwin = true; } @@ -3713,9 +3713,10 @@ function rcube_webmail() { this.display_message(msg, type); - if (this.env.extwin && window.opener && opener.rcmail) { + if (this.env.extwin) { this.lock_form(this.gui_objects.messageform); - opener.rcmail.display_message(msg, type); + if (window.opener && !window.opener.closed && opener.rcmail) + opener.rcmail.display_message(msg, type); setTimeout(function(){ window.close() }, 1000); } else { -- cgit v1.2.3 From 38b71e78790f5ee80af8f65298f5408998f1769d Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Fri, 11 Jan 2013 15:30:43 +0100 Subject: Better check for 'real' links on shift/ctrl clicks --- program/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index de0d2b71a..b1714843b 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -509,7 +509,7 @@ function rcube_webmail() return false; // let the browser handle this click (shift/ctrl usually opens the link in a new window/tab) - if ((obj && obj.href && String(obj.href).indexOf(location.href) < 0) && rcube_event.get_modifier(event)) { + if ((obj && obj.href && String(obj.href).indexOf('#') < 0) && rcube_event.get_modifier(event)) { return true; } -- cgit v1.2.3 From 0b3b66ab127fb534a6941ce89739a7a53be8d9ad Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 11 Jan 2013 19:01:43 +0100 Subject: Fix "Export selected" is inactive after contact delete (#1488906) --- program/js/app.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index b1714843b..686868697 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4227,12 +4227,10 @@ function rcube_webmail() target = win; this.show_contentframe(true); - // load dummy content - if (!cid) { - // unselect selected row(s) + // load dummy content, unselect selected row(s) + if (!cid) this.contact_list.clear_selection(); - this.enable_command('delete', 'compose', false); - } + this.enable_command('delete', 'compose', 'export-selected', cid); } else if (framed) return false; -- cgit v1.2.3 From b5b76d2ccb8e28183c078d242e1530508b2686ae Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 15 Jan 2013 18:18:11 +0100 Subject: Make sure mimetypes is an array not object in a better way --- program/js/app.js | 2 +- program/steps/mail/show.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index 686868697..71976096c 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -820,7 +820,7 @@ function rcube_webmail() var qstring = '_mbox='+urlencode(this.env.mailbox)+'&_uid='+this.env.uid+'&_part='+props.part; // open attachment in frame if it's of a supported mimetype - if (this.env.uid && props.mimetype && this.env.mimetypes && $.inArray(props.mimetype, $.map(this.env.mimetypes, function(v,k){ return v })) >= 0) { + if (this.env.uid && props.mimetype && this.env.mimetypes && $.inArray(props.mimetype, this.env.mimetypes) >= 0) { if (props.mimetype == 'text/html') qstring += '&_safe=1'; this.attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment'); diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 64e628880..3495df9c0 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -79,7 +79,7 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) { } } - $OUTPUT->set_env('mimetypes', $mimetypes); + $OUTPUT->set_env('mimetypes', array_values($mimetypes)); if ($CONFIG['drafts_mbox']) $OUTPUT->set_env('drafts_mailbox', $CONFIG['drafts_mbox']); -- cgit v1.2.3 From e24eba0fc5c45d0a42296ae5ddccc02556afda42 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 18 Jan 2013 18:22:32 +0100 Subject: DOn't use deprecated jQuery.browser, CS fixes (tabs to spaces) --- program/js/googiespell.js | 276 +++++++++++++++++++++++----------------------- 1 file changed, 138 insertions(+), 138 deletions(-) (limited to 'program/js') diff --git a/program/js/googiespell.js b/program/js/googiespell.js index 478858bac..9832116dd 100644 --- a/program/js/googiespell.js +++ b/program/js/googiespell.js @@ -30,16 +30,16 @@ function GoogieSpell(img_dir, server_url, has_dict) GOOGIE_CUR_LANG = cookie_value != null ? cookie_value : GOOGIE_DEFAULT_LANG; this.array_keys = function(arr) { - var res = []; - for (var key in arr) { res.push([key]); } - return res; + var res = []; + for (var key in arr) { res.push([key]); } + return res; } this.img_dir = img_dir; this.server_url = server_url; this.org_lang_to_word = { - "da": "Dansk", "de": "Deutsch", "en": "English", + "da": "Dansk", "de": "Deutsch", "en": "English", "es": "Español", "fr": "Français", "it": "Italiano", "nl": "Nederlands", "pl": "Polski", "pt": "Português", "ru": "Русский", "fi": "Suomi", "sv": "Svenska" @@ -96,8 +96,8 @@ function GoogieSpell(img_dir, server_url, has_dict) $(document).bind('click', function(e) { var target = $(e.target); if(target.attr('googie_action_btn') != '1' && ref.isLangWindowShown()) - ref.hideLangWindow(); - if(target.attr('googie_action_btn') != '1' && ref.isErrorWindowShown()) + ref.hideLangWindow(); + if(target.attr('googie_action_btn') != '1' && ref.isErrorWindowShown()) ref.hideErrorWindow(); }); @@ -225,8 +225,8 @@ this.escapeSpecial = function(val) this.createXMLReq = function (text) { return '' - + '' - + '' + text + ''; + + '' + + '' + text + ''; }; this.spellCheck = function(ignore) @@ -237,27 +237,27 @@ this.spellCheck = function(ignore) ref = this; $.ajax({ type: 'POST', url: this.getUrl(), data: this.createXMLReq(req_text), dataType: 'text', - error: function(o) { + error: function(o) { if (ref.custom_ajax_error) - ref.custom_ajax_error(ref); + ref.custom_ajax_error(ref); else - alert('An error was encountered on the server. Please try again later.'); + alert('An error was encountered on the server. Please try again later.'); if (ref.main_controller) { - $(ref.spell_span).remove(); - ref.removeIndicator(); + $(ref.spell_span).remove(); + ref.removeIndicator(); } ref.checkSpellingState(); - }, + }, success: function(data) { - ref.processData(data); - if (!ref.results.length) { - if (!ref.custom_no_spelling_error) - ref.flashNoSpellingErrorState(); - else - ref.custom_no_spelling_error(ref); - } - ref.removeIndicator(); - } + ref.processData(data); + if (!ref.results.length) { + if (!ref.custom_no_spelling_error) + ref.flashNoSpellingErrorState(); + else + ref.custom_no_spelling_error(ref); + } + ref.removeIndicator(); + } }); }; @@ -269,14 +269,14 @@ this.learnWord = function(word, id) req_text = '' + word + ''; $.ajax({ type: 'POST', url: this.getUrl(), data: req_text, dataType: 'text', - error: function(o) { + error: function(o) { if (ref.custom_ajax_error) - ref.custom_ajax_error(ref); + ref.custom_ajax_error(ref); else - alert('An error was encountered on the server. Please try again later.'); - }, + alert('An error was encountered on the server. Please try again later.'); + }, success: function(data) { - } + } }); }; @@ -350,9 +350,9 @@ this.parseResult = function(r_text) var only_text = matched_c[i].replace(/<[^>]*>/g, ''), split_t = only_text.split(re_split_text); for (var k=0; k < split_t.length; k++) { - if(split_t[k] != '') - item['suggestions'].push(split_t[k]); - } + if(split_t[k] != '') + item['suggestions'].push(split_t[k]); + } results.push(item); } @@ -363,8 +363,8 @@ this.processData = function(data) { this.results = this.parseResult(data); if (this.results.length) { - this.showErrorsInIframe(); - this.resumeEditingState(); + this.showErrorsInIframe(); + this.resumeEditingState(); } }; @@ -414,7 +414,7 @@ this.createListSeparator = function() tr = document.createElement('tr'); $(td).html(' ').attr('googie_action_btn', '1') - .css({'cursor': 'default', 'font-size': '3px', 'border-top': '1px solid #ccc', 'padding-top': '3px'}); + .css({'cursor': 'default', 'font-size': '3px', 'border-top': '1px solid #ccc', 'padding-top': '3px'}); tr.appendChild(td); return tr; @@ -493,10 +493,10 @@ this.showErrorWindow = function(elm, id) $(item).attr('googie_action_btn', '1').css('cursor', 'default') .mouseover(ref.item_onmouseover) .mouseout(ref.item_onmouseout) - .click(function(e) { - ref.learnWord(elm, id); - ref.ignoreError(elm, id); - }); + .click(function(e) { + ref.learnWord(elm, id); + ref.ignoreError(elm, id); + }); item.appendChild(dummy); row.appendChild(item); @@ -538,14 +538,14 @@ this.showErrorWindow = function(elm, id) revert = document.createElement('td'), rev_span = document.createElement('span'); - $(rev_span).addClass('googie_list_revert').html(this.lang_revert + ' ' + old_value); + $(rev_span).addClass('googie_list_revert').html(this.lang_revert + ' ' + old_value); $(revert).mouseover(this.item_onmouseover).mouseout(this.item_onmouseout) - .click(function(e) { - ref.updateOrginalText(offset, elm.innerHTML, old_value, id); - $(elm).removeAttr('is_corrected').css('color', '#b91414').html(old_value); - ref.hideErrorWindow(); - }); + .click(function(e) { + ref.updateOrginalText(offset, elm.innerHTML, old_value, id); + $(elm).removeAttr('is_corrected').css('color', '#b91414').html(old_value); + ref.hideErrorWindow(); + }); revert.appendChild(rev_span); revert_row.appendChild(revert); @@ -557,7 +557,7 @@ this.showErrorWindow = function(elm, id) edit = document.createElement('td'), edit_input = document.createElement('input'), ok_pic = document.createElement('img'), - edit_form = document.createElement('form'); + edit_form = document.createElement('form'); var onsub = function () { if (edit_input.value != '') { @@ -565,34 +565,34 @@ this.showErrorWindow = function(elm, id) ref.saveOldValue(elm, elm.innerHTML); ref.updateOrginalText(offset, elm.innerHTML, edit_input.value, id); - $(elm).attr('is_corrected', true).css('color', 'green').html(edit_input.value); + $(elm).attr('is_corrected', true).css('color', 'green').html(edit_input.value); ref.hideErrorWindow(); } return false; }; - $(edit_input).width(120).css({'margin': 0, 'padding': 0}); - $(edit_input).val(elm.innerHTML).attr('googie_action_btn', '1'); - $(edit).css('cursor', 'default').attr('googie_action_btn', '1'); + $(edit_input).width(120).css({'margin': 0, 'padding': 0}); + $(edit_input).val(elm.innerHTML).attr('googie_action_btn', '1'); + $(edit).css('cursor', 'default').attr('googie_action_btn', '1'); - $(ok_pic).attr('src', this.img_dir + 'ok.gif') - .width(32).height(16) - .css({'cursor': 'pointer', 'margin-left': '2px', 'margin-right': '2px'}) - .click(onsub); + $(ok_pic).attr('src', this.img_dir + 'ok.gif') + .width(32).height(16) + .css({'cursor': 'pointer', 'margin-left': '2px', 'margin-right': '2px'}) + .click(onsub); $(edit_form).attr('googie_action_btn', '1') - .css({'margin': 0, 'padding': 0, 'cursor': 'default', 'white-space': 'nowrap'}) - .submit(onsub); + .css({'margin': 0, 'padding': 0, 'cursor': 'default', 'white-space': 'nowrap'}) + .submit(onsub); - edit_form.appendChild(edit_input); - edit_form.appendChild(ok_pic); + edit_form.appendChild(edit_input); + edit_form.appendChild(ok_pic); edit.appendChild(edit_form); edit_row.appendChild(edit); list.appendChild(edit_row); // Append extra menu items if (this.extra_menu_items.length > 0) - list.appendChild(this.createListSeparator()); + list.appendChild(this.createListSeparator()); var loop = function(i) { if (i < ref.extra_menu_items.length) { @@ -602,12 +602,12 @@ this.showErrorWindow = function(elm, id) var e_row = document.createElement('tr'), e_col = document.createElement('td'); - $(e_col).html(e_elm[0]) + $(e_col).html(e_elm[0]) .mouseover(ref.item_onmouseover) - .mouseout(ref.item_onmouseout) - .click(function() { return e_elm[1](elm, ref) }); + .mouseout(ref.item_onmouseout) + .click(function() { return e_elm[1](elm, ref) }); - e_row.appendChild(e_col); + e_row.appendChild(e_col); list.appendChild(e_row); } loop(i+1); @@ -619,7 +619,7 @@ this.showErrorWindow = function(elm, id) //Close button if (this.use_close_btn) { - list.appendChild(this.createCloseButton(this.hideErrorWindow)); + list.appendChild(this.createCloseButton(this.hideErrorWindow)); } } @@ -637,17 +637,17 @@ this.showErrorWindow = function(elm, id) $(this.error_window).css({'top': top+'px', 'left': left+'px'}).show(); // Dummy for IE - dropdown bug fix - if ($.browser.msie) { - if (!this.error_window_iframe) { + if (document.all && !window.opera) { + if (!this.error_window_iframe) { var iframe = $('