Ajout du champ commun `loc` dans la fiche complète. Gestion complète de la synchronisation avec vérification avant d'enregistrer (deflater->storage) avec un hash pour éviter d'enregistrer ce qui n'a pas changé. + Synchronisation avec histoire de timestamp (date de dernière modification) entre `mini` et `fiche`

This commit is contained in:
xdrm-brackets 2016-05-02 12:22:54 +02:00
parent a7c006f6a9
commit d56a1cced5
10 changed files with 124 additions and 40 deletions

File diff suppressed because one or more lines are too long

View File

@ -277,10 +277,19 @@ ficheBuilder.setLayout(
"\t<h5 class='nobold color0'>\n"+ "\t<h5 class='nobold color0'>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='loc_@uid' data-name='loc' id='locA_@uid'><label for='locA_@uid'>- de 5 minutes</label><br>\n"+ "\t\tOù habite t-elle/il ?<br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='loc_@uid' data-name='loc' id='locB_@uid'><label for='locB_@uid'>de 5 à 15 minutes</label><br>\n"+ "\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_@uid' data-name='loc' id='locA_@uid'><label for='locA_@uid'>- de 10km</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='loc_@uid' data-name='loc' id='locC_@uid'><label for='locC_@uid'>de 15 à 60 minutes</label><br>\n"+ "\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_@uid' data-name='loc' id='locB_@uid'><label for='locB_@uid'>de 10km à 30km</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='loc_@uid' data-name='loc' id='locD_@uid'><label for='locD_@uid'>+ d'une heure</label><br>\n"+ "\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_@uid' data-name='loc' id='locC_@uid'><label for='locC_@uid'>de 30km à 100km</label><br>\n"+
"\t\t&nbsp&nbsp&nbsp<input type='radio' name='loc_@uid' data-name='loc' id='locD_@uid'><label for='locD_@uid'>+ de 100km</label>\n"+
"\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='loc2_@uid' data-name='loc2' id='loc2A_@uid'><label for='loc2A_@uid'>- de 5 minutes</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='loc2_@uid' data-name='loc2' id='loc2B_@uid'><label for='loc2B_@uid'>de 5 à 15 minutes</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='loc2_@uid' data-name='loc2' id='loc2C_@uid'><label for='loc2C_@uid'>de 15 à 60 minutes</label><br>\n"+
"\t\t&nbsp;&nbsp;&nbsp;<input type='radio' name='loc2_@uid' data-name='loc2' id='loc2D_@uid'><label for='loc2D_@uid'>+ d'une heure</label><br>\n"+
"\t</h5>\n"+ "\t</h5>\n"+
"\t<h5 class='nobold color0'>\n"+ "\t<h5 class='nobold color0'>\n"+

View File

@ -1,21 +1,23 @@
function inputPhoneFiche(a,b){this.container=a;this.nav_container=b} function inputPhoneFiche(a,b){this.container=a;this.nav_container=b}
inputPhoneFiche.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{firstname:"",lastname:"",username:"",sexe:[{status:!0},{status:!1}],age:"",job:".",famsit:[{status:!0},{status:!1},{status:!1}],studies:".",reltype:[{status:!0},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1}],reltypeSpecial:"",city:"",loc:[{status:!0},{status:!1},{status:!1},{status:!1}],duration:["",""],context:[{status:!0},{status:!1}, inputPhoneFiche.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{firstname:"",lastname:"",username:"",sexe:[{status:!0},{status:!1}],age:"",job:".",famsit:[{status:!0},{status:!1},{status:!1}],studies:".",reltype:[{status:!0},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1}],reltypeSpecial:"",city:"",loc:[{status:!0},{status:!1},{status:!1},{status:!1}],loc2:[{status:!0},{status:!1},{status:!1},
{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1}],contextSpecial:["","",""],freq:[[{status:!0},{status:!1},{status:!1},{status:!1}],[{status:!0},{status:!1},{status:!1},{status:!1}],[{status:!0},{status:!1},{status:!1},{status:!1}],[{status:!0},{status:!1},{status:!1},{status:!1}],[{status:!0},{status:!1},{status:!1},{status:!1}]],connect:[[{status:!1},{status:!0}],[{status:!1},{status:!0}],[{status:!1}, {status:!1}],duration:["",""],context:[{status:!0},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1},{status:!1}],contextSpecial:["","",""],freq:[[{status:!0},{status:!1},{status:!1},{status:!1}],[{status:!0},{status:!1},{status:!1},{status:!1}],[{status:!0},{status:!1},{status:!1},{status:!1}],[{status:!0},{status:!1},{status:!1},{status:!1}],[{status:!0},{status:!1},{status:!1},{status:!1}]],connect:[[{status:!1},
{status:!0}],[{status:!1},{status:!0}],[{status:!1},{status:!0}],[{status:!1},{status:!0}]],connectSpecial:["",""]}}; {status:!0}],[{status:!1},{status:!0}],[{status:!1},{status:!0}],[{status:!1},{status:!0}],[{status:!1},{status:!0}],[{status:!1},{status:!0}]],connectSpecial:["",""],timestamp:0,valid:!1}};
inputPhoneFiche.prototype.fieldsToStorage=function(){console.log("FICHE: FIELDS TO STORAGE");for(var a=$$("article.relation-panel .fiche-relation"),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),d=lsi.get("fiches",c.uid.value);!1===d&&(d.username="inconnu",d.firstname="inconnu",d.lastname="inconnu");c={uid:c.uid.value,firstname:d.firstname,lastname:d.lastname,username:d.username,sexe:c.sexe,age:c.age.value,job:c.job.value,famsit:c.famsit,studies:c.studies.value, inputPhoneFiche.prototype.fieldsToStorage=function(){console.log("FICHE: FIELDS TO STORAGE");for(var a=$$("article.relation-panel .fiche-relation"),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),d=crc32(JSON.stringify(c)),e=lsi.get("fiches",c.uid.value);!1===e&&(e.username="inconnu",e.firstname="inconnu",e.lastname="inconnu");if(null!=e.hash&&e.hash==d)break;console.warn("> FICHE UPDATE");c={uid:c.uid.value,firstname:e.firstname,lastname:e.lastname,username:e.username,
reltype:c.reltype,reltypeSpecial:c.reltypeSpecial.value,city:c.city.value,loc:c.loc,duration:[c.duration[0].value,c.duration[1].value],context:c.context,contextSpecial:[c.contextSpecial[0].value,c.contextSpecial[1].value,c.contextSpecial[2].value],freq:[c.freq0,c.freq1,c.freq2,c.freq3,c.freq4],connect:[c.connect0,c.connect1,c.connect2,c.connect3,c.connect4,c.connect5],connectSpecial:[c.connectSpecial[0].value,c.connectSpecial[1].value]};c.valid=this.check(c);lsi.set("fiches",c.uid,c)}}; sexe:c.sexe,age:c.age.value,job:c.job.value,famsit:c.famsit,studies:c.studies.value,reltype:c.reltype,reltypeSpecial:c.reltypeSpecial.value,city:c.city.value,loc:c.loc,loc2:c.loc2,duration:[c.duration[0].value,c.duration[1].value],context:c.context,contextSpecial:[c.contextSpecial[0].value,c.contextSpecial[1].value,c.contextSpecial[2].value],freq:[c.freq0,c.freq1,c.freq2,c.freq3,c.freq4],connect:[c.connect0,c.connect1,c.connect2,c.connect3,c.connect4,c.connect5],connectSpecial:[c.connectSpecial[0].value,
c.connectSpecial[1].value],hash:d};c.valid=this.check(c);c.timestamp=Date.now();lsi.set("fiches",c.uid,c)}};
inputPhoneFiche.prototype.add=function(a){console.log("FICHE: ADD");if(null==a.uid)return!1;a.firstname=null!=a.firstname?a.firstname:this.defaultData.firstname;a.lastname=null!=a.lastname?a.lastname:this.defaultData.lastname;a.username=null!=a.username?a.username:this.defaultData.username;a.age=null!=a.age?a.age:this.defaultData.age;a.city=null!=a.city?a.city:this.defaultData.city;a.duration[0]=null!=a.duration[0]?a.duration[0]:this.defaultData.duration[0];a.duration[1]=null!=a.duration[1]?a.duration[1]: inputPhoneFiche.prototype.add=function(a){console.log("FICHE: ADD");if(null==a.uid)return!1;a.firstname=null!=a.firstname?a.firstname:this.defaultData.firstname;a.lastname=null!=a.lastname?a.lastname:this.defaultData.lastname;a.username=null!=a.username?a.username:this.defaultData.username;a.age=null!=a.age?a.age:this.defaultData.age;a.city=null!=a.city?a.city:this.defaultData.city;a.duration[0]=null!=a.duration[0]?a.duration[0]:this.defaultData.duration[0];a.duration[1]=null!=a.duration[1]?a.duration[1]:
this.defaultData.duration[1];a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial;a.contextSpecial[0]=null!=a.contextSpecial[0]?a.contextSpecial[0]:this.defaultData.contextSpecial[0];a.contextSpecial[1]=null!=a.contextSpecial[1]?a.contextSpecial[1]:this.defaultData.contextSpecial[1];a.contextSpecial[2]=null!=a.contextSpecial[2]?a.contextSpecial[2]:this.defaultData.contextSpecial[2];a.connectSpecial[0]=null!=a.connectSpecial[0]?a.connectSpecial[0]:this.defaultData.connectSpecial[0]; this.defaultData.duration[1];a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial;a.contextSpecial[0]=null!=a.contextSpecial[0]?a.contextSpecial[0]:this.defaultData.contextSpecial[0];a.contextSpecial[1]=null!=a.contextSpecial[1]?a.contextSpecial[1]:this.defaultData.contextSpecial[1];a.contextSpecial[2]=null!=a.contextSpecial[2]?a.contextSpecial[2]:this.defaultData.contextSpecial[2];a.connectSpecial[0]=null!=a.connectSpecial[0]?a.connectSpecial[0]:this.defaultData.connectSpecial[0];
a.connectSpecial[1]=null!=a.connectSpecial[1]?a.connectSpecial[1]:this.defaultData.connectSpecial[1];a.job=null!=a.job?a.job:this.defaultData.job;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.famsit=null!=a.famsit?a.famsit:this.defaultData.famsit;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.context=null!=a.context?a.context:this.defaultData.context;a.freq=null!=a.freq?a.freq: a.connectSpecial[1]=null!=a.connectSpecial[1]?a.connectSpecial[1]:this.defaultData.connectSpecial[1];a.job=null!=a.job?a.job:this.defaultData.job;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.famsit=null!=a.famsit?a.famsit:this.defaultData.famsit;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.loc2=null!=a.loc2?a.loc2:this.defaultData.loc2;a.context=null!=a.context?a.context:
this.defaultData.freq;a.connect=null!=a.connect?a.connect:this.defaultData.connect;this.container.innerHTML+=ficheBuilder.build({firstname:a.firstname,lastname:a.lastname,username:a.username,uid:a.uid,age:a.age,city:a.city,duration0:a.duration[0],duration1:a.duration[1],reltypespecial:a.reltypeSpecial,contextspecial0:a.contextSpecial[0],contextspecial1:a.contextSpecial[1],contextspecial2:a.contextSpecial[2],connectspecial0:a.connectSpecial[0],connectspecial1:a.connectSpecial[1]});var b=$('article.fiche-relation input[data-name="uid"][value="'+ this.defaultData.context;a.freq=null!=a.freq?a.freq:this.defaultData.freq;a.connect=null!=a.connect?a.connect:this.defaultData.connect;this.container.innerHTML+=ficheBuilder.build({firstname:a.firstname,lastname:a.lastname,username:a.username,uid:a.uid,age:a.age,city:a.city,duration0:a.duration[0],duration1:a.duration[1],reltypespecial:a.reltypeSpecial,contextspecial0:a.contextSpecial[0],contextspecial1:a.contextSpecial[1],contextspecial2:a.contextSpecial[2],connectspecial0:a.connectSpecial[0],connectspecial1:a.connectSpecial[1]});
a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");b=$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=b&&b.setAttribute("selected","selected");for(var c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]'),b=0;b<c.length&&b<a.sexe.length;b++)a.sexe[b].status?c[b].setAttribute("checked", var b=$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");b=$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=b&&b.setAttribute("selected","selected");for(var c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]'),b=0;b<c.length&&
"checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="famsit"]');for(b=0;b<c.length&&b<a.famsit.length;b++)a.famsit[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');for(b=0;b<c.length&&b<a.reltype.length;b++)a.reltype[b].status?c[b].setAttribute("checked", b<a.sexe.length;b++)a.sexe[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="famsit"]');for(b=0;b<c.length&&b<a.famsit.length;b++)a.famsit[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');for(b=0;b<c.length&&b<a.reltype.length;b++)a.reltype[b].status?
"checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length&&b<a.loc.length;b++)a.loc[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="context"]');for(b=0;b<c.length&&b<a.context.length;b++)a.context[b].status?c[b].setAttribute("checked","checked"): c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length&&b<a.loc.length;b++)a.loc[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc2"]');for(b=0;b<c.length&&b<a.loc2.length;b++)a.loc2[b].status?c[b].setAttribute("checked",
c[b].removeAttribute("checked");for(c=0;c<a.freq.length;c++)for(var d=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="freq'+c+'"]'),b=0;b<d.length&&b<a.freq[c].length;b++)a.freq[c][b].status?d[b].setAttribute("checked","checked"):d[b].removeAttribute("checked");for(c=0;c<a.connect.length;c++)for(d=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect'+c+'"]'),b=0;b<d.length&&b<a.connect[c].length;b++)a.connect[c][b].status? "checked"):c[b].removeAttribute("checked");c=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="context"]');for(b=0;b<c.length&&b<a.context.length;b++)a.context[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");for(c=0;c<a.freq.length;c++)for(var d=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="freq'+c+'"]'),b=0;b<d.length&&b<a.freq[c].length;b++)a.freq[c][b].status?
d[b].setAttribute("checked","checked"):d[b].removeAttribute("checked")};inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("fiches");this.container.innerHTML="";var b=[],c;for(c in a){var d=a[c].uid;d==this.selected&&this.add(a[c]);b.push(d)}this.updateNavBar(b)}; d[b].setAttribute("checked","checked"):d[b].removeAttribute("checked");for(c=0;c<a.connect.length;c++)for(d=$$('article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect'+c+'"]'),b=0;b<d.length&&b<a.connect[c].length;b++)a.connect[c][b].status?d[b].setAttribute("checked","checked"):d[b].removeAttribute("checked")};
inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");for(var a=lsi.keys("contacts"),b=0;b<a.length&&10>b;b++){var c=lsi.get("contacts",a[b]),d=lsi.get("fiches",a[b]);null==d&&(d=this.defaultData);d.uid=c.uid;d.firstname=c.firstname;d.lastname=c.lastname;d.username=c.username;lsi.set("fiches",a[b],d)}}; inputPhoneFiche.prototype.storageToFields=function(){console.log("FICHE: STORAGE TO FIELDS");var a=lsi["export"]("fiches");this.container.innerHTML="";var b=[],c;for(c in a){var d=a[c].uid;d==this.selected&&this.add(a[c]);b.push(d)}this.updateNavBar(b)};
inputPhoneFiche.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML)||"nav-fiche"!=a.parentNode.id)return!1;for(var b=$$("#nav-fiche > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1}; inputPhoneFiche.prototype.sync=function(){console.log("FICHE: SYNC");for(var a=lsi.keys("contacts"),b=0;b<a.length&&10>b;b++){var c=lsi.get("contacts",a[b]),d=lsi.get("fiches",a[b]);null==d&&(d=this.defaultData);d.uid=c.uid;d.firstname=c.firstname;d.lastname=c.lastname;d.username=c.username;lsi.set("fiches",a[b],d)}var a=lsi["export"]("mini-fiches"),d=lsi["export"]("fiches"),e;for(e in d)d[e].timestamp>a[e].timestamp?(a[e].sexe=d[e].sexe,a[e].age=d[e].age,a[e].job=d[e].job,a[e].loc=d[e].loc):(d[e].sexe=
a[e].sexe,d[e].age=a[e].age,d[e].job=a[e].job,d[e].loc=a[e].loc),lsi.set("mini-fiches",e,a[e]),lsi.set("fiches",e,d[e])};inputPhoneFiche.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML)||"nav-fiche"!=a.parentNode.id)return!1;for(var b=$$("#nav-fiche > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1};
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("fiches"),b=Object.keys(a).length;if(this.nav_container.children.length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)this.nav_container.innerHTML+="<span></span>"}for(var d in a)b=this.nav_container.children[a[d].uid],b.innerHTML=a[d].uid+1,!0===a[d].valid?b.addClass("done"):b.remClass("done");this.nav(this.nav_container.children[this.selected])}; inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("fiches"),b=Object.keys(a).length;if(this.nav_container.children.length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)this.nav_container.innerHTML+="<span></span>"}for(var d in a)b=this.nav_container.children[a[d].uid],b.innerHTML=a[d].uid+1,!0===a[d].valid?b.addClass("done"):b.remClass("done");this.nav(this.nav_container.children[this.selected])};
inputPhoneFiche.prototype.check=function(a){if(isNaN(parseInt(a.age))||2>a.city.length||isNaN(parseInt(a.duration[0]))&&0<a.duration[0].length||isNaN(parseInt(a.duration[1]))&&0<a.duration[1].length||0==a.duration[0].length+a.duration[1].length||"."==a.job||"."==a.studies||!checkRadioValue(a.sexe)||!checkRadioValue(a.famsit)||!checkRadioValue(a.reltype)||!checkRadioValue(a.loc)||!checkRadioValue(a.context))return!1;for(var b=0;b<a.freq.length;b++)if(!checkRadioValue(a.freq[b]))return!1;for(b=0;b< inputPhoneFiche.prototype.check=function(a){if(isNaN(parseInt(a.age))||2>a.city.length||isNaN(parseInt(a.duration[0]))&&0<a.duration[0].length||isNaN(parseInt(a.duration[1]))&&0<a.duration[1].length||0==a.duration[0].length+a.duration[1].length||"."==a.job||"."==a.studies||!checkRadioValue(a.sexe)||!checkRadioValue(a.famsit)||!checkRadioValue(a.reltype)||!checkRadioValue(a.loc)||!checkRadioValue(a.loc2)||!checkRadioValue(a.context))return!1;for(var b=0;b<a.freq.length;b++)if(!checkRadioValue(a.freq[b]))return!1;
a.connect.length;b++)if(!checkRadioValue(a.connect[b]))return!1;return a.reltype[8].status&&2>a.reltypeSpecial.length||a.context[11].status&&2>a.contextSpecial[0].length||a.context[12].status&&2>a.contextSpecial[1].length||a.context[13].status&&2>a.contextSpecial[2].length?!1:!0}; for(b=0;b<a.connect.length;b++)if(!checkRadioValue(a.connect[b]))return!1;return a.reltype[8].status&&2>a.reltypeSpecial.length||a.context[11].status&&2>a.contextSpecial[0].length||a.context[12].status&&2>a.contextSpecial[1].length||a.context[13].status&&2>a.contextSpecial[2].length?!1:!0};
inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)}; inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};

