From 813d58e367508740db5147a96991ab8d10aea3b9 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 8 Sep 2014 23:02:46 +0000 Subject: [PATCH] Fix file drop in Firefox by avoiding global event variable --- filemanager/inc/class.filemanager_ui.inc.php | 1 - filemanager/js/app.js | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index be0f2a0bc2..20a9fa97ec 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -459,7 +459,6 @@ class filemanager_ui '3' => 'Show hidden files', '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'])); } diff --git a/filemanager/js/app.js b/filemanager/js/app.js index bbdfbf2bb4..51c7eb35c4 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -69,6 +69,13 @@ app.classes.filemanager = AppJS.extend( 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 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. * * @param {string} row_uid UID of the row the files were dropped on - * @param {et2_nextmatch} widget widget that got the drop - * @param {array} files + * @param {Files[]} files */ - filedrop: function(row_uid, widget ,files) + filedrop: function(row_uid, files) { var self = this; var data = egw.dataGetUIDdata(row_uid);