From 8513033c04797dedeba4de959376bf60c6d52a75 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Tue, 7 Jun 2016 11:06:59 +0200 Subject: [PATCH] Correction matrice --- config/menu.json | 2 +- js/includes/input-facebook-matrice-min.js | 2 +- js/includes/input-facebook-matrice.js | 5 ++++- js/includes/input-phone-matrice-min.js | 3 ++- js/includes/input-phone-matrice.js | 5 ++++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/config/menu.json b/config/menu.json index f7af7d5..c8a439a 100644 --- a/config/menu.json +++ b/config/menu.json @@ -44,7 +44,7 @@ "children": [ { "permissions": [], "text": "Export des données", "attributes": { "data-sublink": "export" } }, - { "permissions": [], "text": "Export des graphiques", + { "permissions": [], "text": "Export Gephi", "attributes": { "data-sublink": "charts" } }, { "permissions": [], "text": "Statistiques", "attributes": { "data-sublink": "analytics" } } diff --git a/js/includes/input-facebook-matrice-min.js b/js/includes/input-facebook-matrice-min.js index aac3af8..163fb49 100644 --- a/js/includes/input-facebook-matrice-min.js +++ b/js/includes/input-facebook-matrice-min.js @@ -2,4 +2,4 @@ function inputFacebookMatrice(a){this.container=a}inputFacebookMatrice.prototype inputFacebookMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var e in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][e]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("f_matrice",0,d)}; inputFacebookMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("f_fiches"),d=lsi.get("f_matrice",0),b=lsi["export"]("f_contacts"),e=[],c;for(c in a)-1==e.indexOf(a[c].contact)&&e.push(a[c].contact);a="";for(c=0;c";0',a+=g.username,a+=""):a+="";for(var f=0;f",a+='', a+=h.username,a+=""):f",a+=""):a+=""}a+=""}this.container.innerHTML=a+"
"}; -inputFacebookMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("f_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1)}; +inputFacebookMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("f_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();setTimeout(function(){a.storageToFields()},500)},!1)}; diff --git a/js/includes/input-facebook-matrice.js b/js/includes/input-facebook-matrice.js index fd5110b..c0bfce5 100644 --- a/js/includes/input-facebook-matrice.js +++ b/js/includes/input-facebook-matrice.js @@ -167,7 +167,10 @@ inputFacebookMatrice.prototype.attach = function(){ /* (3) On enregistre la matrice à chaque modification */ var ptr = this; this.container.addEventListener('click', function(e){ + ptr.fieldsToStorage(); - ptr.storageToFields(); + + setTimeout(function(){ ptr.storageToFields(); }, 500); + }, false); }; diff --git a/js/includes/input-phone-matrice-min.js b/js/includes/input-phone-matrice-min.js index 12dbf2b..71e4fd5 100644 --- a/js/includes/input-phone-matrice-min.js +++ b/js/includes/input-phone-matrice-min.js @@ -2,7 +2,8 @@ function inputPhoneMatrice(a){this.container=a}inputPhoneMatrice.prototype={cont inputPhoneMatrice.prototype.fieldsToStorage=function(){console.log("MATRICE: FIELDS TO STORAGE");var a=(new FormDeflater(this.container,["input"],["data-name"])).deflate();crc32(JSON.stringify(a));var d={},b;for(b in a)if(a[b]instanceof Array)for(var g in a[b])null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b][g]));else null!==a[b]&&(null==d[b]&&(d[b]=[]),d[b].push(parseInt(a[b])));lsi.set("p_matrice",0,d)}; inputPhoneMatrice.prototype.storageToFields=function(){console.log("MATRICE: STORAGE TO FIELDS");var a=lsi["export"]("p_fiches"),d=lsi.get("p_matrice",0),b=lsi["export"]("p_contacts"),g=[],f;for(f in a)-1==g.indexOf(a[f].contact)&&g.push(a[f].contact);a="";for(f=0;f";0',a+=e.username,a+=""):a+="";for(var c=0;c",a+='', a+=h.username,a+=""):c",a+=""):a+=""}a+=""}this.container.innerHTML=a+"
"}; -inputPhoneMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();a.storageToFields()},!1)};inputPhoneMatrice.prototype.parseGrid=function(){var a=$$(".matrice-panel input[data-name][value]"),d;for(d in a)if(a[d]instanceof Element){var b=a[d].getData("name"),g=a[d].value;this.sGrid[b]instanceof Array||(this.sGrid[b]=[]);this.sGrid[b][g]=a[d]}}; +inputPhoneMatrice.prototype.attach=function(){console.log("MATRICE: ATTACH");lsi.createDataset("p_matrice");this.storageToFields();var a=this;this.container.addEventListener("click",function(d){a.fieldsToStorage();setTimeout(function(){a.storageToFields()},500)},!1)}; +inputPhoneMatrice.prototype.parseGrid=function(){var a=$$(".matrice-panel input[data-name][value]"),d;for(d in a)if(a[d]instanceof Element){var b=a[d].getData("name"),g=a[d].value;this.sGrid[b]instanceof Array||(this.sGrid[b]=[]);this.sGrid[b][g]=a[d]}}; inputPhoneMatrice.prototype.snake=function(){this.sVelocity=[0,0];this.sLength=2;this.sStack=[];this.sKeys=[];this.sGrid=[];this.sRoutine=this.sTarget=null;var a=this;this.parseGrid();var d=parseInt(this.sGrid.length/2),b=parseInt(this.sGrid[d].length/2);this.sStack.push(this.sGrid[d][b]);for(var d=!1,g,f;!d;)g=Math.floor(Math.random()*this.sGrid.length),f=Math.floor(Math.random()*this.sGrid[g].length),d=(d=null!=this.sGrid[g]&&null!=this.sGrid[g][f])&&-1==this.sStack.indexOf(this.sGrid[g][f]);this.sTarget= this.sGrid[g][f];document.body.addEventListener("keydown",function(e){-1<[37,38,39,40].indexOf(e.keyCode)&&-1==a.sKeys.indexOf(e.keyCode)&&a.sKeys.push(e.keyCode)},!1);document.body.addEventListener("keyup",function(e){var c=a.sKeys.indexOf(e.keyCode);-1<[37,38,39,40].indexOf(e.keyCode)&&-1e&&(e=a.sGrid[c].length-1);c=(c+a.sVelocity[1])%a.sGrid.length;0>=c&&(c=e+1);if(null==a.sGrid[c]||null==a.sGrid[c][e])c=a.sGrid.length-1;if(null!=a.sGrid[c]&&null!=a.sGrid[c][e]){if(a.sGrid[c][e].checked)if(a.sGrid[c][e].id==a.sTarget.id){a.sLength++; diff --git a/js/includes/input-phone-matrice.js b/js/includes/input-phone-matrice.js index a3980c3..e84f73f 100644 --- a/js/includes/input-phone-matrice.js +++ b/js/includes/input-phone-matrice.js @@ -167,8 +167,11 @@ inputPhoneMatrice.prototype.attach = function(){ /* (3) On enregistre la matrice à chaque modification */ var ptr = this; this.container.addEventListener('click', function(e){ + ptr.fieldsToStorage(); - ptr.storageToFields(); + + setTimeout(function(){ ptr.storageToFields(); }, 500); + }, false); };