max_size) {
// if size > accepted size , push filename with error in an array feedback,
feedback_div.innerHTML += '' + file_to_upload.files[e].name
+content[78]+ "
";
remove_waiting_box();
return false;
} else if ( total_size+file_to_upload.files[e].size >= post_max_size )
{
feedback_div.innerHTML += ' limite '+content[78]+"
";
remove_waiting_box();
return false;
}
else {
total_size+=file_to_upload.files[e].size;
}
}
feedback_div.innerHTML="loading....";
document.getElementById("progress_upload1b").setAttribute("value", 0);
xhr.upload.onprogress = function (e) {
document.getElementById("progress_upload1b").setAttribute("max", e.total) + "
";
document.getElementById("progress_upload1b").setAttribute("value", e.loaded) + "
";
}
xhr.onreadystatechange = function (event) {
if (this.readyState == XMLHttpRequest.DONE)
{
remove_waiting_box();
if (this.status === 200) {
document.getElementById("supplement_div_list"+div).innerHTML += this.responseText ;
let dgbox=id$(form_dom_id).elements["dgbox"].value;
var json_form={} ;
json_form['gDossier']=id$(form_dom_id).elements['gDossier'].value;
json_form['div']=id$(form_dom_id).elements['div'].value;
json_form['jr_id']=id$(form_dom_id).elements['jr_id'].value;
Supplement_Document.refresh_list(json_form["gDossier"],json_form["div"],json_form["jr_id"]);
removeDiv(dgbox);
} else {
document.getElementById("supplement_div_list"+div).innerHTML += "status" + this.statusText + "
";
}
}
}
xhr.open("POST", "ajax_misc.php?"+form_data, true);
// works xhr.send(new FormData(input.parentElement));
var formData = new FormData(document.getElementById(form_dom_id));
xhr.send(formData);
}catch(e)
{
console.error("Supplement_Document.save_file "+e.message)
}
remove_waiting_box();
return false;
}
Supplement_Document.refresh_list=function (nDossier,sDiv,nJR_id)
{
try
{
var queryString = {
gDossier:nDossier,
div:sDiv,
jr_id:nJR_id,
op:"ledger",
act:"refresh_file"
};
var action = new Ajax.Request(
"ajax_misc.php",
{
method: 'GET',
parameters: queryString,
onSuccess: function (req) {
var json=req.responseJSON;
$("supplement_div_list"+sDiv).update(json.html);
id$('doc_supp_'+sDiv).removeClassName("nb-round")
if ( json.count > 0) {
id$('doc_supp_'+sDiv).update(json.count);
id$('doc_supp_'+sDiv).addClassName("nb-round")
}
}
}
);
} catch (e)
{
console.error(e.message);
}
}