diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-09-27 08:27:02 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-09-27 08:27:02 +0200 |
commit | 700dc66c679f0ae6e16c9d016a15bee4269371e6 (patch) | |
tree | 21f30c64e3f2559d015777ec7798855d32be24b5 /plugins/zipdownload/zipdownload.js | |
parent | 18df6f38adb9fb067af104e4cf9484904bf49365 (diff) | |
parent | dc8f292b215719506c2ab0abd8429f4c5ec5c0ed (diff) |
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'plugins/zipdownload/zipdownload.js')
-rw-r--r-- | plugins/zipdownload/zipdownload.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/zipdownload/zipdownload.js b/plugins/zipdownload/zipdownload.js new file mode 100644 index 000000000..080dcd9e3 --- /dev/null +++ b/plugins/zipdownload/zipdownload.js @@ -0,0 +1,33 @@ +/** + * ZipDownload plugin script + */ + +function rcmail_zipmessages() { + if (rcmail.message_list && rcmail.message_list.get_selection().length > 1) { + rcmail.goto_url('plugin.zipdownload.zip_messages', '_mbox=' + urlencode(rcmail.env.mailbox) + '&_uid=' + rcmail.message_list.get_selection().join(',')); + } +} + +$(document).ready(function() { + if (window.rcmail) { + rcmail.addEventListener('init', function(evt) { + // register command (directly enable in message view mode) + rcmail.register_command('plugin.zipdownload.zip_folder', function() { + rcmail.goto_url('plugin.zipdownload.zip_folder', '_mbox=' + urlencode(rcmail.env.mailbox)); + }, rcmail.env.messagecount > 0); + + if (rcmail.message_list && rcmail.env.zipdownload_selection) { + rcmail.message_list.addEventListener('select', function(list) { + rcmail.enable_command('download', list.get_selection().length > 0); + }); + + // check in contextmenu plugin exists and if so allow multiple message download + if (rcmail.contextmenu_disable_multi) + rcmail.contextmenu_disable_multi.splice($.inArray('#download', rcmail.contextmenu_disable_multi), 1); + } + }); + + rcmail.addEventListener('listupdate', function(props) { rcmail.enable_command('plugin.zipdownload.zip_folder', rcmail.env.messagecount > 0); } ); + rcmail.addEventListener('beforedownload', function(props) { rcmail_zipmessages(); } ); + } +});
\ No newline at end of file |