Implemented Download button action

This commit is contained in:
Aleksander Machniak 2013-02-28 17:26:33 +01:00
parent 2ac433b375
commit b0f05f52af

View file

@ -81,6 +81,8 @@ window.rcmail && rcmail.addEventListener('init', function() {
kolab_files_list_coltypes(); kolab_files_list_coltypes();
} }
rcmail.env.file_commands = ['files-get'];
kolab_files_init(); kolab_files_init();
file_api.folder_list(); file_api.folder_list();
} }
@ -308,10 +310,8 @@ kolab_files_click_on_list = function(e)
kolab_files_list_select = function(list) kolab_files_list_select = function(list)
{ {
var selected = list.selection.length; var selected = list.selection.length;
// this.enable_command(this.env.message_commands, selected != null);
// Multi-message commands rcmail.enable_command(rcmail.env.file_commands, selected == 1);
// this.enable_command('delete', 'moveto', 'copy', list.selection.length > 0);
// reset all-pages-selection // reset all-pages-selection
// if (list.selection.length && list.selection.length != list.rowcount) // if (list.selection.length && list.selection.length != list.rowcount)
@ -377,6 +377,15 @@ rcube_webmail.prototype.files_list_update = function(head)
file_api.file_list(); file_api.file_list();
}; };
rcube_webmail.prototype.files_get = function()
{
var id = this.file_list.get_selection();
if (id = $('#rcmrow'+id).data('file')) {
file_api.file_get(id, {'force-download': true});
}
};
/**********************************************************/ /**********************************************************/
/********* Files API handler **********/ /********* Files API handler **********/
@ -501,6 +510,7 @@ function kolab_files_ui()
this.req = this.set_busy(true, 'loading'); this.req = this.set_busy(true, 'loading');
rcmail.enable_command(rcmail.env.file_commands, false);
rcmail.file_list.clear(); rcmail.file_list.clear();
this.get('file_list', params, 'file_list_response'); this.get('file_list', params, 'file_list_response');
@ -614,6 +624,18 @@ function kolab_files_ui()
} }
}; };
this.file_get = function(file, params)
{
if (!params)
params = {};
params.folder = this.env.folder;
params.token = this.env.token;
params.file = file;
rcmail.redirect(this.env.url + this.url('file_get', params));
};
// file upload request // file upload request
this.file_upload = function(form) this.file_upload = function(form)
{ {