From 1e9a59ab89ed69d4bf3cd2d306e1c3f8821f4018 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 8 Apr 2014 14:38:54 +0200 Subject: Don't remove messages from list when moving to another folder in multi-folder search mode, just update the list --- program/steps/mail/list.inc | 5 +++++ program/steps/mail/move_del.inc | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'program/steps') diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index a8fc9eb8a..36c79fb29 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -101,6 +101,11 @@ $OUTPUT->set_env('current_page', $count ? $RCMAIL->storage->get_page() : 1); $OUTPUT->set_env('exists', $exists); $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count), $mbox_name); +// remove old message rows if commanded by the client +if (!empty($_REQUEST['_clear'])) { + $OUTPUT->command('clear_message_list'); +} + // add message rows rcmail_js_message_list($a_headers, false, $cols); diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index ae367b4f7..9c1acd5d2 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -60,7 +60,13 @@ if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_targe $OUTPUT->show_message('messagemoved', 'confirmation'); } - $addrows = true; + if (!empty($_POST['_refresh'])) { + // FIXME: send updated message rows instead of releading the entire list + $OUTPUT->command('refresh_list'); + } + else { + $addrows = true; + } } // delete messages else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) { -- cgit v1.2.3 From aafbe8efdca6dfef736e623dd5da83d64ae10aef Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 8 Apr 2014 15:48:27 +0200 Subject: Fix forwarding all ('*') messages of a search set --- program/js/app.js | 2 +- program/steps/mail/compose.inc | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'program/steps') diff --git a/program/js/app.js b/program/js/app.js index 81829ab13..2a7783fad 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1113,7 +1113,7 @@ function rcube_webmail() case 'forward': 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 }; + url = { _forward_uid: this.uids_to_list(uids), _mbox: this.env.mailbox, _search: this.env.search_request }; if (command == 'forward-attachment' || (!props && this.env.forward_attachment) || uids.length > 1) url._attachment = 1; this.open_compose_step(url); diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 040d81689..22ebaed8d 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -463,6 +463,11 @@ function rcmail_process_compose_params(&$COMPOSE) } } + // resolve _forward_uid=* to an absolute list of messages from a search result + if ($COMPOSE['param']['forward_uid'] == '*' && is_object($_SESSION['search'][1])) { + $COMPOSE['param']['forward_uid'] = $_SESSION['search'][1]->get(); + } + // clean HTML message body which can be submitted by URL if (!empty($COMPOSE['param']['body'])) { $COMPOSE['param']['body'] = rcmail_wash_html($COMPOSE['param']['body'], array('safe' => false, 'inline_html' => true), array()); @@ -1259,10 +1264,10 @@ function rcmail_write_forward_attachments() $index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order()); $COMPOSE['forward_uid'] = $index->get(); } - else if (strpos($COMPOSE['forward_uid'], ':')) { + else if (!is_array($COMPOSE['forward_uid']) && strpos($COMPOSE['forward_uid'], ':')) { $COMPOSE['forward_uid'] = rcube_imap_generic::uncompressMessageSet($COMPOSE['forward_uid']); } - else { + else if (is_string($COMPOSE['forward_uid'])) { $COMPOSE['forward_uid'] = explode(',', $COMPOSE['forward_uid']); } -- cgit v1.2.3 From f50a66c616bdc46ac0c568e1efdeb979477db4db Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 8 Apr 2014 16:26:56 +0200 Subject: Enable listmode switch if listing is not multi-folder --- program/js/app.js | 18 ++++++++++-------- program/steps/mail/func.inc | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'program/steps') diff --git a/program/js/app.js b/program/js/app.js index 2a7783fad..952c542a0 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3,8 +3,8 @@ | Roundcube Webmail Client Script | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2013, The Roundcube Dev Team | - | Copyright (C) 2011-2013, Kolab Systems AG | + | Copyright (C) 2005-2014, The Roundcube Dev Team | + | Copyright (C) 2011-2014, Kolab Systems AG | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -222,7 +222,7 @@ function rcube_webmail() this.gui_objects.messagelist.parentNode.onmousedown = function(e){ return p.click_on_list(e); }; this.enable_command('toggle_status', 'toggle_flag', 'sort', true); - this.enable_command('set-listmode', this.env.threads && !this.env.search_request); + this.enable_command('set-listmode', this.env.threads && !this.is_multifolder_listing()); // load messages this.command('list'); @@ -1715,7 +1715,7 @@ function rcube_webmail() case 'mail': return (this.env.mailboxes[id] && !this.env.mailboxes[id].virtual - && (this.env.mailboxes[id].id != this.env.mailbox || this.is_multifolder_search())) ? 1 : 0; + && (this.env.mailboxes[id].id != this.env.mailbox || this.is_multifolder_listing())) ? 1 : 0; case 'settings': return id != this.env.mailbox ? 1 : 0; @@ -2698,7 +2698,7 @@ function rcube_webmail() return this.folder_selector(obj, function(folder) { ref.command('move', folder); }); // exit if current or no mailbox specified - if (!mbox || (mbox == this.env.mailbox && !this.is_multifolder_search())) + if (!mbox || (mbox == this.env.mailbox && !this.is_multifolder_listing())) return; var lock = false, post_data = this.selection_post_data({_target_mbox: mbox}); @@ -2767,7 +2767,7 @@ function rcube_webmail() this._with_selected_messages = function(action, post_data, lock) { var count = 0, msg, - remove = (action == 'delete' || !this.is_multifolder_search()); + remove = (action == 'delete' || !this.is_multifolder_listing()); // update the list (remove rows, clear selection) if (this.message_list) { @@ -4273,9 +4273,10 @@ function rcube_webmail() this.env.search_mods[mbox] = mods; }; - this.is_multifolder_search = function() + this.is_multifolder_listing = function() { - return this.env.search_request && (this.env.search_scope || 'base') != 'base'; + return typeof this.env.multifolder_listing != 'undefined' ? this.env.multifolder_listing : + (this.env.search_request && (this.env.search_scope || 'base') != 'base'); } this.sent_successfully = function(type, msg, folders) @@ -7060,6 +7061,7 @@ function rcube_webmail() 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); + this.enable_command('set-listmode', this.env.threads && !this.is_multifolder_listing()); if ((response.action == 'list' || response.action == 'search') && this.message_list) { this.msglist_select(this.message_list); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index a541fca96..630086a68 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -393,6 +393,8 @@ function rcmail_js_message_list($a_headers, $insert_top=false, $a_show_cols=null $OUTPUT->command('select_folder', ''); } + $OUTPUT->set_env('multifolder_listing', $multifolder); + if (empty($a_headers)) { return; } -- cgit v1.2.3 From 188247894f6aff3a11f68bbdf94626b8bf58b852 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 8 Apr 2014 19:11:12 +0200 Subject: Make multi-folder message identifiers work with folders containing commas --- program/include/rcmail.php | 10 +++++++--- program/js/app.js | 5 +++-- program/lib/Roundcube/rcube_imap.php | 4 ++-- program/lib/Roundcube/rcube_message.php | 2 +- program/steps/mail/copy.inc | 7 +++++-- program/steps/mail/func.inc | 2 +- program/steps/mail/mark.inc | 4 +++- 7 files changed, 22 insertions(+), 12 deletions(-) (limited to 'program/steps') diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 2ccad03c6..5da181438 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -2025,8 +2025,9 @@ class rcmail extends rcube $_uid = $uids ?: rcube_utils::get_input_value('_uid', RCUBE_INPUT_GPC); $_mbox = $mbox ?: (string)rcube_utils::get_input_value('_mbox', RCUBE_INPUT_GPC); - if (is_array($uid)) { - return $uid; + // already a hash array + if (is_array($_uid) && !isset($_uid[0])) { + return $_uid; } $result = array(); @@ -2040,8 +2041,11 @@ class rcmail extends rcube } } else { + if (is_string($_uid)) + $_uid = explode(',', $_uid); + // create a per-folder UIDs array - foreach (explode(',', $_uid) as $uid) { + foreach ((array)$_uid as $uid) { list($uid, $mbox) = explode('-', $uid, 2); if (empty($mbox)) $mbox = $_mbox; diff --git a/program/js/app.js b/program/js/app.js index 952c542a0..7f19382e0 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3014,7 +3014,8 @@ function rcube_webmail() var icn_src, uid, i, len, rows = this.message_list ? this.message_list.rows : {}; - uids = String(uids).split(','); + if (typeof uids == 'string') + uids = String(uids).split(','); for (i=0, len=uids.length; i $uids) { - $copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox); + if ($mbox == $target) + $copied++; + else + $copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox); } if (!$copied) { diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 630086a68..f711da3e1 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -69,7 +69,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search']) } // remove mbox part from _uid -if (($_uid = get_input_value('_uid', RCUBE_INPUT_GPC)) && preg_match('/^\d+-[^,]+$/', $_uid)) { +if (($_uid = rcube_utils::get_input_value('_uid', RCUBE_INPUT_GPC)) && !is_array($_uid) && preg_match('/^\d+-.+/', $_uid)) { list($_uid, $mbox) = explode('-', $_uid, 2); if (isset($_GET['_uid'])) $_GET['_uid'] = $_uid; if (isset($_POST['_uid'])) $_POST['_uid'] = $_uid; diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc index e81f6c9f5..4e83f975c 100644 --- a/program/steps/mail/mark.inc +++ b/program/steps/mail/mark.inc @@ -68,7 +68,9 @@ if (($_uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) if ($flag == 'DELETED' && $read_deleted && !empty($_POST['_ruid'])) { $ruids = rcube_utils::get_input_value('_ruid', rcube_utils::INPUT_POST); - $read = $RCMAIL->storage->set_flag($ruids, 'SEEN'); + foreach (rcmail::get_uids($ruids) as $mbox => $uids) { + $read += (int)$RCMAIL->storage->set_flag($uids, 'SEEN', $mbox); + } if ($read && !$skip_deleted) { $OUTPUT->command('flag_deleted_as_read', $ruids); -- cgit v1.2.3