Gestion des duplication en prenant toutes les `fiches` et `mini-fiches` de la même manière mais erreur de `timestamp` car mise à jour quand on modifie les `clones`
This commit is contained in:
parent
42d19e7a87
commit
8e40423228
|
@ -1,6 +1,4 @@
|
||||||
var DOM, pageManager, api, Notification, global_start_timestamp;
|
var DOM, pageManager, api, Notification;
|
||||||
|
|
||||||
global_start_timestamp = Date.now();
|
|
||||||
|
|
||||||
|
|
||||||
/* [1] Toggle du sub-menu-side <-> navigation
|
/* [1] Toggle du sub-menu-side <-> navigation
|
||||||
|
|
|
@ -8,10 +8,10 @@ function inputPhoneContact(container, navContainer){
|
||||||
/* [1] Attributs
|
/* [1] Attributs
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
inputPhoneContact.prototype = {
|
inputPhoneContact.prototype = {
|
||||||
container: this.container, // Conteneur des formulaires de contact
|
container: this.container, // Conteneur des formulaires de contact
|
||||||
nav_container: this.nav_container, // Conteneur de la navigation entre les formulaires
|
nav_container: this.nav_container, // Conteneur de la navigation entre les formulaires
|
||||||
selected: 0, // UID du permier des contacts sélectionnés (10 par 10)
|
selected: 0, // UID du permier des contacts sélectionnés (10 par 10)
|
||||||
handler: null // Fonction pour l'enregistrement et la synchronisation des données
|
handler: null // Fonction pour l'enregistrement et la synchronisation des données
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,6 +74,9 @@ inputPhoneContact.prototype.check = function(deflated){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On trim l'username
|
||||||
|
deflated.username = deflated.username.trim();
|
||||||
|
|
||||||
/* (2) On vérifie la validité du formulaire
|
/* (2) On vérifie la validité du formulaire
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
var isValid = !isNaN(deflated.existing) || deflated.username.length > 0;
|
var isValid = !isNaN(deflated.existing) || deflated.username.length > 0;
|
||||||
|
|
|
@ -68,7 +68,7 @@ inputPhoneFiche.prototype.fieldsToStorage = function(){
|
||||||
|
|
||||||
// {5} On récupère et met en forme les valeurs du deflater //
|
// {5} On récupère et met en forme les valeurs du deflater //
|
||||||
// Si le hash est le même, on ne fait rien
|
// Si le hash est le même, on ne fait rien
|
||||||
if( existingData.hash != null && existingData.hash == deflatedHash )
|
if( existingData.hash != null && existingData.hash == deflatedHash || existingData.hash === 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,12 +103,12 @@ inputPhoneFiche.prototype.fieldsToStorage = function(){
|
||||||
if( diff(existingData, obj, ['hash', 'valid', 'timestamp']).length > 0 ){
|
if( diff(existingData, obj, ['hash', 'valid', 'timestamp']).length > 0 ){
|
||||||
console.log( diff(existingData, obj, ['hash', 'valid', 'timestamp']) );
|
console.log( diff(existingData, obj, ['hash', 'valid', 'timestamp']) );
|
||||||
|
|
||||||
console.warn('> FICHE UPDATE');
|
|
||||||
// console.warn('fiche-ts', existingData.timestamp, obj.timestamp);
|
|
||||||
obj.timestamp = Date.now();
|
obj.timestamp = Date.now();
|
||||||
|
console.warn('> FICHE UPDATE ('+(obj.timestamp-input_ts)+')');
|
||||||
|
|
||||||
}else if( existingData['timestamp'] == undefined ){
|
}else if( existingData['timestamp'] == undefined ){
|
||||||
// console.warn('fiche-refresh');
|
console.warn('fiche#'+obj.uid);
|
||||||
obj.timestamp = this.defaultData.timestamp;
|
obj.timestamp = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (7) On enregistre les données dans le 'localStorage' */
|
/* (7) On enregistre les données dans le 'localStorage' */
|
||||||
|
@ -388,188 +388,143 @@ inputPhoneFiche.prototype.sync = function(){
|
||||||
|
|
||||||
{ /* (3) Gestion des liens entre mini-fiches et fiches
|
{ /* (3) Gestion des liens entre mini-fiches et fiches
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
var hasSameUsername, hasSameLink;
|
var originalContact, cloneContact,
|
||||||
|
hasSameUsername, hasSameLink,
|
||||||
|
copied;
|
||||||
|
|
||||||
|
var alreadyDoneUsername = {},
|
||||||
|
alreadyDoneExisting = {};
|
||||||
|
|
||||||
ficheData = lsi.export('p_fiches');
|
ficheData = lsi.export('p_fiches');
|
||||||
miniData = lsi.export('p_mini-fiches');
|
miniData = lsi.export('p_mini-fiches');
|
||||||
|
|
||||||
// Pour chaque mini-fiche
|
// Pour chaque mini-fiche
|
||||||
for( var key in miniData ){
|
for( var key in ficheData ){
|
||||||
|
|
||||||
/* (1) On récupère le contact associé */
|
/* (1) On récupère le contact associé */
|
||||||
var associatedContact = lsi.get('p_contacts', miniData[key].contact);
|
originalContact = lsi.get('p_contacts', ficheData[key].contact);
|
||||||
|
|
||||||
// Si erreur, on passe au suivant
|
// {1.1} On vérifie que le contact n'a pas déja été traité //
|
||||||
if( !associatedContact )
|
if( originalContact.username.length > 0 && alreadyDoneUsername[originalContact.username] != undefined
|
||||||
|
|| originalContact.username.length == 0 && alreadyDoneExisting[originalContact.existing] != undefined )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* (3) On récupère les/la fiche(s) clone(s) si existe */
|
// {1.2} On enregistre username || existing //
|
||||||
var clone = [];
|
if( originalContact.username.length > 0 ) alreadyDoneUsername[originalContact.username] = 0;
|
||||||
|
else alreadyDoneExisting[originalContact.existing] = 0;
|
||||||
|
|
||||||
// Pour chaque fiche
|
// Si erreur, on passe au suivant
|
||||||
|
if( !originalContact )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* (3) On récupère la liste des fiches/mini-fiches de même contact*/
|
||||||
|
var clone = [
|
||||||
|
[ 'fiche', ficheData[key] ]
|
||||||
|
];
|
||||||
|
|
||||||
|
// {3.1} On récupère les fiches de même contact //
|
||||||
for( i in ficheData ){
|
for( i in ficheData ){
|
||||||
|
|
||||||
// on récupère le contact associé (si on est dans `call`, celui dans la tranche avec `sms` / et inversement)
|
// on récupère le contact associé (si on est dans `call`, celui dans la tranche avec `sms` / et inversement)
|
||||||
contactData = lsi.get('p_contacts', ficheData[i].contact);
|
cloneContact = lsi.get('p_contacts', ficheData[i].contact);
|
||||||
|
|
||||||
if( i == key || !contactData )
|
if( i == key || !cloneContact )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// meme pseudo
|
// meme pseudo
|
||||||
hasSameUsername = contactData.username.length > 0 && associatedContact.username === contactData.username;
|
hasSameUsername = cloneContact.username.length > 0 && originalContact.username === cloneContact.username;
|
||||||
// meme lien de contact
|
// meme lien de contact
|
||||||
hasSameLink = !isNaN(contactData.existing) && associatedContact.existing === contactData.existing;
|
hasSameLink = !isNaN(cloneContact.existing) && originalContact.existing === cloneContact.existing;
|
||||||
|
|
||||||
// si ont le même contact, alors on enregistre le clone (sauf si la même fiche)
|
// si ont le même contact, alors on enregistre le clone (sauf si la même fiche)
|
||||||
( hasSameUsername || hasSameLink ) && clone.push( ficheData[i] );
|
( hasSameUsername || hasSameLink ) && clone.push( ['fiche', ficheData[i]] );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// si aucun clone, on quitte
|
// {3.2} On récupère les mini-fiches de même contact //
|
||||||
if( clone.length === 0 )
|
for( i in miniData ){
|
||||||
|
|
||||||
|
// on récupère le contact associé (si on est dans `call`, celui dans la tranche avec `sms` / et inversement)
|
||||||
|
cloneContact = lsi.get('p_contacts', miniData[i].contact);
|
||||||
|
|
||||||
|
// meme pseudo
|
||||||
|
hasSameUsername = cloneContact.username.length > 0 && originalContact.username === cloneContact.username;
|
||||||
|
// meme lien de contact
|
||||||
|
hasSameLink = !isNaN(cloneContact.existing) && originalContact.existing === cloneContact.existing;
|
||||||
|
|
||||||
|
// si ont le même contact, alors on enregistre le clone (sauf si la même fiche)
|
||||||
|
( hasSameUsername || hasSameLink ) && clone.push( ['mini', miniData[i]] );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// {3.3} si aucun clone, on quitte //
|
||||||
|
if( clone.length === 1 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
/* (4) On récupère le modèle (dernier modifié) */
|
/* (4) On récupère le modèle (dernier modifié) */
|
||||||
var mini_ts = ( miniData[key].hasOwnProperty('timestamp') ) ? miniData[key].timestamp : 0;
|
var clones_ts = []; // contiendra les temps des clones
|
||||||
|
|
||||||
var clones_ts = []; // contiendra les temps des clones
|
for( i in clone )
|
||||||
var mini_update = true; // true si dernier modifié
|
clones_ts[i] = clone[i][1].hasOwnProperty('timestamp') ? clone[i][1].timestamp : 0;
|
||||||
|
|
||||||
for( i in clone ){
|
|
||||||
clones_ts[i] = clone[i].hasOwnProperty('timestamp') ? clone[i].timestamp : 0;
|
|
||||||
mini_update = mini_update && mini_ts > clones_ts[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
var last_index = clones_ts.indexOf( Math.max.apply(Math, clones_ts) );
|
var last_index = clones_ts.indexOf( Math.max.apply(Math, clones_ts) );
|
||||||
|
|
||||||
|
/* (5) On copie le dernier modifié dans les clones */
|
||||||
|
for( i in clone ){
|
||||||
|
|
||||||
|
// excepté le dernier modifié
|
||||||
|
if( i == last_index )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
/* (5.1) fiche vers fiche */
|
||||||
|
if( clone[i][0] == clone[last_index][0] ){
|
||||||
|
|
||||||
|
console.warn('copying fiche#'+clone[last_index][1].uid+' to fiche#'+clone[i][1].uid, clones_ts[last_index]-input_ts, clones_ts[i]-input_ts);
|
||||||
|
copied = clone[last_index][1];
|
||||||
/* (5.1) Si mini est le modèle -> On copie les données de MINI dans les CLONES */
|
copied.uid = clone[i][1].uid;
|
||||||
var copied;
|
// copied.timestamp = Date.now();
|
||||||
if( mini_update ){
|
copied.hash = 0
|
||||||
|
|
||||||
for( i in clone ){
|
|
||||||
|
|
||||||
console.warn('copying mini#'+miniData[key].uid+' to fiche#'+clone[i].uid, mini_ts-global_start_timestamp, clones_ts[i]-global_start_timestamp);
|
|
||||||
copied = clone[i];
|
|
||||||
copied.age = miniData[key].age;
|
|
||||||
copied.sexe = miniData[key].sexe;
|
|
||||||
copied.loc = miniData[key].loc;
|
|
||||||
copied.reltype = miniData[key].reltype;
|
|
||||||
copied.reltypeSpecial = miniData[key].reltypeSpecial;
|
|
||||||
// copied.timestamp = Date.now();
|
|
||||||
lsi.set('p_fiches', copied.uid, copied);
|
lsi.set('p_fiches', copied.uid, copied);
|
||||||
|
|
||||||
}
|
/* (5.2) fiche vers mini */
|
||||||
|
}else if( clone[last_index][0] == 'fiche' ){
|
||||||
|
|
||||||
// clone.timestamp = copied.timestamp+1;
|
console.warn('copying fiche#'+clone[last_index][1].uid+' to mini#'+clone[i][1].uid, clones_ts[last_index]-input_ts, clones_ts[i]-input_ts);
|
||||||
// lsi.set('p_mini-fiches', clone.uid, clone);
|
copied = clone[i][1];
|
||||||
|
copied.age = clone[last_index][1].age;
|
||||||
|
copied.sexe = clone[last_index][1].sexe;
|
||||||
|
copied.loc = clone[last_index][1].loc;
|
||||||
|
copied.reltype = clone[last_index][1].reltype;
|
||||||
|
copied.reltypeSpecial = clone[last_index][1].reltypeSpecial;
|
||||||
|
copied.timestamp = Date.now();
|
||||||
|
lsi.set('p_mini-fiches', copied.uid, copied);
|
||||||
|
|
||||||
/* (5.2) Si un clone est le modèle > On copie les données de la FICHE dans la fiche (autres clones) et dans MINI */
|
/* (5.3) mini vers fiche */
|
||||||
}else if( last_index > -1 ){
|
}else{
|
||||||
|
|
||||||
// {1} On copie dans MINI //
|
console.warn('copying mini#'+clone[last_index][1].uid+' to fiche#'+clone[i][1].uid, clones_ts[last_index]-input_ts, clones_ts[i]-input_ts);
|
||||||
console.warn('copying fiche#'+clone[last_index].uid+' to mini#'+miniData[key].uid, clones_ts[last_index]-global_start_timestamp, mini_ts-global_start_timestamp);
|
copied = clone[i][1];
|
||||||
copied = miniData[key];
|
copied.age = clone[last_index][1].age;
|
||||||
copied.age = clone[last_index].age;
|
copied.sexe = clone[last_index][1].sexe;
|
||||||
copied.sexe = clone[last_index].sexe;
|
copied.loc = clone[last_index][1].loc;
|
||||||
copied.loc = clone[last_index].loc;
|
copied.reltype = clone[last_index][1].reltype;
|
||||||
copied.reltype = clone[last_index].reltype;
|
copied.reltypeSpecial = clone[last_index][1].reltypeSpecial;
|
||||||
copied.reltypeSpecial = clone[last_index].reltypeSpecial;
|
|
||||||
// copied.timestamp = Date.now();
|
|
||||||
lsi.set('p_mini-fiches', copied.uid, copied);
|
|
||||||
|
|
||||||
// {2} On copie dans les autres fiches //
|
|
||||||
for( i in clone ){
|
|
||||||
// sauf le modele
|
|
||||||
if( i == last_index ) continue;
|
|
||||||
|
|
||||||
console.warn('copying fiche#'+clone[last_index].uid+' to fiche#'+clone[i].uid, clones_ts[last_index]-global_start_timestamp, clones_ts[i]-global_start_timestamp);
|
|
||||||
copied = clone[last_index];
|
|
||||||
copied.uid = clone[i].uid;
|
|
||||||
// copied.timestamp = Date.now();
|
// copied.timestamp = Date.now();
|
||||||
|
copied.hash = 0;
|
||||||
lsi.set('p_fiches', copied.uid, copied);
|
lsi.set('p_fiches', copied.uid, copied);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// { /* (4) 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 )
|
|
||||||
// continue;
|
|
||||||
//
|
|
||||||
// /* (3) On récupère la/les autre(s) fiche(s) (clone(s)) */
|
|
||||||
// var clone = null;
|
|
||||||
// var inCall = parseInt( ficheData[key].uid ) < this.top_size; // vrai si dans les APPELS, sinon dans les SMS
|
|
||||||
//
|
|
||||||
// for( var i in ficheData ){
|
|
||||||
//
|
|
||||||
// // si on est pas dans le bonne tranche, on passe au suivant
|
|
||||||
// if( inCall && i < this.top_size || !inCall && i >= this.top_size )
|
|
||||||
// continue;
|
|
||||||
//
|
|
||||||
// // on récupère le contact associé (si on est dans `call`, celui dans la tranche avec `sms` / et inversement)
|
|
||||||
// contactData = lsi.get('p_contacts', ficheData[i].contact);
|
|
||||||
//
|
|
||||||
// if( i == key || !contactData )
|
|
||||||
// continue;
|
|
||||||
//
|
|
||||||
// // meme pseudo
|
|
||||||
// hasSameUsername = contactData.username.length > 0 && associatedContact.username === contactData.username;
|
|
||||||
// // meme lien de contact
|
|
||||||
// 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 */
|
|
||||||
// var fiche_ts = ( ficheData[key].hasOwnProperty('timestamp') ) ? ficheData[key].timestamp : 0;
|
|
||||||
// var clone_ts = ( clone instanceof Object && clone.hasOwnProperty('timestamp') ) ? clone.timestamp : 0;
|
|
||||||
// if( clone === null || clone_ts > fiche_ts )
|
|
||||||
// continue;
|
|
||||||
//
|
|
||||||
// console.warn('copying fiche#'+ficheData[key].uid+' to fiche#'+clone.uid, fiche_ts-global_start_timestamp, clone_ts-global_start_timestamp);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// /* (5) On copie les données de la FICHE dans le CLONE */
|
|
||||||
// var copied = ficheData[key];
|
|
||||||
// copied.uid = clone.uid;
|
|
||||||
// // copied.timestamp = Date.now();
|
|
||||||
// lsi.set('p_fiches', copied.uid, copied);
|
|
||||||
//
|
|
||||||
// // ficheData[key].timestamp = copied.timestamp;
|
|
||||||
// // lsi.set('p_fiches', ficheData[key].uid, ficheData[key]);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,8 +60,6 @@ inputPhoneMini.prototype.fieldsToStorage = function(){
|
||||||
if( existingData != null && existingData.hash != null && existingData.hash == deflatedHash )
|
if( existingData != null && existingData.hash != null && existingData.hash == deflatedHash )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
console.warn('> MINI UPDATE');
|
|
||||||
|
|
||||||
|
|
||||||
var obj = {
|
var obj = {
|
||||||
uid: parseInt(deflated.uid),
|
uid: parseInt(deflated.uid),
|
||||||
|
@ -82,14 +80,12 @@ inputPhoneMini.prototype.fieldsToStorage = function(){
|
||||||
// On met à jour la date de modification, si on a pas qu'@uid de différent
|
// On met à jour la date de modification, si on a pas qu'@uid de différent
|
||||||
if( diff(existingData, obj, ['hash', 'valid', 'timestamp']).length > 0 ){
|
if( diff(existingData, obj, ['hash', 'valid', 'timestamp']).length > 0 ){
|
||||||
console.log( diff(existingData, obj, ['hash', 'valid', 'timestamp']) );
|
console.log( diff(existingData, obj, ['hash', 'valid', 'timestamp']) );
|
||||||
console.warn('> MINI UPDATE');
|
|
||||||
// console.warn('mini-ts', existingData.timestamp, obj.timestamp);
|
|
||||||
obj.timestamp = Date.now();
|
|
||||||
|
|
||||||
}else if( existingData['timestamp'] == undefined ){
|
obj.timestamp = Date.now();
|
||||||
// console.warn('mini-refresh');
|
console.warn('> MINI UPDATE ('+(obj.timestamp-input_ts)+')');
|
||||||
obj.timestamp = this.defaultData.timestamp;
|
|
||||||
}
|
}else if( existingData['timestamp'] == undefined )
|
||||||
|
obj.timestamp = Date.now();
|
||||||
|
|
||||||
|
|
||||||
/* (9) On enregistre les données dans le 'localStorage' */
|
/* (9) On enregistre les données dans le 'localStorage' */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
function inputPhoneContact(a,b){this.container=a;this.nav_container=b}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};inputPhoneContact.prototype.callRange=function(a){return 0<=a&&20>a};inputPhoneContact.prototype.smsRange=function(a){return 20<=a&&40>a};
|
function inputPhoneContact(a,b){this.container=a;this.nav_container=b}inputPhoneContact.prototype={container:this.container,nav_container:this.nav_container,selected:0,handler:null};inputPhoneContact.prototype.callRange=function(a){return 0<=a&&20>a};inputPhoneContact.prototype.smsRange=function(a){return 20<=a&&40>a};
|
||||||
inputPhoneContact.prototype.sameContact=function(a,b,c,d){var e=null,e=null;if("call"===d)e={min:0,max:19};else if("sms"===d)e={min:29,max:39};else if("mini"===d)e={min:40,max:Infinity};else return!1;d=e.min;for(var f=e.max;d<f;d++){e=lsi.get("p_contacts",d);if(null===e)break;if(parseInt(e.uid)!==parseInt(a)&&(0<e.username.length&&b===e.username||0===b.length&&parseInt(c)===parseInt(e.existing)))return!0}return!1};
|
inputPhoneContact.prototype.sameContact=function(a,b,c,d){var e=null,e=null;if("call"===d)e={min:0,max:19};else if("sms"===d)e={min:29,max:39};else if("mini"===d)e={min:40,max:Infinity};else return!1;d=e.min;for(var f=e.max;d<f;d++){e=lsi.get("p_contacts",d);if(null===e)break;if(parseInt(e.uid)!==parseInt(a)&&(0<e.username.length&&b===e.username||0===b.length&&parseInt(c)===parseInt(e.existing)))return!0}return!1};
|
||||||
inputPhoneContact.prototype.check=function(a){if(0===lsi.keys("p_subject").length)return Notification.warning("ATTENTION","Il faut renseigner le sujet avant de saisir les contacts"),!1;if(isNaN(a.existing)&&!(0<a.username.length))return!1;var b=this.callRange(a.uid)?"call":this.smsRange(a.uid)?"sms":"mini";return this.sameContact(a.uid,a.username,a.existing,b)?(0<a.username.length?Notification.error("Contact dupliqu\u00e9","Le contact de nom "+a.username+" est d\u00e9ja utilis\u00e9 dans cette partie"):
|
inputPhoneContact.prototype.check=function(a){if(0===lsi.keys("p_subject").length)return Notification.warning("ATTENTION","Il faut renseigner le sujet avant de saisir les contacts"),!1;a.username=a.username.trim();if(isNaN(a.existing)&&!(0<a.username.length))return!1;var b=this.callRange(a.uid)?"call":this.smsRange(a.uid)?"sms":"mini";return this.sameContact(a.uid,a.username,a.existing,b)?(0<a.username.length?Notification.error("Contact dupliqu\u00e9","Le contact de nom "+a.username+" est d\u00e9ja utilis\u00e9 dans cette partie"):
|
||||||
Notification.error("Contact dupliqu\u00e9","Le contact "+lsi.get("p_friends",a.existing).name+" est d\u00e9ja utilis\u00e9 dans cette partie"),!1):!0};
|
Notification.error("Contact dupliqu\u00e9","Le contact "+lsi.get("p_friends",a.existing).name+" est d\u00e9ja utilis\u00e9 dans cette partie"),!1):!0};
|
||||||
inputPhoneContact.prototype.fieldsToStorage=function(){console.group("[phone.contact] fields to storage");for(var a=$$('[data-sublink="phone"] article.contact-panel .new-contact'),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate();if(this.check(c)){var d={uid:parseInt(c.uid),username:c.username,existing:isNaN(c.existing)?".":parseInt(c.existing)};d.hash=crc32(JSON.stringify(d));lsi.set("p_contacts",parseInt(c.uid),d)}}console.groupEnd()};
|
inputPhoneContact.prototype.fieldsToStorage=function(){console.group("[phone.contact] fields to storage");for(var a=$$('[data-sublink="phone"] article.contact-panel .new-contact'),b=0;b<a.length;b++){var c=(new FormDeflater(a[b],["input","select"],["data-name"])).deflate();if(this.check(c)){var d={uid:parseInt(c.uid),username:c.username,existing:isNaN(c.existing)?".":parseInt(c.existing)};d.hash=crc32(JSON.stringify(d));lsi.set("p_contacts",parseInt(c.uid),d)}}console.groupEnd()};
|
||||||
inputPhoneContact.prototype.add=function(a){if(null==a||null==a.uid||isNaN(a.uid))return!1;a.username=null!=a.username?a.username:"";a.existing=null!=a.existing?a.existing:".";var b=lsi["export"]("p_friends");a.contacts="";for(var c in b)a.contacts+="\t\t<option value='"+c+"'>"+b[c].name+"</option>\n";this.container.innerHTML+=pContactBuilder.build(a);c=$('[data-sublink="phone"] article.contact-panel .new-contact input[data-name="uid"][value="'+a.uid+'"] ~ span select[data-name="existing"]>option[value="'+
|
inputPhoneContact.prototype.add=function(a){if(null==a||null==a.uid||isNaN(a.uid))return!1;a.username=null!=a.username?a.username:"";a.existing=null!=a.existing?a.existing:".";var b=lsi["export"]("p_friends");a.contacts="";for(var c in b)a.contacts+="\t\t<option value='"+c+"'>"+b[c].name+"</option>\n";this.container.innerHTML+=pContactBuilder.build(a);c=$('[data-sublink="phone"] article.contact-panel .new-contact input[data-name="uid"][value="'+a.uid+'"] ~ span select[data-name="existing"]>option[value="'+
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
function inputPhoneFiche(a,c){this.container=a;this.nav_container=c;this.top_size=10}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}};
|
function inputPhoneFiche(a,c){this.container=a;this.nav_container=c;this.top_size=10}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.group("[phone.fiche] fields to storage");for(var a=$$('[data-sublink="phone"] article.relation-panel .fiche-relation'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate(),e=crc32(JSON.stringify(b)),d=lsi.get("p_fiches",b.uid);if(!1!==d){if(null!=d.hash&&d.hash==e)return;b={contact:parseInt(b.contact),uid:parseInt(b.uid),sexe:b.sexe,age:b.age,job:b.job,famsit:b.famsit,studies:b.studies,reltype:b.reltype,
|
inputPhoneFiche.prototype.fieldsToStorage=function(){console.group("[phone.fiche] fields to storage");for(var a=$$('[data-sublink="phone"] article.relation-panel .fiche-relation'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate(),g=crc32(JSON.stringify(b)),h=lsi.get("p_fiches",b.uid);if(!1!==h){if(null!=h.hash&&h.hash==g||0===h.hash)return;b={contact:parseInt(b.contact),uid:parseInt(b.uid),sexe:b.sexe,age:b.age,job:b.job,famsit:b.famsit,studies:b.studies,
|
||||||
reltypeSpecial:b.reltypeSpecial,city:b.city,quartier:b.quartier,cp:b.cp,loc:b.loc,duration:b.duration,context:b.context,contextSpecial:b.contextSpecial,freq:b.freq,connect:b.connect,connectSpecial:b.connectSpecial,hash:e};b.valid=this.check(b);0<diff(d,b,["hash","valid","timestamp"]).length?(console.log(diff(d,b,["hash","valid","timestamp"])),console.warn("> FICHE UPDATE"),b.timestamp=Date.now()):void 0==d.timestamp&&(b.timestamp=this.defaultData.timestamp);lsi.set("p_fiches",b.uid,b)}}console.groupEnd()};
|
reltype:b.reltype,reltypeSpecial:b.reltypeSpecial,city:b.city,quartier:b.quartier,cp:b.cp,loc:b.loc,duration:b.duration,context:b.context,contextSpecial:b.contextSpecial,freq:b.freq,connect:b.connect,connectSpecial:b.connectSpecial,hash:g};b.valid=this.check(b);0<diff(h,b,["hash","valid","timestamp"]).length?(console.log(diff(h,b,["hash","valid","timestamp"])),b.timestamp=Date.now(),console.warn("> FICHE UPDATE ("+(b.timestamp-input_ts)+")")):void 0==h.timestamp&&(console.warn("fiche#"+b.uid),b.timestamp=
|
||||||
|
Date.now());lsi.set("p_fiches",b.uid,b)}}console.groupEnd()};
|
||||||
inputPhoneFiche.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;
|
inputPhoneFiche.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.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:
|
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:
|
||||||
|
@ -12,11 +13,12 @@ a.uid+'"] ~ h5>input[type="radio"][data-name="famsit"]');for(c=0;c<b.length;c++)
|
||||||
a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(c=0;c<b.length;c++)b[c].value==a.loc?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="context"]');for(c=0;c<b.length;c++)b[c].value==a.context?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+
|
a.uid+'"] ~ h5>input[type="radio"][data-name="loc"]');for(c=0;c<b.length;c++)b[c].value==a.loc?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="context"]');for(c=0;c<b.length;c++)b[c].value==a.context?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+
|
||||||
a.uid+'"] ~ h5>input[type="radio"][data-name="freq"]');for(c=0;c<b.length;c++)-1<a.freq.indexOf(b[c].value)?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect"]');for(c=0;c<b.length;c++)-1<a.connect.indexOf(b[c].value)?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked")};
|
a.uid+'"] ~ h5>input[type="radio"][data-name="freq"]');for(c=0;c<b.length;c++)-1<a.freq.indexOf(b[c].value)?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked");b=$$('[data-sublink="phone"] article.fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="connect"]');for(c=0;c<b.length;c++)-1<a.connect.indexOf(b[c].value)?b[c].setAttribute("checked","checked"):b[c].removeAttribute("checked")};
|
||||||
inputPhoneFiche.prototype.storageToFields=function(){console.group("[phone.fiche] storage to fields");var a=lsi["export"]("p_fiches");this.container.innerHTML="";for(var c in a)a[c].uid==this.selected&&this.add(a[c]);this.updateNavBar();console.groupEnd()};
|
inputPhoneFiche.prototype.storageToFields=function(){console.group("[phone.fiche] storage to fields");var a=lsi["export"]("p_fiches");this.container.innerHTML="";for(var c in a)a[c].uid==this.selected&&this.add(a[c]);this.updateNavBar();console.groupEnd()};
|
||||||
inputPhoneFiche.prototype.sync=function(){console.group("[phone.fiche] synchronisation");var a=lsi["export"]("p_contacts"),c=[],b,e,d=lsi.keys("p_contacts").length<2*this.top_size?lsi.keys("p_contacts").length:2*this.top_size,k;for(k in a){for(ficheUid=0;-1<c.indexOf(ficheUid)&&ficheUid<d;)ficheUid++;c.push(ficheUid);a=lsi.get("p_fiches",ficheUid);!a&&(a=this.defaultData);a.uid=ficheUid;a.contact=parseInt(k);lsi.set("p_fiches",ficheUid,a);if(c.length>=d)break}var a=lsi["export"]("p_fiches"),c=lsi["export"]("p_mini-fiches"),
|
inputPhoneFiche.prototype.sync=function(){console.group("[phone.fiche] synchronisation");var a=lsi["export"]("p_contacts"),c=[],b,g=lsi.keys("p_contacts").length<2*this.top_size?lsi.keys("p_contacts").length:2*this.top_size,h;for(h in a){for(ficheUid=0;-1<c.indexOf(ficheUid)&&ficheUid<g;)ficheUid++;c.push(ficheUid);a=lsi.get("p_fiches",ficheUid);!a&&(a=this.defaultData);a.uid=ficheUid;a.contact=parseInt(h);lsi.set("p_fiches",ficheUid,a);if(c.length>=g)break}var d,e,k,g={};h={};var a=lsi["export"]("p_fiches"),
|
||||||
g;for(g in c){var h=lsi.get("p_contacts",c[g].contact);if(h){d=[];for(e in a)b=lsi.get("p_contacts",a[e].contact),e!=g&&b&&(k=0<b.username.length&&h.username===b.username,b=!isNaN(b.existing)&&h.existing===b.existing,(k||b)&&d.push(a[e]));if(0!==d.length){k=c[g].hasOwnProperty("timestamp")?c[g].timestamp:0;var h=[],f=!0;for(e in d)h[e]=d[e].hasOwnProperty("timestamp")?d[e].timestamp:0,f=f&&k>h[e];b=h.indexOf(Math.max.apply(Math,h));if(f)for(e in d)console.warn("copying mini#"+c[g].uid+" to fiche#"+
|
c=lsi["export"]("p_mini-fiches"),l;for(l in a)if(d=lsi.get("p_contacts",a[l].contact),!(0<d.username.length&&void 0!=g[d.username]||0==d.username.length&&void 0!=h[d.existing])&&(0<d.username.length?g[d.username]=0:h[d.existing]=0,d)){var f=[["fiche",a[l]]];for(b in a)e=lsi.get("p_contacts",a[b].contact),b!=l&&e&&(k=0<e.username.length&&d.username===e.username,e=!isNaN(e.existing)&&d.existing===e.existing,(k||e)&&f.push(["fiche",a[b]]));for(b in c)e=lsi.get("p_contacts",c[b].contact),k=0<e.username.length&&
|
||||||
d[e].uid,k-global_start_timestamp,h[e]-global_start_timestamp),f=d[e],f.age=c[g].age,f.sexe=c[g].sexe,f.loc=c[g].loc,f.reltype=c[g].reltype,f.reltypeSpecial=c[g].reltypeSpecial,lsi.set("p_fiches",f.uid,f);else if(-1<b)for(e in console.warn("copying fiche#"+d[b].uid+" to mini#"+c[g].uid,h[b]-global_start_timestamp,k-global_start_timestamp),f=c[g],f.age=d[b].age,f.sexe=d[b].sexe,f.loc=d[b].loc,f.reltype=d[b].reltype,f.reltypeSpecial=d[b].reltypeSpecial,lsi.set("p_mini-fiches",f.uid,f),d)e!=b&&(console.warn("copying fiche#"+
|
d.username===e.username,e=!isNaN(e.existing)&&d.existing===e.existing,(k||e)&&f.push(["mini",c[b]]);if(1!==f.length){k=[];for(b in f)k[b]=f[b][1].hasOwnProperty("timestamp")?f[b][1].timestamp:0;e=k.indexOf(Math.max.apply(Math,k));for(b in f)b!=e&&(f[b][0]==f[e][0]?(console.warn("copying fiche#"+f[e][1].uid+" to fiche#"+f[b][1].uid,k[e]-input_ts,k[b]-input_ts),d=f[e][1],d.uid=f[b][1].uid,d.hash=0,lsi.set("p_fiches",d.uid,d)):"fiche"==f[e][0]?(console.warn("copying fiche#"+f[e][1].uid+" to mini#"+f[b][1].uid,
|
||||||
d[b].uid+" to fiche#"+d[e].uid,h[b]-global_start_timestamp,h[e]-global_start_timestamp),f=d[b],f.uid=d[e].uid,lsi.set("p_fiches",f.uid,f))}}}console.groupEnd()};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;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
k[e]-input_ts,k[b]-input_ts),d=f[b][1],d.age=f[e][1].age,d.sexe=f[e][1].sexe,d.loc=f[e][1].loc,d.reltype=f[e][1].reltype,d.reltypeSpecial=f[e][1].reltypeSpecial,d.timestamp=Date.now(),lsi.set("p_mini-fiches",d.uid,d)):(console.warn("copying mini#"+f[e][1].uid+" to fiche#"+f[b][1].uid,k[e]-input_ts,k[b]-input_ts),d=f[b][1],d.age=f[e][1].age,d.sexe=f[e][1].sexe,d.loc=f[e][1].loc,d.reltype=f[e][1].reltype,d.reltypeSpecial=f[e][1].reltypeSpecial,d.hash=0,lsi.set("p_fiches",d.uid,d)))}}console.groupEnd()};
|
||||||
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("p_fiches");this.nav_container.innerHTML="";for(var c=Object.keys(a),b=0;b<c.length;b++){var e=parseInt(c[b]);0==e&&(this.nav_container.innerHTML+="<span>APPELS</span>");20>e&&b<c.length-1&&20<=c[b+1]?this.nav_container.innerHTML+='<span data-n="'+e+'" class="lc">'+(e%20+1)+"</span> ":(20==e&&(this.nav_container.innerHTML+='<br><span class="fc"> SMS </span>'),this.nav_container.innerHTML+='<span data-n="'+
|
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;b<c.length;b++)c[b].remClass("active");a.addClass("active");this.selected=parseInt(a.getData("n"))};
|
||||||
e+'">'+(e%20+1)+"</span>")}for(var d in a)c=$('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[d].uid+'"]'),null!=c&&(!0===a[d].valid?c.addClass("done"):c.remClass("done"));this.nav($('[data-sublink="phone"] #p_nav-fiche [data-n="'+this.selected+'"]'))};
|
inputPhoneFiche.prototype.updateNavBar=function(){var a=lsi["export"]("p_fiches");this.nav_container.innerHTML="";for(var c=Object.keys(a),b=0;b<c.length;b++){var g=parseInt(c[b]);0==g&&(this.nav_container.innerHTML+="<span>APPELS</span>");20>g&&b<c.length-1&&20<=c[b+1]?this.nav_container.innerHTML+='<span data-n="'+g+'" class="lc">'+(g%20+1)+"</span> ":(20==g&&(this.nav_container.innerHTML+='<br><span class="fc"> SMS </span>'),this.nav_container.innerHTML+='<span data-n="'+
|
||||||
|
g+'">'+(g%20+1)+"</span>")}for(var h in a)c=$('[data-sublink="phone"] #p_nav-fiche [data-n="'+a[h].uid+'"]'),null!=c&&(!0===a[h].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]))&&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 c=0;c<a.freq.length;c++)if(""==a.freq[c])return!1;for(c=0;c<a.connect.length;c++)if(""==a.connect[c])return!1;return"10"==a.reltype&&2>a.reltypeSpecial.length||
|
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 c=0;c<a.freq.length;c++)if(""==a.freq[c])return!1;for(c=0;c<a.connect.length;c++)if(""==a.connect[c])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.group("[phone.fiche] attaching events");lsi.createDataset("p_fiches");this.storageToFields();this.handler=a;this.nav_container.addEventListener("click",function(a){this.nav(a.target);this.handler(a.target)}.bind(this),!1);console.groupEnd()};
|
"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.group("[phone.fiche] attaching events");lsi.createDataset("p_fiches");this.storageToFields();this.handler=a;this.nav_container.addEventListener("click",function(a){this.nav(a.target);this.handler(a.target)}.bind(this),!1);console.groupEnd()};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
function inputPhoneMini(a,c){this.container=a;this.nav_container=c}inputPhoneMini.prototype={container:this.container,nav_container:this.nav_container,selected:null,handler:null,defaultData:{contact:null,sexe:"2",age:".",studies:"0",loc:".",reltype:"9",reltypeSpecial:"",unknown:!1,timestamp:0,valid:!1}};
|
function inputPhoneMini(a,c){this.container=a;this.nav_container=c}inputPhoneMini.prototype={container:this.container,nav_container:this.nav_container,selected:null,handler:null,defaultData:{contact:null,sexe:"2",age:".",studies:"0",loc:".",reltype:"9",reltypeSpecial:"",unknown:!1,timestamp:0,valid:!1}};
|
||||||
inputPhoneMini.prototype.fieldsToStorage=function(){console.group("[phone.mini] fields to storage");for(var a=$$('[data-sublink="phone"] article.mini-relation-panel .mini-fiche-relation'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate(),e=crc32(JSON.stringify(b)),d=lsi.get("p_mini-fiches",b.uid);if(!1!==d){if(null!=d&&null!=d.hash&&d.hash==e)return;console.warn("> MINI UPDATE");b={uid:parseInt(b.uid),contact:parseInt(b.uid),sexe:b.sexe,age:b.age,studies:b.studies,
|
inputPhoneMini.prototype.fieldsToStorage=function(){console.group("[phone.mini] fields to storage");for(var a=$$('[data-sublink="phone"] article.mini-relation-panel .mini-fiche-relation'),c=0;c<a.length;c++){var b=(new FormDeflater(a[c],["input","select"],["data-name"])).deflate(),e=crc32(JSON.stringify(b)),d=lsi.get("p_mini-fiches",b.uid);if(!1!==d){if(null!=d&&null!=d.hash&&d.hash==e)return;b={uid:parseInt(b.uid),contact:parseInt(b.uid),sexe:b.sexe,age:b.age,studies:b.studies,reltype:b.reltype,
|
||||||
reltype:b.reltype,reltypeSpecial:b.reltypeSpecial,loc:b.loc,unknown:null!=b.unknown,hash:e};b.valid=this.check(b);0<diff(d,b,["hash","valid","timestamp"]).length?(console.log(diff(d,b,["hash","valid","timestamp"])),console.warn("> MINI UPDATE"),b.timestamp=Date.now()):void 0==d.timestamp&&(b.timestamp=this.defaultData.timestamp);lsi.set("p_mini-fiches",b.uid,b)}}console.groupEnd()};
|
reltypeSpecial:b.reltypeSpecial,loc:b.loc,unknown:null!=b.unknown,hash:e};b.valid=this.check(b);0<diff(d,b,["hash","valid","timestamp"]).length?(console.log(diff(d,b,["hash","valid","timestamp"])),b.timestamp=Date.now(),console.warn("> MINI UPDATE ("+(b.timestamp-input_ts)+")")):void 0==d.timestamp&&(b.timestamp=Date.now());lsi.set("p_mini-fiches",b.uid,b)}}console.groupEnd()};
|
||||||
inputPhoneMini.prototype.add=function(a){if(null==a||null==a.uid)return!1;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.unknown=null!=a.unknown?a.unknown:this.defaultData.unknown;var c=lsi.get("p_contacts",
|
inputPhoneMini.prototype.add=function(a){if(null==a||null==a.uid)return!1;a.age=null!=a.age?a.age:this.defaultData.age;a.sexe=null!=a.sexe?a.sexe:this.defaultData.sexe;a.studies=null!=a.studies?a.studies:this.defaultData.studies;a.reltype=null!=a.reltype?a.reltype:this.defaultData.reltype;a.reltypeSpecial=null!=a.reltypeSpecial?a.reltypeSpecial:this.defaultData.reltypeSpecial;a.loc=null!=a.loc?a.loc:this.defaultData.loc;a.unknown=null!=a.unknown?a.unknown:this.defaultData.unknown;var c=lsi.get("p_contacts",
|
||||||
a.uid);if(!1===c)return!1;if(!isNaN(c.existing)){var b=lsi.get("p_friends",c.existing);c.username=b.name;a.contact=c.uid;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.studies1&&(a.studies=b.studies1)}this.container.innerHTML+=pMiniFicheBuilder.build({name:c.username,countcall:c.countcall,countsms:c.countsms,uid:a.uid,reltypespecial:a.reltypeSpecial});c=$('[data-sublink="phone"] article.mini-fiche-relation input[data-name="uid"][value="'+
|
a.uid);if(!1===c)return!1;if(!isNaN(c.existing)){var b=lsi.get("p_friends",c.existing);c.username=b.name;a.contact=c.uid;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.studies1&&(a.studies=b.studies1)}this.container.innerHTML+=pMiniFicheBuilder.build({name:c.username,countcall:c.countcall,countsms:c.countsms,uid:a.uid,reltypespecial:a.reltypeSpecial});c=$('[data-sublink="phone"] article.mini-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.mini-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.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(c=0;c<b.length;c++)b[c].value==
|
a.uid+'"] ~ h5>span>select[data-name="studies"]>option[value="'+a.studies+'"]');null!=c&&c.setAttribute("selected","selected");c=$('[data-sublink="phone"] article.mini-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.mini-fiche-relation input[data-name="uid"][value="'+a.uid+'"] ~ h5>input[type="radio"][data-name="sexe"]');for(c=0;c<b.length;c++)b[c].value==
|
||||||
|
|
|
@ -119,6 +119,9 @@ FormDeflater.prototype.deflate = function(){
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
FormDeflater.prototype.checkable = function(element){
|
FormDeflater.prototype.checkable = function(element){
|
||||||
|
if( !(element instanceof Element) )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( element.tagName != 'INPUT' )
|
if( element.tagName != 'INPUT' )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function FormDeflater(b,c,a){for(var d=0;d<c.length;d++)c[d]=c[d].toLowerCase();for(d=0;d<a.length;d++)a[d]=a[d].toLowerCase();this.container=b;this.tags=c;this.attr=a}FormDeflater.prototype={container:this.container,tags:this.tags,attr:this.attr};
|
function FormDeflater(b,c,a){for(var d=0;d<c.length;d++)c[d]=c[d].toLowerCase();for(d=0;d<a.length;d++)a[d]=a[d].toLowerCase();this.container=b;this.tags=c;this.attr=a}FormDeflater.prototype={container:this.container,tags:this.tags,attr:this.attr};
|
||||||
FormDeflater.prototype.deflate=function(){for(var b=this.getChildren(this.container),b=this.filterElements(b),c={},a=0;a<b.length;a++)for(var d=0;d<this.attr.length;d++){var e=b[a].getAttribute(this.attr[d]);if(null!==e&&0<e.length){c.hasOwnProperty(e)?c[e]instanceof Array?c[e].push({target:b[a],attr:this.attr[d],value:b[a].value,checked:b[a].checked}):c[e]=[c[e],{target:b[a],attr:this.attr[d],value:b[a].value,checked:b[a].checked}]:c[e]={target:b[a],attr:this.attr[d],value:b[a].value,checked:b[a].checked};
|
FormDeflater.prototype.deflate=function(){for(var b=this.getChildren(this.container),b=this.filterElements(b),c={},a=0;a<b.length;a++)for(var d=0;d<this.attr.length;d++){var e=b[a].getAttribute(this.attr[d]);if(null!==e&&0<e.length){c.hasOwnProperty(e)?c[e]instanceof Array?c[e].push({target:b[a],attr:this.attr[d],value:b[a].value,checked:b[a].checked}):c[e]=[c[e],{target:b[a],attr:this.attr[d],value:b[a].value,checked:b[a].checked}]:c[e]={target:b[a],attr:this.attr[d],value:b[a].value,checked:b[a].checked};
|
||||||
break}}return c=this.cleanOutput(c)};FormDeflater.prototype.checkable=function(b){return"INPUT"!=b.tagName||-1==["radio","checkbox"].indexOf(b.getAttribute("type").toLowerCase())?!1:!0};
|
break}}return c=this.cleanOutput(c)};FormDeflater.prototype.checkable=function(b){return b instanceof Element&&"INPUT"==b.tagName&&-1!=["radio","checkbox"].indexOf(b.getAttribute("type").toLowerCase())?!0:!1};
|
||||||
FormDeflater.prototype.cleanOutput=function(b){var c={},a;for(a in b)if(b[a]instanceof Array){var d=!0,e=[],f;for(f in b[a])if(this.checkable(b[a][f].target))!0===b[a][f].checked&&e.push(f);else{d=!1;break}if(d)if(1==e.length)c[a]=b[a][e[0]].value;else for(f in c[a]=[],e)c[a].push(b[a][e[f]].value);else for(f in c[a]=[],b[a])c[a].push(b[a][f].value)}else this.checkable(b[a].target)?c[a]=b[a].checked?b[a].value:null:c[a]=b[a].value;return c};
|
FormDeflater.prototype.cleanOutput=function(b){var c={},a;for(a in b)if(b[a]instanceof Array){var d=!0,e=[],f;for(f in b[a])if(this.checkable(b[a][f].target))!0===b[a][f].checked&&e.push(f);else{d=!1;break}if(d)if(1==e.length)c[a]=b[a][e[0]].value;else for(f in c[a]=[],e)c[a].push(b[a][e[f]].value);else for(f in c[a]=[],b[a])c[a].push(b[a][f].value)}else this.checkable(b[a].target)?c[a]=b[a].checked?b[a].value:null:c[a]=b[a].value;return c};
|
||||||
FormDeflater.prototype.getChildren=function(b){if(!(b instanceof Element))return[];for(var c=b=[].slice.call(b.children),a=0;a<b.length;a++)c=c.concat([].slice.call(this.getChildren(b[a])));return c};FormDeflater.prototype.filterElements=function(b){for(var c=[],a=0;a<b.length;a++)-1<this.tags.indexOf(b[a].tagName.toLowerCase())&&c.push(b[a]);return c};
|
FormDeflater.prototype.getChildren=function(b){if(!(b instanceof Element))return[];for(var c=b=[].slice.call(b.children),a=0;a<b.length;a++)c=c.concat([].slice.call(this.getChildren(b[a])));return c};FormDeflater.prototype.filterElements=function(b){for(var c=[],a=0;a<b.length;a++)-1<this.tags.indexOf(b[a].tagName.toLowerCase())&&c.push(b[a]);return c};
|
||||||
|
|
|
@ -212,6 +212,20 @@ function diff(A, B, ignore){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* CLONE UN OBJET DE PROFONDEUR 1
|
||||||
|
*
|
||||||
|
* @input<Object> Objet à cloner
|
||||||
|
*
|
||||||
|
* @return clone<Object> Objet identique (cloné)
|
||||||
|
*
|
||||||
|
* Note: prise en compte des primitifs && tableaux uniquement
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
// Object.prototype.clone = function(){
|
||||||
|
// return this;
|
||||||
|
// };
|
||||||
|
|
||||||
|
|
||||||
/* DEFINITION DES FORMATS UTILES POUR INPUT-CHECKER
|
/* DEFINITION DES FORMATS UTILES POUR INPUT-CHECKER
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
var DOM,pageManager,api,Notification,global_start_timestamp;global_start_timestamp=Date.now();
|
var DOM,pageManager,api,Notification,navSubMenu=function(a){var c=$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+pageManager.vars[0]+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+a+'"]'):b,b=null==b?$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub > span[data-sublink]"):b;if(null==b)return!1;null!=c&&c.remClass("active");c=$$("#CONTAINER > section[data-sublink].active");
|
||||||
var navSubMenu=function(a){var c=$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+pageManager.vars[0]+'"]'),b=null,b=a instanceof Element?a:null,b="string"==typeof a?$("#MENU-SIDE > span[data-link="+pageManager.page+'] + div.sub > span[data-sublink="'+a+'"]'):b,b=null==b?$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub > span[data-sublink]"):b;if(null==b)return!1;null!=c&&c.remClass("active");c=$$("#CONTAINER > section[data-sublink].active");for(a=
|
for(a=0;a<c.length;a++)c[a].remClass("active");if(null!=b)for(b.addClass("active"),c=$$('#CONTAINER > section[data-sublink="'+b.getData("sublink")+'"]'),a=0;a<c.length;a++)c[a].addClass("active");if(!b.getData("sublink"))return!1;a=pageManager.vars[0]!=b.getData("sublink");pageManager.vars[0]=b.getData("sublink");a&&pageManager.updateURL()},navMenu=function(a){var c=$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]'),b=null,b=a instanceof Element?a:null,b=(b="string"==typeof a?$('#WRAPPER > #MENU-SIDE > span[data-link="'+
|
||||||
0;a<c.length;a++)c[a].remClass("active");if(null!=b)for(b.addClass("active"),c=$$('#CONTAINER > section[data-sublink="'+b.getData("sublink")+'"]'),a=0;a<c.length;a++)c[a].addClass("active");if(!b.getData("sublink"))return!1;a=pageManager.vars[0]!=b.getData("sublink");pageManager.vars[0]=b.getData("sublink");a&&pageManager.updateURL()},navMenu=function(a){var c=$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.page+'"]'),b=null,b=a instanceof Element?a:null,b=(b="string"==typeof a?$('#WRAPPER > #MENU-SIDE > span[data-link="'+
|
|
||||||
a+'"]'):b)||$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]');if(null==b)return!1;c&&c.remClass("active");b&&b.addClass("active");b.getData("link")&&(DOM.HEADER.addClass("loading"),a=function(){1<=pageManager.vars.length&&null!=$('#CONTAINER > section[data-sublink="'+pageManager.vars[0]+'"]')?navSubMenu(pageManager.vars[0]):navSubMenu(null);var a=$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub");null!=a&&a.addEventListener("click",function(a){for(a=a.target;a!=
|
a+'"]'):b)||$('#WRAPPER > #MENU-SIDE > span[data-link="'+pageManager.pagelist[0]+'"]');if(null==b)return!1;c&&c.remClass("active");b&&b.addClass("active");b.getData("link")&&(DOM.HEADER.addClass("loading"),a=function(){1<=pageManager.vars.length&&null!=$('#CONTAINER > section[data-sublink="'+pageManager.vars[0]+'"]')?navSubMenu(pageManager.vars[0]):navSubMenu(null);var a=$("#MENU-SIDE > span[data-link="+pageManager.page+"] + div.sub");null!=a&&a.addEventListener("click",function(a){for(a=a.target;a!=
|
||||||
document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1);DOM.HEADER.remClass("loading")},pageManager.page!=b.getData("link")&&pageManager.setPage(b.getData("link")),pageManager.activeXHR?pageManager.activeXHR.addEventListener("loadend",a,!1):a.call())},refresher=function(){navSubMenu()};DOM={WRAPPER:$("body > #WRAPPER"),HEADER:$("body > #WRAPPER > #HEADER"),MENUSIDE:$("body > #WRAPPER > #MENU-SIDE"),CONTAINER:$("body > #WRAPPER > #CONTAINER")};api=new APIClass("/api/");
|
document.body&&!a.getData("sublink");)a=a.parentNode;a.getData("sublink")&&navSubMenu(a)},!1);DOM.HEADER.remClass("loading")},pageManager.page!=b.getData("link")&&pageManager.setPage(b.getData("link")),pageManager.activeXHR?pageManager.activeXHR.addEventListener("loadend",a,!1):a.call())},refresher=function(){navSubMenu()};DOM={WRAPPER:$("body > #WRAPPER"),HEADER:$("body > #WRAPPER > #HEADER"),MENUSIDE:$("body > #WRAPPER > #MENU-SIDE"),CONTAINER:$("body > #WRAPPER > #CONTAINER")};api=new APIClass("/api/");
|
||||||
Notification=new NotificationClass($("#notification-container"));Notification.defaultTimeout=4E3;
|
Notification=new NotificationClass($("#notification-container"));Notification.defaultTimeout=4E3;
|
||||||
|
|
|
@ -11,6 +11,7 @@ var sField, sSubmit, sList,
|
||||||
fFicheManager = null,
|
fFicheManager = null,
|
||||||
fMatriceManager = null;
|
fMatriceManager = null;
|
||||||
|
|
||||||
|
var input_ts = Date.now();
|
||||||
|
|
||||||
/*=========================================================*/
|
/*=========================================================*/
|
||||||
/*=========== Gestion de la recherche de sujet ============*/
|
/*=========== Gestion de la recherche de sujet ============*/
|
||||||
|
@ -680,6 +681,10 @@ var pDynamicUpdate = function(target){
|
||||||
/* (8) On met à jour les contacts si on les a modifié on si on navigue dans les contacts */
|
/* (8) On met à jour les contacts si on les a modifié on si on navigue dans les contacts */
|
||||||
pContactManager.storageToFields();
|
pContactManager.storageToFields();
|
||||||
|
|
||||||
|
/* (9) On met à jour les barres de navigation */
|
||||||
|
pMiniManager.updateNavBar();
|
||||||
|
pFicheManager.updateNavBar();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -690,7 +695,11 @@ var pDynamicUpdate = function(target){
|
||||||
pFicheManager.storageToFields();
|
pFicheManager.storageToFields();
|
||||||
pMatriceManager.storageToFields();
|
pMatriceManager.storageToFields();
|
||||||
|
|
||||||
/* (8) On met à jour les contacts si on les a modifié on si on navigue dans les contacts */
|
/* (9) On met à jour les barres de navigation */
|
||||||
|
pMiniManager.updateNavBar();
|
||||||
|
pFicheManager.updateNavBar();
|
||||||
|
|
||||||
|
/* (10) On met à jour les contacts si on les a modifié on si on navigue dans les contacts */
|
||||||
( isSaveButton || isNavContact ) && pContactManager.storageToFields();
|
( isSaveButton || isNavContact ) && pContactManager.storageToFields();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var sField,sSubmit,sList,pSubjectManager=null,pContactManager=null,pMiniManager=null,pFicheManager=null,pMatriceManager=null,fSubjectManager=null,fContactManager=null,fMiniManager=null,fFicheManager=null,fMatriceManager=null;sField=$("#search-field");sSubmit=$("#search-subject");sList=$('section[data-sublink="survey"] ul[data-list]');
|
var sField,sSubmit,sList,pSubjectManager=null,pContactManager=null,pMiniManager=null,pFicheManager=null,pMatriceManager=null,fSubjectManager=null,fContactManager=null,fMiniManager=null,fFicheManager=null,fMatriceManager=null,input_ts=Date.now();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.push("<li data-element data-id='"+g+"'>"),c.push("<div data-user><span>SUJET</span></div>"),c.push("<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+g+"'></span> </div>"),c.push("<div> <span data-prefix='Nom'>"+
|
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.push("<li data-element data-id='"+g+"'>"),c.push("<div data-user><span>SUJET</span></div>"),c.push("<div> <span><input type='text' readonly style='text-align: center' onclick='this.select()' class='flag' value='"+g+"'></span> </div>"),c.push("<div> <span data-prefix='Nom'>"+
|
||||||
a.results[g].name+"</span> </div>"),c.push("<div> <span data-prefix='Cr\u00e9ation'>"+a.results[g].creation+"</span> </div>"),c.push("<div> <span><input type='checkbox' id='s_"+g+"' "+(null!=a.results[g].phone?"checked":"")+" disabled><label for='s_"+g+"'>Cellulaire</label>"),c.push("</span> </div>"),c.push("<div> <span><input type='checkbox' id='s_"+g+"' "+(null!=a.results[g].facebook?"checked":"")+" disabled><label for='s_"+g+"'>Facebook</label>"),c.push("</span> </div>"),c.push("</li>");sList.innerHTML=
|
a.results[g].name+"</span> </div>"),c.push("<div> <span data-prefix='Cr\u00e9ation'>"+a.results[g].creation+"</span> </div>"),c.push("<div> <span><input type='checkbox' id='s_"+g+"' "+(null!=a.results[g].phone?"checked":"")+" disabled><label for='s_"+g+"'>Cellulaire</label>"),c.push("</span> </div>"),c.push("<div> <span><input type='checkbox' id='s_"+g+"' "+(null!=a.results[g].facebook?"checked":"")+" disabled><label for='s_"+g+"'>Facebook</label>"),c.push("</span> </div>"),c.push("</li>");sList.innerHTML=
|
||||||
c.join("")})};sSubmit.addEventListener("click",tmpSubjectSearchListener,!1);sField.addEventListener("keypress",function(a){13===a.keyCode&&tmpSubjectSearchListener(a)},!1);
|
c.join("")})};sSubmit.addEventListener("click",tmpSubjectSearchListener,!1);sField.addEventListener("keypress",function(a){13===a.keyCode&&tmpSubjectSearchListener(a)},!1);
|
||||||
|
@ -21,10 +21,10 @@ pContactManager.fieldsToStorage();pMiniManager.fieldsToStorage();pFicheManager.f
|
||||||
"La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/phone",subject:lsi["export"]("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;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",
|
"La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/phone",subject:lsi["export"]("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;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),console.groupEnd())};include("/js/includes/input-facebook-subject.js",function(){fLoaded[0]=1;facebookRoutine()});include("/js/includes/input-facebook-contact.js",function(){fLoaded[1]=1;facebookRoutine()});include("/js/includes/input-facebook-mini.js",function(){fLoaded[2]=1;facebookRoutine()});include("/js/includes/input-facebook-fiche.js",function(){fLoaded[3]=1;facebookRoutine()});include("/js/includes/input-facebook-matrice.js",function(){fLoaded[4]=1;facebookRoutine()});
|
1E4);console.log(a)},!1)},!1),console.groupEnd())};include("/js/includes/input-facebook-subject.js",function(){fLoaded[0]=1;facebookRoutine()});include("/js/includes/input-facebook-contact.js",function(){fLoaded[1]=1;facebookRoutine()});include("/js/includes/input-facebook-mini.js",function(){fLoaded[2]=1;facebookRoutine()});include("/js/includes/input-facebook-fiche.js",function(){fLoaded[3]=1;facebookRoutine()});include("/js/includes/input-facebook-matrice.js",function(){fLoaded[4]=1;facebookRoutine()});
|
||||||
var pDynamicUpdate=function(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.groupEnd();console.groupEnd();console.group("[phone] Dynamic Update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();
|
var pDynamicUpdate=function(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.groupEnd();console.groupEnd();console.group("[phone] 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 console.groupEnd(),!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());console.groupEnd()},
|
pMiniManager.sync();!0===a?api.send({path:"subject/getFriends",subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return console.groupEnd(),!1;lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();pContactManager.storageToFields();pMiniManager.updateNavBar();pFicheManager.updateNavBar()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),pMiniManager.updateNavBar(),
|
||||||
fDynamicUpdate=function(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.groupEnd();console.groupEnd();console.group("[facebook] Dynamic Update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();
|
pFicheManager.updateNavBar(),(c||b)&&pContactManager.storageToFields());console.groupEnd()},fDynamicUpdate=function(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.groupEnd();console.groupEnd();console.group("[facebook] Dynamic Update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();
|
||||||
fMiniManager.sync();!0===a?api.send({path:"subject/getFriends",subject_id:fSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return console.groupEnd(),!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());console.groupEnd()};
|
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 console.groupEnd(),!1;lsi["import"]("f_friends",a.subjects);fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();fContactManager.storageToFields()}):(fMiniManager.storageToFields(),fFicheManager.storageToFields(),fMatriceManager.storageToFields(),
|
||||||
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})}
|
(c||b)&&fContactManager.storageToFields());console.groupEnd()};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=
|
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="'+
|
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+'"]'),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="'+
|
||||||
|
|
Loading…
Reference in New Issue