Commit 8a8bcf28 by Julian Arni

remove repeated warnings

parent ef0828fc
...@@ -67,29 +67,18 @@ $('#fileupload').fileupload({ ...@@ -67,29 +67,18 @@ $('#fileupload').fileupload({
autoUpload: false, autoUpload: false,
options: {
acceptFileTypes: /(\.|\/)tar\.gz$/i ,
processQueue: [{
action: 'validate',
acceptFileTypes: '@'
}]
},
add: function(e, data) { add: function(e, data) {
submitBtn.unbind('click');
var file = data.files[0]; var file = data.files[0];
if (file.type == "application/x-gzip") { if (file.type == "application/x-gzip") {
submitBtn.click(function(e){ submitBtn.click(function(e){
e.preventDefault(); e.preventDefault();
submitBtn.hide();
data.submit().complete(function(result, textStatus, xhr) { data.submit().complete(function(result, textStatus, xhr) {
if (result.status != 200) { if (result.status != 200) {
alert('${_("Your import has failed.")}\n\n' + alert('${_("Your import has failed.")}\n\n' + JSON.parse(result.responseText)["ErrMsg"]);
JSON.parse(result.responseText)["ErrMsg"]);
submitBtn.show(); submitBtn.show();
bar.hide(); bar.hide();
} else {
bar.hide()
alert('${_("Your import was successful.")}');
window.location = '${successful_import_redirect_url}';
} }
}); });
}); });
...@@ -109,19 +98,7 @@ $('#fileupload').fileupload({ ...@@ -109,19 +98,7 @@ $('#fileupload').fileupload({
alert('${_("Your import was successful.")}'); alert('${_("Your import was successful.")}');
window.location = '${successful_import_redirect_url}'; window.location = '${successful_import_redirect_url}';
}, },
processActions: { sequentialUploads: true
validate: function(data, options) {
var dfdata = $.Deferred(),
file = data.files[data.index];
if (!options.acceptFileTypes.test(file.type)) {
file.error = 'Invalid file type: must be a tar.gz file!';
dfdata.rejectWith(this, [data]);
} else {
dfdata.resolveWith(this, [data]);
}
return dfdata.promise();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment