summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js68
1 files changed, 63 insertions, 5 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 87ee76c8f..7c86bb0e8 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -197,7 +197,7 @@ function rcube_webmail()
if (this.env.action=='show' || this.env.action=='preview')
{
- this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete',
+ this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete',
'open', 'mark', 'edit', 'viewsource', 'download', 'print', 'load-attachment', 'load-headers', true);
if (this.env.next_uid)
@@ -674,6 +674,11 @@ function rcube_webmail()
this.copy_contact(null, props);
break;
+ case 'copy':
+ if (this.task == 'mail')
+ this.copy_messages(props);
+ break;
+
case 'mark':
if (props)
this.mark_message(props);
@@ -1194,10 +1199,14 @@ function rcube_webmail()
// handle mouse release when dragging
if (this.drag_active && model && this.env.last_folder_target) {
+ var mbox = model[this.env.last_folder_target].id;
+
$(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget');
- this.command('moveto', model[this.env.last_folder_target].id);
this.env.last_folder_target = null;
list.draglayer.hide();
+
+ if (!this.drag_menu(e, mbox))
+ this.command('moveto', mbox);
}
// reset 'pressed' buttons
@@ -1209,6 +1218,29 @@ function rcube_webmail()
}
};
+ this.drag_menu = function(e, mbox)
+ {
+ var modkey = rcube_event.get_modifier(e);
+ var menu = $('#'+this.gui_objects.message_dragmenu);
+
+ if (menu && modkey == SHIFT_KEY) {
+ var pos = rcube_event.get_mouse_pos(e);
+ this.env.drag_mbox = mbox;
+ menu.css({top: (pos.y-10)+'px', left: (pos.x-10)+'px'}).show();
+ return true;
+ }
+ };
+
+ this.drag_menu_action = function(action)
+ {
+ var menu = $('#'+this.gui_objects.message_dragmenu);
+ if (menu) {
+ menu.hide();
+ }
+ this.command(action, this.env.drag_mbox);
+ this.env.drag_mbox = null;
+ };
+
this.drag_start = function(list)
{
var model = this.task == 'mail' ? this.env.mailboxes : this.env.address_sources;
@@ -1389,12 +1421,12 @@ function rcube_webmail()
{
this.enable_command('reply', 'reply-all', 'forward', false);
this.enable_command('show', 'print', 'open', 'edit', 'download', 'viewsource', selected);
- this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false));
+ this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false));
}
else
{
this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', 'edit', 'open', 'download', 'viewsource', selected);
- this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false));
+ this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false));
}
// start timer for message preview (wait for double click)
@@ -2121,6 +2153,32 @@ function rcube_webmail()
$(row.obj).removeClass('unroot');
};
+ // copy selected messages to the specified mailbox
+ this.copy_messages = function(mbox)
+ {
+ // 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)))
+ return;
+
+ var add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : '');
+ var a_uids = new Array();
+
+ if (this.env.uid)
+ a_uids[0] = this.env.uid;
+ else
+ {
+ var selection = this.message_list.get_selection();
+ var id;
+ for (var n=0; n<selection.length; n++) {
+ id = selection[n];
+ a_uids[a_uids.length] = id;
+ }
+ }
+
+ // send request to server
+ this.http_post('copy', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, false);
+ };
+
// move selected messages to the specified mailbox
this.move_messages = function(mbox)
{
@@ -4625,7 +4683,7 @@ function rcube_webmail()
if (this.env.contentframe)
this.show_contentframe(false);
// disable commands useless when mailbox is empty
- this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete',
+ this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete',
'mark', 'viewsource', 'open', 'edit', 'download', 'print', 'load-attachment',
'purge', 'expunge', 'select-all', 'select-none', 'sort',
'expand-all', 'expand-unread', 'collapse-all', false);