Suppression du numéro pouour le sujet + proposition des contacts déja utilisé lors de la saisie des contacts

This commit is contained in:
xdrm-brackets 2016-05-27 16:32:26 +02:00
parent ad8db73e1b
commit e137976dca
29 changed files with 1730 additions and 2182 deletions

View File

@ -98,9 +98,7 @@
"unserialize": {
"description": "Recupere le contenu d'un fichier XML de journal d'appel s'il a été importé au préalable.",
"permissions": [],
"parameters": {
"phone_number": { "description": "Numéro de téléphone de l'interrogé.", "type": "number" }
}
"parameters": {}
}
},
@ -291,7 +289,6 @@
"description": "Upload d'un journal d'appel au format .xml.",
"permissions": ["admin"],
"parameters": {
"phone_number": { "description": "Numéro de téléphone de l'interrogé.", "type": "number" },
"file": { "description": "Fichier du journal d'appel.", "type": "FILE" }
}
},

View File

@ -1,5 +1,5 @@
function inputFacebookMatrice(a){this.container=a}inputFacebookMatrice.prototype={container:this.container};
inputFacebookMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var e in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][e]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("f_matrice",0,d)};
inputFacebookMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("f_fiches"),d=lsi.get("f_matrice",0),b=lsi["export"]("f_contacts"),e=[],c;for(c in a)-1==e.indexOf(a[c].contact)&&e.push(a[c].contact);a="<table class='line'>";for(c=0;c<e.length;c++){var g=b[c],a=a+"<tr>";0<c?(a+='<td style="text-align: right;">',a+=g.username,a+="</td>"):a+="<td></td>";for(var f=0;f<e.length;f++)if(f<e.length-1){var h=b[f];0==c?(a+="<td>",a+='<span style="writing-mode: vertical-lr; text-align: right;">',
a+=h.username,a+="</span>"):f<c?(a+="<td>",a+="<input type='checkbox' name='matrice_"+g.uid+"_"+h.uid+"' data-name='"+g.uid+"' value='"+h.uid+"' id='matrice_"+g.uid+"_"+h.uid+"'",null!=d[c]&&-1<d[c].indexOf(f)&&(a+=" checked"),a+=" >",a+="<label for='matrice_"+g.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
a+=h.username,a+="</span>"):f<c?(a+="<td>",a+="<input type='checkbox' name='matrice_"+g.uid+"_"+h.uid+"' data-name='"+g.uid+"' value='"+h.uid+"' id='f_matrice_"+g.uid+"_"+h.uid+"'",null!=d[c]&&-1<d[c].indexOf(f)&&(a+=" checked"),a+=" >",a+="<label for='f_matrice_"+g.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
inputFacebookMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("f_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1)};

View File

@ -127,12 +127,12 @@ inputFacebookMatrice.prototype.storageToFields = function(){
// {4} Valeurs des relations (boutons) //
}else if( B < A ){
matrice_html += "<td>";
matrice_html += "<input type='checkbox' name='matrice_"+conA.uid+"_"+conB.uid+"' data-name='"+conA.uid+"' value='"+conB.uid+"' id='matrice_"+conA.uid+"_"+conB.uid+"'";
matrice_html += "<input type='checkbox' name='matrice_"+conA.uid+"_"+conB.uid+"' data-name='"+conA.uid+"' value='"+conB.uid+"' id='f_matrice_"+conA.uid+"_"+conB.uid+"'";
// Si la relation existe, on active le bouton
if( matriceData[A] != null && matriceData[A].indexOf(B) > -1 )
matrice_html += " checked";
matrice_html += " >";
matrice_html += "<label for='matrice_"+conA.uid+"_"+conB.uid+"'></label>";
matrice_html += "<label for='f_matrice_"+conA.uid+"_"+conB.uid+"'></label>";
// {5} Cases vides (moitié supérieure droite) //
}else

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,13 @@ fContactBuilder.setLayout(
"\t<input type='hidden' data-name='uid' value='@uid'>\n"+
"\t<span class='select-container nobold'><select data-name='existing'>\n"+
"\t\t<option value='.' disabled selected>Contact existant</option>\n"+
"@existinglist"+
"\t</select></span>\n"+
"\t&nbsp;&nbsp;&nbsp;&nbsp;ou&nbsp;&nbsp;&nbsp;&nbsp;\n"+
"\t<input type='text' data-name='username' placeholder='Pseudo' value='@username' > \n"+
"\t<input type='submit' class='primary sub-number' value='Enregistrer'>\n"+
"</h4>\n\n");

File diff suppressed because one or more lines are too long

View File

@ -15,19 +15,15 @@ pContactBuilder.setLayout(
"\t<input type='text' data-name='number' placeholder='Numéro de téléphone' value='@number' > \n"+
"\t<span class='select-container nobold'><select data-name='existing'>\n"+
"\t\t<option value='.' disabled selected>Contact existant</option>\n"+
"@existinglist"+
"\t\t<option value='2'>Jean</option>\n"+
"\t\t<option value='3'>Blaise</option>\n"+
"\t\t<option value='4'>Roger</option>\n"+
"\t\t<option value='5'>Marie</option>\n"+
"\t\t<option value='6'>Adèle</option>\n"+
"\t\t<option value='.'>Utiliser pseudo</option>\n"+
"@contacts"+
"\t</select></span>\n"+
"\tou\n"+
"\t&nbsp;&nbsp;&nbsp;&nbsp;ou&nbsp;&nbsp;&nbsp;&nbsp;\n"+
"\t<input type='text' data-name='username' placeholder='Pseudo' value='@username' > \n"+
"\t<input type='submit' class='primary sub-number' value='Enregistrer'>\n"+
"</h4>\n\n");

View File

@ -1,8 +1,9 @@
function inputPhoneContact(a,b){this.container=a;this.nav_container=b}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};inputPhoneContact.prototype.check=function(a){return 0<a.username.length};
inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$('[data-sublink="phone"] article.contact-panel .new-contact'),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input"],["data-name"])).deflate();if(this.check(c)){var d={uid:parseInt(c.uid),number:c.number,username:c.username,call:parseInt(c.call),sms:parseInt(c.sms),countcall:parseInt(c.countcall),countsms:parseInt(c.countsms)};d.hash=crc32(JSON.stringify(d));lsi.set("p_contacts",parseInt(c.uid),
d)}}};
inputPhoneContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a||null==a.uid||isNaN(a.uid))return!1;a.number=null!=a.number?a.number:"";a.username=null!=a.username?a.username:"";a.call=null!=a.call?a.call:-1;a.sms=null!=a.sms?a.sms:-1;a.countcall=null!=a.countcall?a.countcall:0;a.countsms=null!=a.countsms?a.countsms:0;this.container.innerHTML+=pContactBuilder.build(a);a=$$('[data-sublink="phone"] article.contact-panel .new-contact');for(var b=this,c=0;c<a.length;c++)a[c].removeEventListener("click",function(a){b.nav(a.target);
b.handler(a.target)},!1),a[c].addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};inputPhoneContact.prototype.storageToFields=function(){console.log("CONTACTS: STORAGE TO FIELDS");var a=lsi.keys("p_contacts");this.container.innerHTML="";for(var b=this.selected+10,c=this.selected;c<b&&c<a.length;c++)this.add(lsi.get("p_contacts",a[c]));b>=a.length&&this.add({uid:a.length});this.updateNavBar()};
inputPhoneContact.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-contact"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-contact > span.active'),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneContact.prototype.updateNavBar=function(){var a=lsi.keys("p_contacts").length;if(this.nav_container.children.length!=a){this.nav_container.innerHTML="";for(var b=0;b<a;b+=10)this.nav_container.innerHTML+='<span data-n="'+b+'">'+(1+b/10)+"</span>"}this.nav($('[data-sublink="phone"] #p_nav-contact [data-n="'+this.selected+'"]'))};
inputPhoneContact.prototype.attach=function(a){console.log("CONTACTS: ATTACH");lsi.createDataset("p_contacts");this.storageToFields();this.handler=a;var b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};
function inputPhoneContact(a,c){this.container=a;this.nav_container=c}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};inputPhoneContact.prototype.check=function(a){return"."!=a.existing||0<a.username.length};
inputPhoneContact.prototype.fieldsToStorage=function(){console.log("CONTACTS: FIELDS TO STORAGE");for(var a=$$('[data-sublink="phone"] article.contact-panel .new-contact'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate();console.warn(b);if(this.check(b)){var d={uid:parseInt(b.uid),number:b.number,username:b.username,call:parseInt(b.call),sms:parseInt(b.sms),countcall:parseInt(b.countcall),countsms:parseInt(b.countsms),existing:isNaN(b.existing)?".":parseInt(b.existing)};
d.hash=crc32(JSON.stringify(d));lsi.set("p_contacts",parseInt(b.uid),d)}}};
inputPhoneContact.prototype.add=function(a){console.log("CONTACTS: ADD");if(null==a||null==a.uid||isNaN(a.uid))return!1;a.number=null!=a.number?a.number:"";a.username=null!=a.username?a.username:"";a.call=null!=a.call?a.call:-1;a.sms=null!=a.sms?a.sms:-1;a.countcall=null!=a.countcall?a.countcall:0;a.countsms=null!=a.countsms?a.countsms:0;a.existing=null!=a.existing?a.existing:".";var c=lsi["export"]("p_friends");a.contacts="";for(var b in c)a.contacts+="\t\t<option value='"+b+"'>"+c[b].name+"</option>\n";
this.container.innerHTML+=pContactBuilder.build(a);b=$('[data-sublink="phone"] article.contact-panel .new-contact input[data-name="uid"][value="'+a.uid+'"] ~ span select[data-name="existing"]>option[value="'+a.existing+'"]');null!=b&&b.setAttribute("selected","selected");a=$$('[data-sublink="phone"] article.contact-panel .new-contact');var d=this;for(b=0;b<a.length;b++)a[b].removeEventListener("click",function(a){d.nav(a.target);d.handler(a.target)},!1),a[b].addEventListener("click",function(a){d.nav(a.target);
d.handler(a.target)},!1)};inputPhoneContact.prototype.storageToFields=function(){console.log("CONTACTS: STORAGE TO FIELDS");var a=lsi.keys("p_contacts");this.container.innerHTML="";for(var c=this.selected+10,b=this.selected;b<c&&b<a.length;b++)this.add(lsi.get("p_contacts",a[b]));c>=a.length&&this.add({uid:a.length});this.updateNavBar()};
inputPhoneContact.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-contact"!=a.parentNode.id)return!1;for(var c=$$('[data-sublink="phone"] #p_nav-contact > span.active'),b=0;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneContact.prototype.updateNavBar=function(){var a=lsi.keys("p_contacts").length;if(this.nav_container.children.length!=a){this.nav_container.innerHTML="";for(var c=0;c<a;c+=10)this.nav_container.innerHTML+='<span data-n="'+c+'">'+(1+c/10)+"</span>"}this.nav($('[data-sublink="phone"] #p_nav-contact [data-n="'+this.selected+'"]'))};
inputPhoneContact.prototype.attach=function(a){console.log("CONTACTS: ATTACH");lsi.createDataset("p_contacts");this.storageToFields();this.handler=a;var c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)};

