From 9a0153324eeb1f0e808cb1a063d1f37d49ad48e2 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 15 Dec 2013 10:01:38 +0100 Subject: Implemented menu actions to copy/move messages, added folder-selector widget (#1484086) --- program/js/app.js | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 107 insertions(+), 6 deletions(-) (limited to 'program/js') diff --git a/program/js/app.js b/program/js/app.js index cbe61ab4a..138fcbb13 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -842,14 +842,14 @@ function rcube_webmail() case 'move': case 'moveto': // deprecated if (this.task == 'mail') - this.move_messages(props); + this.move_messages(props, obj); else if (this.task == 'addressbook') this.move_contacts(props); break; case 'copy': if (this.task == 'mail') - this.copy_messages(props); + this.copy_messages(props, obj); else if (this.task == 'addressbook') this.copy_contacts(props); break; @@ -1411,8 +1411,6 @@ function rcube_webmail() this.drag_start = function(list) { - var model = this.task == 'mail' ? this.env.mailboxes : this.env.contactfolders; - this.drag_active = true; if (this.preview_timer) @@ -2612,10 +2610,12 @@ function rcube_webmail() }; // copy selected messages to the specified mailbox - this.copy_messages = function(mbox) + this.copy_messages = function(mbox, obj) { if (mbox && typeof mbox === 'object') mbox = mbox.id; + else if (!mbox) + return this.folder_selector(obj, function(folder) { ref.command('copy', folder); }); // exit if current or no mailbox specified if (!mbox || mbox == this.env.mailbox) @@ -2632,10 +2632,12 @@ function rcube_webmail() }; // move selected messages to the specified mailbox - this.move_messages = function(mbox) + this.move_messages = function(mbox, obj) { if (mbox && typeof mbox === 'object') mbox = mbox.id; + else if (!mbox) + return this.folder_selector(obj, function(folder) { ref.command('move', folder); }); // exit if current or no mailbox specified if (!mbox || mbox == this.env.mailbox) @@ -6553,6 +6555,105 @@ function rcube_webmail() elem.onclick = function() { rcmail.command('show-headers', '', elem); }; }; + // create folder selector popup, position and display it + this.folder_selector = function(obj, callback) + { + var container = this.folder_selector_element; + + if (!container) { + var rows = [], + delim = this.env.delimiter, + ul = $('