Correction complète cette fois du chargement unique des pages+dépendances [FCT]
This commit is contained in:
parent
d5d1bead3f
commit
4e77bb69fe
|
@ -135,8 +135,8 @@ var navMenu = function(section){
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* (x) Si on change de page, on charge la nouvelle charge */
|
/* (x) Si première ou changement de page, on charge la nouvelle */
|
||||||
( DOM.CONTAINER.innerHTML.length === 0 || target.getData('link') != pageManager.page ) && pageManager.setPage( target.getData('link') );
|
pageManager.page != target.getData('link') && pageManager.setPage( target.getData('link') );
|
||||||
|
|
||||||
// Si on a `pageManager.activeXHR`, on met le handler, sinon on lance
|
// Si on a `pageManager.activeXHR`, on met le handler, sinon on lance
|
||||||
pageManager.activeXHR ? pageManager.activeXHR.addEventListener('loadend', handlerX, false) : handlerX.call();
|
pageManager.activeXHR ? pageManager.activeXHR.addEventListener('loadend', handlerX, false) : handlerX.call();
|
||||||
|
@ -242,10 +242,8 @@ LOGIN.hide.addEventListener('click', function(e){ LOGIN.page.className = '';
|
||||||
api.send({path:'download/menu'}, function(response){
|
api.send({path:'download/menu'}, function(response){
|
||||||
|
|
||||||
// si erreur
|
// si erreur
|
||||||
if( response.ModuleError != 0 ){
|
if( response.ModuleError !== 0 )
|
||||||
console.warn('menu load error: '+response.ModuleError);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// On initialise la liste des pages
|
// On initialise la liste des pages
|
||||||
pagelist = [];
|
pagelist = [];
|
||||||
|
@ -254,7 +252,6 @@ api.send({path:'download/menu'}, function(response){
|
||||||
for( var i = 0 ; i < response.menu.length; i++ )
|
for( var i = 0 ; i < response.menu.length; i++ )
|
||||||
pagelist.push( response.menu[i].attributes['data-link'] );
|
pagelist.push( response.menu[i].attributes['data-link'] );
|
||||||
|
|
||||||
console.log('menu loaded', pagelist);
|
|
||||||
/* (1) On initialisa pageManager */
|
/* (1) On initialisa pageManager */
|
||||||
pageManager = new pageManagerClass();
|
pageManager = new pageManagerClass();
|
||||||
pageManager.setPage(null, '/view', DOM.CONTAINER, pagelist, null );
|
pageManager.setPage(null, '/view', DOM.CONTAINER, pagelist, null );
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* [0] Constructeur -> définit le conteneur et le bouton d'ajout
|
/* [0] Constructeur -> définit le conteneur et le bouton d'ajout
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
function inputPhoneSubject(iTmpId, iSubjectId, store_button){
|
function inputPhoneSubject(iSubjectId, store_button){
|
||||||
this.tmp_id = iTmpId;
|
|
||||||
this.subject_id = iSubjectId;
|
this.subject_id = iSubjectId;
|
||||||
this.store_button = store_button;
|
this.store_button = store_button;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +9,6 @@ function inputPhoneSubject(iTmpId, iSubjectId, store_button){
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
inputPhoneSubject.prototype = {
|
inputPhoneSubject.prototype = {
|
||||||
store_button: this.store_button, // Bouton d'ajout d'un formulaire
|
store_button: this.store_button, // Bouton d'ajout d'un formulaire
|
||||||
tmp_id: this.tmp_id,
|
|
||||||
subject_id: this.subject_id,
|
subject_id: this.subject_id,
|
||||||
handler: null
|
handler: null
|
||||||
};
|
};
|
||||||
|
@ -33,7 +31,6 @@ inputPhoneSubject.prototype.fieldsToStorage = function(){
|
||||||
|
|
||||||
// {2} On récupère et met en forme les valeurs du deflater //
|
// {2} On récupère et met en forme les valeurs du deflater //
|
||||||
var obj = {
|
var obj = {
|
||||||
tmp_id: this.tmp_id.value,
|
|
||||||
subject_id: this.subject_id.value
|
subject_id: this.subject_id.value
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -58,10 +55,9 @@ inputPhoneSubject.prototype.storageToFields = function(){
|
||||||
// {1} On récupère les informations du sujet //
|
// {1} On récupère les informations du sujet //
|
||||||
var subjectData = lsi.get('p_subject', 0);
|
var subjectData = lsi.get('p_subject', 0);
|
||||||
|
|
||||||
subjectData = subjectData || { tmp_id: '', subject_id: '' };
|
subjectData = subjectData || { subject_id: '' };
|
||||||
|
|
||||||
// {2} On restore les valeurs //
|
// {2} On restore les valeurs //
|
||||||
this.tmp_id.value = subjectData.tmp_id;
|
|
||||||
this.subject_id.value = subjectData.subject_id;
|
this.subject_id.value = subjectData.subject_id;
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,13 +77,13 @@ inputPhoneSubject.prototype.attach = function(handler){
|
||||||
|
|
||||||
// Pointeur pour les scopes des addEventListener()
|
// Pointeur pour les scopes des addEventListener()
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
var ptr = this;
|
|
||||||
// Handler de mise à jour quand les champs sont bons
|
// Handler de mise à jour quand les champs sont bons
|
||||||
function fts(e){
|
var fts = function(e){
|
||||||
ptr.fieldsToStorage();
|
this.fieldsToStorage();
|
||||||
ptr.handler(true);
|
this.handler(true);
|
||||||
ptr.storageToFields();
|
this.storageToFields();
|
||||||
}
|
}.bind(this);
|
||||||
|
|
||||||
|
|
||||||
/* (2) On attache l'évènement sur le bouton d'enregistrement */
|
/* (2) On attache l'évènement sur le bouton d'enregistrement */
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
function inputPhoneSubject(a,b,c){this.tmp_id=a;this.subject_id=b;this.store_button=c}inputPhoneSubject.prototype={store_button:this.store_button,tmp_id:this.tmp_id,subject_id:this.subject_id,handler:null};inputPhoneSubject.prototype.check=function(){return 0<this.subject_id.value.length&&!isNaN(this.subject_id.value)};
|
function inputPhoneSubject(a,b){this.subject_id=a;this.store_button=b}inputPhoneSubject.prototype={store_button:this.store_button,subject_id:this.subject_id,handler:null};inputPhoneSubject.prototype.check=function(){return 0<this.subject_id.value.length&&!isNaN(this.subject_id.value)};inputPhoneSubject.prototype.fieldsToStorage=function(){console.group("[phone.subject] fields to storage");if(!this.check())return!1;lsi.set("p_subject",0,{subject_id:this.subject_id.value});console.groupEnd("[phone.subject] fields to storage")};
|
||||||
inputPhoneSubject.prototype.fieldsToStorage=function(){console.group("[phone.subject] fields to storage");if(!this.check())return!1;lsi.set("p_subject",0,{tmp_id:this.tmp_id.value,subject_id:this.subject_id.value});console.groupEnd("[phone.subject] fields to storage")};inputPhoneSubject.prototype.storageToFields=function(){console.group("[phone.subject] storage to fields");var a=lsi.get("p_subject",0),a=a||{tmp_id:"",subject_id:""};this.tmp_id.value=a.tmp_id;this.subject_id.value=a.subject_id;console.groupEnd("[phone.subject] storage to fields")};
|
inputPhoneSubject.prototype.storageToFields=function(){console.group("[phone.subject] storage to fields");var a=lsi.get("p_subject",0),a=a||{subject_id:""};this.subject_id.value=a.subject_id;console.groupEnd("[phone.subject] storage to fields")};
|
||||||
inputPhoneSubject.prototype.attach=function(a){console.group("[phone.subject] attaching events");lsi.createDataset("p_subject");lsi.createDataset("p_friends");this.handler=a;var b=this;this.store_button.addEventListener("click",function(a){b.fieldsToStorage();b.handler(!0);b.storageToFields()},!1);this.storageToFields();console.groupEnd("[phone.subject] attaching events")};
|
inputPhoneSubject.prototype.attach=function(a){console.group("[phone.subject] attaching events");lsi.createDataset("p_subject");lsi.createDataset("p_friends");this.handler=a;a=function(a){this.fieldsToStorage();this.handler(!0);this.storageToFields()}.bind(this);this.store_button.addEventListener("click",a,!1);this.storageToFields();console.groupEnd("[phone.subject] attaching events")};
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
function pageManagerClass(){}var ptrPageManagerClass;
|
function pageManagerClass(){}var ptrPageManagerClass;
|
||||||
pageManagerClass.prototype={depJS:null,depCSS:null,xhr:[],activeXHR:null,page:null,vars:[],root:"",path:"",jsPath:"js",cssPath:"css",pagelist:null,container:null,ajax:function(b,c,d,a){var e;e=this.xhr.push(window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest"))-1;this.activeXHR=this.xhr[e];this.xhr[e].addEventListener("readystatechange",function(a){if(void 0!=this.xhr[a]&&4===this.xhr[a].readyState){-1<[0,200].indexOf(this.xhr[a].status)?c(this.xhr[a].responseText):
|
pageManagerClass.prototype={loaded:null,depJS:null,depCSS:null,xhr:[],activeXHR:null,page:null,vars:[],root:"",path:"",jsPath:"js",cssPath:"css",pagelist:null,container:null,ajax:function(b,c,d,a){var e;e=this.xhr.push(window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest"))-1;this.activeXHR=this.xhr[e];this.xhr[e].addEventListener("readystatechange",function(a){if(void 0!=this.xhr[a]&&4===this.xhr[a].readyState){-1<[0,200].indexOf(this.xhr[a].status)?c(this.xhr[a].responseText):
|
||||||
c();this.xhr[a]=null;var b=!0;for(a=0;a<this.xhr.length;a++)if(null!==this.xhr[a]){b=!1;break}b&&(this.xhr=[])}}.bind(this,e),!1);d="string"==typeof d&&/^POST|GET$/i.test(d)?d.toUpperCase():"POST";a="POST"==d&&"object"==typeof a&&a instanceof FormData?a:null;this.xhr[e].open(d,b,!0);this.xhr[e].send(a);return this},explodeURL:function(b){b=1<=arguments.length?b:document.URL;if(null!=this.pagelist&&/^(?:(?:https?:\/\/)?[^\/]+)\/([a-z0-9_]+)\/?(?:\/((?:.+\/)+)\/?)?$/i.test(b)){for(var c=RegExp.$2.split("/");""==
|
c();this.xhr[a]=null;var b=!0;for(a=0;a<this.xhr.length;a++)if(null!==this.xhr[a]){b=!1;break}b&&(this.xhr=[])}}.bind(this,e),!1);d="string"==typeof d&&/^POST|GET$/i.test(d)?d.toUpperCase():"POST";a="POST"==d&&"object"==typeof a&&a instanceof FormData?a:null;this.xhr[e].open(d,b,!0);this.xhr[e].send(a);return this},explodeURL:function(b){b=1<=arguments.length?b:document.URL;if(null!=this.pagelist&&/^(?:(?:https?:\/\/)?[^\/]+)\/([a-z0-9_]+)\/?(?:\/((?:.+\/)+)\/?)?$/i.test(b)){for(var c=RegExp.$2.split("/");""==
|
||||||
c[c.length-1];)c.pop();return-1<this.pagelist.indexOf(RegExp.$1)?{page:RegExp.$1,"var":c}:null}return null},loadDependencies:function(){"object"==typeof this.depCSS&&this.depCSS instanceof Element&&this.depCSS.parentNode==document.head&&document.head.removeChild(this.depCSS);"object"==typeof this.depJS&&this.depJS instanceof Element&&this.depJS.parentNode==document.head&&document.head.removeChild(this.depJS);ptrPageManagerClass=this;this.ajax(this.root+this.path+"/"+this.cssPath+"/"+this.page+".css",
|
c[c.length-1];)c.pop();return-1<this.pagelist.indexOf(RegExp.$1)?{page:RegExp.$1,"var":c}:null}return null},loadDependencies:function(){"object"==typeof this.depCSS&&this.depCSS instanceof Element&&this.depCSS.parentNode==document.head&&document.head.removeChild(this.depCSS);"object"==typeof this.depJS&&this.depJS instanceof Element&&this.depJS.parentNode==document.head&&document.head.removeChild(this.depJS);this.ajax(this.root+this.path+"/"+this.cssPath+"/"+this.page+".css",function(b){null!=b?(this.depCSS=
|
||||||
function(b){null!=b?(ptrPageManagerClass.depCSS=document.createElement("link"),ptrPageManagerClass.depCSS.rel="stylesheet",ptrPageManagerClass.depCSS.type="text/css",ptrPageManagerClass.depCSS.href=ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.cssPath+"/"+ptrPageManagerClass.page+".css",document.head.appendChild(ptrPageManagerClass.depCSS)):console.warn("[loadDependencies_Error] - ("+ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.cssPath+"/"+
|
document.createElement("link"),this.depCSS.rel="stylesheet",this.depCSS.type="text/css",this.depCSS.href=this.root+this.path+"/"+this.cssPath+"/"+this.page+".css",document.head.appendChild(this.depCSS)):console.warn("[loadDependencies_Error] - ("+this.root+this.path+"/"+this.cssPath+"/"+this.page+".css)")}.bind(this));this.ajax(this.root+this.path+"/"+this.jsPath+"/"+this.page+".js",function(b){null!=b?(this.depJS=document.createElement("script"),this.depJS.type="text/javascript",this.depJS.src=this.root+
|
||||||
ptrPageManagerClass.page+".css)")});this.ajax(this.root+this.path+"/"+this.jsPath+"/"+this.page+".js",function(b){null!=b?(ptrPageManagerClass.depJS=document.createElement("script"),ptrPageManagerClass.depJS.type="text/javascript",ptrPageManagerClass.depJS.src=ptrPageManagerClass.root+ptrPageManagerClass.path+"/"+ptrPageManagerClass.jsPath+"/"+ptrPageManagerClass.page+".js",document.head.appendChild(ptrPageManagerClass.depJS)):console.warn("[loadDependencies_Error] - ("+ptrPageManagerClass.root+ptrPageManagerClass.path+
|
this.path+"/"+this.jsPath+"/"+this.page+".js",document.head.appendChild(this.depJS)):console.warn("[loadDependencies_Error] - ("+this.root+this.path+"/"+this.jsPath+"/"+this.page+".js)")}.bind(this))},updateURL:function(){0<this.vars.length?window.history.pushState(this.page,this.page,this.root+"/"+this.page+"/"+this.vars.join("/")+"/"):window.history.pushState(this.page,this.page,this.root+"/"+this.page+"/")},setPage:function(b,c,d,a,e){var f="object"==typeof a&&a instanceof Array?a:null;if(null!=
|
||||||
"/"+ptrPageManagerClass.jsPath+"/"+ptrPageManagerClass.page+".js)")})},updateURL:function(){0<this.vars.length?window.history.pushState(this.page,this.page,this.root+"/"+this.page+"/"+this.vars.join("/")+"/"):window.history.pushState(this.page,this.page,this.root+"/"+this.page+"/")},setPage:function(b,c,d,a,e){var f="object"==typeof a&&a instanceof Array?a:null;if(null!=f)for(a=0;a<f.length&&(f="string"==typeof f[a]&&/^[a-z0-9_]+$/i.test(f[a])?f:null,null!=f);a++);this.pagelist=null!=f?f:this.pagelist;
|
f)for(a=0;a<f.length&&(f="string"==typeof f[a]&&/^[a-z0-9_]+$/i.test(f[a])?f:null,null!=f);a++);this.pagelist=null!=f?f:this.pagelist;this.root="string"==typeof e?e:this.root;this.path="string"==typeof c?c:this.path;this.container="object"==typeof d&&d instanceof Element?d:this.container;if(null!=this.pagelist&&null!=this.container)if("string"==typeof b&&-1<this.pagelist.indexOf(b)){this.page=b;b=new FormData;for(a=0;a<this.vars.length;a++)b.append(this.vars[a],null);this.ajax(this.root+this.path+
|
||||||
this.page=this.pagelist[0];this.root="string"==typeof e?e:this.root;this.path="string"==typeof c?c:this.path;this.container="object"==typeof d&&d instanceof Element?d:this.container;if(null!=this.pagelist&&null!=this.container)if("string"==typeof b&&-1<this.pagelist.indexOf(b)){this.page=b;b=new FormData;for(a=0;a<this.vars.length;a++)b.append(this.vars[a],null);this.ajax(this.root+this.path+"/"+this.page+".php",function(a){this.container.innerHTML=a;this.loadDependencies()}.bind(this),"POST",b);
|
"/"+this.page+".php",function(a){this.container.innerHTML=a;this.loadDependencies()}.bind(this),"POST",b);this.updateURL()}else if(c=this.explodeURL(),null!=c){b=new FormData;for(a=this.vars.length=0;a<c["var"].length;a++)this.vars[a]=c["var"][a],b.append(this.vars[a],null);if(c.page==this.page)return this;this.page=c.page;this.ajax(this.root+this.path+"/"+this.page+".php",function(a){this.container.innerHTML=a;this.loadDependencies()}.bind(this),"POST",b);this.updateURL()}else this.setPage(this.pagelist[0]);
|
||||||
this.updateURL()}else if(c=this.explodeURL(),null!=c){b=new FormData;for(a=this.vars.length=0;a<c["var"].length;a++)this.vars[a]=c["var"][a],b.append(this.vars[a],null);if(c.page==this.page)return this;this.page=c.page;this.ajax(this.root+this.path+"/"+this.page+".php",function(a){this.container.innerHTML=a;this.loadDependencies()}.bind(this),"POST",b);this.updateURL()}else this.setPage(this.pagelist[0]);else console.warn("pagelist et container manquant");return this},refresh:function(){this.setPage(this.page);
|
else console.warn("pagelist et container manquant");return this},refresh:function(){this.setPage(this.page);return this}};
|
||||||
return this}};
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ function pageManagerClass(){}
|
||||||
var ptrPageManagerClass; // pointeur global pour l'utilisation de fonctions de fonctions
|
var ptrPageManagerClass; // pointeur global pour l'utilisation de fonctions de fonctions
|
||||||
|
|
||||||
pageManagerClass.prototype = {
|
pageManagerClass.prototype = {
|
||||||
|
loaded: null, // la page chargée en ce moment
|
||||||
depJS: null, // la dépendance javascript
|
depJS: null, // la dépendance javascript
|
||||||
depCSS: null, // la dépendance css
|
depCSS: null, // la dépendance css
|
||||||
xhr: [], // tableau d'objets pour les requêtes ajax
|
xhr: [], // tableau d'objets pour les requêtes ajax
|
||||||
|
@ -152,29 +153,28 @@ pageManagerClass.prototype = {
|
||||||
if( typeof this.depJS == 'object' && this.depJS instanceof Element && this.depJS.parentNode == document.head )
|
if( typeof this.depJS == 'object' && this.depJS instanceof Element && this.depJS.parentNode == document.head )
|
||||||
document.head.removeChild( this.depJS );
|
document.head.removeChild( this.depJS );
|
||||||
|
|
||||||
ptrPageManagerClass = this;
|
|
||||||
// si le fichier css existe
|
// si le fichier css existe
|
||||||
this.ajax(this.root+this.path+'/'+this.cssPath+'/'+this.page+'.css', function(e){
|
this.ajax(this.root+this.path+'/'+this.cssPath+'/'+this.page+'.css', function(e){
|
||||||
if( e != null ){ // on charge la dépendance CSS si le fichier existe
|
if( e != null ){ // on charge la dépendance CSS si le fichier existe
|
||||||
ptrPageManagerClass.depCSS = document.createElement('link');
|
this.depCSS = document.createElement('link');
|
||||||
ptrPageManagerClass.depCSS.rel = 'stylesheet';
|
this.depCSS.rel = 'stylesheet';
|
||||||
ptrPageManagerClass.depCSS.type = 'text/css';
|
this.depCSS.type = 'text/css';
|
||||||
ptrPageManagerClass.depCSS.href = ptrPageManagerClass.root+ptrPageManagerClass.path+'/'+ptrPageManagerClass.cssPath+'/'+ptrPageManagerClass.page+'.css';
|
this.depCSS.href = this.root+this.path+'/'+this.cssPath+'/'+this.page+'.css';
|
||||||
document.head.appendChild(ptrPageManagerClass.depCSS);
|
document.head.appendChild(this.depCSS);
|
||||||
}else
|
}else
|
||||||
console.warn('[loadDependencies_Error] - ('+ptrPageManagerClass.root+ptrPageManagerClass.path+'/'+ptrPageManagerClass.cssPath+'/'+ptrPageManagerClass.page+'.css)');
|
console.warn('[loadDependencies_Error] - ('+this.root+this.path+'/'+this.cssPath+'/'+this.page+'.css)');
|
||||||
});
|
}.bind(this));
|
||||||
|
|
||||||
// si le fichier js existe
|
// si le fichier js existe
|
||||||
this.ajax(this.root+this.path+'/'+this.jsPath+'/'+this.page+'.js', function(e){
|
this.ajax(this.root+this.path+'/'+this.jsPath+'/'+this.page+'.js', function(e){
|
||||||
if( e != null ){ // on charge la dépendance JS si le fichier existe
|
if( e != null ){ // on charge la dépendance JS si le fichier existe
|
||||||
ptrPageManagerClass.depJS = document.createElement('script');
|
this.depJS = document.createElement('script');
|
||||||
ptrPageManagerClass.depJS.type = 'text/javascript';
|
this.depJS.type = 'text/javascript';
|
||||||
ptrPageManagerClass.depJS.src = ptrPageManagerClass.root+ptrPageManagerClass.path+'/'+ptrPageManagerClass.jsPath+'/'+ptrPageManagerClass.page+'.js';
|
this.depJS.src = this.root+this.path+'/'+this.jsPath+'/'+this.page+'.js';
|
||||||
document.head.appendChild(ptrPageManagerClass.depJS);
|
document.head.appendChild(this.depJS);
|
||||||
}else
|
}else
|
||||||
console.warn('[loadDependencies_Error] - ('+ptrPageManagerClass.root+ptrPageManagerClass.path+'/'+ptrPageManagerClass.jsPath+'/'+ptrPageManagerClass.page+'.js)');
|
console.warn('[loadDependencies_Error] - ('+this.root+this.path+'/'+this.jsPath+'/'+this.page+'.js)');
|
||||||
});
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
/* =======================================================================
|
/* =======================================================================
|
||||||
|
@ -221,7 +221,7 @@ pageManagerClass.prototype = {
|
||||||
/* on attribue la variable temporaire pageList à l'attribut de l'objet si la variable pageList temporaire n'est pas nulle */
|
/* on attribue la variable temporaire pageList à l'attribut de l'objet si la variable pageList temporaire n'est pas nulle */
|
||||||
this.pagelist = ( pageList != null ) ? pageList : this.pagelist;
|
this.pagelist = ( pageList != null ) ? pageList : this.pagelist;
|
||||||
// affecte à l'attribut page la page par défaut (premier élément de pagelist)
|
// affecte à l'attribut page la page par défaut (premier élément de pagelist)
|
||||||
this.page = this.pagelist[0];
|
// this.page = this.pagelist[0];
|
||||||
// Gestion de pRoot si racine autre que racine du vhost
|
// Gestion de pRoot si racine autre que racine du vhost
|
||||||
this.root = ( typeof pRoot == 'string' ) ? pRoot : this.root;
|
this.root = ( typeof pRoot == 'string' ) ? pRoot : this.root;
|
||||||
// affecte pPath à l'attribut path s'il est renseigné
|
// affecte pPath à l'attribut path s'il est renseigné
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
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 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");
|
||||||
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="'+
|
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="'+
|
||||||
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")},0!==DOM.CONTAINER.innerHTML.length&&b.getData("link")==pageManager.page||pageManager.setPage(b.getData("link")),pageManager.activeXHR?pageManager.activeXHR.addEventListener("loadend",a,!1):a.call())};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())};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=new NotificationClass($("#notification-container"));Notification.defaultTimeout=4E3;
|
Notification.defaultTimeout=4E3;
|
||||||
Notification.errorCodes={"-1":"Erreur de r\u00e9seau, veuillez recharger la page et r\u00e9essayer",0:"Erreur interne",1:"Erreur interne",2:"Erreur interne",3:"Le fichier est introuvable",4:"Erreur interne",5:"Erreur interne",6:"Erreur interne",7:"Erreur interne",8:"Erreur interne",9:"Certaines donn\u00e9es sont manquantes",10:"Erreur interne",11:"Erreur interne",12:"Erreur interne",13:"Erreur interne",14:"Erreur interne",15:"Erreur interne",16:"Vous n'avez pas la permission d'effectuer cette action",
|
Notification.errorCodes={"-1":"Erreur de r\u00e9seau, veuillez recharger la page et r\u00e9essayer",0:"Erreur interne",1:"Erreur interne",2:"Erreur interne",3:"Le fichier est introuvable",4:"Erreur interne",5:"Erreur interne",6:"Erreur interne",7:"Erreur interne",8:"Erreur interne",9:"Certaines donn\u00e9es sont manquantes",10:"Erreur interne",11:"Erreur interne",12:"Erreur interne",13:"Erreur interne",14:"Erreur interne",15:"Erreur interne",16:"Vous n'avez pas la permission d'effectuer cette action",17:"Le t\u00e9l\u00e9chargement a \u00e9chou\u00e9",
|
||||||
17:"Le t\u00e9l\u00e9chargement a \u00e9chou\u00e9",18:"Le fichier est invalide (format incorrect)"};lsi.setStorage(localStorage);DOM.MENUSIDE.addEventListener("click",function(a){for(a=a.target;a!=document.body&&!a.getData("link");)a=a.parentNode;a.getData("link")&&navMenu(a.getData("link"))},!1);function reload(){navMenu(pageManager.page)}var LOGIN={show:document.getElementById("user-data"),hide:document.getElementById("login-close"),page:document.getElementById("LOGIN")};
|
18:"Le fichier est invalide (format incorrect)"};lsi.setStorage(localStorage);DOM.MENUSIDE.addEventListener("click",function(a){for(a=a.target;a!=document.body&&!a.getData("link");)a=a.parentNode;a.getData("link")&&navMenu(a.getData("link"))},!1);function reload(){navMenu(pageManager.page)}var LOGIN={show:document.getElementById("user-data"),hide:document.getElementById("login-close"),page:document.getElementById("LOGIN")};
|
||||||
LOGIN.show.addEventListener("click",function(a){LOGIN.page.className="active"},!1);LOGIN.hide.addEventListener("click",function(a){LOGIN.page.className=""},!1);
|
LOGIN.show.addEventListener("click",function(a){LOGIN.page.className="active"},!1);LOGIN.hide.addEventListener("click",function(a){LOGIN.page.className=""},!1);api.send({path:"download/menu"},function(a){if(0===a.ModuleError){pagelist=[];for(var c=0;c<a.menu.length;c++)pagelist.push(a.menu[c].attributes["data-link"]);pageManager=new pageManagerClass;pageManager.setPage(null,"/view",DOM.CONTAINER,pagelist,null);navMenu(pageManager.page)}});
|
||||||
api.send({path:"download/menu"},function(a){if(0!=a.ModuleError)console.warn("menu load error: "+a.ModuleError);else{pagelist=[];for(var c=0;c<a.menu.length;c++)pagelist.push(a.menu[c].attributes["data-link"]);console.log("menu loaded",pagelist);pageManager=new pageManagerClass;pageManager.setPage(null,"/view",DOM.CONTAINER,pagelist,null);navMenu(pageManager.page)}});
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ if( $getAllR->error == ManagerError::Success )
|
||||||
<h3 data-n='1' class='color4'>Identifier l'enquêté</h3>
|
<h3 data-n='1' class='color4'>Identifier l'enquêté</h3>
|
||||||
<article class='subject-panel'>
|
<article class='subject-panel'>
|
||||||
<h4 class='self color2' data-icon='a'>
|
<h4 class='self color2' data-icon='a'>
|
||||||
<input type='hidden' data-name='tmp_id' value=''>
|
<!-- <input type='hidden' data-name='tmp_id' value=''> -->
|
||||||
|
|
||||||
<span class='select-container nobold'><select data-name='subject_id'>
|
<span class='select-container nobold'><select data-name='subject_id'>
|
||||||
<option value='.' disabled selected>Identifiant</option>
|
<option value='.' disabled selected>Identifiant</option>
|
||||||
|
|
|
@ -109,7 +109,7 @@ var phoneRoutine = function(){
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
/* (1) On crée une instance du manager du sujet */
|
/* (1) On crée une instance du manager du sujet */
|
||||||
pSubjectManager = new inputPhoneSubject(
|
pSubjectManager = new inputPhoneSubject(
|
||||||
$('[data-sublink="phone"] article.subject-panel [data-name="tmp_id"]'),
|
// $('[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="subject_id"]'),
|
||||||
$('[data-sublink="phone"] article.subject-panel [data-name="submit"]')
|
$('[data-sublink="phone"] article.subject-panel [data-name="submit"]')
|
||||||
);
|
);
|
||||||
|
@ -360,12 +360,6 @@ var facebookRoutine = function(){
|
||||||
|
|
||||||
fAlready = true;
|
fAlready = true;
|
||||||
|
|
||||||
// console.log( facebookRoutineExecuted, typeof inputFacebookSubject );
|
|
||||||
// console.log( facebookRoutineExecuted, typeof inputFacebookContact );
|
|
||||||
// console.log( facebookRoutineExecuted, typeof inputFacebookMini );
|
|
||||||
// console.log( facebookRoutineExecuted, typeof inputFacebookFiche );
|
|
||||||
// console.log( facebookRoutineExecuted, typeof inputFacebookMatrice );
|
|
||||||
// console.log( facebookRoutineExecuted, typeof inputFacebookMatrice );
|
|
||||||
|
|
||||||
console.group('[facebook] Initialization');
|
console.group('[facebook] Initialization');
|
||||||
|
|
||||||
|
@ -373,7 +367,6 @@ var facebookRoutine = function(){
|
||||||
---------------------------------------------------------*/
|
---------------------------------------------------------*/
|
||||||
/* (1) On crée une instance du manager du sujet */
|
/* (1) On crée une instance du manager du sujet */
|
||||||
fSubjectManager = new inputFacebookSubject(
|
fSubjectManager = new inputFacebookSubject(
|
||||||
$('[data-sublink="facebook"] article.subject-panel [data-name="tmp_id"]'),
|
|
||||||
$('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),
|
$('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),
|
||||||
$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]')
|
$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]')
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,7 +2,7 @@ var sField,sSubmit,sList,pSubjectManager=null,pContactManager=null,pMiniManager=
|
||||||
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);
|
||||||
var pAlready=!1,pLoaded=[!1,!1,!1,!1,!1],phoneRoutine=function(){pLoaded[0]&&pLoaded[1]&&pLoaded[2]&&pLoaded[3]&&pLoaded[4]&&!pAlready&&(pAlready=!0,console.group("[phone] Initialization"),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'),
|
var pAlready=!1,pLoaded=[!1,!1,!1,!1,!1],phoneRoutine=function(){pLoaded[0]&&pLoaded[1]&&pLoaded[2]&&pLoaded[3]&&pLoaded[4]&&!pAlready&&(pAlready=!0,console.group("[phone] Initialization"),pSubjectManager=new inputPhoneSubject($('[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')),
|
$('[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),$('[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")},
|
pMatriceManager.attach(pDynamicUpdate),$('[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-facebook-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));
|
!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-facebook-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));
|
||||||
|
@ -11,16 +11,16 @@ a.ModuleError),!1;lsi.set("p_subject",0,a.local_data.subject);lsi["import"]("p_c
|
||||||
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,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].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(c in a)if(!a[c].valid)return Notification.warning("Attention",
|
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,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].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(c in a)if(!a[c].valid)return Notification.warning("Attention",
|
||||||
"La <i>fiche compl\u00e8te</i> <b>"+(parseInt(c)+1)+"</b> est incompl\u00e8te et/ou incorrecte"),!1;c={path:"input/facebook",subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <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/facebook",subject:lsi["export"]("p_subject")[0],contacts:lsi["export"]("p_contacts"),mini:lsi["export"]("p_mini-fiches"),fiches:lsi["export"]("p_fiches"),matrice:lsi["export"]("p_matrice")[0]};api.send(c,function(a){console.log(a);if(0!=a.ModuleError)return Notification.error("ERREUR",a.ModuleError),!1;Notification.success("OK","L'identifiant du sujet est <strong>"+a.subject_id+"</strong> ! Tout s'est bien d\u00e9roul\u00e9.",
|
||||||
1E4);console.log(a)},!1)},!1),console.groupEnd("[phone] Initialization"))};include("/js/includes/input-phone-subject.js",function(){pLoaded[0]=!0;phoneRoutine()});include("/js/includes/input-phone-contact.js",function(){pLoaded[1]=!0;phoneRoutine()});include("/js/includes/input-phone-mini.js",function(){pLoaded[2]=!0;phoneRoutine()});include("/js/includes/input-phone-fiche.js",function(){pLoaded[3]=!0;phoneRoutine()});include("/js/includes/input-phone-matrice.js",function(){pLoaded[4]=!0;phoneRoutine()});
|
1E4);console.log(a)},!1)},!1),console.groupEnd("[phone] Initialization"))};include("/js/includes/input-phone-subject.js",function(){pLoaded[0]=!0;phoneRoutine()});include("/js/includes/input-phone-contact.js",function(){pLoaded[1]=!0;phoneRoutine()});include("/js/includes/input-phone-mini.js",function(){pLoaded[2]=!0;phoneRoutine()});include("/js/includes/input-phone-fiche.js",function(){pLoaded[3]=!0;phoneRoutine()});include("/js/includes/input-phone-matrice.js",function(){pLoaded[4]=!0;phoneRoutine()});
|
||||||
var fAlready=!1,fLoaded=[!1,!1,!1,!1,!1],facebookRoutine=function(){fLoaded[0]&&fLoaded[1]&&fLoaded[2]&&fLoaded[3]&&fLoaded[4]&&!fAlready&&(fAlready=!0,console.group("[facebook] Initialization"),fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="tmp_id"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]')),fSubjectManager.attach(fDynamicUpdate),
|
var fAlready=!1,fLoaded=[!1,!1,!1,!1,!1],facebookRoutine=function(){fLoaded[0]&&fLoaded[1]&&fLoaded[2]&&fLoaded[3]&&fLoaded[4]&&!fAlready&&(fAlready=!0,console.group("[facebook] Initialization"),fSubjectManager=new inputFacebookSubject($('[data-sublink="facebook"] article.subject-panel [data-name="subject_id"]'),$('[data-sublink="facebook"] article.subject-panel [data-name="submit"]')),fSubjectManager.attach(fDynamicUpdate),fContactManager=new inputFacebookContact($('[data-sublink="facebook"] article.contact-panel'),
|
||||||
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),
|
$('[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=new inputFacebookMatrice($('[data-sublink="facebook"] article.matrice-panel')),fMatriceManager.attach(fDynamicUpdate),$('[data-sublink="facebook"] #f_clear-all').addEventListener("click",function(a){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");lsi.clear("f_friends");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();
|
fMatriceManager.attach(fDynamicUpdate),$('[data-sublink="facebook"] #f_clear-all').addEventListener("click",function(a){lsi.clear("f_subject");lsi.clear("f_contacts");lsi.clear("f_mini-fiches");lsi.clear("f_fiches");lsi.clear("f_matrice");lsi.clear("f_friends");fSubjectManager.storageToFields();fContactManager.storageToFields();fMiniManager.storageToFields();fFicheManager.storageToFields();fMatriceManager.storageToFields();Notification.success("OK","Les donn\u00e9es ont \u00e9t\u00e9 supprim\u00e9es")},
|
||||||
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=
|
!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-phone-data.json";b.href="data:application/octet-stream,"+encodeURIComponent(JSON.stringify(a));
|
||||||
"local-phone-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]};
|
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",
|
||||||
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);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();pDynamicUpdate(!0)})},!1),$('[data-sublink="facebook"] #f_submit-all').addEventListener("click",
|
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);pSubjectManager.storageToFields();pContactManager.storageToFields();pMatriceManager.storageToFields();pDynamicUpdate(!0)})},!1),$('[data-sublink="facebook"] #f_submit-all').addEventListener("click",function(a){console.log("> GATHERING ALL DATA");pSubjectManager.fieldsToStorage();
|
||||||
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"]("f_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].valid))return Notification.warning("Attention","La <i>fiche rapide</i> <b>"+b+"</b> est incompl\u00e8te et/ou incorrecte"),
|
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"]("f_mini-fiches");var b=0,c;for(c in a)if(!isNaN(c)&&(b++,!a[c].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(c in a)if(!a[c].valid)return Notification.warning("Attention",
|
||||||
!1;a=lsi["export"]("f_fiches");for(c in a)if(!a[c].valid)return Notification.warning("Attention","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),
|
"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.",
|
||||||
!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("[facebook] Initialization"))};include("/js/includes/input-facebook-subject.js",function(){fLoaded[0]=!0;facebookRoutine()});include("/js/includes/input-facebook-contact.js",function(){fLoaded[1]=!0;facebookRoutine()});include("/js/includes/input-facebook-mini.js",function(){fLoaded[2]=!0;facebookRoutine()});
|
1E4);console.log(a)},!1)},!1),console.groupEnd("[facebook] Initialization"))};include("/js/includes/input-facebook-subject.js",function(){fLoaded[0]=!0;facebookRoutine()});include("/js/includes/input-facebook-contact.js",function(){fLoaded[1]=!0;facebookRoutine()});include("/js/includes/input-facebook-mini.js",function(){fLoaded[2]=!0;facebookRoutine()});include("/js/includes/input-facebook-fiche.js",function(){fLoaded[3]=!0;facebookRoutine()});
|
||||||
include("/js/includes/input-facebook-fiche.js",function(){fLoaded[3]=!0;facebookRoutine()});include("/js/includes/input-facebook-matrice.js",function(){fLoaded[4]=!0;facebookRoutine()});
|
include("/js/includes/input-facebook-matrice.js",function(){fLoaded[4]=!0;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.group("[phone] Dynamic Update");pMiniManager.fieldsToStorage();pFicheManager.fieldsToStorage();pContactManager.fieldsToStorage();pMatriceManager.fieldsToStorage();pFicheManager.sync();pMiniManager.sync();!0===a?api.send({path:"subject/getFriends",
|
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.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!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("[phone] Dynamic Update")},fDynamicUpdate=function(a){var b=a instanceof Element,c=b&&
|
subject_id:pSubjectManager.subject_id.value},function(a){if(0!=a.ModuleError)return!1;lsi["import"]("p_friends",a.subjects);pMiniManager.storageToFields();pFicheManager.storageToFields();pMatriceManager.storageToFields();pContactManager.storageToFields()}):(pMiniManager.storageToFields(),pFicheManager.storageToFields(),pMatriceManager.storageToFields(),(c||b)&&pContactManager.storageToFields());console.groupEnd("[phone] Dynamic Update")},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.group("[facebook] Dynamic Update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();!0===a?api.send({path:"subject/getFriends",subject_id:fSubjectManager.subject_id.value},
|
"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.group("[facebook] Dynamic Update");fMiniManager.fieldsToStorage();fFicheManager.fieldsToStorage();fContactManager.fieldsToStorage();fMatriceManager.fieldsToStorage();fFicheManager.sync();fMiniManager.sync();!0===a?api.send({path:"subject/getFriends",subject_id:fSubjectManager.subject_id.value},
|
||||||
|
|
Loading…
Reference in New Issue