View File

@ -26,6 +26,7 @@ inputPhoneFiche.prototype = {
reltypeSpecial: '', reltypeSpecial: '',
city: '', city: '',
loc: [ {status:true}, {status:false}, {status:false}, {status:false} ], loc: [ {status:true}, {status:false}, {status:false}, {status:false} ],
loc2: [ {status:true}, {status:false}, {status:false}, {status:false} ],
duration: ['', ''], duration: ['', ''],
context: [ {status:true}, {status:false}, {status:false}, {status:false}, {status:false}, context: [ {status:true}, {status:false}, {status:false}, {status:false}, {status:false},
{status:false}, {status:false}, {status:false}, {status:false}, {status:false}, {status:false}, {status:false}, {status:false}, {status:false}, {status:false},
@ -44,7 +45,9 @@ inputPhoneFiche.prototype = {
[ {status:false}, {status:true} ], [ {status:false}, {status:true} ],
[ {status:false}, {status:true} ], [ {status:false}, {status:true} ],
[ {status:false}, {status:true} ]], [ {status:false}, {status:true} ]],
connectSpecial: ['', ''] connectSpecial: ['', ''],
timestamp: 0,
valid: false
} }
}; };
@ -63,6 +66,8 @@ inputPhoneFiche.prototype.fieldsToStorage = function(){
// {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom // // {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom //
var deflated = deflater.deflate(); var deflated = deflater.deflate();
// On crée le hash
var deflatedHash = crc32(JSON.stringify(deflated));
// console.log( deflated ); // console.log( deflated );
@ -80,6 +85,13 @@ inputPhoneFiche.prototype.fieldsToStorage = function(){
// {5} On récupère et met en forme les valeurs du deflater // // {5} On récupère et met en forme les valeurs du deflater //
// Si le hash est le même, on ne fait rien
if( existingData.hash != null && existingData.hash == deflatedHash )
return;
console.warn('> FICHE UPDATE');
var obj = { var obj = {
uid: deflated.uid.value, uid: deflated.uid.value,
firstname: existingData.firstname, firstname: existingData.firstname,
@ -94,6 +106,7 @@ inputPhoneFiche.prototype.fieldsToStorage = function(){
reltypeSpecial: deflated.reltypeSpecial.value, reltypeSpecial: deflated.reltypeSpecial.value,
city: deflated.city.value, city: deflated.city.value,
loc: deflated.loc, // Choix 1 à 3 loc: deflated.loc, // Choix 1 à 3
loc2: deflated.loc2, // Choix 1 à 3
duration: [ duration: [
deflated.duration[0].value, // Durée de la relation en mois deflated.duration[0].value, // Durée de la relation en mois
deflated.duration[1].value // Durée de la relation en années deflated.duration[1].value // Durée de la relation en années
@ -122,14 +135,16 @@ inputPhoneFiche.prototype.fieldsToStorage = function(){
connectSpecial: [ connectSpecial: [
deflated.connectSpecial[0].value, deflated.connectSpecial[0].value,
deflated.connectSpecial[1].value deflated.connectSpecial[1].value
] ],
hash: deflatedHash
}; };
/* (6) On vérifie la validité des données et on l'enregistre dans l'objet */ /* (6) On vérifie la validité des données et on l'enregistre dans l'objet avec la date de modification */
obj.valid = this.check(obj); obj.valid = this.check(obj);
obj.timestamp = Date.now();
// {6} On enregistre les données dans le 'localStorage' // /* (7) On enregistre les données dans le 'localStorage' */
lsi.set('fiches', obj.uid, obj); lsi.set('fiches', obj.uid, obj);
} }
}; };
@ -181,6 +196,7 @@ inputPhoneFiche.prototype.add = function(objectData){
objectData.famsit = (objectData.famsit != null) ? objectData.famsit : this.defaultData.famsit; objectData.famsit = (objectData.famsit != null) ? objectData.famsit : this.defaultData.famsit;
objectData.reltype = (objectData.reltype != null) ? objectData.reltype : this.defaultData.reltype; objectData.reltype = (objectData.reltype != null) ? objectData.reltype : this.defaultData.reltype;
objectData.loc = (objectData.loc != null) ? objectData.loc : this.defaultData.loc; objectData.loc = (objectData.loc != null) ? objectData.loc : this.defaultData.loc;
objectData.loc2 = (objectData.loc2 != null) ? objectData.loc2 : this.defaultData.loc2;
objectData.context = (objectData.context != null) ? objectData.context : this.defaultData.context; objectData.context = (objectData.context != null) ? objectData.context : this.defaultData.context;
objectData.freq = (objectData.freq != null) ? objectData.freq : this.defaultData.freq; objectData.freq = (objectData.freq != null) ? objectData.freq : this.defaultData.freq;
objectData.connect = (objectData.connect != null) ? objectData.connect : this.defaultData.connect; objectData.connect = (objectData.connect != null) ? objectData.connect : this.defaultData.connect;
@ -243,6 +259,12 @@ inputPhoneFiche.prototype.add = function(objectData){
if( objectData.loc[i].status ) locCreated[i].setAttribute('checked', 'checked'); if( objectData.loc[i].status ) locCreated[i].setAttribute('checked', 'checked');
else locCreated[i].removeAttribute('checked'); else locCreated[i].removeAttribute('checked');
/* (7bis) On sélectionna la valeur des boutons <radio> pour la LOCATION */
var loc2Created = $$('article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="loc2"]');
for( var i = 0 ; i < loc2Created.length && i < objectData.loc2.length ; i++ )
if( objectData.loc2[i].status ) loc2Created[i].setAttribute('checked', 'checked');
else loc2Created[i].removeAttribute('checked');
/* (8) On sélectionna la valeur des boutons <radio> pour le CONTEXTE DE RENCONTRE */ /* (8) On sélectionna la valeur des boutons <radio> pour le CONTEXTE DE RENCONTRE */
var contextCreated = $$('article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="context"]'); var contextCreated = $$('article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="context"]');
@ -324,6 +346,8 @@ inputPhoneFiche.prototype.storageToFields = function(){
inputPhoneFiche.prototype.sync = function(){ inputPhoneFiche.prototype.sync = function(){
console.log('FICHE: SYNC'); console.log('FICHE: SYNC');
/* (1) Mise à jour en fonction des contacts
---------------------------------------------------------*/
/* (1) On récupère les clés de tous les CONTACTS */ /* (1) On récupère les clés de tous les CONTACTS */
var contactUIDs = lsi.keys('contacts'); var contactUIDs = lsi.keys('contacts');
@ -351,7 +375,37 @@ inputPhoneFiche.prototype.sync = function(){
/* (7) On enregistre les modification */ /* (7) On enregistre les modification */
lsi.set('fiches', contactUIDs[i], ficheData); lsi.set('fiches', contactUIDs[i], ficheData);
}
/* (2) Mise à jour en fonction des MINI fiches
---------------------------------------------------------*/
/* (1) On récupère les valeurs des MINI fiches et des FICHES */
var miniData = lsi.export('mini-fiches');
var ficheData = lsi.export('fiches');
/* (2) Pour chaque champ, on synchronise les MINI fiches avec les FICHES associées */
for( var key in ficheData ){
var ficheModifiedLast = ficheData[key].timestamp > miniData[key].timestamp;
/* (3) Si la FICHE a été modifiée en dernier, on utilise ses données */
if( ficheModifiedLast ){
miniData[key].sexe = ficheData[key].sexe;
miniData[key].age = ficheData[key].age;
miniData[key].job = ficheData[key].job;
miniData[key].loc = ficheData[key].loc;
/* (4) Sinon, on utilise les données de la MINI */
}else{
ficheData[key].sexe = miniData[key].sexe;
ficheData[key].age = miniData[key].age;
ficheData[key].job = miniData[key].job;
ficheData[key].loc = miniData[key].loc;
}
/* (5) On enregistre les modifications */
lsi.set('mini-fiches', key, miniData[key]);
lsi.set('fiches', key, ficheData[key]);
} }
}; };
@ -472,6 +526,9 @@ inputPhoneFiche.prototype.check = function(ficheData){
// 11. La DISTANCE DE DOMICILE (location) a un et un seul choix // 11. La DISTANCE DE DOMICILE (location) a un et un seul choix
if( !checkRadioValue(ficheData.loc) ) if( !checkRadioValue(ficheData.loc) )
return false; return false;
// 11bis. La DISTANCE DE DOMICILE (location 2) a un et un seul choix
if( !checkRadioValue(ficheData.loc2) )
return false;
// 12. Le CONTEXTE DE RENCONTRE a un et un seul choix // 12. Le CONTEXTE DE RENCONTRE a un et un seul choix
if( !checkRadioValue(ficheData.context) ) if( !checkRadioValue(ficheData.context) )
return false; return false;

View File

@ -1,10 +1,10 @@
function inputPhoneMini(a,b){this.container=a;this.nav_container=b}inputPhoneMini.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{firstname:"",lastname:"",username:"",sexe:[{status:!0},{status:!1}],age:"",job:".",loc:[{status:!0},{status:!1},{status:!1},{status:!1}]}}; function inputPhoneMini(a,b){this.container=a;this.nav_container=b}inputPhoneMini.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{firstname:"",lastname:"",username:"",sexe:[{status:!0},{status:!1}],age:"",job:".",loc:[{status:!0},{status:!1},{status:!1},{status:!1}],timestamp:0,valid:!1}};
inputPhoneMini.prototype.fieldsToStorage=function(){console.log("MINI FICHE: FIELDS TO STORAGE");for(var a=$$("article.mini-relation-panel .mini-fiche-relation"),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),d=lsi.get("mini-fiches",c.uid.value);!1===d&&(d.username="inconnu",d.firstname="inconnu",d.lastname="inconnu");c={uid:c.uid.value,firstname:d.firstname,lastname:d.lastname,username:d.username,sexe:c.sexe,age:c.age.value,job:c.job.value,loc:c.loc}; inputPhoneMini.prototype.fieldsToStorage=function(){console.log("MINI FICHE: FIELDS TO STORAGE");for(var a=$$("article.mini-relation-panel .mini-fiche-relation"),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate(),e=crc32(JSON.stringify(c)),d=lsi.get("mini-fiches",c.uid.value);!1===d&&(d.username="inconnu",d.firstname="inconnu",d.lastname="inconnu");if(null!=d.hash&&d.hash==e)break;console.warn("> MINI UPDATE");c={uid:c.uid.value,firstname:d.firstname,lastname:d.lastname,
c.valid=this.check(c);lsi.set("mini-fiches",c.uid,c)}}; username:d.username,sexe:c.sexe,age:c.age.value,job:c.job.value,loc:c.loc,hash:e};c.valid=this.check(c);c.timestamp=Date.now();lsi.set("mini-fiches",c.uid,c)}};
inputPhoneMini.prototype.add=function(a){console.log("MINI FICHE: ADD");if(null==a||null==a.uid)return!1;a.firstname=null!=a.firstname?a.firstname:this.defaultData.firstname;a.lastname=null!=a.lastname?a.lastname:this.defaultData.lastname;a.username=null!=a.username?a.username:this.defaultData.username;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.job=null!=a.job?a.job:this.defaultData.job;a.loc=null!=a.loc?a.loc:this.defaultData.loc;this.container.innerHTML+= inputPhoneMini.prototype.add=function(a){console.log("MINI FICHE: ADD");if(null==a||null==a.uid)return!1;a.firstname=null!=a.firstname?a.firstname:this.defaultData.firstname;a.lastname=null!=a.lastname?a.lastname:this.defaultData.lastname;a.username=null!=a.username?a.username:this.defaultData.username;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.job=null!=a.job?a.job:this.defaultData.job;a.loc=null!=a.loc?a.loc:this.defaultData.loc;this.container.innerHTML+=
miniFicheBuilder.build({firstname:a.firstname,lastname:a.lastname,username:a.username,uid:a.uid,age:a.age,job:a.job});var b=$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");for(var c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]'),b=0;b<c.length&&b<a.sexe.length;b++)a.sexe[b].status?c[b].setAttribute("checked", miniFicheBuilder.build({firstname:a.firstname,lastname:a.lastname,username:a.username,uid:a.uid,age:a.age,job:a.job});var b=$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");for(var c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]'),b=0;b<c.length&&b<a.sexe.length;b++)a.sexe[b].status?c[b].setAttribute("checked",
"checked"):c[b].removeAttribute("checked");c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length&&b<a.loc.length;b++)a.loc[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked")};inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi["export"]("mini-fiches");this.container.innerHTML="";this.add(a[this.selected]);this.updateNavBar()}; "checked"):c[b].removeAttribute("checked");c=$$('article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(b=0;b<c.length&&b<a.loc.length;b++)a.loc[b].status?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked")};inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi["export"]("mini-fiches");this.container.innerHTML="";this.add(a[this.selected]);this.updateNavBar()};
inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("contacts"),b;for(b in a){var c=lsi.get("mini-fiches",b);null==c&&(c=this.defaultData,c.valid=!1);c.uid=a[b].uid;c.firstname=a[b].firstname;c.lastname=a[b].lastname;c.username=a[b].username;lsi.set("mini-fiches",b,c)}}; inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("contacts"),b;for(b in a){var c=lsi.get("mini-fiches",b);null==c&&(c=this.defaultData,c.valid=!1);c.uid=a[b].uid;c.firstname=a[b].firstname;c.lastname=a[b].lastname;c.username=a[b].username;lsi.set("mini-fiches",b,c)}};
inputPhoneMini.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML)||"nav-mini"!=a.parentNode.id)return!1;for(var b=$$("#nav-mini > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1}; inputPhoneMini.prototype.nav=function(a){if("undefined"==typeof a||isNaN(a.innerHTML)||"nav-mini"!=a.parentNode.id)return!1;for(var b=$$("#nav-mini > span.active"),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.innerHTML)-1};
inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("mini-fiches"),b=Object.keys(a).length;if(this.nav_container.children.length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)this.nav_container.innerHTML+="<span></span>"}for(var d in a)b=this.nav_container.children[a[d].uid],b.innerHTML=a[d].uid+1,!0===a[d].valid?b.addClass("done"):b.remClass("done");this.nav(this.nav_container.children[this.selected])}; inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("mini-fiches"),b=Object.keys(a).length;if(this.nav_container.children.length!=b){this.nav_container.innerHTML="";for(var c=0;c<b;c++)this.nav_container.innerHTML+="<span></span>"}for(var e in a)b=this.nav_container.children[a[e].uid],b.innerHTML=a[e].uid+1,!0===a[e].valid?b.addClass("done"):b.remClass("done");this.nav(this.nav_container.children[this.selected])};
inputPhoneMini.prototype.check=function(a){return!isNaN(parseInt(a.age))&&checkRadioValue(a.sexe)&&"."!=a.job&&checkRadioValue(a.loc)?!0:!1};inputPhoneMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("mini-fiches");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)}; inputPhoneMini.prototype.check=function(a){return!isNaN(parseInt(a.age))&&checkRadioValue(a.sexe)&&"."!=a.job&&checkRadioValue(a.loc)?!0:!1};inputPhoneMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("mini-fiches");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};

