MDL-31000 Added comment about the importance of repository array keys and hardened...
[moodle.git] / lib / form / dndupload.js
index 990c3a2..df0fb19 100644 (file)
@@ -98,7 +98,9 @@ M.form_dndupload = {
             // file is uploaded
             this.callback = options.formcallback;
         } else {
-            alert('dndupload: Need to define either options.filemanager or options.callback');
+            if (M.cfg.developerdebug) {
+                alert('dndupload: Need to define either options.filemanager or options.callback');
+            }
             return;
         }
 
@@ -112,10 +114,10 @@ M.form_dndupload = {
      */
     browser_supported: function() {
 
-        if (typeof FileReader=='undefined') {
+        if (typeof FileReader == 'undefined') {
             return false;
         }
-        if (typeof FormData=='undefined') {
+        if (typeof FormData == 'undefined') {
             return false;
         }
         return true;
@@ -128,9 +130,9 @@ M.form_dndupload = {
      * @param returns int id of upload repository or false if not found
      */
     get_upload_repositoryid: function(repositories) {
-         for (var id in repositories) {
-             if(repositories[id].type == "upload") {
-                 return id;
+         for (var i in repositories) {
+             if (repositories[i].type == "upload") {
+                 return repositories[i].id;
              }
          }