6 lines
1.9 KiB
JavaScript
6 lines
1.9 KiB
JavaScript
|
var exportSubjectList=$("#export_subject-list"),exportSubjectAdd=$("#export_add-subject"),exportDeflater=new FormDeflater(document.getElementById("export-form"),["input"],["data-name"]);exportSubjectAdd.addEventListener("click",function(b){b=document.createElement("input");b.type="number";b.dataset.name="subjects";b.placeholder="Sujet";b.style="width: 5em; display: block;";exportSubjectList.appendChild(b)},!1);
|
||
|
$("#export-form #export_export-all").addEventListener("click",function(b){var a=(new FormDeflater(exportSubjectList,["input"],["data-name"])).deflate().subjects;b=[];a instanceof Array||(a=[a]);for(var c=0;c<a.length;c++)0<a[c].length&&!isNaN(a[c])&&b.push(a[c]);a=exportDeflater.deflate();api.send({path:"download/multiple",subjects:b,all:"all"==a.group},function(a){if(0!=a.ModuleError)return!1;document.location=a.link;Notification.success("OK","Lancement du t\u00e9l\u00e9chargement..")})},!1);
|
||
|
var chartsSubjectList=$("#charts_subject-list"),chartsSubjectAdd=$("#charts_add-subject"),chartsDeflater=new FormDeflater(document.getElementById("charts-form"),["input"],["data-name"]);chartsSubjectAdd.addEventListener("click",function(b){b=document.createElement("input");b.type="number";b.dataset.name="subjects";b.placeholder="Sujet";b.style="width: 5em; display: block;";chartsSubjectList.appendChild(b)},!1);
|
||
|
$("#charts-form #charts_export-all").addEventListener("click",function(b){var a=(new FormDeflater(chartsSubjectList,["input"],["data-name"])).deflate().subjects;b=[];a instanceof Array||(a=[a]);for(var c=0;c<a.length;c++)0<a[c].length&&!isNaN(a[c])&&b.push(a[c]);a=chartsDeflater.deflate();c={path:"download/chart",phone:"1"==a.phone,facebook:"1"==a.facebook,survey:"1"==a.survey,all:"all"==a.group};"all"!=a.group&&0<b.length&&(c.subjects=b);api.send(c,function(a){if(0!=a.ModuleError)return!1;document.location=
|
||
|
a.link;Notification.success("OK","Lancement du t\u00e9l\u00e9chargement..")})},!1);
|