Browse Source

status

master
Pascal Gloor 5 years ago
parent
commit
f09b80e40a
1 changed files with 22 additions and 22 deletions
  1. 22
    22
      www/js/autodoc.js

+ 22
- 22
www/js/autodoc.js View File



function upload_zone_drop(e) { function upload_zone_drop(e) {
var ev = e.originalEvent; var ev = e.originalEvent;
console.log(ev.dataTransfer.files);

$.each(ev.dataTransfer.files, function(id,file) {
console.log(file);
var fileid = temp.upload.length;
temp.upload.push({
progress: 0,
error: null,
obj: file
});
});


if ( temp.documentid == null ) { if ( temp.documentid == null ) {
$.post(conf.openapi + "/documents", {}, function(data) { $.post(conf.openapi + "/documents", {}, function(data) {
temp.upload = [];
temp.documentid = data.id; temp.documentid = data.id;
upload_status(); upload_status();
handle_uploads(ev);
upload_handler();
}); });
} }
else { else {
handle_uploads(ev);
upload_handler();
} }
} }


function handle_uploads(ev) {
function upload_handler() {


console.log(ev.dataTransfer.files);
console.log(temp.upload);


$.each(ev.dataTransfer.files, function(id,file) {
console.log(handle_uploads, file);
var fileid = temp.upload.length;
temp.upload.push({
name: file.name,
type: file.type,
size: file.size,
progress: 0,
error: null
});
if ( file.type != 'application/pdf' && file.type != 'image/png' && file.type != 'image/jpeg' ) {
temp.upload[fileid]['progress']=1;
temp.upload[fileid]['error']='invalid file type';
$.each(temp.upload, function(id,file) {
console.log(upload_handler, file);

if ( file.obj.type != 'application/pdf' && file.obj.type != 'image/png' && file.obj.type != 'image/jpeg' ) {
temp.upload[id]['progress']=1;
temp.upload[id]['error']='invalid file type';
} }
else { else {
var reader = new FileReader(); var reader = new FileReader();
}, file.type) }, file.type)
}; };
reader.readAsArrayBuffer(data); reader.readAsArrayBuffer(data);

} }
}); });
return true; return true;
console.log(obj); console.log(obj);
$('.autodoc_upload_status').append(obj); $('.autodoc_upload_status').append(obj);
}); });
if ( !finished ) {
if ( !finished || temp.upload.length == 0 ) {
setTimeout(upload_status, 1000); setTimeout(upload_status, 1000);
} }
} }

Loading…
Cancel
Save