This commit is contained in:
xdrm-brackets 2016-05-30 08:52:56 +02:00
parent f7ada6418c
commit 26f9269554
8 changed files with 901 additions and 7586 deletions

View File

@ -18,4 +18,4 @@ inputPhoneFiche.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("p_fiches");this.nav_container.innerHTML="";for(var b=Object.keys(a),c=0;c<b.length;c++){var e=parseInt(b[c]);0==e&&(this.nav_container.innerHTML+="<span>APPELS</span>");10>e&&c<b.length-1&&10<=b[c+1]?this.nav_container.innerHTML+='<span data-n="'+e+'" class="lc">'+(e%10+1)+"</span>&nbsp;&nbsp;":(10==e&&(this.nav_container.innerHTML+='<span class="fc">SMS</span>'),this.nav_container.innerHTML+='<span data-n="'+e+'">'+(e%10+1)+"</span>")}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]))&&0<a.duration[0].length||isNaN(parseInt(a.duration[1]))&&0<a.duration[1].length||0==a.duration[0].length+a.duration[1].length||"."==a.job||"."==a.studies||"."==a.age||""==a.sexe||""==a.famsit||""==a.reltype||""==a.loc||""==a.context)return!1;for(var b=0;b<a.freq.length;b++)if(""==a.freq[b])return!1;for(b=0;b<a.connect.length;b++)if(""==a.connect[b])return!1;return"10"==a.reltype&&2>a.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,b=this;this.nav_container.addEventListener("click",function(a){b.nav(a.target);b.handler(a.target)},!1)};
"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)};

View File

@ -661,7 +661,6 @@ inputPhoneFiche.prototype.attach = function(handler){
/* (3) On attache la barre de navigation à une fonction */
// On enregistre le handler
this.handler = handler;
var ptr = this;
/* (2) On attache l'évènement sur le bouton d'ajout de contact */
var ptr = this;

View File

@ -9,5 +9,5 @@ a.loc?c[b].setAttribute("checked","checked"):c[b].removeAttribute("checked");b=$
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<c.indexOf(parseInt(e))?lsi.del("p_mini-fiches",e):(b=0==a[e].username.length?e.toString()+"-":e,d=lsi.get("p_mini-fiches",b),null==d&&(d=this.defaultData,d.valid=!1,isNaN(b)&&(d.reltype="9")),d.uid=parseInt(e),lsi.set("p_mini-fiches",b,d));d=lsi["export"]("p_mini-fiches");if(null==
d[this.selected])for(e in d)if(!isNaN(e)){this.selected=parseInt(e);break}};inputPhoneMini.prototype.nav=function(a){if(null==a||!1===a.getData("n")||isNaN(a.getData("n"))||"p_nav-mini"!=a.parentNode.id)return!1;for(var b=$$('[data-sublink="phone"] #p_nav-mini > span.active'),c=0;c<b.length;c++)b[c].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("p_mini-fiches");this.nav_container.innerHTML="";var b=0,c;for(c in a)isNaN(c)||(this.nav_container.innerHTML+='<span data-n="'+c+'">'+ ++b+"</span>");for(c in a)isNaN(c)||(b=$('[data-sublink="phone"] #p_nav-mini [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 [data-n="'+this.selected+'"]'))};
inputPhoneMini.prototype.updateNavBar=function(){var a=lsi["export"]("p_mini-fiches");this.nav_container.innerHTML="";var b=0,c;for(c in a)isNaN(c)||(this.nav_container.innerHTML+='<span data-n="'+c+'">'+ ++b+"</span>");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)};

View File

