MDL-33175 - filemanager: make dndupload icon clickable
authorDan Poltawski <dan@moodle.com>
Thu, 14 Jun 2012 05:24:10 +0000 (13:24 +0800)
committerDan Poltawski <dan@moodle.com>
Thu, 14 Jun 2012 05:25:05 +0000 (13:25 +0800)
lib/form/filemanager.js

index 3b2bd3e..3949641 100644 (file)
@@ -262,16 +262,12 @@ M.form_filemanager.init = function(Y, options) {
             var button_addfile  = this.filemanager.one('.fp-btn-add');
 
             // setup 'add file' button
-            // if maxfiles == -1, the no limit
-            button_addfile.on('click', function(e) {
-                e.preventDefault();
-                var options = this.filepicker_options;
-                options.formcallback = this.filepicker_callback;
-                // XXX: magic here, to let filepicker use filemanager scope
-                options.magicscope = this;
-                options.savepath = this.currentpath;
-                M.core_filepicker.show(Y, options);
-            }, this);
+            button_addfile.on('click', this.show_filepicker, this);
+
+            var dndarrow = this.filemanager.one('.dndupload-arrow');
+            if (dndarrow) {
+                dndarrow.on('click', this.show_filepicker, this);
+            }
 
             // setup 'make a folder' button
             if (this.options.subdirs) {
@@ -369,6 +365,18 @@ M.form_filemanager.init = function(Y, options) {
                     }
                 }, this);
         },
+
+        show_filepicker: function (e) {
+            // if maxfiles == -1, the no limit
+            e.preventDefault();
+            var options = this.filepicker_options;
+            options.formcallback = this.filepicker_callback;
+            // XXX: magic here, to let filepicker use filemanager scope
+            options.magicscope = this;
+            options.savepath = this.currentpath;
+            M.core_filepicker.show(Y, options);
+        },
+
         print_path: function() {
             var p = this.options.path;
             this.pathbar.setContent('').addClass('empty');