Toggle save as for multiple based on selection (no directory) and browser support

This commit is contained in:
Nathan Gray 2014-06-23 22:41:34 +00:00
parent d0b80697c2
commit 4d5b7540bd
2 changed files with 19 additions and 1 deletions

View File

@ -125,10 +125,11 @@ class filemanager_ui
'saveas' => array( 'saveas' => array(
'caption' => lang('Save as'), 'caption' => lang('Save as'),
'group' => $group, 'group' => $group,
'allowOnMultiple' => false, 'allowOnMultiple' => true,
'icon' => 'filesave', 'icon' => 'filesave',
'onExecute' => 'javaScript:app.filemanager.force_download', 'onExecute' => 'javaScript:app.filemanager.force_download',
'disableClass' => 'isDir', 'disableClass' => 'isDir',
'enabled' => 'javaScript:app.filemanager.is_multiple_allowed'
), ),
'edit' => array( 'edit' => array(
'caption' => lang('Edit settings'), 'caption' => lang('Edit settings'),

View File

@ -477,6 +477,23 @@ app.classes.filemanager = AppJS.extend(
return false; return false;
}, },
/**
* Check to see if the browser supports downloading multiple files
* (using a tag download attribute) to enable/disable the context menu
*
* @param {egwAction} action
* @param {egwActionObject[]} selected
*/
is_multiple_allowed: function(action, selected)
{
var allowed = typeof document.createElement('a').download != "undefined";
if(typeof action == "undefined") return allowed;
return (allowed || selected.length <= 1) && action.not_disableClass.apply(action, arguments);
},
/** /**
* Change directory * Change directory
* *