@ -376,7 +376,7 @@ inputPhoneMini.prototype.updateNavBar = function(){
if( isNaN(key) )
continue;
var currentElement = $('[data-sublink="phone"] #p_nav-mini [data-n="'+miniData[key].uid+'"]');
var currentElement = $('[data-sublink="phone"] #p_nav-mini span[data-n="'+miniData[key].uid+'"]');
if( currentElement == null )
continue;
@ -395,7 +395,7 @@ inputPhoneMini.prototype.updateNavBar = function(){
/* (3) On séléctionne par défaut la dernière MINI fiche sélectionnée */
this.nav( $('[data-sublink="phone"] #p_nav-mini [data-n="'+this.selected+'"]') );
this.nav( $('[data-sublink="phone"] #p_nav-mini span[data-n="'+this.selected+'"]') );
};

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

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

@ -1,42 +1,41 @@
var sField=$("#search-field"),sSubmit=$("#search-subject"),sList=$('section[data-sublink="survey"] ul[data-list]');
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);
sSubmit.addEventListener("click",function(a){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="",g;for(g in b.results)a+="<li data-element data-id='"+g+"'>",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='"+g+"'></span> </div>",a+="<div> <span data-prefix='Nom'>"+
b.results[g].name+"</span> </div>",a+="<div> <span data-prefix='Cr\u00e9ation'>"+b.results[g].creation+"</span> </div>",a+="<div> <span><input type='checkbox' id='s_"+g+"' "+(null!=b.results[g].phone?"checked":"")+" disabled><label for='s_"+g+"'>Cellulaire</label>",a+="</span> </div>",a+="<div> <span><input type='checkbox' id='s_"+g+"' "+(null!=b.results[g].facebook?"checked":"")+" disabled><label for='s_"+g+"'>Facebook</label>",a+="</span> </div>",a+="</li>";sList.innerHTML=a})},!1);
var pSubjectManager,pContactManager,pMiniManager,pFicheManager,pMatriceManager;
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),a=a&&"SPAN"==b.tagName&&"p_nav-contact"==b.parentNode.id;if(!e&&!g&&!a&&!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;console.warn("> existing contacts loaded");lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();pContactManager.storageToFields()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(e||a)&&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()}
function pDynamicUpdate(a){var b=a instanceof Element,f=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(!f&&!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(),(f||b)&&pContactManager.storageToFields())}var fSubjectManager,fContactManager,fMiniManager,fFicheManager,fMatriceManager;
function fDynamicUpdate(a){var b=a instanceof Element,f=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(!f&&!g&&!b&&!0!==a)return!1;console.log("> dynamic update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();fMiniManager.storageToFields();
fFicheManager.storageToFields();fMatriceManager.storageToFields();(f||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 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 d=0;d<a.call.length;d++){var c=a.directory[a.call[d]];
lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:d,sms:-1})}for(d=0;d<a.sms.length;d++)if(c=a.directory[a.sms[d]],-1<a.call.indexOf(a.sms[d])){var f=lsi.get("p_contacts",c.id);f.sms=d;lsi.set("p_contacts",c.id,f)}else lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:-1,sms:d});for(var h in a.directory)h=parseInt(h),-1<a.call.indexOf(h)||-1<a.sms.indexOf(h)||(c=a.directory[h],lsi.set("p_contacts",
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"] 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 e=0;e<a.call.length;e++){var c=a.directory[a.call[e]];
lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:e,sms:-1})}for(e=0;e<a.sms.length;e++)if(c=a.directory[a.sms[e]],-1<a.call.indexOf(a.sms[e])){var f=lsi.get("p_contacts",c.id);f.sms=e;lsi.set("p_contacts",c.id,f)}else lsi.set("p_contacts",c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.call,call:-1,sms:e});for(var h in a.directory)h=parseInt(h),-1<a.call.indexOf(h)||-1<a.sms.indexOf(h)||(c=a.directory[h],lsi.set("p_contacts",
c.id,{uid:c.id,number:c.number,username:c.name,countsms:c.sms,countcall:c.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");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();
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);
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,d;for(d in a)if(!isNaN(d)&&(b++,!a[d].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(d in a)if(!a[d].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(d)+1)+"</b> 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 <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,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),
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");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 <i>sujet</i>"),!1;a=lsi["export"]("f_mini-fiches");var b=0,f;for(f in a)if(!isNaN(f)&&(b++,!a[f].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),
!1;a=lsi["export"]("f_fiches");for(f in a)if(!a[f].valid)return Notification.warning("Attention","La <i>fiche compl\u00e8te</i> <b>"+(parseInt(f)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;f={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(f,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"),d=0;if(null!=b&&b)for(var c in e)isNaN(c)||(b="",null!=a[c]&&(b=a[c].username),e=$('#p_nav-mini [data-n="'+c+'"]'),e.click(),$("#unknown_min_p_"+c).checked=0==b.length,0==b.length?($("#sexeI_mini_p_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_p_"+c).checked=!0):(b=["H","F"][Math.floor(d%2)],$("#sexe"+b+"_mini_p_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="studies"]').value=1+d%6,b=d%10,9==b?($("#reltype10_mini_p_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_mini_p_"+c).checked=!0,d++));for(var f in g)isNaN(f)||(e=$('#p_nav-fiche [data-n="'+
f+'"]'),e.click(),b=["H","F","I"][Math.floor(d%3)],$("#sexe"+b+"_p_"+f).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="age"]').value=d%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[d%a.length],$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value=a,a=(d%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=d%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+d).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value=(1E4+d).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+
f+'"] ~ h5 input[data-name="quartier"]').value=d,$("#loc"+["A","B","C","D"][Math.floor(d%4)]+"_p_"+f).checked=!0,a=$$('article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="duration"]'),a[0].value=d.toString(),a[1].value=1+d.toString(),a=d%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"),d++)}
function testRoutineFacebook(b){var a=lsi["export"]("f_contacts"),e=lsi["export"]("f_mini-fiches"),g=lsi["export"]("f_fiches"),d=0;if(null!=b&&b)for(var c in e)isNaN(c)||(b="",null!=a[c]&&(b=a[c].username),e=$('#f_nav-mini [data-n="'+c+'"]'),e.click(),$("#unknown_min_f_"+c).checked=0==b.length,0==b.length?($("#sexeI_mini_f_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_f_"+c).checked=!0):(b=["H","F"][Math.floor(d%2)],$("#sexe"+b+"_mini_f_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+c+'"] ~ h5 select[data-name="studies"]').value=1+d%6,b=d%10,9==b?($("#reltype10_mini_f_"+c).checked=!0,$('input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+b+"_mini_f_"+c).checked=!0,d++));for(var f in g)isNaN(f)||(e=$('#f_nav-fiche [data-n="'+
f+'"]'),e.click(),b=["H","F","I"][Math.floor(d%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=d%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[d%a.length],$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 select[data-name="job"]').value=a,a=(d%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=d%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+d).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="cp"]').value=(1E4+d).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+f+'"] ~ h5 input[data-name="quartier"]').value=d,$("#loc"+["A","B","C","D"][Math.floor(d%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=d.toString(),a[1].value=1+d.toString(),a=d%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"),d++)};
function testRoutinePhone(a){var b=lsi["export"]("p_contacts"),f=lsi["export"]("p_mini-fiches"),g=lsi["export"]("p_fiches"),d=0;if(null!=a&&a)for(var e in f)isNaN(e)||(a="",null!=b[e]&&(a=b[e].username),f=$('#p_nav-mini [data-n="'+e+'"]'),f.click(),$("#unknown_min_p_"+e).checked=0==a.length,0==a.length?($("#sexeI_mini_p_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_p_"+e).checked=!0):(a=["H","F"][Math.floor(d%2)],$("#sexe"+a+"_mini_p_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=1+d%6,a=d%10,9==a?($("#reltype10_mini_p_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_mini_p_"+e).checked=!0,d++));for(var c in g)isNaN(c)||(f=$('#p_nav-fiche [data-n="'+
c+'"]'),f.click(),a=["H","F","I"][Math.floor(d%3)],$("#sexe"+a+"_p_"+c).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ 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="'+c+'"] ~ 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="'+
c+'"] ~ h5 select[data-name="studies"]').value=b,a=d%9,8==a?($("#reltype10_p_"+c).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_p_"+c).checked=!0,$('article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="city"]').value=(10+d).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="cp"]').value=(1E4+d).toString(),$('article.fiche-relation > input[data-name="uid"][value="'+
c+'"] ~ h5 input[data-name="quartier"]').value=d,$("#loc"+["A","B","C","D"][Math.floor(d%4)]+"_p_"+c).checked=!0,b=$$('article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ 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_"+c).checked=!0,g=$$('article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ 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"),f=lsi["export"]("f_mini-fiches"),g=lsi["export"]("f_fiches"),d=0;if(null!=a&&a)for(var e in f)isNaN(e)||(a="",null!=b[e]&&(a=b[e].username),f=$('#f_nav-mini [data-n="'+e+'"]'),f.click(),$("#unknown_min_f_"+e).checked=0==a.length,0==a.length?($("#sexeI_mini_f_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=0,
$("#reltype9_mini_f_"+e).checked=!0):(a=["H","F"][Math.floor(d%2)],$("#sexe"+a+"_mini_f_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="age"]').value=d%19,$('input[data-name="uid"][value="'+e+'"] ~ h5 select[data-name="studies"]').value=1+d%6,a=d%10,9==a?($("#reltype10_mini_f_"+e).checked=!0,$('input[data-name="uid"][value="'+e+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_mini_f_"+e).checked=!0,d++));for(var c in g)isNaN(c)||(f=$('#f_nav-fiche [data-n="'+
c+'"]'),f.click(),a=["H","F","I"][Math.floor(d%3)],$("#sexe"+a+"_f_"+c).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ 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="'+c+'"] ~ 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="'+c+'"] ~ h5 select[data-name="studies"]').value=b,a=d%9,8==a?($("#reltype10_f_"+c).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="reltypeSpecial"]').value="autre"):$("#reltype"+a+"_f_"+c).checked=!0,$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="city"]').value=
(10+d).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="cp"]').value=(1E4+d).toString(),$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="quartier"]').value=d,$("#loc"+["A","B","C","D"][Math.floor(d%4)]+"_f_"+c).checked=!0,b=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ 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_"+c).checked=!0,g=$$('section[data-sublink="facebook"] article.fiche-relation > input[data-name="uid"][value="'+c+'"] ~ h5 input[data-name="contextSpecial"]'),11==b&&(g[0].value="internet"),12==b&&(g[1].value="association"),13==b&&(g[2].value="autre"),d++)};

View File

@ -121,7 +121,6 @@ function pDynamicUpdate(target){
return false;
// On enregistre les contacts existants
console.warn('> existing contacts loaded');
lsi.import('p_friends', response.subjects);
/* (8) On affiche le tout */
@ -296,7 +295,8 @@ include('/js/includes/input-phone-matrice-min.js', function(){
// Listener pour snake
var smgr = new ShortcutManager();
smgr.append('s+n+a+k+e', function(){ pMatriceManager.snake(); });
var snakeAlready = false;
smgr.append('s+n+a+k+e', function(){ if( !snakeAlready ){ snakeAlready = true; pMatriceManager.snake(); } });
smgr.listen();