"+
diff --git a/js/includes/input-phone-fiche-min.js b/js/includes/input-phone-fiche-min.js
index 6c35b2f..fc9f816 100644
--- a/js/includes/input-phone-fiche-min.js
+++ b/js/includes/input-phone-fiche-min.js
@@ -4,13 +4,13 @@ city:b.city,quartier:b.quartier,cp:b.cp,loc:b.loc,duration:b.duration,context:b.
inputPhoneFiche.prototype.add=function(a){console.log("FICHE: ADD");if(null==a.uid||isNaN(a.uid)||null==a.contact||isNaN(a.contact))return!1;a.city=null!=a.city?a.city:this.defaultData.city;a.quartier=null!=a.quartier?a.quartier:this.defaultData.quartier;a.cp=null!=a.cp?a.cp:this.defaultData.cp;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];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.age=null!=a.age?a.age:this.defaultData.age;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:this.defaultData.freq;
-a.connect=null!=a.connect?a.connect:this.defaultData.connect;var c=lsi.get("p_contacts",a.contact);if(!1===c)return!1;if(!isNaN(c.existing)){var b=lsi.get("p_friends",c.existing);c.username=b.name;a.age=b.age;a.sexe=b.sexe;a.loc=b.dist;isNaN(b.reltype)?(a.reltype=10,a.reltypeSpecial=b.reltype):(a.reltype=b.reltype,a.reltypeSpecial="");null!=b.studies2&&(a.studies=b.studies2,a.job=b.job,a.famsit=b.famsit,a.city=b.city,a.cp=b.cp,a.quartier=b.quartier,a.duration[0]=b.duration[0],a.duration[1]=b.duration[1],
-a.context=b.context,a.contextSpecial=b.contextExtra,a.connect=b.connect,a.connectSpecial=b.connectExtra,a.freq=b.freq)}this.container.innerHTML+=pFicheBuilder.build({name:c.username,countcall:c.countcall,countsms:c.countsms,uid:a.uid,contact:a.contact,city:a.city,quartier:a.quartier,cp:a.cp,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]});c=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="job"]>option[value="'+a.job+'"]');null!=c&&c.setAttribute("selected","selected");c=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=c&&c.setAttribute("selected","selected");c=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+
-a.uid+'"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');null!=c&&c.setAttribute("selected","selected");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(c=0;cinput[type="radio"][data-name="famsit"]');
-for(c=0;cinput[type="radio"][data-name="reltype"]');for(c=0;cinput[type="radio"][data-name="loc"]');
-for(c=0;cinput[type="radio"][data-name="context"]');for(c=0;cinput[type="radio"][data-name="freq"]');
-for(c=0;cinput[type="radio"][data-name="connect"]');for(c=0;cspan>select[data-name="job"]>option[value="'+a.job+'"]');null!=c&&c.setAttribute("selected","selected");c=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+
+'"]');null!=c&&c.setAttribute("selected","selected");c=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');null!=c&&c.setAttribute("selected","selected");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(c=0;cinput[type="radio"][data-name="famsit"]');for(c=0;cinput[type="radio"][data-name="reltype"]');for(c=0;cinput[type="radio"][data-name="loc"]');for(c=0;cinput[type="radio"][data-name="context"]');for(c=0;cinput[type="radio"][data-name="freq"]');for(c=0;cinput[type="radio"][data-name="connect"]');for(c=0;clsi.keys("p_contacts").length?lsi.keys("p_contacts").length:40,e;for(e in a){for(ficheUid=0;-1=d)break}var a=lsi["export"]("p_fiches"),f;for(f in a)if(d=lsi.get("p_contacts",a[f].contact)){c=
null;e=20>parseInt(a[f].uid);for(var g in a)if(!(e&&20>g||!e&&20<=g)&&(b=lsi.get("p_contacts",a[g].contact),g!=f&&b)){var h=0a[f].timestamp||(d=a[f],d.uid=c.uid,lsi.set("p_fiches",c.uid,d))}};
diff --git a/js/includes/input-phone-fiche.js b/js/includes/input-phone-fiche.js
index 06d32f3..4e54d1a 100644
--- a/js/includes/input-phone-fiche.js
+++ b/js/includes/input-phone-fiche.js
@@ -169,6 +169,8 @@ inputPhoneFiche.prototype.add = function(objectData){
return false;
// {2} Si lié à un contact d'une autre étude, on utilise ses informations //
+ var importedFiche = '';
+
if( !isNaN(associatedContact.existing) ){
var existingData = lsi.get('p_friends', associatedContact.existing);
@@ -204,6 +206,9 @@ inputPhoneFiche.prototype.add = function(objectData){
objectData.connect = existingData.connect;
objectData.connectSpecial = existingData.connectExtra;
objectData.freq = existingData.freq;
+ importedFiche = 'Contact importé: non modifiable!';
+ }else{
+ importedFiche = 'Contact importé (incomplet): modifiable partiellement!';
}
}
@@ -211,6 +216,7 @@ inputPhoneFiche.prototype.add = function(objectData){
// {5} Création physique //
this.container.innerHTML += pFicheBuilder.build({
+ importedfiche: importedFiche,
name: associatedContact.username,
countcall: associatedContact.countcall,
countsms: associatedContact.countsms,
diff --git a/js/includes/input-phone-mini-min.js b/js/includes/input-phone-mini-min.js
index 7f226e9..1ce1224 100644
--- a/js/includes/input-phone-mini-min.js
+++ b/js/includes/input-phone-mini-min.js
@@ -7,7 +7,7 @@ a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');
a.sexe?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");c=$$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="reltype"]');for(b=0;binput[type="radio"][data-name="loc"]');for(b=0;binput[type="checkbox"][data-name="unknown"]');null!=b&&a.unknown&&b.setAttribute("checked","checked")};
inputPhoneMini.prototype.storageToFields=function(){console.log("MINI FICHE: STORAGE TO FIELDS");var a=lsi.get("p_mini-fiches",this.selected);if(null==a)return this.updateNavBar(),!1;this.container.innerHTML="";this.add(a);this.updateNavBar()};
-inputPhoneMini.prototype.sync=function(){console.log("MINI FICHE: SYNC");var a=lsi["export"]("p_contacts"),b=lsi["export"]("p_fiches"),c=[],d;for(d in b)-1==c.indexOf(b[d].contact)&&c.push(b[d].contact);for(var e in a)-1 span.active'),c=0;c span.active'),c=0;c'+ ++b+"");for(c in a)isNaN(c)||(b=$('[data-sublink="phone"] #p_nav-mini span[data-n="'+a[c].uid+'"]'),null!=b&&(!0===a[c].valid?b.addClass("done"):b.remClass("done")));this.nav($('[data-sublink="phone"] #p_nav-mini span[data-n="'+this.selected+'"]'))};
inputPhoneMini.prototype.check=function(a){return a.unknown?!0:""==a.sexe||"."==a.studies||"."==a.age||""==a.loc||""==a.reltype||"10"==a.reltype&&2>a.reltypeSpecial.length?!1:!0};inputPhoneMini.prototype.attach=function(a){console.log("MINI FICHE: ATTACH");lsi.createDataset("p_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)};
diff --git a/js/includes/input-phone-mini.js b/js/includes/input-phone-mini.js
index 3567802..9c3aac6 100644
--- a/js/includes/input-phone-mini.js
+++ b/js/includes/input-phone-mini.js
@@ -256,34 +256,28 @@ inputPhoneMini.prototype.sync = function(){
/* (1) On récupère les clés de tous les CONTACTS */
var contactData = lsi.export('p_contacts');
+ var ficheData, miniData;
- /* (2) On enregistre les contacts qui sont déja dans les FICHES */
- var fiches = lsi.export('p_fiches');
- var ignoredContacts = [];
- for( var id in fiches )
- if( ignoredContacts.indexOf( fiches[id].contact ) == -1 )
- ignoredContacts.push( fiches[id].contact );
+ /* (2) On enregistre les contacts qui ne sont pas déja dans les FICHES */
+ ficheData = lsi.export('p_fiches');
+
+ for( var id in ficheData )
+ delete contactData[ ficheData[id].contact ];
- /* (3) Pour chaque CONTACT, on met à jour/crée la MINI fiche associée */
+ /* (3) Pour chaque CONTACT restant, on met à jour/crée la MINI fiche associée */
for( var key in contactData ){
- /* (4) Si le contact est déja dans une fiche, on le retire */
- if( ignoredContacts.indexOf(parseInt(key)) > -1 ){
- // On supprime au cas ou
- lsi.del('p_mini-fiches', key);
- continue;
- }
- /* (5) Si le contact n'a aucun nominatif, on met inconnu par défaut, mais on ne l'affiche pas */
+ /* (4) Si le contact n'a aucun nominatif, on met inconnu par défaut, mais on ne l'affiche pas */
var noName = contactData[key].username.length == 0;
- // On rajoute un '.' après pour dire qu'on affichera pas
+ // On rajoute un '-' après pour dire qu'on affichera pas
var uid = noName ? key.toString()+'-' : key;
/* (5) On récupère les informations de la MINI (si elle existe) */
- var miniData = lsi.get('p_mini-fiches', uid);
+ miniData = lsi.get('p_mini-fiches', uid);
/* (6) Si la MINI fiche n'exise pas, on la crée avec les valeurs par défaut */
@@ -297,7 +291,7 @@ inputPhoneMini.prototype.sync = function(){
}
/* (7) On met à jour la MINI fiche */
- miniData.uid = parseInt(key);
+ miniData.uid = parseInt( key );
/* (8) On enregistre les modification */
@@ -306,7 +300,7 @@ inputPhoneMini.prototype.sync = function(){
}
/* (9) On met à jour la mini-fiche en cours */
- var miniData = lsi.export('p_mini-fiches');
+ miniData = lsi.export('p_mini-fiches');
// Si la clé n'existe plus
if( miniData[this.selected] == null ){
diff --git a/view/js/input-min.js b/view/js/input-min.js
index 264f4bb..5aca808 100644
--- a/view/js/input-min.js
+++ b/view/js/input-min.js
@@ -23,7 +23,7 @@ Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")}
api.send(a,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(a){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 sujet"),!1;a=lsi["export"]("f_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention","La fiche rapide"+b+" est incompl\u00e8te et/ou incorrecte"),
!1;a=lsi["export"]("f_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention","La fiche compl\u00e8te"+(parseInt(c)+1)+" 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 testContactsPhone(){for(var a=0;45>a;a++)0==a%20?lsi.set("p_contacts",a,{uid:a,username:"contact-x"}):lsi.set("p_contacts",a,{uid:a,username:"contact-"+a})}
+!1;console.log(a)},!1)},!1)})})})})});function testContactsPhone(){for(var a=0;45>a;a++)0==a%20?lsi.set("p_contacts",a,{uid:a,username:"contact-x"}):lsi.set("p_contacts",a,{uid:a,username:"contact-"+a})}function testContactsFacebook(){for(var a=0;45>a;a++)0==a%20?lsi.set("f_contacts",a,{uid:a,username:"contact-x"}):lsi.set("f_contacts",a,{uid:a,username:"contact-"+a})}
function testRoutinePhone(a){var b=lsi["export"]("p_contacts"),c=lsi["export"]("p_mini-fiches"),g=lsi["export"]("p_fiches"),d=0;if(null!=a&&a)for(var f in c)isNaN(f)||(a="",null!=b[f]&&(a=b[f].username),c=$('#p_nav-mini [data-n="'+f+'"]'),c.click(),$("#unknown_min_p_"+f).checked=0==a.length,0==a.length?($("#sexeI_mini_p_"+f).checked=!0,$('input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="studies"]').value=
0,$("#reltype9_mini_p_"+f).checked=!0):(a=["H","F"][Math.floor(d%2)],$("#sexe"+a+"_mini_p_"+f).checked=!0,$('input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="studies"]').value=1+d%6,a=d%10,9==a?($("#reltype10_mini_p_"+f).checked=!0,$('input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_mini_p_"+f).checked=!0,d++));for(var e in g)isNaN(e)||(c=$('#p_nav-fiche [data-n="'+
e+'"]'),c.click(),a=["H","F","I"][Math.floor(d%3)],$("#sexe"+a+"_p_"+e).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=d%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[d%b.length],$('article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="job"]').value=b,b=(d%12).toString(),1==b.length&&(b="0"+b),$('article.fiche-relation > input[data-name="uid"][value="'+
diff --git a/view/js/input.js b/view/js/input.js
index fc06bf7..07a7a3a 100644
--- a/view/js/input.js
+++ b/view/js/input.js
@@ -267,7 +267,7 @@ var sField, sSubmit, sList,
//TODO: Remettre version min
include('/js/includes/input-phone-fiche.js', function(){
include('/js/includes/input-phone-matrice-min.js', function(){
-
+
/* (1) Gestion du formulaire du sujet
---------------------------------------------------------*/
/* (1) On crée une instance du manager du sujet */
@@ -950,6 +950,18 @@ var sField, sSubmit, sList,
};
+ function testContactsFacebook(){
+
+ for( var i = 0 ; i < 45 ; i++ ){
+
+ if( i%20 == 0 )
+ lsi.set('f_contacts', i, { uid: i, username: 'contact-x' });
+ else
+ lsi.set('f_contacts', i, { uid: i, username: 'contact-'+i });
+ }
+ };
+
+