View File

@ -20,7 +20,7 @@ inputPhoneContact.prototype = {
=========================================================*/
inputPhoneContact.prototype.check = function(deflated){
/* On retourne la validité du formulaire */
return deflated.username.length > 0;
return deflated.existing != '.' || deflated.username.length > 0;
}
@ -35,10 +35,11 @@ inputPhoneContact.prototype.fieldsToStorage = function(){
for( var i = 0 ; i < visibleContacts.length ; i++ ){
// {2} On initialise notre deflater pour récupérer les valeurs //
var deflater = new FormDeflater(visibleContacts[i], ['input'], ['data-name']);
var deflater = new FormDeflater(visibleContacts[i], ['input', 'select'], ['data-name']);
// {3} On enregistre ce contact si le numéro n'est pas vide et soit pseudo/prénom/nom //
var deflated = deflater.deflate();
console.warn(deflated);
// Si le formulaire n'est pas valide, on ne l'enregistre pas
if( !this.check(deflated) ) continue;
@ -54,7 +55,9 @@ inputPhoneContact.prototype.fieldsToStorage = function(){
sms: parseInt(deflated.sms),
countcall: parseInt(deflated.countcall),
countsms: parseInt(deflated.countsms)
countsms: parseInt(deflated.countsms),
existing: (!isNaN(deflated.existing)) ? parseInt(deflated.existing) : '.'
};
/* (5) On calcule et ajoute le hash des données */
@ -96,15 +99,29 @@ inputPhoneContact.prototype.add = function(objectData){
objectData.sms = (objectData.sms != null) ? objectData.sms : -1;
objectData.countcall = (objectData.countcall != null) ? objectData.countcall : 0;
objectData.countsms = (objectData.countsms != null) ? objectData.countsms : 0;
objectData.existing = (objectData.existing != null) ? objectData.existing : '.';
// {1} On ajoute le HTML //
this.container.innerHTML += pContactBuilder.build(objectData);
// {1} On récupére la liste des contacts déja renseignés //
var existing = lsi.export('p_friends');
var buildData = objectData;
buildData.contacts = '';
// {2} On attache les évènements sur les formulaires //
for( var i in existing )
buildData.contacts += "\t\t<option value='"+i+"'>"+existing[i].name+"</option>\n";
// {2} On ajoute le HTML //
this.container.innerHTML += pContactBuilder.build(buildData);
// {3} On remplit @existing s'il y a une valeur //
var existingOption = $('[data-sublink="phone"] article.contact-panel .new-contact input[data-name="uid"][value="'+objectData.uid+'"] ~ span select[data-name="existing"]>option[value="'+objectData.existing+'"]');
if( existingOption != null )
existingOption.setAttribute('selected', 'selected');
// {4} On attache les évènements sur les formulaires //
var contactForms = $$('[data-sublink="phone"] article.contact-panel .new-contact');
// On met à jour les listener (remove, puis add)
// On met à jour les listener (remove, puis add) */
var ptr = this;
for( var i = 0 ; i < contactForms.length ; i++ ){
contactForms[i].removeEventListener('click', function(e){ ptr.nav(e.target); ptr.handler(e.target); }, false);

View File

@ -1,7 +1,7 @@
function inputPhoneMatrice(a){this.container=a}inputPhoneMatrice.prototype={container:this.container};
inputPhoneMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var g in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][g]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("p_matrice",0,d)};
inputPhoneMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("p_fiches"),d=lsi.get("p_matrice",0),b=lsi["export"]("p_contacts"),g=[],f;for(f in a)-1==g.indexOf(a[f].contact)&&g.push(a[f].contact);a="<table class='line'>";for(f=0;f<g.length;f++){var e=b[f],a=a+"<tr>";0<f?(a+='<td style="text-align: right;">',a+=e.username,a+="</td>"):a+="<td></td>";for(var c=0;c<g.length;c++)if(c<g.length-1){var h=b[c];0==f?(a+="<td>",a+='<span style="writing-mode: vertical-lr; text-align: right;">',
a+=h.username,a+="</span>"):c<f?(a+="<td>",a+="<input type='checkbox' name='matrice_"+e.uid+"_"+h.uid+"' data-name='"+e.uid+"' value='"+h.uid+"' id='matrice_"+e.uid+"_"+h.uid+"'",null!=d[f]&&-1<d[f].indexOf(c)&&(a+=" checked"),a+=" >",a+="<label for='matrice_"+e.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
a+=h.username,a+="</span>"):c<f?(a+="<td>",a+="<input type='checkbox' name='matrice_"+e.uid+"_"+h.uid+"' data-name='"+e.uid+"' value='"+h.uid+"' id='p_matrice_"+e.uid+"_"+h.uid+"'",null!=d[f]&&-1<d[f].indexOf(c)&&(a+=" checked"),a+=" >",a+="<label for='p_matrice_"+e.uid+"_"+h.uid+"'></label>"):a+="<td class='hidden'>";a+="</td>"}a+="</tr>"}this.container.innerHTML=a+"</table>"};
inputPhoneMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1)};inputPhoneMatrice.prototype.parseGrid=function(){var a=$$(".matrice-panel input[data-name][value]"),d;for(d in a)if(a[d]instanceof Element){var b=a[d].getData("name"),g=a[d].value;this.sGrid[b]instanceof Array||(this.sGrid[b]=[]);this.sGrid[b][g]=a[d]}};
inputPhoneMatrice.prototype.snake=function(){this.sVelocity=[0,0];this.sLength=2;this.sStack=[];this.sKeys=[];this.sGrid=[];this.sRoutine=this.sTarget=null;var a=this;this.parseGrid();var d=parseInt(this.sGrid.length/2),b=parseInt(this.sGrid[d].length/2);this.sStack.push(this.sGrid[d][b]);for(var d=!1,g,f;!d;)g=Math.floor(Math.random()*this.sGrid.length),f=Math.floor(Math.random()*this.sGrid[g].length),d=(d=null!=this.sGrid[g]&&null!=this.sGrid[g][f])&&-1==this.sStack.indexOf(this.sGrid[g][f]);this.sTarget=
this.sGrid[g][f];document.body.addEventListener("keydown",function(e){-1<[37,38,39,40].indexOf(e.keyCode)&&-1==a.sKeys.indexOf(e.keyCode)&&a.sKeys.push(e.keyCode)},!1);document.body.addEventListener("keyup",function(e){var c=a.sKeys.indexOf(e.keyCode);-1<[37,38,39,40].indexOf(e.keyCode)&&-1<c&&a.sKeys.splice(c)},!1);this.sRoutine=setInterval(function(){-1<a.sKeys.indexOf(37)?a.sVelocity[0]=-1:-1<a.sKeys.indexOf(39)&&(a.sVelocity[0]=1);-1<a.sKeys.indexOf(38)?a.sVelocity[1]=-1:-1<a.sKeys.indexOf(40)?

View File

@ -127,12 +127,12 @@ inputPhoneMatrice.prototype.storageToFields = function(){
// {4} Valeurs des relations (boutons) //
}else if( B < A ){
matrice_html += "<td>";
matrice_html += "<input type='checkbox' name='matrice_"+conA.uid+"_"+conB.uid+"' data-name='"+conA.uid+"' value='"+conB.uid+"' id='matrice_"+conA.uid+"_"+conB.uid+"'";
matrice_html += "<input type='checkbox' name='matrice_"+conA.uid+"_"+conB.uid+"' data-name='"+conA.uid+"' value='"+conB.uid+"' id='p_matrice_"+conA.uid+"_"+conB.uid+"'";
// Si la relation existe, on active le bouton
if( matriceData[A] != null && matriceData[A].indexOf(B) > -1 )
matrice_html += " checked";
matrice_html += " >";
matrice_html += "<label for='matrice_"+conA.uid+"_"+conB.uid+"'></label>";
matrice_html += "<label for='p_matrice_"+conA.uid+"_"+conB.uid+"'></label>";
// {5} Cases vides (moitié supérieure droite) //
}else

View File

@ -1,3 +1,3 @@
function inputPhoneSubject(a,b,c,d){this.tmp_id=a;this.number=c;this.subject_id=b;this.store_button=d}inputPhoneSubject.prototype={store_button:this.store_button,tmp_id:this.tmp_id,number:this.number,subject_id:this.subject_id};inputPhoneSubject.prototype.check=function(){return 0<this.number.value.length&&0<this.subject_id.value.length&&!isNaN(this.subject_id.value)};
inputPhoneSubject.prototype.fieldsToStorage=function(){console.log("SUBJECT: FIELDS TO STORAGE");if(!this.check())return!1;lsi.set("p_subject",0,{tmp_id:this.tmp_id.value,number:this.number.value,subject_id:this.subject_id.value})};inputPhoneSubject.prototype.storageToFields=function(){console.log("SUBJECT: STORAGE TO FIELDS");var a=lsi.get("p_subject",0);null==a&&(a={tmp_id:"",number:"",subject_id:""});this.tmp_id.value=a.tmp_id;this.number.value=a.number;this.subject_id.value=a.subject_id};
inputPhoneSubject.prototype.attach=function(){function a(a){b.fieldsToStorage()&&b.storageToFields()}console.log("SUBJECT: ATTACH");lsi.createDataset("p_subject");var b=this;this.store_button.addEventListener("click",a,!1);this.number.addEventListener("blur",a,!1);this.subject_id.addEventListener("blur",a,!1);this.storageToFields()};
function inputPhoneSubject(a,c,b){this.tmp_id=a;this.subject_id=c;this.store_button=b}inputPhoneSubject.prototype={store_button:this.store_button,tmp_id:this.tmp_id,subject_id:this.subject_id,handler:null};inputPhoneSubject.prototype.check=function(){return 0<this.subject_id.value.length&&!isNaN(this.subject_id.value)};inputPhoneSubject.prototype.fieldsToStorage=function(){console.log("SUBJECT: FIELDS TO STORAGE");if(!this.check())return!1;lsi.set("p_subject",0,{tmp_id:this.tmp_id.value,subject_id:this.subject_id.value})};
inputPhoneSubject.prototype.storageToFields=function(){console.log("SUBJECT: STORAGE TO FIELDS");var a=lsi.get("p_subject",0);null==a&&(a={tmp_id:"",subject_id:""});this.tmp_id.value=a.tmp_id;this.subject_id.value=a.subject_id};
inputPhoneSubject.prototype.attach=function(a){function c(a){b.fieldsToStorage();b.handler(!0);b.storageToFields()}console.log("SUBJECT: ATTACH");lsi.createDataset("p_subject");lsi.createDataset("p_friends");this.handler=a;var b=this;this.store_button.addEventListener("click",c,!1);this.subject_id.addEventListener("blur",c,!1);this.storageToFields()};

View File

@ -1,10 +1,8 @@
/* [0] Constructeur -> définit le conteneur et le bouton d'ajout
=========================================================*/
function inputPhoneSubject(iTmpId, iSubjectId, iNumber, store_button){
function inputPhoneSubject(iTmpId, iSubjectId, store_button){
this.tmp_id = iTmpId;
this.number = iNumber;
this.subject_id = iSubjectId;
this.store_button = store_button;
}
@ -13,8 +11,8 @@ function inputPhoneSubject(iTmpId, iSubjectId, iNumber, store_button){
inputPhoneSubject.prototype = {
store_button: this.store_button, // Bouton d'ajout d'un formulaire
tmp_id: this.tmp_id,
number: this.number,
subject_id: this.subject_id
subject_id: this.subject_id,
handler: null
};
@ -22,7 +20,7 @@ inputPhoneSubject.prototype = {
=========================================================*/
inputPhoneSubject.prototype.check = function(){
/* (1) Le numéro n'est pas vide */
return this.number.value.length > 0 && this.subject_id.value.length > 0 && !isNaN(this.subject_id.value);
return this.subject_id.value.length > 0 && !isNaN(this.subject_id.value);
};
/* [3] Gestion de l'enregistrement des formulaires de contact
@ -36,7 +34,6 @@ inputPhoneSubject.prototype.fieldsToStorage = function(){
// {2} On récupère et met en forme les valeurs du deflater //
var obj = {
tmp_id: this.tmp_id.value,
number: this.number.value,
subject_id: this.subject_id.value
};
@ -59,11 +56,10 @@ inputPhoneSubject.prototype.storageToFields = function(){
var subjectData = lsi.get('p_subject', 0);
if( subjectData == null )
subjectData = { tmp_id: '', number: '', subject_id: '' };
subjectData = { tmp_id: '', subject_id: '' };
// {2} On restore les valeurs //
this.tmp_id.value = subjectData.tmp_id;
this.number.value = subjectData.number;
this.subject_id.value = subjectData.subject_id;
};
@ -71,23 +67,24 @@ inputPhoneSubject.prototype.storageToFields = function(){
/* [5] Point d'amorçage de la gestion des contacts
=========================================================*/
inputPhoneSubject.prototype.attach = function(){
inputPhoneSubject.prototype.attach = function(handler){
console.log('SUBJECT: ATTACH');
/* (1) On initialise le jeu de données */
lsi.createDataset('p_subject');
lsi.createDataset('p_friends');
// Pointeur pour les scopes des addEventListener()
this.handler = handler;
var ptr = this;
// Handler de mise à jour quand les champs sont bons
function fts(e){ if( ptr.fieldsToStorage() ) ptr.storageToFields(); }
function fts(e){ ptr.fieldsToStorage(); ptr.handler(true); ptr.storageToFields(); }
/* (2) On attache l'évènement sur le bouton d'enregistrement */
this.store_button.addEventListener('click', fts, false);
/* (3) On attache un évènement de 'blur' sur chaque '<input type="text">' */
this.number.addEventListener( 'blur', fts, false);
this.subject_id.addEventListener('blur', fts, false);
/* (4) On charge le sujet depuis la mémoire ('localStorage') */

View File

@ -22,10 +22,6 @@
extract($params);
// On formatte le numéro de téléphone
$phone_number = Database::formatNumber($phone_number);
/* [0] On récupère dans la config le chemin du fichier
=========================================================*/
/* (1) On récupère le fichier */
@ -223,7 +219,7 @@
/* [7] Enregistrement du journal d'appel au format de sortie
=========================================================*/
// on cržée un id unique pour cet utilisateur
$subject_id = sessionManager::sha1($phone_number);
$subject_id = sessionManager::sha1(uniqid());
/* (1) On construit le contenu */
$phone_storage = array(

View File

@ -255,10 +255,7 @@
/* [1] On enregistre les données du sujet
=========================================================*/
$file['subject'] = array(
'id' => $offset + $subject_id,
'name' => $subject['username']
);
$file['subject'] = array( 'id' => $subject_id );
/* [2] On enregistre les contacts des MINI

View File

@ -105,7 +105,8 @@
/* (3) On enregistre ses contacts s'il en a */
if( isset($fetch['contacts']) )
$subjects = array_merge($subjects, $fetch['contacts']);
foreach($fetch['contacts'] as $contact)
$subjects[$contact['id']] = $contact;
/* [2] On récupére la liste des contacts saisis dans PHONE
@ -117,7 +118,8 @@
/* (2) Si on trouve des contacts, on les ajoute */
if( $fetch !== false && isset($fetch['contacts']) )
$subjects = array_merge($subjects, $fetch['contacts']);
foreach($fetch['contacts'] as $contact)
$subjects[$contact['id']] = $contact;
@ -131,7 +133,8 @@
/* (2) Si on trouve des contacts, on les ajoute */
if( $fetch !== false && isset($fetch['contacts']) )
$subjects = array_merge($subjects, $fetch['contacts']);
foreach($fetch['contacts'] as $contact)
$subjects[$contact['id']] = $contact;
/* [4] Gestion du retour

View File

@ -86,6 +86,7 @@
private static function simpleFile($prefix, $extension, $file, $tester){
// Si on est pas connecté, on retourne une erreur -> impossible via token
if( !connected() ) return array( 'error' => ManagerError::PermissionError );
if( !file_exists($file['tmp_name']) ) return array( 'error' => ManagerError::UnreachableResource );
/* [1] On récupère le chemin du fichier à créer et vérifie le dossier
@ -187,7 +188,7 @@
return array( 'ModuleError' => $uploadError );
/* (2) Gestion du parsage (unserialize) du journal d'appel */
$request = new ModuleRequest('call_log/unserialize', array( 'phone_number' => $phone_number ) );
$request = new ModuleRequest('call_log/unserialize', array() );
$response = $request->dispatch();
/* (3) Restitution du retour de `unserialize` */

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
[]
{"1":{"line":0,"hash":"8c61ad184a90f6fb8cad263c70f70a261cd79be1"},"284":{"line":1,"hash":"7612b6ef7aa53df76ac92789dcf48f9222435091"}}

View File

@ -1 +1 @@
284
374

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,6 @@ if( $getAllR->error == ManagerError::Success )
<h3 data-n='1' class='color4'>Identifier l'enquêté</h3>
<span data-space></span>
<article class='subject-panel'>
<h4 class='self color2' data-icon='a'>
<input type='hidden' data-name='tmp_id' value=''>
@ -90,11 +89,9 @@ if( $getAllR->error == ManagerError::Success )
?>
</select></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type='text' data-name='number' id='p_subject_phone_number' placeholder='Numéro de téléphone'>
<input type='submit' class='primary' data-name='submit' data-store value='Enregistrer'>
<input type='submit' class='primary' data-name='submit' id='store_p_subject' data-store value='Enregistrer'>
</h4>
</article>
<span data-space></span>
<h3 data-n='2' class='color4'>Importer un journal d'appel</h3>
@ -204,7 +201,6 @@ if( $getAllR->error == ManagerError::Success )
<h3 data-n='1' class='color4'>Identifier l'enquêté</h3>
<span data-space></span>
<article class='subject-panel'>
<h4 class='self color2' data-icon='a'>
@ -219,7 +215,6 @@ if( $getAllR->error == ManagerError::Success )
<input type='submit' class='primary' data-name='submit' data-store value='Enregistrer'>
</h4>
</article>
<span data-space></span>
<h3 data-n='2' class='color4'>Saisir manuellement les amis</h3>

62
view/js/input-min.js vendored
View File

@ -1,35 +1,41 @@
var sField=$("#search-field"),sSubmit=$("#search-subject"),sList=$('section[data-sublink="survey"] ul[data-list]');
sSubmit.addEventListener("click",function(c){api.send({path:"subject/search",name:sField.value},function(b){if(0!=b.ModuleError)return Notification.error("Erreur","La recherche a \u00e9chou\u00e9."),!1;console.log(b);var a="",e;for(e in b.results)a+="<li data-element data-id='"+e+"'>",a+="<div data-user><span>SUJET</span></div>",a+="<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+e+"'></span> </div>",a+="<div> <span data-prefix='Nom'>"+
b.results[e].name+"</span> </div>",a+="<div> <span data-prefix='Cr\u00e9ation'>"+b.results[e].creation+"</span> </div>",a+="<div> <span><input type='checkbox' id='s_"+e+"' "+(null!=b.results[e].phone?"checked":"")+" disabled><label for='s_"+e+"'>Cellulaire</label>",a+="</span> </div>",a+="<div> <span><input type='checkbox' id='s_"+e+"' "+(null!=b.results[e].facebook?"checked":"")+" disabled><label for='s_"+e+"'>Facebook</label>",a+="</span> </div>",a+="</li>";sList.innerHTML=a})},!1);
sSubmit.addEventListener("click",function(b){api.send({path:"subject/search",name:sField.value},function(a){if(0!=a.ModuleError)return Notification.error("Erreur","La recherche a \u00e9chou\u00e9."),!1;console.log(a);var e="",b;for(b in a.results)e+="<li data-element data-id='"+b+"'>",e+="<div data-user><span>SUJET</span></div>",e+="<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+b+"'></span> </div>",e+="<div> <span data-prefix='Nom'>"+
a.results[b].name+"</span> </div>",e+="<div> <span data-prefix='Cr\u00e9ation'>"+a.results[b].creation+"</span> </div>",e+="<div> <span><input type='checkbox' id='s_"+b+"' "+(null!=a.results[b].phone?"checked":"")+" disabled><label for='s_"+b+"'>Cellulaire</label>",e+="</span> </div>",e+="<div> <span><input type='checkbox' id='s_"+b+"' "+(null!=a.results[b].facebook?"checked":"")+" disabled><label for='s_"+b+"'>Facebook</label>",e+="</span> </div>",e+="</li>";sList.innerHTML=e})},!1);
var pSubjectManager,pContactManager,pMiniManager,pFicheManager,pMatriceManager;
function pDynamicUpdate(c){var b=c instanceof Element,a=b&&"INPUT"==c.tagName&&"submit"==c.type,e=b&&"SPAN"==c.tagName&&("p_nav-mini"==c.parentNode.id||"p_nav-fiche"==c.parentNode.id),b=b&&"SPAN"==c.tagName&&"p_nav-contact"==c.parentNode.id;if(!a&&!e&&!b&&!0!==c)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();pMiniManager.storageToFields();
pFicheManager.storageToFields();pMatriceManager.storageToFields();(a||b)&&pContactManager.storageToFields()}var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
function fDynamicUpdate(c){var b=c instanceof Element,a=b&&"INPUT"==c.tagName&&"submit"==c.type,e=b&&"SPAN"==c.tagName&&("f_nav-mini"==c.parentNode.id||"f_nav-fiche"==c.parentNode.id),b=b&&"SPAN"==c.tagName&&"f_nav-contact"==c.parentNode.id;if(!a&&!e&&!b&&!0!==c)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
fFicheManager.storageToFields();fMatriceManager.storageToFields();(a||b)&&fContactManager.storageToFields()}
api.send({path:"subject/getFriends",subject_id:1},function(c){if(0!=c.ModuleError)return Notification.error("Erreur",c.ModuleError),!1;lsi.createDataset("all-subjects");lsi["import"]("all-subjects",c.subjects);include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact-min.js",function(){include("/js/includes/input-phone-mini-min.js",function(){include("/js/includes/input-phone-fiche-min.js",function(){include("/js/includes/input-phone-matrice-min.js",function(){pSubjectManager=
new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="number"]'),$('[data-sublink="phone"] article.subject-panel [data-name="submit"]'));pSubjectManager.attach();pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(pDynamicUpdate);
pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(pDynamicUpdate);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),$('[data-sublink="phone"] #p_nav-fiche'));pFicheManager.attach(pDynamicUpdate);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(pDynamicUpdate);var b=new ShortcutManager;b.append("s+n+a+k+e",
function(){pMatriceManager.snake()});b.listen();$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("change",function(a){a={path:"upload/call_log",phone_number:$('[data-sublink="phone"] #p_subject_phone_number').value,file:a.target.files[0]};api.send(a,function(a){console.log(a);var b=null;if(0!=a.ModuleError)9==a.ModuleError?Notification.error("Erreur",
"Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");pSubjectManager.tmp_id.value=a.tmp_id;pSubjectManager.fieldsToStorage();pSubjectManager.storageToFields();for(var c=0;c<a.call.length;c++){var d=a.directory[a.call[c]];lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:c,sms:-1})}for(c=
0;c<a.sms.length;c++)if(d=a.directory[a.sms[c]],-1<a.call.indexOf(a.sms[c])){var k=lsi.get("p_contacts",d.id);k.sms=c;lsi.set("p_contacts",d.id,k)}else lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:c});for(var h in a.directory)h=parseInt(h),-1<a.call.indexOf(h)||-1<a.sms.indexOf(h)||(d=a.directory[h],lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:-1}));pContactManager.storageToFields();
pDynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(a){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");pSubjectManager.storageToFields();pContactManager.storageToFields();pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},
!1);$('[data-sublink="phone"] #p_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};var b=$('[data-sublink="phone"] #p_download-target');b.download="local-phone-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));
b.click()},!1);$('[data-sublink="phone"] #p_import-all').addEventListener("click",function(a){$('[data-sublink="phone"] #p_local-upload').click()},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("change",function(a){a={path:"upload/local_data",file:$('[data-sublink="phone"] #p_local-upload').files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",
a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_contacts",a.local_data.contacts);lsi["import"]("p_mini-fiches",a.local_data.mini);lsi["import"]("p_fiches",a.local_data.fiches);lsi.set("p_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();pDynamicUpdate(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();
pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();if(!pSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("p_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("p_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention",
"La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/phone",subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",
1E4);console.log(a)},!1)},!1)})})})})});include("/js/includes/input-facebook-subject-min.js",function(){include("/js/includes/input-facebook-contact-min.js",function(){include("/js/includes/input-facebook-mini-min.js",function(){include("/js/includes/input-facebook-fiche-min.js",function(){include("/js/includes/input-facebook-matrice-min.js",function(){fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]'));
function pDynamicUpdate(b){var a=b instanceof Element,e=a&&"INPUT"==b.tagName&&"submit"==b.type,g=a&&"SPAN"==b.tagName&&("p_nav-mini"==b.parentNode.id||"p_nav-fiche"==b.parentNode.id),c=a&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!e&&!g&&!c&&!0!==b)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();api.send({path:"subject/getFriends",
subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return!1;console.warn("> existing contacts loaded");lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();(e||c)&&pContactManager.storageToFields()})}var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
function fDynamicUpdate(b){var a=b instanceof Element,e=a&&"INPUT"==b.tagName&&"submit"==b.type,g=a&&"SPAN"==b.tagName&&("f_nav-mini"==b.parentNode.id||"f_nav-fiche"==b.parentNode.id),a=a&&"SPAN"==b.tagName&&"f_nav-contact"==b.parentNode.id;if(!e&&!g&&!a&&!0!==b)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
fFicheManager.storageToFields();fMatriceManager.storageToFields();(e||a)&&fContactManager.storageToFields()}
include("/js/includes/input-phone-subject-min.js",function(){include("/js/includes/input-phone-contact.js",function(){include("/js/includes/input-phone-mini.js",function(){include("/js/includes/input-phone-fiche-min.js",function(){include("/js/includes/input-phone-matrice-min.js",function(){pSubjectManager=new inputPhoneSubject($('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="phone"] article.subject-panel [data-name="submit"]'));
pSubjectManager.attach(pDynamicUpdate);pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(pDynamicUpdate);pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(pDynamicUpdate);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'),$('[data-sublink="phone"] #p_nav-fiche'));
pFicheManager.attach(pDynamicUpdate);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(pDynamicUpdate);var b=new ShortcutManager;b.append("s+n+a+k+e",function(){pMatriceManager.snake()});b.listen();$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] input#p_call_log-import[type="file"]').addEventListener("change",function(a){api.send({path:"upload/call_log",
file:a.target.files[0]},function(a){console.log(a);var b=null;if(0!=a.ModuleError)9==a.ModuleError?Notification.error("Erreur","Il est n\u00e9cessaire de saisir les informations du <b>sujet</b> avant d'exporter son journal d'appel"):Notification.error("Erreur",a.ModuleError);else{b=Notification.info("Info","Chargement du journal d'appel");pSubjectManager.tmp_id.value=a.tmp_id;pSubjectManager.fieldsToStorage();pSubjectManager.storageToFields();for(var c=0;c<a.call.length;c++){var d=a.directory[a.call[c]];
lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:c,sms:-1})}for(c=0;c<a.sms.length;c++)if(d=a.directory[a.sms[c]],-1<a.call.indexOf(a.sms[c])){var f=lsi.get("p_contacts",d.id);f.sms=c;lsi.set("p_contacts",d.id,f)}else lsi.set("p_contacts",d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:c});for(var h in a.directory)h=parseInt(h),-1<a.call.indexOf(h)||-1<a.sms.indexOf(h)||(d=a.directory[h],lsi.set("p_contacts",
d.id,{uid:d.id,number:d.number,username:d.name,countsms:d.sms,countcall:d.call,call:-1,sms:-1}));pContactManager.storageToFields();pDynamicUpdate(!0);null!=b&&b.click();Notification.success("OK","Chargement termin\u00e9")}})},!1);$('[data-sublink="phone"] #p_clear-all').addEventListener("click",function(a){lsi.clear("p_subject");lsi.clear("p_contacts");lsi.clear("p_mini-fiches");lsi.clear("p_fiches");lsi.clear("p_matrice");pSubjectManager.storageToFields();pContactManager.storageToFields();pMiniManager.storageToFields();
pFicheManager.storageToFields();pMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="phone"] #p_export-all').addEventListener("click",function(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};
var b=$('[data-sublink="phone"] #p_download-target');b.download="local-phone-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$('[data-sublink="phone"] #p_import-all').addEventListener("click",function(a){$('[data-sublink="phone"] #p_local-upload').click()},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="phone"] #p_local-upload').addEventListener("change",function(a){a=
{path:"upload/local_data",file:$('[data-sublink="phone"] #p_local-upload').files[0]};api.send(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_contacts",a.local_data.contacts);lsi["import"]("p_mini-fiches",a.local_data.mini);lsi["import"]("p_fiches",a.local_data.fiches);lsi.set("p_matrice",0,a.local_data.matrice);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();
pDynamicUpdate(!0)})},!1);$('[data-sublink="phone"] #p_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();if(!pSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;a=lsi["export"]("p_mini-fiches");var b=0,g;for(g in a)if(!isNaN(g)&&(b++,!a[g].valid))return Notification.warning("Attention",
"La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("p_fiches");for(g in a)if(!a[g].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(g)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;g={path:"input/phone",subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(g,function(a){console.log(a);
if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",1E4);console.log(a)},!1)},!1)})})})})});
include("/js/includes/input-facebook-subject-min.js",function(){include("/js/includes/input-facebook-contact-min.js",function(){include("/js/includes/input-facebook-mini-min.js",function(){include("/js/includes/input-facebook-fiche-min.js",function(){include("/js/includes/input-facebook-matrice-min.js",function(){fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]'));
fSubjectManager.attach();fContactManager=new inputFacebookContact($('[data-sublink="facebook"] article.contact-panel'),$('[data-sublink="facebook"] #f_nav-contact'));fContactManager.attach(fDynamicUpdate);fMiniManager=new inputFacebookMini($('[data-sublink="facebook"] article.mini-relation-panel'),$('[data-sublink="facebook"] #f_nav-mini'));fMiniManager.attach(fDynamicUpdate);fFicheManager=new inputFacebookFiche($('[data-sublink="facebook"] article.relation-panel'),$('[data-sublink="facebook"] #f_nav-fiche'));
fFicheManager.attach(fDynamicUpdate);fMatriceManager=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel'));fMatriceManager.attach(fDynamicUpdate);$('[data-sublink="facebook"] #f_clear-all').addEventListener("click",function(b){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();
fMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},!1);$('[data-sublink="facebook"] #f_export-all').addEventListener("click",function(b){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");b={subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};var a=$('[data-sublink="facebook"] #f_download-target');
a.download="local-facebook-data.json";a.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(b));a.click()},!1);$('[data-sublink="facebook"] #f_import-all').addEventListener("click",function(b){$('[data-sublink="facebook"] #f_local-upload').click()},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("click",function(b){b.target.value=null},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("change",function(b){b={path:"upload/local_data",file:$('[data-sublink="facebook"] #f_local-upload').files[0]};
api.send(b,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("Erreur",a.ModuleError),!1;lsi.set("f_subject",0,a.local_data.subject);lsi["import"]("f_contacts",a.local_data.contacts);lsi["import"]("f_mini-fiches",a.local_data.mini);lsi["import"]("f_fiches",a.local_data.fiches);lsi.set("f_matrice",0,a.local_data.matrice);fSubjectManager.storageToFields();fContactManager.storageToFields();fMatriceManager.storageToFields();fDynamicUpdate(!0)})},!1);$('[data-sublink="facebook"] #f_submit-all').addEventListener("click",
function(b){console.log("> GATHERING ALL DATA");fSubjectManager.fieldsToStorage();fContactManager.fieldsToStorage();fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();if(!fSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;b=lsi["export"]("f_mini-fiches");var a=0,c;for(c in b)if(!isNaN(c)&&(a++,!b[c].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+a+"</b> est incompl\u00e8te et/ou incorrecte"),
!1;b=lsi["export"]("f_fiches");for(c in b)if(!b[c].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/facebook",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),
!1;console.log(a)},!1)},!1)})})})})})});
function testRoutinePhone(c){var b=lsi["export"]("p_contacts"),a=lsi["export"]("p_mini-fiches"),e=lsi["export"]("p_fiches"),f=0;if(null!=c&&c)for(var g in a)isNaN(g)||(c="",null!=b[g]&&(c=b[g].username),a=$('#p_nav-mini [data-n="'+g+'"]'),a.click(),$("#unknown_min_p_"+g).checked=0==c.length,0==c.length?($("#sexeI_mini_p_"+g).checked=!0,$('input[data-name="uid"][value="'+g+'"] ~ h5 select[data-name="age"]').value=f%19,$('input[data-name="uid"][value="'+g+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_p_"+g).checked=!0):(c=["H","F"][Math.floor(f%2)],$("#sexe"+c+"_mini_p_"+g).checked=!0,$('input[data-name="uid"][value="'+g+'"] ~ h5 select[data-name="age"]').value=f%19,$('input[data-name="uid"][value="'+g+'"] ~ h5 select[data-name="studies"]').value=1+f%6,c=f%10,9==c?($("#reltype10_mini_p_"+g).checked=!0,$('input[data-name="uid"][value="'+g+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+c+"_mini_p_"+g).checked=!0,f++));for(var d in e)isNaN(d)||(a=$('#p_nav-fiche [data-n="'+
d+'"]'),a.click(),c=["H","F","I"][Math.floor(f%3)],$("#sexe"+c+"_p_"+d).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=f%19,b="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),b=b[f%b.length],$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="job"]').value=b,b=(f%12).toString(),1==b.length&&(b="0"+b),$('article.fiche-relation > input[data-name="uid"][value="'+
d+'"] ~ h5 select[data-name="studies"]').value=b,c=f%9,8==c?($("#reltype10_p_"+d).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+c+"_p_"+d).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="city"]').value=(10+f).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="cp"]').value=(1E4+f).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+
d+'"] ~ h5 input[data-name="quartier"]').value=f,$("#loc"+["A","B","C","D"][Math.floor(f%4)]+"_p_"+d).checked=!0,b=$$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="duration"]'),b[0].value=f.toString(),b[1].value=1+f.toString(),b=f%14,$("article.fiche-relation #contexte"+b+"_p_"+d).checked=!0,e=$$('article.fiche-relation > input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="contextSpecial"]'),11==b&&(e[0].value="internet"),12==b&&(e[1].value="association"),
13==b&&(e[2].value="autre"),f++)};
function(b){console.log("> GATHERING ALL DATA");fSubjectManager.fieldsToStorage();fContactManager.fieldsToStorage();fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();if(!fSubjectManager.check())return Notification.warning("Attention","Vous devez saisir les informations du <i>sujet</i>"),!1;b=lsi["export"]("f_mini-fiches");var a=0,e;for(e in b)if(!isNaN(e)&&(a++,!b[e].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+a+"</b> est incompl\u00e8te et/ou incorrecte"),
!1;b=lsi["export"]("f_fiches");for(e in b)if(!b[e].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(e)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;e={path:"input/facebook",subject:lsi["export"]("f_subject")[0],contacts:lsi["export"]("f_contacts"),mini:lsi["export"]("f_mini-fiches"),fiches:lsi["export"]("f_fiches"),matrice:lsi["export"]("f_matrice")[0]};api.send(e,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),
!1;console.log(a)},!1)},!1)})})})})});
function testRoutinePhone(b){var a=lsi["export"]("p_contacts"),e=lsi["export"]("p_mini-fiches"),g=lsi["export"]("p_fiches"),c=0;if(null!=b&&b)for(var d in e)isNaN(d)||(b="",null!=a[d]&&(b=a[d].username),e=$('#p_nav-mini [data-n="'+d+'"]'),e.click(),$("#unknown_min_p_"+d).checked=0==b.length,0==b.length?($("#sexeI_mini_p_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_p_"+d).checked=!0):(b=["H","F"][Math.floor(c%2)],$("#sexe"+b+"_mini_p_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=1+c%6,b=c%10,9==b?($("#reltype10_mini_p_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_mini_p_"+d).checked=!0,c++));for(var f in g)isNaN(f)||(e=$('#p_nav-fiche [data-n="'+
f+'"]'),e.click(),b=["H","F","I"][Math.floor(c%3)],$("#sexe"+b+"_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=c%19,a="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),a=a[c%a.length],$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value=a,a=(c%12).toString(),1==a.length&&(a="0"+a),$('article.fiche-relation > input[data-name="uid"][value="'+
f+'"] ~ h5 select[data-name="studies"]').value=a,b=c%9,8==b?($("#reltype10_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="city"]').value=(10+c).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value=(1E4+c).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+
f+'"] ~ h5 input[data-name="quartier"]').value=c,$("#loc"+["A","B","C","D"][Math.floor(c%4)]+"_p_"+f).checked=!0,a=$$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="duration"]'),a[0].value=c.toString(),a[1].value=1+c.toString(),a=c%14,$("article.fiche-relation #contexte"+a+"_p_"+f).checked=!0,g=$$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="contextSpecial"]'),11==a&&(g[0].value="internet"),12==a&&(g[1].value="association"),
13==a&&(g[2].value="autre"),c++)}
function testRoutineFacebook(b){var a=lsi["export"]("f_contacts"),e=lsi["export"]("f_mini-fiches"),g=lsi["export"]("f_fiches"),c=0;if(null!=b&&b)for(var d in e)isNaN(d)||(b="",null!=a[d]&&(b=a[d].username),e=$('#f_nav-mini [data-n="'+d+'"]'),e.click(),$("#unknown_min_f_"+d).checked=0==b.length,0==b.length?($("#sexeI_mini_f_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_f_"+d).checked=!0):(b=["H","F"][Math.floor(c%2)],$("#sexe"+b+"_mini_f_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="age"]').value=c%19,$('input[data-name="uid"][value="'+d+'"] ~ h5 select[data-name="studies"]').value=1+c%6,b=c%10,9==b?($("#reltype10_mini_f_"+d).checked=!0,$('input[data-name="uid"][value="'+d+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_mini_f_"+d).checked=!0,c++));for(var f in g)isNaN(f)||(e=$('#f_nav-fiche [data-n="'+
f+'"]'),e.click(),b=["H","F","I"][Math.floor(c%3)],$("#sexe"+b+"_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=c%19,a="10 21 22 23 31 32 36 41 46 47 48 51 54 55 56 61 66 69 71 72 73 74 75 76 81 82".split(" "),a=a[c%a.length],$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value=a,a=(c%12).toString(),1==a.length&&
(a="0"+a),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="studies"]').value=a,b=c%9,8==b?($("#reltype10_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_f_"+f).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="city"]').value=
(10+c).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value=(1E4+c).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="quartier"]').value=c,$("#loc"+["A","B","C","D"][Math.floor(c%4)]+"_f_"+f).checked=!0,a=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="duration"]'),
a[0].value=c.toString(),a[1].value=1+c.toString(),a=c%14,$('section[data-sublink="facebook"] article.fiche-relation #contexte'+a+"_f_"+f).checked=!0,g=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="contextSpecial"]'),11==a&&(g[0].value="internet"),12==a&&(g[1].value="association"),13==a&&(g[2].value="autre"),c++)};

