1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

[file upload] modified fileupload-ui.js to show error msg in the upload popup

This commit is contained in:
llj
2013-11-27 11:02:18 +08:00
parent 44b656d05f
commit 3360cc6780
2 changed files with 14 additions and 4 deletions

View File

@@ -143,7 +143,10 @@
data.context.each(function (index) {
var file = ($.isArray(data.result) &&
data.result[index]) || {error: 'emptyResult'};
file.size = data.files[index].size;
if (file.error) {
file.error = data.result.error || 'emptyResult'; // for ie, browsers which use iframe
file.name = data.files[index].name;
that._adjustMaxNumberOfFiles(1);
}
that._transition($(this)).done(
@@ -183,7 +186,14 @@
data.context.each(function (index) {
if (data.errorThrown !== 'abort') {
var file = data.files[index];
file.error = file.error || data.errorThrown ||
var r_error;
if (data.jqXHR.responseText) {
r_error = $.parseJSON(data.jqXHR.responseText).error;
}
if (data.dataType == 'iframe json') { // for browsers which use iframe
data.errorThrown = '';
}
file.error = r_error || file.error || data.errorThrown ||
'can not connect the server';
that._transition($(this)).done(
function () {

View File

@@ -46,11 +46,11 @@ def upload_js():
{% if (file.error) { %}
<td class="name">{%=file.name%}</td>
<td class="size">{%=o.formatFileSize(file.size)%}</td>
<td class="error"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
<td></td>
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}:</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else { %}
<td class="name">{%=file.name%}</td>
<td colspan="3"></td>
<td class="size">{%=o.formatFileSize(file.size)%}</td>
<td colspan="2"></td>
{% } %}
</tr>
{% } %}