View File

@ -19,7 +19,9 @@ inputPhoneMini.prototype = {
sexe: [{status:true}, {status:false}], sexe: [{status:true}, {status:false}],
age: '', age: '',
job: '.', job: '.',
loc: [{status:true}, {status:false}, {status:false}, {status:false}] loc: [{status:true}, {status:false}, {status:false}, {status:false}],
timestamp: 0,
valid: false
} }
}; };
@ -37,6 +39,8 @@ inputPhoneMini.prototype.fieldsToStorage = function(){
// {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom // // {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom //
var deflated = deflater.deflate(); var deflated = deflater.deflate();
// On crée le hash
var deflatedHash = crc32(JSON.stringify(deflated));
// console.log(deflated); // console.log(deflated);
@ -54,6 +58,13 @@ inputPhoneMini.prototype.fieldsToStorage = function(){
// {5} On récupère et met en forme les valeurs du deflater // // {5} On récupère et met en forme les valeurs du deflater //
// Si le hash est le même, on ne fait rien
if( existingData.hash != null && existingData.hash == deflatedHash )
return;
console.warn('> MINI UPDATE');
var obj = { var obj = {
uid: deflated.uid.value, uid: deflated.uid.value,
firstname: existingData.firstname, firstname: existingData.firstname,
@ -62,11 +73,13 @@ inputPhoneMini.prototype.fieldsToStorage = function(){
sexe: deflated.sexe, // [0] Homme, [1] Femme sexe: deflated.sexe, // [0] Homme, [1] Femme
age: deflated.age.value, age: deflated.age.value,
job: deflated.job.value, job: deflated.job.value,
loc: deflated.loc // [0] Choix 1 -> [3] Choix 4 loc: deflated.loc, // [0] Choix 1 -> [3] Choix 4
hash: deflatedHash
}; };
/* (8) On vérifie la validité des données et on l'enregistre dans l'objet */ /* (8) On vérifie la validité des données et on l'enregistre dans l'objet avec la date de modification */
obj.valid = this.check(obj); obj.valid = this.check(obj);
obj.timestamp = Date.now();
/* (9) On enregistre les données dans le 'localStorage' */ /* (9) On enregistre les données dans le 'localStorage' */

4
js/lib/api-min.js vendored
View File

@ -1,3 +1,3 @@
function APIClass(b){this.target=b} function APIClass(b){this.target=b}
APIClass.prototype={xhr:[],send:function(b,d,g){b.hasOwnProperty("path")||d({ModuleError:4});for(var a=0;a<this.xhr.length;a++)4==this.xhr[a].readyState&&(this.xhr=this.xhr.slice(0,a-1).concat(this.xhr.slice(a,this.xhr.length-1)));this.xhr.push(null);a=this.xhr.length-1;this.xhr[a]=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest");console.log(b);var e=this;this.xhr[a].onreadystatechange=function(){if(4==e.xhr[a].readyState)if(-1<[0,200].indexOf(e.xhr[a].status))try{d(JSON.parse(e.xhr[a].responseText))}catch(b){d({ModuleError:1})}else d({ModuleError:3})}; APIClass.prototype={xhr:[],send:function(b,c,f){b.hasOwnProperty("path")||c({ModuleError:4});for(var a=0;a<this.xhr.length;a++)4==this.xhr[a].readyState&&(this.xhr=this.xhr.slice(0,a-1).concat(this.xhr.slice(a,this.xhr.length-1)));this.xhr.push(null);a=this.xhr.length-1;this.xhr[a]=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest");console.log(b);var d=this;this.xhr[a].onreadystatechange=function(){if(4==d.xhr[a].readyState)if(-1<[0,200].indexOf(d.xhr[a].status))try{c(JSON.parse(d.xhr[a].responseText))}catch(b){c({ModuleError:1})}else c({ModuleError:3})};
var f=new FormData,c;for(c in b)"path"!=c?f.append(c,JSON.stringify(b[c])):f.append(c,b[c]);this.xhr[a].open("POST",this.target,!0);null!=g&&this.xhr[a].setRequestHeader("Authorization","Digest "+g);this.xhr[a].send(f)}}; var g=new FormData,e;for(e in b)g.append(e,b[e]);this.xhr[a].open("POST",this.target,!0);null!=f&&this.xhr[a].setRequestHeader("Authorization","Digest "+f);this.xhr[a].send(g)}};

