Commit 895c4f00 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

No commit message

No commit message
parent b60aa1e8
......@@ -161,7 +161,7 @@ jQuery.validator.addMethod("exclude_required", function(value, element, options)
}
}
var _uploadProgress = function(elt) {
var _uploadProgress = function(elt, justinit) {
var allUploaded = true,
upload_file_status = new Array();
$(".fileupload").each(function(){
......@@ -179,7 +179,7 @@ jQuery.validator.addMethod("exclude_required", function(value, element, options)
upload_file_status.push({param: tid.join("_"), name: realname, loaded: tloaded, total: t2load});
}
});
if (allUploaded) {
if (allUploaded && !justinit) {
clearInterval(timer);
elt.$element.trigger('uploaded');
}
......@@ -219,7 +219,7 @@ jQuery.validator.addMethod("exclude_required", function(value, element, options)
$("#workflow_form :checkbox").each(function(){
if (!$(this).prop('checked')) { params += $(this).attr("name") + "=false&"; }
});
$this.$element.on("uploaded", function() {
$.ajax({
url: $this.options.serverURL + '/run_workflow?' + params + 'callback=?',
......@@ -232,19 +232,25 @@ jQuery.validator.addMethod("exclude_required", function(value, element, options)
$this.$element.trigger('uploading');
var nbdata2submit = 0;
// submit the data of each fileupload
$(".fileupload").each(function(){
var tid = $(this).attr("id").split("_"),
iid = tid.slice(1, tid.length).join("_");
if ($("#"+iid).data("data2upload")) {
$("#"+iid).data("data2upload").submit();
nbdata2submit += 1;
}
});
// execute _uploadProgress to init the display
_uploadProgress($this);
// then loop to follow the file upload
timer = setInterval(function() { _uploadProgress($this) }, TIMER);
if (nbdata2submit > 0) {
// execute _uploadProgress to init the display
_uploadProgress($this, true);
// then loop to follow the file upload
timer = setInterval(function() { _uploadProgress($this, false) }, TIMER);
} else {
$this.$element.trigger('uploaded');
}
}
}
......
Supports Markdown
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