mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-31110 Filemanager drag and drop upload - always hide spinner, even when errors occur
This commit is contained in:
parent
f6b4ec2b4a
commit
4069ae323d
@ -435,6 +435,7 @@ $string['rpcerror'] = 'Ooops! Your MNET communication has failed! Here\'s that e
|
||||
$string['secretalreadyused'] = 'Change password confirmation link was already used, password was not changed';
|
||||
$string['sectionnotexist'] = 'This section does not exist';
|
||||
$string['sendmessage'] = 'Send message';
|
||||
$string['serverconnection'] = 'Error connecting to the server';
|
||||
$string['servicedonotexist'] = 'The service does not exist';
|
||||
$string['sessionwaiterr'] = 'Timed out while waiting for session lock.<br />Wait for your current requests to finish and try again later.';
|
||||
$string['sessioncookiesdisable'] = 'Incorrect use of require_key_login() - session cookies must be disabled!';
|
||||
|
@ -324,7 +324,6 @@ M.form_dndupload = {
|
||||
update_filemanager: function() {
|
||||
if (this.filemanager) {
|
||||
// update the filemanager that we've uploaded the files
|
||||
this.hide_progress_spinner();
|
||||
this.filemanager.filepicker_callback();
|
||||
}
|
||||
},
|
||||
@ -335,6 +334,7 @@ M.form_dndupload = {
|
||||
upload_file: function(file) {
|
||||
if (file.size > this.maxbytes && this.maxbytes > 0) {
|
||||
// Check filesize before attempting to upload
|
||||
this.hide_progress_spinner();
|
||||
alert(M.util.get_string('uploadformlimit', 'moodle')+"\n'"+file.name+"'");
|
||||
return false;
|
||||
}
|
||||
@ -348,26 +348,29 @@ M.form_dndupload = {
|
||||
var xhr = new XMLHttpRequest();
|
||||
var self = this;
|
||||
xhr.onreadystatechange = function() { // Process the server response
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var result = JSON.parse(xhr.responseText);
|
||||
if (result) {
|
||||
if (result.error) {
|
||||
self.hide_progress_spinner();
|
||||
alert(result.error);
|
||||
} else if (self.callback) {
|
||||
// Only update the filepicker if there were no errors
|
||||
self.hide_progress_spinner();
|
||||
if (result.event == 'fileexists') {
|
||||
// Do not worry about this, as we only care about the last
|
||||
// file uploaded, with the filepicker
|
||||
result.file = result.newfile.filename;
|
||||
result.url = result.newfile.url;
|
||||
if (xhr.readyState == 4) {
|
||||
self.hide_progress_spinner();
|
||||
if (xhr.status == 200) {
|
||||
var result = JSON.parse(xhr.responseText);
|
||||
if (result) {
|
||||
if (result.error) {
|
||||
alert(result.error);
|
||||
} else if (self.callback) {
|
||||
// Only update the filepicker if there were no errors
|
||||
if (result.event == 'fileexists') {
|
||||
// Do not worry about this, as we only care about the last
|
||||
// file uploaded, with the filepicker
|
||||
result.file = result.newfile.filename;
|
||||
result.url = result.newfile.url;
|
||||
}
|
||||
result.client_id = self.clientid;
|
||||
self.callback(result);
|
||||
} else {
|
||||
self.update_filemanager();
|
||||
}
|
||||
result.client_id = self.clientid;
|
||||
self.callback(result);
|
||||
} else {
|
||||
self.update_filemanager();
|
||||
}
|
||||
} else {
|
||||
alert(M.util.get_string('serverconnection', 'error'));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -315,7 +315,7 @@ FMHTML;
|
||||
array('cannotdeletefile', 'error'), array('confirmdeletefile', 'repository'),
|
||||
array('nopathselected', 'repository'), array('popupblockeddownload', 'repository'),
|
||||
array('draftareanofiles', 'repository'), array('path', 'moodle'), array('setmainfile', 'repository'),
|
||||
array('moving', 'repository'), array('files', 'moodle')
|
||||
array('moving', 'repository'), array('files', 'moodle'), array('serverconnection', 'error')
|
||||
)
|
||||
);
|
||||
$PAGE->requires->js_module($module);
|
||||
|
Loading…
x
Reference in New Issue
Block a user