summaryrefslogtreecommitdiff
path: root/program/js/app.js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-04-10 08:41:34 +0200
committerAleksander Machniak <alec@alec.pl>2014-04-10 08:41:34 +0200
commiteddaf0b5f68c9863181b62db33bc468d38071e8a (patch)
tree16028e6f44573377ba901f097d64e97b1b79f6c2 /program/js/app.js
parent70c0d256841aa736a3f4a74a345ec4b0dfcdad78 (diff)
parent39ca69b0072a618c0ccc112a016a44970c6667f7 (diff)
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'program/js/app.js')
-rw-r--r--program/js/app.js82
1 files changed, 52 insertions, 30 deletions
diff --git a/program/js/app.js b/program/js/app.js
index e81abceb4..7f19382e0 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');
@@ -707,7 +707,7 @@ function rcube_webmail()
break;
case 'list':
- // re-send for the selected folder
+ // re-send search query for the selected folder
if (props && props != '' && this.env.search_request && this.gui_objects.qsearchbox.value) {
var oldmbox = this.env.search_scope == 'all' ? '*' : this.env.mailbox;
this.env.search_mods[props] = this.env.search_mods[oldmbox]; // copy search mods from active search
@@ -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);
@@ -1713,7 +1713,9 @@ function rcube_webmail()
{
switch (this.task) {
case 'mail':
- return (this.env.mailboxes[id] && this.env.mailboxes[id].id != this.env.mailbox && !this.env.mailboxes[id].virtual) ? 1 : 0;
+ return (this.env.mailboxes[id]
+ && !this.env.mailboxes[id].virtual
+ && (this.env.mailboxes[id].id != this.env.mailbox || this.is_multifolder_listing())) ? 1 : 0;
case 'settings':
return id != this.env.mailbox ? 1 : 0;
@@ -2191,8 +2193,16 @@ function rcube_webmail()
this.http_request('search', this.search_params(false, filter), lock);
};
+ // reload the current message listing
+ this.refresh_list = function()
+ {
+ this.list_mailbox(this.env.mailbox, this.env.current_page || 1, null, { _clear:1 }, true);
+ if (this.message_list)
+ this.message_list.clear_selection();
+ };
+
// list messages of a specific mailbox
- this.list_mailbox = function(mbox, page, sort, url)
+ this.list_mailbox = function(mbox, page, sort, url, update_only)
{
var win, target = window;
@@ -2217,15 +2227,17 @@ function rcube_webmail()
this.select_all_mode = false;
}
- // unselect selected messages and clear the list and message data
- this.clear_message_list();
+ if (!update_only) {
+ // unselect selected messages and clear the list and message data
+ this.clear_message_list();
- if (mbox != this.env.mailbox || (mbox == this.env.mailbox && !page && !sort))
- url._refresh = 1;
+ if (mbox != this.env.mailbox || (mbox == this.env.mailbox && !page && !sort))
+ url._refresh = 1;
- this.select_folder(mbox, '', true);
- this.unmark_folder(mbox, 'recent', '', true);
- this.env.mailbox = mbox;
+ this.select_folder(mbox, '', true);
+ this.unmark_folder(mbox, 'recent', '', true);
+ this.env.mailbox = mbox;
+ }
// load message list remotely
if (this.gui_objects.messagelist) {
@@ -2259,20 +2271,17 @@ function rcube_webmail()
};
// send remote request to load message list
- this.list_mailbox_remote = function(mbox, page, post_data)
+ this.list_mailbox_remote = function(mbox, page, url)
{
- // clear message list first
- this.message_list.clear();
-
var lock = this.set_busy(true, 'loading');
- if (typeof post_data != 'object')
- post_data = {};
- post_data._mbox = mbox;
+ if (typeof url != 'object')
+ url = {};
+ url._mbox = mbox;
if (page)
- post_data._page = page;
+ url._page = page;
- this.http_request('list', post_data, lock);
+ this.http_request('list', url, lock);
};
// removes messages that doesn't exists from list selection array
@@ -2689,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.env.search_request || this.env.search_scope == 'base')))
+ if (!mbox || (mbox == this.env.mailbox && !this.is_multifolder_listing()))
return;
var lock = false, post_data = this.selection_post_data({_target_mbox: mbox});
@@ -2757,7 +2766,8 @@ function rcube_webmail()
// @private
this._with_selected_messages = function(action, post_data, lock)
{
- var count = 0, msg;
+ var count = 0, msg,
+ remove = (action == 'delete' || !this.is_multifolder_listing());
// update the list (remove rows, clear selection)
if (this.message_list) {
@@ -2774,10 +2784,11 @@ function rcube_webmail()
roots.push(root);
}
}
- this.message_list.remove_row(id, (this.env.display_next && n == selection.length-1));
+ if (remove)
+ this.message_list.remove_row(id, (this.env.display_next && n == selection.length-1));
}
// make sure there are no selected rows
- if (!this.env.display_next)
+ if (!this.env.display_next && remove)
this.message_list.clear_selection();
// update thread tree icons
for (n=0, len=roots.length; n<len; n++) {
@@ -2788,9 +2799,12 @@ function rcube_webmail()
if (count < 0)
post_data._count = (count*-1);
// remove threads from the end of the list
- else if (count > 0)
+ else if (count > 0 && remove)
this.delete_excessive_thread_rows();
+ if (!remove)
+ post_data._refresh = 1;
+
if (!lock) {
msg = action == 'move' ? 'movingmessage' : 'deletingmessage';
lock = this.display_message(this.get_label(msg), 'loading');
@@ -3000,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<len; i++) {
uid = uids[i];
@@ -3013,7 +3028,7 @@ function rcube_webmail()
// with select_all mode checking
this.uids_to_list = function(uids)
{
- return this.select_all_mode ? '*' : uids.join(',');
+ return this.select_all_mode ? '*' : (uids.length <= 1 ? uids.join(',') : uids);
};
// Sets title of the delete button
@@ -4259,6 +4274,12 @@ function rcube_webmail()
this.env.search_mods[mbox] = mods;
};
+ this.is_multifolder_listing = function()
+ {
+ 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)
{
this.display_message(msg, type);
@@ -7041,6 +7062,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);