Fix file drop in Firefox by avoiding global event variable

This commit is contained in:
Nathan Gray 2014-09-08 23:02:46 +00:00
parent 4e6c5c3a1f
commit 813d58e367
2 changed files with 9 additions and 4 deletions

View File

@ -459,7 +459,6 @@ class filemanager_ui
'3' => 'Show hidden files', '3' => 'Show hidden files',
'0' => 'Files from subdirectories', '0' => 'Files from subdirectories',
); );
$tpl->setElementAttribute('nm', 'onfiledrop', 'app.filemanager.filedrop');
$tpl->exec('filemanager.filemanager_ui.index',$content,$sel_options,$readonlys,array('nm' => $content['nm'])); $tpl->exec('filemanager.filemanager_ui.index',$content,$sel_options,$readonlys,array('nm' => $content['nm']));
} }

View File

@ -69,6 +69,13 @@ app.classes.filemanager = AppJS.extend(
this.path_widget = this.et2.getWidgetById('path'); this.path_widget = this.et2.getWidgetById('path');
if(this.et2.getWidgetById('nm'))
{
// Legacy JS only supports 2 arguments (event and widget), so set
// to the actual function here
this.et2.getWidgetById('nm').set_onfiledrop(jQuery.proxy(this.filedrop, this));
}
// get clipboard from browser localstore and update button tooltips // get clipboard from browser localstore and update button tooltips
if (typeof window.localStorage != 'undefined' && typeof window.localStorage[this.clipboard_localstore_key] != 'undefined') if (typeof window.localStorage != 'undefined' && typeof window.localStorage[this.clipboard_localstore_key] != 'undefined')
{ {
@ -580,10 +587,9 @@ app.classes.filemanager = AppJS.extend(
* This is a callback from nextmatch to prevent the default link action, and just upload instead. * This is a callback from nextmatch to prevent the default link action, and just upload instead.
* *
* @param {string} row_uid UID of the row the files were dropped on * @param {string} row_uid UID of the row the files were dropped on
* @param {et2_nextmatch} widget widget that got the drop * @param {Files[]} files
* @param {array} files
*/ */
filedrop: function(row_uid, widget ,files) filedrop: function(row_uid, files)
{ {
var self = this; var self = this;
var data = egw.dataGetUIDdata(row_uid); var data = egw.dataGetUIDdata(row_uid);