View File

@ -75,8 +75,7 @@ APIClass.prototype = {
// On ajoute tous les attributs en POST // On ajoute tous les attributs en POST
for( var key in pRequest ) for( var key in pRequest )
if( key != 'path' ) form.append(key, JSON.stringify(pRequest[key])); form.append(key, pRequest[key]);
else form.append(key, pRequest[key]);
this.xhr[i].open('POST', this.target, true); this.xhr[i].open('POST', this.target, true);

View File

@ -63,7 +63,7 @@
$markdown .= "### $count - '$moduleName' methods<br>"; $markdown .= "### $count - '$moduleName' methods<br>";
foreach($moduleData as $methodName=>$methodData) foreach($moduleData as $methodName=>$methodData)
$markdown .= "- `$methodName` - ".$methodData['description']."<br>"; $markdown .= "`$methodName` - ".$methodData['description']."<br>";
$markdown .= '----<br>'; $markdown .= '----<br>';

View File

@ -99,8 +99,12 @@ function dynamicUpdate(target){
miniManager.sync(); miniManager.sync();
/* (5) On synchronise les FICHE avec les CONTACTS */ /* (5) On synchronise les FICHE avec les CONTACTS */
// La synchronisation des champs communs est aussi faite entre `mini` et `fiches`
// 1. Si les valeurs de `fiche` sont pas définis, on prend les valeurs de `mini`
// 2. Sinon, on prend les valeurs de `fiche`
ficheManager.sync(); ficheManager.sync();
/* (6) On affiche le tout */ /* (6) On affiche le tout */
miniManager.storageToFields(); miniManager.storageToFields();
ficheManager.storageToFields(); ficheManager.storageToFields();