View File

@ -113,7 +113,17 @@ function pDynamicUpdate(target){
// Supprime les contacts déja dans les FICHES
pMiniManager.sync();
/* (7) On affiche le tout */
/* (7) On récupère tous les amis du sujet */
api.send({ path: 'subject/getFriends', subject_id: pSubjectManager.subject_id.value }, function(response){
// Si erreur, on quitte
if( response.ModuleError != 0 )
return false;
// On enregistre les contacts existants
console.warn('> existing contacts loaded');
lsi.import('p_friends', response.subjects);
/* (8) On affiche le tout */
pMiniManager.storageToFields();
pFicheManager.storageToFields();
pMatriceManager.storageToFields();
@ -121,6 +131,9 @@ function pDynamicUpdate(target){
/* (8) On met à jour les contacts si on les a modifié on si on navigue dans les contacts */
if( isSaveButton || isNavContact )
pContactManager.storageToFields();
});
}
@ -192,30 +205,14 @@ function fDynamicUpdate(target){
/* [3] On récupère la liste des "amis"
=========================================================*/
api.send({ path: 'subject/getFriends', subject_id: 1 }, function(allSubjectsResponse){
// Si erreur
if( allSubjectsResponse.ModuleError != 0){
Notification.error('Erreur', allSubjectsResponse.ModuleError);
return false;
}
// On enregistre la liste des amis existants
lsi.createDataset('all-subjects');
lsi.import('all-subjects', allSubjectsResponse.subjects);
/*=========================================================*/
/*========== Gestion du formulaire téléphonique ===========*/
/*=========================================================*/
include('/js/includes/input-phone-subject-min.js', function(){
include('/js/includes/input-phone-contact-min.js', function(){
include('/js/includes/input-phone-mini-min.js', function(){
//TODO: Remettre version min
include('/js/includes/input-phone-contact.js', function(){
//TODO: Remettre version min
include('/js/includes/input-phone-mini.js', function(){
include('/js/includes/input-phone-fiche-min.js', function(){
include('/js/includes/input-phone-matrice-min.js', function(){
@ -226,12 +223,11 @@ api.send({ path: 'subject/getFriends', subject_id: 1 }, function(allSubjectsResp
pSubjectManager = new inputPhoneSubject(
$('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),
$('[data-sublink="phone"] article.subject-panel [data-name="subject_id"]'),
$('[data-sublink="phone"] article.subject-panel [data-name="number"]'),
$('[data-sublink="phone"] article.subject-panel [data-name="submit"]')
);
/* (2) On le démarre */
pSubjectManager.attach();
pSubjectManager.attach(pDynamicUpdate);
@ -285,6 +281,7 @@ api.send({ path: 'subject/getFriends', subject_id: 1 }, function(allSubjectsResp
pMatriceManager.attach(pDynamicUpdate);
// Listener pour snake
var smgr = new ShortcutManager();
smgr.append('s+n+a+k+e', function(){ pMatriceManager.snake(); });
@ -312,7 +309,6 @@ api.send({ path: 'subject/getFriends', subject_id: 1 }, function(allSubjectsResp
/* (1) On rédige la requête */
var request = {
path: 'upload/call_log',
phone_number: $('[data-sublink="phone"] #p_subject_phone_number').value,
file: e.target.files[0]
};
@ -874,10 +870,6 @@ api.send({ path: 'subject/getFriends', subject_id: 1 }, function(allSubjectsResp
});
@ -1082,3 +1074,183 @@ function testRoutinePhone(doMini){
}
}
/*=========================================================*/
/*============== Routine de test FACEBOOK =================*/
/*=========================================================*/
function testRoutineFacebook(doMini){
/* [0] Récupération des données
=========================================================*/
var contacts = lsi.export('f_contacts');
var mini = lsi.export('f_mini-fiches');
var fiches = lsi.export('f_fiches');
var count = 0;
/* [1] Remplissage des mini-fiches
=========================================================*/
if( doMini != null && doMini ){
for( var m in mini ){
/* (0) Si la fiche n'est pas affichée, on passe à la suivante */
if( isNaN(m) )
continue;
/* (1) On récupére le nom du contact associé */
var name = '';
if( contacts[m] != null )
name = contacts[m].username;
/* (2) On remplit la mini fiche */
// {1} On se positionne sur la fiche en question //
var navBut = $('#f_nav-mini [data-n="'+m+'"]');
navBut.click();
// {2} Si la personne n'a pas de nom, on met que ce contact est inconnu, puis les valeurs par défaut //
$('#unknown_min_f_'+m).checked = name.length == 0;
/* (3) Si personne inconnue -> valeurs indéterminées */
if( name.length == 0 ){
// {1} Sexe indéterminé //
$('#sexeI_mini_f_'+m).checked = true;
// {2} Age indéterminé //
$('input[data-name="uid"][value="'+m+'"] ~ h5 select[data-name="age"]').value = count % 19;
// {3} Etudes indéterminées //
$('input[data-name="uid"][value="'+m+'"] ~ h5 select[data-name="studies"]').value = 0;
// {4} Type de relation inconnue //
$('#reltype9_mini_f_'+m).checked = true;
continue;
/* (4) Si la personne est connue on incrémente les valeurs */
}else{
// {1} On remplit le sexe //
var sexeVal = ['H', 'F'][ Math.floor(count % 2) ];
$('#sexe'+sexeVal+'_mini_f_'+m).checked = true;
// {2} On remplit l'age //
$('input[data-name="uid"][value="'+m+'"] ~ h5 select[data-name="age"]').value = count % 19;
// {3} On remplit les études //
$('input[data-name="uid"][value="'+m+'"] ~ h5 select[data-name="studies"]').value = 1 + (count % 6);
// {4} Type de relation //
var relVal = count % 10;
// Si AUTRE
if( relVal == 9 ){
$('#reltype10_mini_f_'+m).checked = true;
$('input[data-name="uid"][value="'+m+'"] ~ h5 input[data-name="reltypeSpecial"]').value = 'autre';
// Sinon
}else
$('#reltype'+relVal+'_mini_f_'+m).checked = true;
}
count++;
}
}
/* [2] Remplissage des fiches complètes
=========================================================*/
for( var f in fiches ){
/* (0) Si la fiche n'est pas affichée, on passe à la suivante */
if( isNaN(f) )
continue;
/* (1) On récupére le nom du contact associé */
var name = '';
if( contacts[fiches[f].contact] != null )
name = contacts[fiches[f].contact].username;
/* (2) On remplit la fiche */
// {1} On se positionne sur la fiche en question //
var navBut = $('#f_nav-fiche [data-n="'+f+'"]');
navBut.click();
// {1} On remplit le sexe //
var sexeVal = ['H', 'F', 'I'][ Math.floor(count % 3) ];
$('#sexe'+sexeVal+'_f_'+f).checked = true;
// {2} On remplit l'age //
$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value = count % 19;
// {3} On remplit la profession //
var jobVal = ['10', '21', '22', '23', '31', '32', '36', '41', '46', '47', '48', '51', '54', '55', '56', '61', '66', '69', '71', '72', '73', '74', '75', '76', '81', '82'];
jobVal = jobVal[ count % jobVal.length ];
$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value = jobVal;
// {4} On remplit les études //
var stuVal = (count % 12).toString();
if( stuVal.length == 1 ) stuVal = '0'+stuVal;
$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="studies"]').value = stuVal;
// {5} Type de relation //
var relVal = count % 9;
// Si AUTRE
if( relVal == 8 ){
$('#reltype10_f_'+f).checked = true;
$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value = 'autre';
// Sinon
}else
$('#reltype'+relVal+'_f_'+f).checked = true;
// {6} La ville, le CP et le quartier //
$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="city"]').value = (10 + count).toString();
$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value = (10000 + count).toString();
$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="quartier"]').value = count;
// {7} Temps entre les domiciles //
var locVal = ['A', 'B', 'C', 'D'][ Math.floor(count % 4) ];
$('#loc'+locVal+'_f_'+f).checked = true;
// {8} Temps de connaissance //
var duration = $$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="duration"]');
duration[0].value = count.toString();
duration[1].value = 1+count.toString();
// {9} Contexte de rencontre //
var ctxVal = count % 14;
$('section[data-sublink="facebook"] article.fiche-relation #contexte'+ctxVal+'_f_'+f).checked = true;
var ctxSpe = $$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="contextSpecial"]');
// Si special1
if( ctxVal == 11 )
ctxSpe[0].value = 'internet';
// Si special2
if( ctxVal == 12 )
ctxSpe[1].value = 'association';
// Si special3
if( ctxVal == 13 )
ctxSpe[2].value = 'autre';
count++;
}
}