summaryrefslogtreecommitdiff
path: root/program/js/app.js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-06 11:11:37 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-06 11:11:37 +0100
commitbc2c4380b5b754a3b13cc7d6663b2b81d2577e2e (patch)
tree7a3c360113d21a5f7c6d0e90b252ce5965dd3589 /program/js/app.js
parentac37746c2ae187edaf38c7a660213e216f90b035 (diff)
Add attachment menu with Open and Download options (#1488975)
Diffstat (limited to 'program/js/app.js')
-rw-r--r--program/js/app.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 4011fa593..55c71d776 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -179,7 +179,8 @@ function rcube_webmail()
}
// enable general commands
- this.enable_command('close', 'logout', 'mail', 'addressbook', 'settings', 'save-pref', 'compose', 'undo', 'about', 'switch-task', true);
+ this.enable_command('close', 'logout', 'mail', 'addressbook', 'settings', 'save-pref',
+ 'compose', 'undo', 'about', 'switch-task', 'menu-open', 'menu-save', true);
if (this.env.permaurl)
this.enable_command('permaurl', 'extwin', true);
@@ -211,7 +212,7 @@ function rcube_webmail()
this.gui_objects.messagelist.parentNode.onmousedown = function(e){ return p.click_on_list(e); };
this.message_list.init();
- this.enable_command('toggle_status', 'toggle_flag', 'menu-open', 'menu-save', 'sort', true);
+ this.enable_command('toggle_status', 'toggle_flag', 'sort', true);
// load messages
this.command('list');
@@ -227,7 +228,7 @@ function rcube_webmail()
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',
+ 'print', 'load-attachment', 'download-attachment', 'show-headers', 'hide-headers', 'download',
'forward', 'forward-inline', 'forward-attachment'];
if (this.env.action == 'show' || this.env.action == 'preview') {
@@ -608,6 +609,11 @@ function rcube_webmail()
break;
case 'menu-open':
+ if (props && props.menu == 'attachmentmenu') {
+ var mimetype = this.env.attachments[props.id];
+ this.enable_command('open-attachment', mimetype && this.env.mimetypes && $.inArray(mimetype, this.env.mimetypes) >= 0);
+ }
+
case 'menu-save':
this.triggerEvent(command, {props:props});
return false;
@@ -833,11 +839,14 @@ function rcube_webmail()
break;
case 'load-attachment':
- var qstring = '_mbox='+urlencode(this.env.mailbox)+'&_uid='+this.env.uid+'&_part='+props.part;
+ case 'open-attachment':
+ case 'download-attachment':
+ var qstring = '_mbox='+urlencode(this.env.mailbox)+'&_uid='+this.env.uid+'&_part='+props,
+ mimetype = this.env.attachments[props];
// open attachment in frame if it's of a supported mimetype
- if (this.env.uid && props.mimetype && this.env.mimetypes && $.inArray(props.mimetype, this.env.mimetypes) >= 0) {
- var attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment'+this.env.uid+props.part);
+ if (command != 'download-attachment' && mimetype && this.env.mimetypes && $.inArray(mimetype, this.env.mimetypes) >= 0) {
+ var attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', 'rcubemailattachment'+this.env.uid+props);
if (attachment_win) {
setTimeout(function(){ attachment_win.focus(); }, 10);
break;