diff --git a/js/includes/input-phone-fiche-min.js b/js/includes/input-phone-fiche-min.js index 25c1d3e..6c35b2f 100644 --- a/js/includes/input-phone-fiche-min.js +++ b/js/includes/input-phone-fiche-min.js @@ -1,20 +1,21 @@ -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:{sexe:"2",age:".",job:".",famsit:"0",studies:"0",reltype:"0",reltypeSpecial:"",city:"",quartier:"",cp:"",loc:"0",duration:["",""],context:"0",contextSpecial:["","",""],freq:["4","9","14","19","24"],connect:"1 3 5 7 9 11".split(" "),connectSpecial:["",""],timestamp:0,valid:!1}}; -inputPhoneFiche.prototype.fieldsToStorage=function(){console.log("FICHE: FIELDS TO STORAGE");for(var a=$$('[data-sublink="phone"] article.relation-panel .fiche-relation'),b=0;b FICHE UPDATE"),c.timestamp=Date.now());lsi.set("p_fiches",c.uid,c)}}}; +function inputPhoneFiche(a,c){this.container=a;this.nav_container=c}inputPhoneFiche.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{sexe:"2",age:".",job:".",famsit:"0",studies:"0",reltype:"0",reltypeSpecial:"",city:"",quartier:"",cp:"",loc:"0",duration:["",""],context:"0",contextSpecial:["","",""],freq:["4","9","14","19","24"],connect:"1 3 5 7 9 11".split(" "),connectSpecial:["",""],timestamp:0,valid:!1}}; +inputPhoneFiche.prototype.fieldsToStorage=function(){console.log("FICHE: FIELDS TO STORAGE");for(var a=$$('[data-sublink="phone"] article.relation-panel .fiche-relation'),c=0;c FICHE UPDATE"),b.timestamp=Date.now());lsi.set("p_fiches",b.uid,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 b=lsi.get("p_contacts",a.contact);if(!1===b)return!1;if(!isNaN(b.existing)){var c=lsi.get("p_friends",b.existing);b.username=c.name;a.age=c.age;a.sexe=c.sexe;a.loc=c.dist;isNaN(c.reltype)?(a.reltype=10,a.reltypeSpecial=c.reltype):(a.reltype=c.reltype,a.reltypeSpecial="");null!=c.studies2&&(a.studies=c.studies2,a.job=c.job,a.famsit=c.famsit,a.city=c.city,a.cp=c.cp,a.quartier=c.quartier,a.duration[0]=c.duration[0],a.duration[1]=c.duration[1], -a.context=c.context,a.contextSpecial=c.contextExtra,a.connect=c.connect,a.connectSpecial=c.connectExtra,a.freq=c.freq)}this.container.innerHTML+=pFicheBuilder.build({name:b.username,countcall:b.countcall,countsms:b.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]});b=$('[data-sublink="phone"] 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=$('[data-sublink="phone"] 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");b=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+ -a.uid+'"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');null!=b&&b.setAttribute("selected","selected");c=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(b=0;binput[type="radio"][data-name="famsit"]'); -for(b=0;binput[type="radio"][data-name="reltype"]');for(b=0;binput[type="radio"][data-name="loc"]'); -for(b=0;binput[type="radio"][data-name="context"]');for(b=0;binput[type="radio"][data-name="freq"]'); -for(b=0;binput[type="radio"][data-name="connect"]');for(b=0;blsi.keys("p_contacts").length?lsi.keys("p_contacts").length:40;if(b.length=c)break}var a=lsi["export"]("p_fiches"),f;for(f in a)b=lsi.get("p_contacts",a[f].contact),null!=b&&(b=20>parseInt(f)?20+b.sms: -b.call,b=a[b],null==b||b.timestamp>=a[f].timestamp||(c=a[f],c.uid=b.uid,lsi.set("p_fiches",b.uid,c)))};inputPhoneFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-fiche"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-fiche > span.active'),c=0;cAPPELS");20>e&&c'+(e%20+1)+"  ":(20==e&&(this.nav_container.innerHTML+='
   SMS   '),this.nav_container.innerHTML+=''+(e%20+1)+"")}for(var d in a)b=$('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('[data-sublink="phone"] #p_nav-fiche [data-n="'+this.selected+'"]'))}; -inputPhoneFiche.prototype.check=function(a){if(2>a.city.length||isNaN(parseInt(a.duration[0]))&&0a.reltypeSpecial.length|| -"11"==a.context&&2>a.contextSpecial[0].length||"12"==a.context&&2>a.contextSpecial[1].length||"13"==a.context&&2>a.contextSpecial[2].length?!1:!0};inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("p_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)}; +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;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))}}; +inputPhoneFiche.prototype.nav=function(a){if(!(a instanceof Element&&a.getData("n"))||isNaN(a.getData("n"))||"p_nav-fiche"!=a.parentNode.id)return!1;for(var c=$$('[data-sublink="phone"] #p_nav-fiche > span.active'),b=0;bAPPELS");20>d&&b'+(d%20+1)+"  ":(20==d&&(this.nav_container.innerHTML+='
   SMS   '),this.nav_container.innerHTML+=''+(d%20+1)+"")}for(var e in a)c=$('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[e].uid+'"]'),null!=c&&(!0===a[e].valid?c.addClass("done"):c.remClass("done"));this.nav($('[data-sublink="phone"] #p_nav-fiche [data-n="'+this.selected+'"]'))}; +inputPhoneFiche.prototype.check=function(a){if(2>a.city.length||isNaN(parseInt(a.duration[0]))&&0a.reltypeSpecial.length|| +"11"==a.context&&2>a.contextSpecial[0].length||"12"==a.context&&2>a.contextSpecial[1].length||"13"==a.context&&2>a.contextSpecial[2].length?!1:!0};inputPhoneFiche.prototype.attach=function(a){console.log("FICHE: ATTACH");lsi.createDataset("p_fiches");this.storageToFields();this.handler=a;var c=this;this.nav_container.addEventListener("click",function(a){c.nav(a.target);c.handler(a.target)},!1)}; diff --git a/js/includes/input-phone-fiche.js b/js/includes/input-phone-fiche.js index d5a462a..06d32f3 100644 --- a/js/includes/input-phone-fiche.js +++ b/js/includes/input-phone-fiche.js @@ -343,77 +343,98 @@ inputPhoneFiche.prototype.storageToFields = function(){ inputPhoneFiche.prototype.sync = function(){ console.log('FICHE: SYNC'); - /* (1) Mise à jour en fonction des contacts APRÈS IMPORT + /* (1) Initialisation ---------------------------------------------------------*/ /* (1) On récupère tous les CONTACTS */ var contacts = lsi.export('p_contacts'); - var addedFicheUids = []; // Contiendra les uids des fiches qui seront crées + + /* (2) Contiendra les uids des fiches qui seront crées */ + var addedFicheUids = []; + var ficheData, contactData; - /* (2) Mise à jour en fonction des contacts APRÈS SAISIE MANUELLE + /* (2) Mise à jour en fonction des contacts APRÈS SAISIE ---------------------------------------------------------*/ // Nombre maximum de fiches (40, sauf si moins de 40 contacts, dans ce cas, le nombre de contacts); var nbMaxFiche = lsi.keys('p_contacts').length < 40 ? lsi.keys('p_contacts').length : 40; - // Si moins de 20+20 contacts crées, on les complètes en fonction des contacts séquentiellement - if( addedFicheUids.length < nbMaxFiche ){ + /* (1) Pour chaque CONTACT, on met à jour/crée la FICHE associée */ + for( var uid in contacts ){ - /* (1) Pour chaque CONTACT, on met à jour/crée la FICHE associée*/ - for( var uid in contacts ){ + /* (1) On cherche un uid de fiche non existant dans l'intervalle [0;40[ */ + ficheUid = 0; + while( addedFicheUids.indexOf(ficheUid) > -1 && ficheUid < nbMaxFiche ) + ficheUid++; - /* (2) On cherche un uid de fiche non existant dans l'intervalle 0-19 */ - var ficheUid = 0; - while( addedFicheUids.indexOf(ficheUid) > -1 && ficheUid < nbMaxFiche ) - ficheUid++; + // On enregistre le nouvel UID dans les uid crées + addedFicheUids.push(ficheUid); - // On enregistre le nouvel UID dans les uid crées - addedFicheUids.push(ficheUid); + /* (2) On récupère les informations de la FICHE (si elle existe) */ + var ficheData = lsi.get('p_fiches', ficheUid); - /* (3) On récupère les informations de la FICHE (si elle existe) */ - var ficheData = lsi.get('p_fiches', ficheUid); + // Si la fiche n'existe pas, on la crée avec les valeurs par défaut + !ficheData && ( ficheData = this.defaultData ); - // Si la fiche n'existe pas, on la crée avec les valeurs par défaut - if( ficheData == null ) - ficheData = this.defaultData; - - /* (4) On met à jour la fiche ET on l'enregistre */ - ficheData.uid = ficheUid; - ficheData.contact = parseInt(uid); - lsi.set('p_fiches', ficheUid, ficheData); + /* (3) On met à jour la fiche ET on l'enregistre */ + ficheData.uid = ficheUid; + ficheData.contact = parseInt(uid); + lsi.set('p_fiches', ficheUid, ficheData); - /* (5) Si on a déja crée 20+20 fiches, on arrête */ - if( addedFicheUids.length >= nbMaxFiche ) - break; - } - + /* (4) Si on a déja crée 20+20 fiches, on arrête */ + if( addedFicheUids.length >= nbMaxFiche ) + break; } - /* (3) Mise à jour des fiches dupliquées entre le top 20 des APPELS et celui des SMS + + /* (3) Gestion des fiches dupliquées ---------------------------------------------------------*/ ficheData = lsi.export('p_fiches'); for( var key in ficheData ){ + /* (1) On récupère le contact associé */ var associatedContact = lsi.get('p_contacts', ficheData[key].contact); // Si erreur, on passe au suivant - if( associatedContact == null ) + if( !associatedContact ) continue; - /* (3) On récupère l'autre fiche (clone) */ - var inCall = parseInt(key) < 20; // Si on est dans le top 20 des APPELS, sinon dans celui des SMS - var cloneIndex = inCall ? 20+associatedContact.sms : associatedContact.call; // Contient l'index du clone dans l'autre top (APPELS ou SMS) + /* (3) On récupère la/les autre(s) fiche(s) (clone(s)) */ + var clone = null; + var inCall = parseInt( ficheData[key].uid ) < 20; // vrai si dans les APPELS, sinon dans les SMS - var clone = ficheData[cloneIndex]; + for( var i in ficheData ){ + // si on est pas dans le bonne tranche, on passe au suivant + if( inCall && i < 20 || !inCall && i >= 20 ) + continue; - /* (4) Si le clone a été modifié en dernier, on ne fait rien */ - if( clone == null || clone.timestamp >= ficheData[key].timestamp ) + // on récupère le contact associé + contactData = lsi.get('p_contacts', ficheData[i].contact); + + if( i == key || !contactData ) + continue; + + // meme pseudo + var hasSameUsername = contactData.username.length > 0 && associatedContact.username === contactData.username; + // meme lien de contact + var hasSameLink = !isNaN(contactData.existing) && associatedContact.existing === contactData.existing; + + // si ont le même contact, alors on enregistre le clone (sauf si la même fiche) + ( hasSameUsername || hasSameLink ) && ( clone = ficheData[i] ); + + if( clone !== null ) + break; + + } + + /* (4) Si c'est le clone qui a été modifié en dernier, on ne fait rien */ + if( clone === null || clone.timestamp > ficheData[key].timestamp ) continue; - /* (5) On copie les données de la FICHE dans le clone (cas ou la fiche est modifiée en dernier) */ + /* (5) On copie les données de la FICHE dans le CLONE */ var obj = ficheData[key]; obj.uid = clone.uid; lsi.set('p_fiches', clone.uid, obj); @@ -432,10 +453,10 @@ inputPhoneFiche.prototype.sync = function(){ =========================================================*/ inputPhoneFiche.prototype.nav = function(element){ /* (1) On vérifie que l'élément contient un nombre et existe */ - if( element == null ) + if( !(element instanceof Element) ) return false; - if( element.getData('n') === false || isNaN(element.getData('n')) || element.parentNode.id != 'p_nav-fiche' ) + if( !element.getData('n') || isNaN(element.getData('n')) || element.parentNode.id != 'p_nav-fiche' ) return false; /* (2) On désactive tous les éléments actifs */ diff --git a/js/lib/reset-min.js b/js/lib/reset-min.js index d6e161e..f9d33f0 100644 --- a/js/lib/reset-min.js +++ b/js/lib/reset-min.js @@ -1,4 +1,4 @@ function $(a){return document.querySelector(a)}function $$(a){return document.querySelectorAll(a)}Element.prototype.getData=function(a){return"undefined"==typeof this.dataset?!1:this.dataset.hasOwnProperty(a)?this.dataset[a]:!1};Element.prototype.addClass=function(a){var b=this.className.split(" ");-1 EXCLUSION, SIN action = typeof action === 'boolean' ? action : false; // Si la ressource n'est pas donnée - if( jsResource == null ) return false; + if( !jsResource ) return false; /* (1) Gestion de l'inclusion */ @@ -125,7 +125,7 @@ function include(jsResource, callback, action){ // action=true -> EXCLUSION, SIN _includeTags.push(tag); // On définit le callback - tag.onload = callback; + tag.onload = (function(){ return function(){ callback(); } })(); return true; /* (2) Gestion de l'exclusion */ diff --git a/view/js/input-min.js b/view/js/input-min.js index 340493b..264f4bb 100644 --- a/view/js/input-min.js +++ b/view/js/input-min.js @@ -1,24 +1,38 @@ -var sField,sSubmit,sList,pSubjectManager,pContactManager,pMiniManager,pFicheManager,pMatriceManager,fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager; -document.body.addEventListener("load",function(){function e(b){var c=b instanceof Element,a=c&&"INPUT"==b.tagName&&"submit"==b.type,d=c&&"SPAN"==b.tagName&&("p_nav-mini"==b.parentNode.id||"p_nav-fiche"==b.parentNode.id),c=c&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!a&&!d&&!c&&!0!==b)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync(); -!0===b?api.send({path:"subject/getFriends",subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return!1;lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();pContactManager.storageToFields()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(a||c)&&pContactManager.storageToFields())}function f(b){var c=b instanceof Element,a=c&&"INPUT"==b.tagName&& -"submit"==b.type,d=c&&"SPAN"==b.tagName&&("f_nav-mini"==b.parentNode.id||"f_nav-fiche"==b.parentNode.id),c=c&&"SPAN"==b.tagName&&"f_nav-contact"==b.parentNode.id;if(!a&&!d&&!c&&!0!==b)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();!0===b?api.send({path:"subject/getFriends",subject_id:fSubjectManager.subject_id.value},function(a){if(0!= -a.ModuleError)return!1;lsi["import"]("f_friends",a.subjects);fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();fContactManager.storageToFields()}):(fMiniManager.storageToFields(),fFicheManager.storageToFields(),fMatriceManager.storageToFields(),(a||c)&&fContactManager.storageToFields())}sField=$("#search-field");sSubmit=$("#search-subject");sList=$('section[data-sublink="survey"] ul[data-list]');var g=function(b){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="",d;for(d in b.results)a+="
  • ",a+="
    SUJET
    ",a+="
    ",a+="
    "+b.results[d].name+"
    ",a+="
    "+b.results[d].creation+ -"
    ",a+="
    ",a+="
    ",a+="
    ",a+="
    ",a+="
  • ";sList.innerHTML=a})};sSubmit.addEventListener("click",g,!1);sField.addEventListener("keypress",function(b){13===b.keyCode&&g(b)},!1);fMatriceManager= -fFicheManager=fMiniManager=fContactManager=fSubjectManager=pMatriceManager=pFicheManager=pMiniManager=pContactManager=pSubjectManager=null;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.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(e);pContactManager=new inputPhoneContact($('[data-sublink="phone"] article.contact-panel'),$('[data-sublink="phone"] #p_nav-contact'));pContactManager.attach(e);pMiniManager=new inputPhoneMini($('[data-sublink="phone"] article.mini-relation-panel'),$('[data-sublink="phone"] #p_nav-mini'));pMiniManager.attach(e);pFicheManager=new inputPhoneFiche($('[data-sublink="phone"] article.relation-panel'), -$('[data-sublink="phone"] #p_nav-fiche'));pFicheManager.attach(e);pMatriceManager=new inputPhoneMatrice($('[data-sublink="phone"] article.matrice-panel'));pMatriceManager.attach(e);var b=new ShortcutManager,c=!1;b.append("s+n+a+k+e",function(){c||(c=!0,pMatriceManager.snake())});b.listen();$('[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");lsi.clear("p_friends"); -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", +var sField,sSubmit,sList,pSubjectManager,pContactManager,pMiniManager,pFicheManager,pMatriceManager,fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;sField=$("#search-field");sSubmit=$("#search-subject");sList=$('section[data-sublink="survey"] ul[data-list]'); +var tmpSubjectSearchListener=function(a){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 c="",g;for(g in a.results)c+="
  • ",c+="
    SUJET
    ",c+="
    ",c+="
    "+ +a.results[g].name+"
    ",c+="
    "+a.results[g].creation+"
    ",c+="
    ",c+="
    ",c+="
    ",c+="
    ",c+="
  • ";sList.innerHTML=c})}; +sSubmit.addEventListener("click",tmpSubjectSearchListener,!1);sField.addEventListener("keypress",function(a){13===a.keyCode&&tmpSubjectSearchListener(a)},!1);pMatriceManager=pFicheManager=pMiniManager=pContactManager=pSubjectManager=null; +function pDynamicUpdate(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,g=b&&"SPAN"==a.tagName&&("p_nav-mini"==a.parentNode.id||"p_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"p_nav-contact"==a.parentNode.id;if(!c&&!g&&!b&&!0!==a)return!1;console.log("> dynamic update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();!0===a?api.send({path:"subject/getFriends", +subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return!1;lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();pContactManager.storageToFields()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(c||b)&&pContactManager.storageToFields())}fMatriceManager=fFicheManager=fMiniManager=fContactManager=fSubjectManager=null; +function fDynamicUpdate(a){var b=a instanceof Element,c=b&&"INPUT"==a.tagName&&"submit"==a.type,g=b&&"SPAN"==a.tagName&&("f_nav-mini"==a.parentNode.id||"f_nav-fiche"==a.parentNode.id),b=b&&"SPAN"==a.tagName&&"f_nav-contact"==a.parentNode.id;if(!c&&!g&&!b&&!0!==a)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();!0===a?api.send({path:"subject/getFriends", +subject_id:fSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return!1;lsi["import"]("f_friends",a.subjects);fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();fContactManager.storageToFields()}):(fMiniManager.storageToFields(),fFicheManager.storageToFields(),fMatriceManager.storageToFields(),(c||b)&&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.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 a=new ShortcutManager,b=!1;a.append("s+n+a+k+e",function(){b||(b=!0,pMatriceManager.snake())});a.listen();$('[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");lsi.clear("p_friends");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();e(!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 sujet"),!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 fiche rapide "+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 fiche compl\u00e8te "+(parseInt(c)+1)+" 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 "+a.subject_id+" ! 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.js",function(){include("/js/includes/input-facebook-mini.js",function(){include("/js/includes/input-facebook-fiche.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(f);fContactManager=new inputFacebookContact($('[data-sublink="facebook"] article.contact-panel'),$('[data-sublink="facebook"] #f_nav-contact'));fContactManager.attach(f);fMiniManager=new inputFacebookMini($('[data-sublink="facebook"] article.mini-relation-panel'),$('[data-sublink="facebook"] #f_nav-mini')); -fMiniManager.attach(f);fFicheManager=new inputFacebookFiche($('[data-sublink="facebook"] article.relation-panel'),$('[data-sublink="facebook"] #f_nav-fiche'));fFicheManager.attach(f);fMatriceManager=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel'));fMatriceManager.attach(f);$('[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"); -lsi.clear("f_friends");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 c=$('[data-sublink="facebook"] #f_download-target');c.download="local-facebook-data.json";c.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(b));c.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(b){console.log(b);if(0!=b.ModuleError)return Notification.error("Erreur",b.ModuleError),!1;lsi.set("f_subject",0,b.local_data.subject);lsi["import"]("f_contacts",b.local_data.contacts);lsi["import"]("f_mini-fiches",b.local_data.mini);lsi["import"]("f_fiches",b.local_data.fiches); -lsi.set("f_matrice",0,b.local_data.matrice);fSubjectManager.storageToFields();fContactManager.storageToFields();fMatriceManager.storageToFields();f(!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 sujet"), -!1;b=lsi["export"]("f_mini-fiches");var c=0,a;for(a in b)if(!isNaN(a)&&(c++,!b[a].valid))return Notification.warning("Attention","La fiche rapide "+c+" est incompl\u00e8te et/ou incorrecte"),!1;b=lsi["export"]("f_fiches");for(a in b)if(!b[a].valid)return Notification.warning("Attention","La fiche compl\u00e8te "+(parseInt(a)+1)+" est incompl\u00e8te et/ou incorrecte"),!1;a={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(a,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;console.log(a)},!1)},!1)})})})})})},!1); +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 sujet"),!1;a=lsi["export"]("p_mini-fiches");var b=0,d;for(d in a)if(!isNaN(d)&&(b++, +!a[d].valid))return Notification.warning("Attention","La fiche rapide "+b+" est incompl\u00e8te et/ou incorrecte"),!1;a=lsi["export"]("p_fiches");for(d in a)if(!a[d].valid)return Notification.warning("Attention","La fiche compl\u00e8te "+(parseInt(d)+1)+" est incompl\u00e8te et/ou incorrecte"),!1;d={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(d,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est "+a.subject_id+" ! 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.js",function(){include("/js/includes/input-facebook-mini.js",function(){include("/js/includes/input-facebook-fiche.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(fDynamicUpdate); +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(a){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");lsi.clear("f_friends");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(a){Notification.info("INFORMATION","Lancement du t\u00e9l\u00e9chargement de la sauvegarde");a={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 b=$('[data-sublink="facebook"] #f_download-target');b.download= +"local-facebook-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));b.click()},!1);$('[data-sublink="facebook"] #f_import-all').addEventListener("click",function(a){$('[data-sublink="facebook"] #f_local-upload').click()},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("click",function(a){a.target.value=null},!1);$('[data-sublink="facebook"] #f_local-upload').addEventListener("change",function(a){a={path:"upload/local_data",file:$('[data-sublink="facebook"] #f_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("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})} +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="'+ +e+'"] ~ h5 select[data-name="studies"]').value=b,a=d%9,8==a?($("#reltype10_p_"+e).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_p_"+e).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="city"]').value=(10+d).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="cp"]').value=(1E4+d).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+ +e+'"] ~ h5 input[data-name="quartier"]').value=d,$("#loc"+["A","B","C","D"][Math.floor(d%4)]+"_p_"+e).checked=!0,b=$$('article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="duration"]'),b[0].value=d.toString(),b[1].value=1+d.toString(),b=d%14,$("article.fiche-relation #contexte"+b+"_p_"+e).checked=!0,g=$$('article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="contextSpecial"]'),11==b&&(g[0].value="internet"),12==b&&(g[1].value="association"), +13==b&&(g[2].value="autre"),d++)} +function testRoutineFacebook(a){var b=lsi["export"]("f_contacts"),c=lsi["export"]("f_mini-fiches"),g=lsi["export"]("f_fiches"),d=0;if(null!=a&&a)for(var f in c)isNaN(f)||(a="",null!=b[f]&&(a=b[f].username),c=$('#f_nav-mini [data-n="'+f+'"]'),c.click(),$("#unknown_min_f_"+f).checked=0==a.length,0==a.length?($("#sexeI_mini_f_"+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_f_"+f).checked=!0):(a=["H","F"][Math.floor(d%2)],$("#sexe"+a+"_mini_f_"+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_f_"+f).checked=!0,$('input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_mini_f_"+f).checked=!0,d++));for(var e in g)isNaN(e)||(c=$('#f_nav-fiche [data-n="'+ +e+'"]'),c.click(),a=["H","F","I"][Math.floor(d%3)],$("#sexe"+a+"_f_"+e).checked=!0,$('section[data-sublink="facebook"] 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],$('section[data-sublink="facebook"] 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),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=b,a=d%9,8==a?($("#reltype10_f_"+e).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_f_"+e).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="city"]').value= +(10+d).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="cp"]').value=(1E4+d).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="quartier"]').value=d,$("#loc"+["A","B","C","D"][Math.floor(d%4)]+"_f_"+e).checked=!0,b=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="duration"]'), +b[0].value=d.toString(),b[1].value=1+d.toString(),b=d%14,$('section[data-sublink="facebook"] article.fiche-relation #contexte'+b+"_f_"+e).checked=!0,g=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="contextSpecial"]'),11==b&&(g[0].value="internet"),12==b&&(g[1].value="association"),13==b&&(g[2].value="autre"),d++)}; diff --git a/view/js/input.js b/view/js/input.js index 555467d..fc06bf7 100644 --- a/view/js/input.js +++ b/view/js/input.js @@ -3,7 +3,6 @@ var sField, sSubmit, sList, fSubjectManager, fContactManager, fMiniManager, fFicheManager, fMatriceManager; -document.body.addEventListener('load', function(){ /*=========================================================*/ /*=========== Gestion de la recherche de sujet ============*/ @@ -80,10 +79,10 @@ document.body.addEventListener('load', function(){ /* [1] Initialisation des utilitaires et variables PHONE =========================================================* /* (1) Initialisation des managers */ - pSubjectManager = null, - pContactManager = null, - pMiniManager = null, - pFicheManager = null, + pSubjectManager = null; + pContactManager = null; + pMiniManager = null; + pFicheManager = null; pMatriceManager = null; @@ -161,11 +160,6 @@ document.body.addEventListener('load', function(){ } } - fSubjectManager = null, - fContactManager = null, - fMiniManager = null, - fFicheManager = null, - fMatriceManager = null; @@ -173,6 +167,11 @@ document.body.addEventListener('load', function(){ /* [2] Initialisation des utilitaires et variables FACEBEOOK =========================================================* /* (1) Initialisation des managers */ + fSubjectManager = null; + fContactManager = null; + fMiniManager = null; + fFicheManager = null; + fMatriceManager = null; @@ -268,8 +267,7 @@ document.body.addEventListener('load', function(){ //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 */ @@ -937,6 +935,27 @@ document.body.addEventListener('load', function(){ + + + + function testContactsPhone(){ + + for( var i = 0 ; i < 45 ; i++ ){ + + if( i%20 == 0 ) + lsi.set('p_contacts', i, { uid: i, username: 'contact-x' }); + else + lsi.set('p_contacts', i, { uid: i, username: 'contact-'+i }); + } + }; + + + + + + + + /*=========================================================*/ /*============= Routine de test CELLULAIRE ================*/ /*=========================================================*/ @@ -1291,7 +1310,3 @@ document.body.addEventListener('load', function(){ } } - - - -}, false);