|
|
@@ -13,7 +13,8 @@ var conf = { |
|
|
|
end: 0 |
|
|
|
}, |
|
|
|
run: { |
|
|
|
"upload_handler": 0 |
|
|
|
"upload_handler": 0, |
|
|
|
"upload_status": 0 |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
@@ -208,9 +209,14 @@ function upload_zone_drop(e) { |
|
|
|
upload_handler(); |
|
|
|
} |
|
|
|
|
|
|
|
if (conf.run.upload_status == 0) { |
|
|
|
upload_status(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function upload_handler() { |
|
|
|
var stop = 1; |
|
|
|
conf.run.upload_handler = 1; |
|
|
|
console.log("upload_handler"); |
|
|
|
if (temp.documentid == null) { |
|
|
@@ -243,11 +249,17 @@ function upload_handler() { |
|
|
|
reader.readAsArrayBuffer(file.obj); |
|
|
|
} |
|
|
|
} |
|
|
|
stop = 0; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
setTimeout(function () { upload_handler(); }, 1000); |
|
|
|
if (stop) { |
|
|
|
conf.run.upload_handler = 0; |
|
|
|
} |
|
|
|
else { |
|
|
|
setTimeout(function () { upload_handler(); }, 2000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function upload_read_event(e) { |
|
|
@@ -269,7 +281,6 @@ function upload_read_event(e) { |
|
|
|
url: conf.openapi + "/documents/" + temp.documentid + "/data", |
|
|
|
data: e.target.result, |
|
|
|
contentType: temp.upload[e.data].obj.type, |
|
|
|
// context: { id: 0 + (function () { var x = e.data; console.log("upload_id", x); return x; }()) }, |
|
|
|
context: { id: e.data }, |
|
|
|
processData: false, |
|
|
|
xhr: function () { |
|
|
@@ -298,11 +309,16 @@ function upload_read_event(e) { |
|
|
|
} |
|
|
|
|
|
|
|
function upload_status() { |
|
|
|
var stop = 1; |
|
|
|
|
|
|
|
conf.run.upload_status = 1; |
|
|
|
|
|
|
|
$.each(temp.upload, function (id, file) { |
|
|
|
if (!$('.autodoc_upload_status_' + id).length) { |
|
|
|
var obj = $(".autodoc_template_progress").children().clone(); |
|
|
|
$(obj).addClass('autodoc_upload_status_' + id); |
|
|
|
$('.autodoc_upload_status').append(obj); |
|
|
|
stop = 0; |
|
|
|
} |
|
|
|
var obj = $('.autodoc_upload_status_' + id).children(); |
|
|
|
if (file.error != null) { |
|
|
@@ -320,13 +336,19 @@ function upload_status() { |
|
|
|
else if (file.progress < 50) { |
|
|
|
$(obj).html(file.obj.name + ': ' + 'reading file'); |
|
|
|
$(obj).css('width', file.progress + '%'); |
|
|
|
stop = 0; |
|
|
|
} |
|
|
|
else { |
|
|
|
$(obj).html(file.obj.name + ': ' + 'sending file'); |
|
|
|
$(obj).css('width', file.progress + '%'); |
|
|
|
|
|
|
|
stop = 0; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
setTimeout(function () { upload_status(); }, 100); |
|
|
|
if (stop) { |
|
|
|
conf.run.upload_status = 0; |
|
|
|
} |
|
|
|
else { |
|
|
|
setTimeout(function () { upload_status(); }, 100); |
|
|
|
} |
|
|
|
} |