diff --git a/public_html/js/includes/input-facebook-fiche.js b/public_html/js/includes/input-facebook-fiche.js index face42b..467436f 100644 --- a/public_html/js/includes/input-facebook-fiche.js +++ b/public_html/js/includes/input-facebook-fiche.js @@ -17,6 +17,8 @@ inputFacebookFiche.prototype = { defaultData: { // Valeurs par défaut sexe: '2', age: '.', + interest: '.', + relmark: '.', job: '.', famsit: '0', // Choix 1 à 3 studies: '0', @@ -29,9 +31,12 @@ inputFacebookFiche.prototype = { duration: ['', ''], context: '0', // Choix 1 à 14 contextSpecial: ['', '', ''], - freq: ['4', '9', '14', '19', '24'], // 1er choix des 4 pour chaque question + freq: ['3', '8', '13', '18', '23'], // 4er choix des 4 pour chaque question + irlfreq: ['3', '8', '13', '18', '23'], // 4er choix des 4 pour chaque question connect: ['1', '3', '5', '7', '9', '11'], // Le deuxième choix (Oui/Non) donc 'Non' par défaut pour chaque question connectSpecial: ['', ''], + medsoc: '0', + medrel: '0', timestamp: 0, valid: false } @@ -68,6 +73,8 @@ inputFacebookFiche.prototype.fieldsToStorage = function(){ obj = { sexe: deflated.sexe, age: deflated.age, + interest: deflated.interest, + relmark: deflated.relmark, job: deflated.job, famsit: deflated.famsit, studies: deflated.studies, @@ -79,8 +86,11 @@ inputFacebookFiche.prototype.fieldsToStorage = function(){ loc: deflated.loc, duration: deflated.duration, context: deflated.context, + medsoc: deflated.medsoc, + medrel: deflated.medrel, contextSpecial: deflated.contextSpecial, freq: deflated.freq, + irlfreq: deflated.irlfreq, connect: deflated.connect, connectSpecial: deflated.connectSpecial, uid: parseInt(deflated.uid), @@ -143,9 +153,11 @@ inputFacebookFiche.prototype.add = function(objectData){ objectData.connectSpecial[1] = (objectData.connectSpecial[1] != null) ? objectData.connectSpecial[1] : this.defaultData.connectSpecial[1]; // {2} Champs // + /* {1} Vérification des */ // 1. La ville a au moins 2 caractères if( ficheData.city.length < 2 ) return false; - // 3. La durée de la relation en mois est vide ou un nombre + // 2. La durée de la relation en mois est vide ou un nombre if( isNaN(parseInt(ficheData.duration[0])) && ficheData.duration[0].length > 0 ) return false; - // 4. La durée de la relation en année est vide ou un nombre + // 3. La durée de la relation en année est vide ou un nombre if( isNaN(parseInt(ficheData.duration[1])) && ficheData.duration[1].length > 0 ) return false; - // 5. Pour la durée de la relation, au moins un des 2 n'est pas vide + // 4. Pour la durée de la relation, au moins un des 2 n'est pas vide if( ficheData.duration[0].length+ficheData.duration[1].length == 0 ) return false; - // {2} Vérification des pour la profession n'est pas indéfini + /* {2} Vérification des pour la profession n'est pas indéfini if( ficheData.job == '.' ) return false; - // 7. Le pour les études n'est pas indéfini if( ficheData.studies == '.' ) return false; - // 8. Le pour l'AGE n'est pas indéfini if( ficheData.age == '.' ) return false; + // 8. Le pour la NOTE DE RELATION n'est pas indéfini + if( ficheData.relmark == '.' ) + return false; - // {3} Vérification des radio // - // 9. Le SEXE a un et un seul choix + /* {3} Vérification des radio */ + // 10. Le SEXE a un et un seul choix if( ficheData.sexe == '' ) return false; - // 10. La SITUATION FAMILIALE a un et un seul choix + // 11. La SITUATION FAMILIALE a un et un seul choix if( ficheData.famsit == '' ) return false; - // 11. Le TYPE DE RELATION a un et un seul choix + // 12. Le TYPE DE RELATION a un et un seul choix if( ficheData.reltype == '' ) return false; - // 12. La DISTANCE DE DOMICILE (location) a un et un seul choix + // 13. La DISTANCE DE DOMICILE (location) a un et un seul choix if( ficheData.loc == '' ) return false; - // 13. Le CONTEXTE DE RENCONTRE a un et un seul choix + // 14. Le CONTEXTE DE RENCONTRE a un et un seul choix if( ficheData.context == '' ) return false; - // 14. Les FRÉQUENCES ont un et un seul choix (par question de fréquence) + // 15. L'UTILISATION DES MEDIAS SOCIAUX a un et un seul choix + if( ficheData.medsoc == '' ) + return false; + // 16. L'UTILISATION DES MEDIAS SOCIAUX a un et un seul choix + if( ficheData.medrel == '' ) + return false; + // 17. Les FRÉQUENCES ont un et un seul choix (par question de fréquence) for( var i = 0 ; i < ficheData.freq.length ; i++ ) if( ficheData.freq[i] == '' ) return false; - // 15. Les CONNECTION ont un et un seul choix (par question de connection) + // 18. Les FRÉQUENCES IRL ont un et un seul choix (par question de fréquence) + for( var i = 0 ; i < ficheData.irlfreq.length ; i++ ) + if( ficheData.irlfreq[i] == '' ) + return false; + // 19. Les CONNECTION ont un et un seul choix (par question de connection) for( var i = 0 ; i < ficheData.connect.length ; i++ ) if( ficheData.connect[i] == '' ) return false; - // {4} dépendant d'un choix d'un radio // - // 16. TYPE DE RELATION si autre est coché (indice 8), reltypeSpecial doit avoir au moins 2 caractère + /* {4} dépendant d'un choix d'un radio */ + // 20. TYPE DE RELATION si autre est coché (indice 8), reltypeSpecial doit avoir au moins 2 caractère if( ficheData.reltype == '10' && ficheData.reltypeSpecial.length < 2 ) return false; - // 17. CONTEXTE DE RELATION si est coché indice 11, contactSpecial[0] doit avoir au moins 2 caractères + // 21. CONTEXTE DE RELATION si est coché indice 11, contactSpecial[0] doit avoir au moins 2 caractères if( ficheData.context == '11' && ficheData.contextSpecial[0].length < 2 ) return false; - // 18. CONTEXTE DE RELATION si est coché indice 12, contextSpecial[1] doit avoir au moins 2 caractères + // 22. CONTEXTE DE RELATION si est coché indice 12, contextSpecial[1] doit avoir au moins 2 caractères if( ficheData.context == '12' && ficheData.contextSpecial[1].length < 2 ) return false; - // 19. CONTEXTE DE RELATION si est coché indice 13, contextSpecial[2] doit avoir au moins 2 caractères + // 23. CONTEXTE DE RELATION si est coché indice 13, contextSpecial[2] doit avoir au moins 2 caractères if( ficheData.context == '13' && ficheData.contextSpecial[2].length < 2 ) return false; - // 20. Si tout s'est bien passé, on retourne TRUE + // 24. Si tout s'est bien passé, on retourne TRUE return true; }; diff --git a/public_html/js/includes/input-phone-fiche.js b/public_html/js/includes/input-phone-fiche.js index 16ae3c8..30090bb 100644 --- a/public_html/js/includes/input-phone-fiche.js +++ b/public_html/js/includes/input-phone-fiche.js @@ -307,7 +307,7 @@ inputPhoneFiche.prototype.add = function(objectData){ var contextCreated = $$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="context"]'); for( var i = 0 ; i < contextCreated.length ; i++ ) if( contextCreated[i].value == objectData.context ) contextCreated[i].setAttribute('checked', 'checked'); - else + else contextCreated[i].removeAttribute('checked', 'checked'); /* {16} On sélectionna la valeur des boutons pour l'UTILISATION DES MEDIAS SOCIAUX */ var medsocCreated = $$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="medsoc"]'); @@ -321,13 +321,13 @@ inputPhoneFiche.prototype.add = function(objectData){ if( medrelCreated[i].value == objectData.medrel ) medrelCreated[i].setAttribute('checked', 'checked'); else medrelCreated[i].removeAttribute('checked'); + /* {18} On sélectionna la valeur des boutons pour les FREQUENCES */ var freqCreated = $$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="freq"]'); for( var i = 0 ; i < freqCreated.length ; i++ ) if( objectData.freq.indexOf(freqCreated[i].value) > -1 ) freqCreated[i].setAttribute('checked', 'checked'); else freqCreated[i].removeAttribute('checked'); - /* {19} On sélectionna la valeur des boutons pour les FREQUENCES IRL */ var irlfreqCreated = $$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+objectData.uid+'"] ~ h5>input[type="radio"][data-name="irlfreq"]'); for( var i = 0 ; i < irlfreqCreated.length ; i++ ) diff --git a/public_html/js/includes/min/input-facebook-fiche.js b/public_html/js/includes/min/input-facebook-fiche.js index 0a16dd2..abd45f2 100644 --- a/public_html/js/includes/min/input-facebook-fiche.js +++ b/public_html/js/includes/min/input-facebook-fiche.js @@ -1,23 +1,28 @@ -function inputFacebookFiche(a,b){this.container=a;this.nav_container=b;this.top_size=10}inputFacebookFiche.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}}; -inputFacebookFiche.prototype.fieldsToStorage=function(){console.group("[facebook.fiche] fields to storage");var a,b,c,e,d,h=$$('[data-sublink="facebook"] article.relation-panel .fiche-relation');a=0;for(b=h.length;a FICHE UPDATE ("+(e.timestamp-input_ts)+")"),lsi.set("f_fiches",e.uid,e));console.groupEnd()}; +function inputFacebookFiche(a,b){this.container=a;this.nav_container=b;this.top_size=10} +inputFacebookFiche.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null,defaultData:{sexe:"2",age:".",interest:".",relmark:".",job:".",famsit:"0",studies:"0",reltype:"0",reltypeSpecial:"",city:"",quartier:"",cp:"",loc:"0",duration:["",""],context:"0",contextSpecial:["","",""],freq:["3","8","13","18","23"],irlfreq:["3","8","13","18","23"],connect:"1 3 5 7 9 11".split(" "),connectSpecial:["",""],medsoc:"0",medrel:"0",timestamp:0,valid:!1}}; +inputFacebookFiche.prototype.fieldsToStorage=function(){console.group("[facebook.fiche] fields to storage");var a,b,c,d,e,h=$$('[data-sublink="facebook"] article.relation-panel .fiche-relation');a=0;for(b=h.length;a FICHE UPDATE ("+(d.timestamp-input_ts)+")"),lsi.set("f_fiches",d.uid,d));console.groupEnd()}; inputFacebookFiche.prototype.add=function(a){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("f_contacts",a.contact);if(!1===b)return!1;var c="";isNaN(b.existing)||(c=lsi.get("f_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,c="Contact import\u00e9: non modifiable!"):c="Contact import\u00e9 (incomplet): modifiable partiellement!");this.container.innerHTML+=fFicheBuilder.build({importedfiche:c,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="facebook"] 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="facebook"] 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="facebook"] 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="facebook"] 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;bspan>select[data-name="job"]>option[value="'+a.job+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="facebook"] 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="facebook"] 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");b=$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="interest"]>option[value="'+a.interest+'"]');null!=b&&b.setAttribute("selected","selected");b=$('[data-sublink="facebook"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>span>select[data-name="relmark"]>option[value="'+a.relmark+'"]');null!= +b&&b.setAttribute("selected","selected");c=$$('[data-sublink="facebook"] 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="medsoc"]');for(b=0;binput[type="radio"][data-name="medrel"]');for(b=0;binput[type="radio"][data-name="freq"]');for(b=0;binput[type="radio"][data-name="irlfreq"]');for(b=0;binput[type="radio"][data-name="connect"]');for(b=0;b span.active'),c=0;cHISTORIQUE");20>e&&c'+(e%20+1)+"  ":(20==e&&(this.nav_container.innerHTML+='
MESSENGER '),this.nav_container.innerHTML+=''+(e%20+1)+"")}for(var d in a)b=$('[data-sublink="facebook"] #f_nav-fiche [data-n="'+a[d].uid+'"]'),null!=b&&(!0===a[d].valid?b.addClass("done"):b.remClass("done"));this.nav($('[data-sublink="facebook"] #f_nav-fiche [data-n="'+this.selected+'"]'))}; -inputFacebookFiche.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};inputFacebookFiche.prototype.attach=function(a){console.group("[facebook.fiche] attaching events");lsi.createDataset("f_fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1);console.groupEnd()}; +inputFacebookFiche.prototype.updateNavBar=function(){var a=lsi["export"]("f_fiches");this.nav_container.innerHTML="";for(var b=Object.keys(a),c=0;cHISTORIQUE");20>d&&c'+(d%20+1)+"  ":(20==d&&(this.nav_container.innerHTML+='
MESSENGER '),this.nav_container.innerHTML+=''+(d%20+1)+"")}for(var e in a)b=$('[data-sublink="facebook"] #f_nav-fiche [data-n="'+a[e].uid+'"]'),null!=b&&(!0===a[e].valid?b.addClass("done"):b.remClass("done"));this.nav($('[data-sublink="facebook"] #f_nav-fiche [data-n="'+this.selected+'"]'))}; +inputFacebookFiche.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}; +inputFacebookFiche.prototype.attach=function(a){console.group("[facebook.fiche] attaching events");lsi.createDataset("f_fiches");this.storageToFields();this.handler=a;var b=this,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1);console.groupEnd()}; diff --git a/public_html/js/includes/min/input-phone-fiche.js b/public_html/js/includes/min/input-phone-fiche.js index acbffa2..a1ee8e0 100644 --- a/public_html/js/includes/min/input-phone-fiche.js +++ b/public_html/js/includes/min/input-phone-fiche.js @@ -12,10 +12,10 @@ b=$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value= '"] ~ h5>span>select[data-name="age"]>option[value="'+a.age+'"]');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="interest"]>option[value="'+a.interest+'"]');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="relmark"]>option[value="'+a.relmark+'"]');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="medsoc"]');for(b=0;binput[type="radio"][data-name="medrel"]');for(b=0;binput[type="radio"][data-name="freq"]');for(b=0;binput[type="radio"][data-name="irlfreq"]');for(b=0;binput[type="radio"][data-name="connect"]');for(b=0;binput[type="radio"][data-name="context"]');for(b=0;binput[type="radio"][data-name="medsoc"]');for(b=0;binput[type="radio"][data-name="medrel"]');for(b=0;binput[type="radio"][data-name="freq"]');for(b=0;binput[type="radio"][data-name="irlfreq"]');for(b=0;binput[type="radio"][data-name="connect"]');for(b=0;b