MDL-33842 Filemanager dndupload - now displays error messages (including antivirus)
authorDavo Smith <git@davosmith.co.uk>
Tue, 19 Jun 2012 13:27:12 +0000 (14:27 +0100)
committerDavo Smith <git@davosmith.co.uk>
Tue, 19 Jun 2012 13:27:12 +0000 (14:27 +0100)
lib/form/dndupload.js

index 103d316..53018b9 100644 (file)
@@ -717,14 +717,6 @@ M.form_dndupload.init = function(Y, options) {
             this.callback(lastresult);
         },
 
-        /**
-         * Log any errors generated
-         */
-        add_error: function(text, errorlevel) {
-            // TODO
-            console.log(text);
-        },
-
         /**
          * Upload a single file via an AJAX call to the 'upload' repository. Automatically
          * calls do_upload as each upload completes.
@@ -748,7 +740,8 @@ M.form_dndupload.init = function(Y, options) {
                         var result = JSON.parse(xhr.responseText);
                         if (result) {
                             if (result.error) {
-                                self.add_error(result.error); // TODO add filename?
+                                self.print_msg(result.error, 'error'); // TODO add filename?
+                                self.uploadfinished();
                             } else {
                                 // Only update the filepicker if there were no errors
                                 if (result.event == 'fileexists') {
@@ -760,11 +753,10 @@ M.form_dndupload.init = function(Y, options) {
                                 result.client_id = self.options.clientid;
                             }
                         }
-                        self.processedfiles++;
                         self.do_upload(result); // continue uploading
                     } else {
-                        self.add_error(M.util.get_string('serverconnection', 'error'));
-                        this.uploadfinished();
+                        self.print_msg(M.util.get_string('serverconnection', 'error'), 'error');
+                        self.uploadfinished();
                     }
                 }
             };