pages 'users/*' et 'machines/*' DONE (inclus pages 'users/groups' et 'machines/groups' avec la recherche et tous les liens)

This commit is contained in:
xdrm-brackets 2016-07-21 01:19:19 +02:00
parent 2f3e00d99f
commit f180ff13e8
9 changed files with 178 additions and 33 deletions

View File

@ -376,7 +376,7 @@
"permissions": ["warehouse", "admin"],
"parameters": {
"keywords": { "description": "Mots-clés de la recherche.", "type": "text" },
"class": { "description": "Type de groupe.", "type": "int", "optional": true }
"class": { "description": "Type de groupe.", "type": "id", "optional": true }
},
"output": {
"clusters": { "description": "Liste des groupes correspondants aux mots-clés.", "type": "array<mixed>" }

View File

@ -21,9 +21,12 @@
case 'machine_cluster': return "
<article class='inline-box' id='@id_machine_cluster'>
<span class='title' style='color: ".$_SESSION['WAREHOUSE']['theme']."'>@name</span>
<span class='link_remove' data-cluster='@id_machine_cluster'>@icon_remove</span>
<span class='link_edit' data-cluster='@id_machine_cluster'>@icon_edit</span>
<span class='code'>
@icon_type
<span>@count machines</span>

View File

@ -21,9 +21,12 @@
case 'user_cluster': return "
<article class='inline-box' id='@id_user_cluster'>
<span class='title' style='color: ".$_SESSION['WAREHOUSE']['theme']."'>@name</span>
<span class='link_remove' data-cluster='@id_user_cluster'>@icon_remove</span>
<span class='link_edit' data-cluster='@id_user_cluster'>@icon_edit</span>
<span class='code'>
@icon_type
<span>@count utilisateurs</span>

14
view/js/groups-min.js vendored
View File

@ -15,12 +15,12 @@ keywords:section.remove.input.search.keyword.value};api.send(b,function(a){0==a.
0:1,api.send({path:"clusterDefault/delete",id_cluster:section.remove.input.search.id.value,"class":a},function(a){0==a.ModuleError&&1==a.status?(console.log("Groupe supprimee!"),section.remove.input.submit.anim("active",1500),pageManager.vars[1]="",navSubMenu("view"),document.location=""):console.error("ModuleError::"+a.ModuleError)}))},!1)}
if(null!=section.edit.element){var autofill_edit=function(){var a="",b="",d=!0;if(null==found_edit[searchindex_edit])searchindex_edit=section.edit.input.search.num.innerHTML=0;else{var c;found_edit[searchindex_remove].hasOwnProperty("id_user_cluster")?(a=found_edit[searchindex_remove].id_user_cluster,c=0):(a=found_edit[searchindex_remove].id_machine_cluster,c=1);b=found_edit[searchindex_remove].name;d=!1;section.edit.input.search.num.innerHTML=searchindex_edit+1}section.edit.input.search.id.value=
a;section.edit.input.name.value=b;section.edit.input["class"].value=0==c?"utilisateur":"machine";section.edit.input.submit.disabled=d};section.edit.input={search:{view:document.querySelector(section.edit.text+".edit_search_view"),num:document.querySelector(section.edit.text+".edit_search_num"),sum:document.querySelector(section.edit.text+".edit_search_sum"),keyword:document.querySelector(section.edit.text+"#edit_search_keyword"),id:document.querySelector(section.edit.text+"#edit_search_id"),submit:document.querySelector(section.edit.text+
"#edit_search_submit")},name:document.querySelector(section.edit.text+"#edit_name"),"class":document.querySelector(section.edit.text+"#edit_class"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastkeywords_edit="",found_edit=[],searchindex_edit=0;2<=pageManager.vars.length&&/^(u|m)\d+$/.test(pageManager.vars[1])&&(console.log("bla"),prefix=pageManager.vars[1][0],cluster=pageManager.vars[1].slice(1),request={path:"clusterDefault/getById",id_cluster:cluster,"class":"u"==prefix?
0:1},api.send(request,function(a){0==a.ModuleError&&(found_edit=[a.cluster],searchindex_edit=0,autofill_edit())}));section.edit.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.keyword.value)if(section.edit.input.search.keyword.value==lastkeywords_edit)searchindex_edit=(searchindex_edit+1)%found_edit.length,autofill_edit();else{var b={path:"clusterDefault/search",keywords:section.edit.input.search.keyword.value};api.send(b,function(a){0==
a.ModuleError&&(section.edit.input.search.submit.anim("active",1E3),searchindex_edit=0,found_edit=a.clusters,section.edit.input.search.sum.innerHTML=found_edit.length,autofill_edit());lastkeywords_edit=b.keywords})}},!1);section.edit.input.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.id.value){var b=found_edit[searchindex_edit].hasOwnProperty("id_user_cluster")?0:1,d={path:"clusterDefault/edit",id_cluster:section.edit.input.search.id.value,name:section.edit.input.name.value,
"class":b};api.send(d,function(a){0==a.ModuleError&&1==a.status?(console.log("Groupe modifiee!"),section.edit.input.submit.anim("active",1500),pageManager.vars[1]=(0==b?"u":"m")+d.id_cluster,navSubMenu("view"),document.location=""):console.error("ModuleError::"+a.ModuleError)})}},!1)}
"#edit_search_submit")},name:document.querySelector(section.edit.text+"#edit_name"),"class":document.querySelector(section.edit.text+"#edit_class"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastkeywords_edit="",found_edit=[],searchindex_edit=0;2<=pageManager.vars.length&&/^(u|m)\d+$/.test(pageManager.vars[1])&&(prefix=pageManager.vars[1][0],cluster=pageManager.vars[1].slice(1),request={path:"clusterDefault/getById",id_cluster:cluster,"class":"u"==prefix?0:1},api.send(request,
function(a){0==a.ModuleError&&(found_edit=[a.cluster],searchindex_edit=0,autofill_edit())}));section.edit.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.keyword.value)if(section.edit.input.search.keyword.value==lastkeywords_edit)searchindex_edit=(searchindex_edit+1)%found_edit.length,autofill_edit();else{var b={path:"clusterDefault/search",keywords:section.edit.input.search.keyword.value};api.send(b,function(a){0==a.ModuleError&&(section.edit.input.search.submit.anim("active",
1E3),searchindex_edit=0,found_edit=a.clusters,section.edit.input.search.sum.innerHTML=found_edit.length,autofill_edit());lastkeywords_edit=b.keywords})}},!1);section.edit.input.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.id.value){var b=found_edit[searchindex_edit].hasOwnProperty("id_user_cluster")?0:1,d={path:"clusterDefault/edit",id_cluster:section.edit.input.search.id.value,name:section.edit.input.name.value,"class":b};api.send(d,function(a){0==
a.ModuleError&&1==a.status?(console.log("Groupe modifiee!"),section.edit.input.submit.anim("active",1500),pageManager.vars[1]=(0==b?"u":"m")+d.id_cluster,navSubMenu("view"),document.location=""):console.error("ModuleError::"+a.ModuleError)})}},!1)}
null!=section.members.element&&null!=section.members.chooser.element&&(section.members.chooser.deflater=new FormDeflater(section.members.chooser.element,["select"],["data-name"]),section.members.chooser.submit=document.querySelector(section.members.chooser.text+"#choose-cluster"),section.members.chooser.submit.addEventListener("click",function(a){a.preventDefault();a=section.members.chooser.deflater.deflate().cluster;/^(u|m)\d+$/.test(a)&&(pageManager.vars[1]=a,pageManager.refresh(),document.location=
"")},!1));
null!=section.members.element&&null==section.members.chooser.element&&(2<=pageManager.vars.length&&/^(u|m)\d+$/.test(pageManager.vars[1]),section.members.deflater=new FormDeflater(section.members.element,["input"],["data-name"]),section.members.baseData=section.members.deflater.deflate().members,section.members["class"]=document.querySelector("#members-member-class").value,section.members.idcluster=document.querySelector("#members-member-idcluster").value,section.members.element.addEventListener("click",function(a){var b=
[],d=[],c=section.members.deflater.deflate().members;c instanceof Array||(c=[c]);for(a=0;a<c.length;a++)-1==section.members.baseData.indexOf(c[a])&&b.push(c[a]);for(a=0;a<section.members.baseData.length;a++)-1==c.indexOf(section.members.baseData[a])&&d.push(section.members.baseData[a]);for(a=0;a<b.length;a++){var e={};e.path=0==section.members["class"]?"userDefault/link":"machineDefault/link";e.id_cluster=section.members.idcluster;0==section.members["class"]?e.id_user=b[a]:e.id_machine=b[a];api.send(e,
function(a){0!=a.ModuleError&&console.error("Erreur d'ajout de membre")})}for(a=0;a<d.length;a++)b={},b.path=0==section.members["class"]?"userDefault/unlink":"machineDefault/unlink",b.id_cluster=section.members.idcluster,0==section.members["class"]?b.id_user=d[a]:b.id_machine=d[a],api.send(b,function(a){0!=a.ModuleError&&console.error("Erreur d'ajout de membre")});section.members.baseData=c},!1));
null!=section.members.element&&null==section.members.chooser.element&&(section.members.deflater=new FormDeflater(section.members.element,["input"],["data-name"]),section.members.baseData=section.members.deflater.deflate().members,section.members["class"]=document.querySelector("#members-member-class").value,section.members.idcluster=document.querySelector("#members-member-idcluster").value,section.members.element.addEventListener("click",function(a){var b=[],d=[],c=section.members.deflater.deflate().members;c instanceof
Array||(c=[c]);for(a=0;a<c.length;a++)-1==section.members.baseData.indexOf(c[a])&&b.push(c[a]);for(a=0;a<section.members.baseData.length;a++)-1==c.indexOf(section.members.baseData[a])&&d.push(section.members.baseData[a]);for(a=0;a<b.length;a++){var e={};e.path=0==section.members["class"]?"userDefault/link":"machineDefault/link";e.id_cluster=section.members.idcluster;0==section.members["class"]?e.id_user=b[a]:e.id_machine=b[a];api.send(e,function(a){0!=a.ModuleError&&console.error("Erreur d'ajout de membre")})}for(a=
0;a<d.length;a++)b={},b.path=0==section.members["class"]?"userDefault/unlink":"machineDefault/unlink",b.id_cluster=section.members.idcluster,0==section.members["class"]?b.id_user=d[a]:b.id_machine=d[a],api.send(b,function(a){0!=a.ModuleError&&console.error("Erreur d'ajout de membre")});section.members.baseData=c},!1));

View File

@ -546,7 +546,6 @@ if( section.edit.element != null ){
// Gestion automatique au chargement de la page si ID_CLUSTER dans url "/users/edit/:id_cluster:"
if( pageManager.vars.length >= 2 && /^(u|m)\d+$/.test(pageManager.vars[1]) ){
console.log('bla');
var prefix = pageManager.vars[1][0];
var cluster = pageManager.vars[1].slice(1);
@ -746,12 +745,6 @@ if( section.members.element != null && section.members.chooser.element != null )
if( section.members.element != null && section.members.chooser.element == null ){
// Gestion automatique au chargement de la page si ID_CLUSTER dans url "/users/remove/:id_cluster:"
if( pageManager.vars.length >= 2 && /^(u|m)\d+$/.test(pageManager.vars[1]) ){
}
/* (1) On initialise le Deflater() */
section.members.deflater = new FormDeflater(
section.members.element,

View File

@ -1,7 +1,7 @@
var section={view:{text:'#CONTAINER > section[data-sublink="view"] ',element:document.querySelector('#CONTAINER > section[data-sublink="view"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="view"] > .searchbar')},create:{text:'#CONTAINER > section[data-sublink="create"] ',element:document.querySelector('#CONTAINER > section[data-sublink="create"]')},remove:{text:'#CONTAINER > section[data-sublink="remove"] ',element:document.querySelector('#CONTAINER > section[data-sublink="remove"]')},
edit:{text:'#CONTAINER > section[data-sublink="edit"] ',element:document.querySelector('#CONTAINER > section[data-sublink="edit"]')}};
edit:{text:'#CONTAINER > section[data-sublink="edit"] ',element:document.querySelector('#CONTAINER > section[data-sublink="edit"]')},groups:{text:'#CONTAINER > section[data-sublink="groups"] ',element:document.querySelector('#CONTAINER > section[data-sublink="groups"]'),searchbar:document.querySelector('#CONTAINER > section[data-sublink="groups"] > .searchbar')}};
if(null!=section.view.element){1<pageManager.vars.length&&!isNaN(pageManager.vars[1])&&(document.location="#"+pageManager.vars[1],document.getElementById(pageManager.vars[1]).addClass("selected"));section.view.link={edit:document.querySelectorAll(section.view.text+".link_edit[data-machine]"),remove:document.querySelectorAll(section.view.text+".link_remove[data-machine]")};section.view.group={rem:document.querySelectorAll(section.view.text+".rem-group[data-machine][data-group]"),add:document.querySelectorAll(section.view.text+
".add-group[data-machine]")};section.view.searchbar.addEventListener("keyup",function(a){api.send({path:"machineDefault/search",keywords:section.view.searchbar.value},function(b){if(0==b.ModuleError){for(var a=[],c=0;c<b.machines.length;c++)a.push(b.machines[c].id_machine);b=document.querySelectorAll(section.view.text+"> article.inline-box[id]");for(c=0;c<b.length;c++)-1<a.indexOf(b[c].id)?b[c].remClass("hidden"):b[c].addClass("hidden")}})},!1);for(var i=0;i<section.view.link.edit.length;i++)section.view.link.edit[i].addEventListener("click",
".add-group[data-machine]")};section.view.searchbar.addEventListener("keyup",function(a){api.send({path:"machineDefault/search",keywords:section.view.searchbar.value},function(a){if(0==a.ModuleError){for(var d=[],c=0;c<a.machines.length;c++)d.push(a.machines[c].id_machine);a=document.querySelectorAll(section.view.text+"> article.inline-box[id]");for(c=0;c<a.length;c++)-1<d.indexOf(a[c].id)?a[c].remClass("hidden"):a[c].addClass("hidden")}})},!1);for(var i=0;i<section.view.link.edit.length;i++)section.view.link.edit[i].addEventListener("click",
function(a){pageManager.vars[1]=a.target.getData("machine");navSubMenu("edit");document.location=""},!1);for(i=0;i<section.view.link.remove.length;i++)section.view.link.remove[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("machine");navSubMenu("remove");document.location=""},!1);for(i=0;i<section.view.group.rem.length;i++)section.view.group.rem[i].addEventListener("click",function(a){var b={path:"machineDefault/unlink",id_machine:a.target.getData("machine"),id_cluster:a.target.getData("group")};
api.send(b,function(b){if(0!=b.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1)}
null!=section.create.element&&(section.create.input={name:document.querySelector(section.create.text+"#create_name"),submit:document.querySelector(section.create.text+"#create_submit")},section.create.input.submit.addEventListener("click",function(a){a.preventDefault();api.send({path:"machineDefault/create",name:section.create.input.name.value},function(a){0==a.ModuleError&&(console.log("Machine cree!"),pageManager.vars=["view",a.id_machine],pageManager.refresh(),document.location="",section.create.input.submit.anim("active",
@ -15,4 +15,8 @@ if(null!=section.edit.element){var autofill_edit=function(){var a="",b="",d=!0;n
num:document.querySelector(section.edit.text+".edit_search_num"),sum:document.querySelector(section.edit.text+".edit_search_sum"),keyword:document.querySelector(section.edit.text+"#edit_search_keyword"),id:document.querySelector(section.edit.text+"#edit_search_id"),submit:document.querySelector(section.edit.text+"#edit_search_submit")},name:document.querySelector(section.edit.text+"#edit_name"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastkeywords_edit="",found_edit=[],
searchindex_edit=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&api.send({path:"machineDefault/getById",id_machine:pageManager.vars[1]},function(a){0==a.ModuleError&&(found_edit=[a.machine],searchindex_edit=0,autofill_edit())});section.edit.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.keyword.value)if(section.edit.input.search.keyword.value==lastkeywords_edit)searchindex_edit=(searchindex_edit+1)%found_edit.length,autofill_edit();
else{var b={path:"machineDefault/search",keywords:section.edit.input.search.keyword.value};api.send(b,function(a){0==a.ModuleError&&(section.edit.input.search.submit.anim("active",1E3),searchindex_edit=0,found_edit=a.machines,section.edit.input.search.sum.innerHTML=found_edit.length,autofill_edit());lastkeywords_edit=b.keywords})}},!1);section.edit.input.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.id.value){var b={path:"machineDefault/edit",id_machine:section.edit.input.search.id.value,
name:section.edit.input.name.value};api.send(b,function(a){0==a.ModuleError&&1==a.status?(console.log("Machine modifiee!"),section.edit.input.submit.anim("active",1500),pageManager.vars[1]=b.id_machine,navSubMenu("view"),document.location=""):console.error("ModuleError::"+a.ModuleError)})}},!1)};
name:section.edit.input.name.value};api.send(b,function(a){0==a.ModuleError&&1==a.status?(console.log("Machine modifiee!"),section.edit.input.submit.anim("active",1500),pageManager.vars[1]=b.id_machine,navSubMenu("view"),document.location=""):console.error("ModuleError::"+a.ModuleError)})}},!1)}
if(null!=section.groups.element){section.groups.link={remove:document.querySelectorAll(section.groups.text+".link_remove[data-cluster]"),edit:document.querySelectorAll(section.groups.text+".link_edit[data-cluster]")};section.groups.group={rem:document.querySelectorAll(section.groups.text+".rem-member[data-cluster][data-member]"),add:document.querySelectorAll(section.groups.text+".add-member[data-cluster]")};section.groups.searchbar.addEventListener("keyup",function(a){api.send({path:"clusterDefault/search",
keywords:section.groups.searchbar.value,"class":1},function(a){if(0==a.ModuleError){for(var d=[],c=0;c<a.clusters.length;c++)d.push(a.clusters[c].id_machine_cluster);a=document.querySelectorAll(section.groups.text+"> article.inline-box[id]");for(c=0;c<a.length;c++)-1<d.indexOf(a[c].id)?a[c].remClass("hidden"):a[c].addClass("hidden")}})},!1);for(i=0;i<section.groups.link.edit.length;i++)section.groups.link.edit[i].addEventListener("click",function(a){pageManager.vars[0]="edit";pageManager.vars[1]=
"m"+a.target.getData("cluster");navMenu("groups",!0)},!1);for(i=0;i<section.groups.link.remove.length;i++)section.groups.link.remove[i].addEventListener("click",function(a){pageManager.vars[0]="remove";pageManager.vars[1]="m"+a.target.getData("cluster");navMenu("groups",!0)},!1);for(i=0;i<section.groups.group.rem.length;i++)section.groups.group.rem[i].addEventListener("click",function(a){var b={path:"machineDefault/unlink",id_cluster:a.target.getData("cluster"),id_machine:a.target.getData("member")};
api.send(b,function(b){if(0!=b.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1);for(i=0;i<section.groups.group.add.length;i++)section.groups.group.add[i].addEventListener("click",function(a){pageManager.vars[0]="members";pageManager.vars[1]="m"+a.target.getData("cluster");navMenu("groups",!0)},!1)};

View File

@ -19,6 +19,12 @@ var section = {
edit: {
text: '#CONTAINER > section[data-sublink="edit"] ',
element: document.querySelector('#CONTAINER > section[data-sublink="edit"]')
},
groups: {
text: '#CONTAINER > section[data-sublink="groups"] ',
element: document.querySelector('#CONTAINER > section[data-sublink="groups"]'),
searchbar: document.querySelector('#CONTAINER > section[data-sublink="groups"] > .searchbar')
}
};
@ -584,3 +590,136 @@ if( section.edit.element != null ){
}
/* [5] groups -> Groupes de machines
=========================================================*/
if( section.groups.element != null ){
/* (1) On recupere tous les liens vers des sous-sections */
section.groups.link = {
remove: document.querySelectorAll(section.groups.text + '.link_remove[data-cluster]'),
edit: document.querySelectorAll(section.groups.text + '.link_edit[data-cluster]')
};
/* (2) On récupère toutes les actions de groupes */
section.groups.group = {
rem: document.querySelectorAll(section.groups.text + '.rem-member[data-cluster][data-member]'),
add: document.querySelectorAll(section.groups.text + '.add-member[data-cluster]')
};
/* (3) Gestion de la recherche instantannee */
section.groups.searchbar.addEventListener('keyup', function(e){
var search = {
path: 'clusterDefault/search',
keywords: section.groups.searchbar.value,
class: 1
};
// On envoie la requete
api.send(search, function(result){
if( result.ModuleError == 0 ){ // si aucune erreur
// On enregistre tous les UID dans un tableau
var uid_list = [];
for( var i = 0 ; i < result.clusters.length ; i++ )
uid_list.push( result.clusters[i].id_machine_cluster);
// On recupere la liste des elements correspondants aux utilisateurs
var cluster_list = document.querySelectorAll(section.groups.text + '> article.inline-box[id]');
// Pour chaque cluster
for( var i = 0 ; i < cluster_list.length ; i++ ){
// Si doit etre visible
if( uid_list.indexOf(cluster_list[i].id) > -1 )
cluster_list[i].remClass('hidden');
// Si ne doit pas etre visible
else
cluster_list[i].addClass('hidden');
}
}
});
}, false);
var i;
/* (4) On gere la "redirection" vers la modification */
for( i = 0 ; i < section.groups.link.edit.length ; i++ ){
section.groups.link.edit[i].addEventListener('click', function(e){
pageManager.vars[0] = 'edit';
pageManager.vars[1] = 'm'+e.target.getData('cluster');
navMenu('groups', true);
}, false);
}
/* (5) On gere la "redirection" vers la suppression */
for( i = 0 ; i < section.groups.link.remove.length ; i++ ){
section.groups.link.remove[i].addEventListener('click', function(e){
pageManager.vars[0] = 'remove';
pageManager.vars[1] = 'm'+e.target.getData('cluster');
navMenu('groups', true);
}, false);
}
/* (6) On gere la "suppression" d'un groupe */
for( i = 0 ; i < section.groups.group.rem.length ; i++ ){
section.groups.group.rem[i].addEventListener('click', function(e){
// {1} On rédige la requête //
var request = {
path: 'machineDefault/unlink',
id_cluster: e.target.getData('cluster'),
id_machine: e.target.getData('member')
};
// {2} On envoie la requête //
api.send(request, function(response){
// {3} Si erreur, on ne fait rien //
if( response.ModuleError != 0 )
return false;
// {4} Si tout s'est bien passé //
e.target.parentNode.parentNode.removeChild( e.target.parentNode );
});
}, false);
}
/* (7) On gere la "modification" des membres d'un groupe */
for( i = 0 ; i < section.groups.group.add.length ; i++ ){
section.groups.group.add[i].addEventListener('click', function(e){
pageManager.vars[0] = 'members';
pageManager.vars[1] = 'm'+e.target.getData('cluster');
navMenu('groups', true);
}, false);
}
}

View File

@ -19,6 +19,7 @@ id:document.querySelector(section.edit.text+"#edit_search_id"),submit:document.q
(searchindex_edit+1)%found_edit.length,autofill_edit();else{var c={path:"userDefault/search",keywords:section.edit.input.search.keyword.value};api.send(c,function(a){0==a.ModuleError&&(section.edit.input.search.submit.anim("active",1E3),searchindex_edit=0,found_edit=a.users,section.edit.input.search.sum.innerHTML=found_edit.length,autofill_edit());lastkeywords_edit=c.keywords})}},!1);section.edit.input.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.id.value){var c=
{path:"userDefault/edit",id_user:parseInt(section.edit.input.search.id.value),code:section.edit.input.code.value,username:section.edit.input.username.value,firstname:section.edit.input.firstname.value,lastname:section.edit.input.lastname.value,mail:section.edit.input.mail.value};api.send(c,function(a){console.log(a);0==a.ModuleError&&1==a.status?(console.log("Utilisateur modifie!"),section.edit.input.submit.anim("active",1500),pageManager.vars[1]=c.id_user,navSubMenu("view"),document.location=""):
console.error("ModuleError::"+a.ModuleError)})}},!1)}
if(null!=section.groups.element){section.groups.link={remove:document.querySelectorAll(section.groups.text+".link_remove[data-cluster]")};section.groups.group={rem:document.querySelectorAll(section.groups.text+".rem-member[data-cluster][data-member]"),add:document.querySelectorAll(section.groups.text+".add-member[data-cluster]")};section.groups.searchbar.addEventListener("keyup",function(a){api.send({path:"clusterDefault/search",keywords:section.groups.searchbar.value,"class":0},function(a){if(0==
a.ModuleError){for(var d=[],b=0;b<a.clusters.length;b++)d.push(a.clusters[b].id_cluster);a=document.querySelectorAll(section.groups.text+"> article.inline-box[id]");for(b=0;b<a.length;b++)-1<d.indexOf(a[b].id)?a[b].remClass("hidden"):a[b].addClass("hidden")}})},!1);for(i=0;i<section.groups.link.remove.length;i++)section.groups.link.remove[i].addEventListener("click",function(a){navMenu("groups","remove");pageManager.vars[1]="u"+a.target.getData("cluster")},!1);for(i=0;i<section.groups.group.rem.length;i++)section.groups.group.rem[i].addEventListener("click",
function(a){var c={path:"userDefault/unlink",id_cluster:a.target.getData("cluster"),id_user:a.target.getData("member")};api.send(c,function(c){if(0!=c.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1);for(i=0;i<section.groups.group.add.length;i++)section.groups.group.add[i].addEventListener("click",function(a){pageManager.vars[0]="members";pageManager.vars[1]="u"+a.target.getData("cluster");navMenu("groups",!0)},!1)};
if(null!=section.groups.element){section.groups.link={remove:document.querySelectorAll(section.groups.text+".link_remove[data-cluster]"),edit:document.querySelectorAll(section.groups.text+".link_edit[data-cluster]")};section.groups.group={rem:document.querySelectorAll(section.groups.text+".rem-member[data-cluster][data-member]"),add:document.querySelectorAll(section.groups.text+".add-member[data-cluster]")};section.groups.searchbar.addEventListener("keyup",function(a){api.send({path:"clusterDefault/search",
keywords:section.groups.searchbar.value,"class":0},function(a){if(0==a.ModuleError){for(var d=[],b=0;b<a.clusters.length;b++)d.push(a.clusters[b].id_user_cluster);a=document.querySelectorAll(section.groups.text+"> article.inline-box[id]");for(b=0;b<a.length;b++)-1<d.indexOf(a[b].id)?a[b].remClass("hidden"):a[b].addClass("hidden")}})},!1);for(i=0;i<section.groups.link.edit.length;i++)section.groups.link.edit[i].addEventListener("click",function(a){pageManager.vars[0]="edit";pageManager.vars[1]="u"+
a.target.getData("cluster");navMenu("groups",!0)},!1);for(i=0;i<section.groups.link.remove.length;i++)section.groups.link.remove[i].addEventListener("click",function(a){pageManager.vars[0]="remove";pageManager.vars[1]="u"+a.target.getData("cluster");navMenu("groups",!0)},!1);for(i=0;i<section.groups.group.rem.length;i++)section.groups.group.rem[i].addEventListener("click",function(a){var c={path:"userDefault/unlink",id_cluster:a.target.getData("cluster"),id_user:a.target.getData("member")};api.send(c,
function(c){if(0!=c.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1);for(i=0;i<section.groups.group.add.length;i++)section.groups.group.add[i].addEventListener("click",function(a){pageManager.vars[0]="members";pageManager.vars[1]="u"+a.target.getData("cluster");navMenu("groups",!0)},!1)};

View File

@ -648,7 +648,8 @@ if( section.groups.element != null ){
/* (1) On recupere tous les liens vers des sous-sections */
section.groups.link = {
remove: document.querySelectorAll(section.groups.text + '.link_remove[data-cluster]')
remove: document.querySelectorAll(section.groups.text + '.link_remove[data-cluster]'),
edit: document.querySelectorAll(section.groups.text + '.link_edit[data-cluster]')
};
/* (2) On récupère toutes les actions de groupes */
@ -674,7 +675,7 @@ if( section.groups.element != null ){
// On enregistre tous les UID dans un tableau
var uid_list = [];
for( var i = 0 ; i < result.clusters.length ; i++ )
uid_list.push( result.clusters[i].id_cluster);
uid_list.push( result.clusters[i].id_user_cluster);
// On recupere la liste des elements correspondants aux utilisateurs
var cluster_list = document.querySelectorAll(section.groups.text + '> article.inline-box[id]');
@ -697,22 +698,23 @@ if( section.groups.element != null ){
/* (4) On gere la "redirection" vers la modification */
// for( i = 0 ; i < section.groups.link.edit.length ; i++ ){
//
// section.groups.link.edit[i].addEventListener('click', function(e){
// pageManager.vars[1] = e.target.getData('cluster');
// navSubMenu('edit');
// document.location = '';
// }, false);
//
// }
for( i = 0 ; i < section.groups.link.edit.length ; i++ ){
section.groups.link.edit[i].addEventListener('click', function(e){
pageManager.vars[0] = 'edit';
pageManager.vars[1] = 'u'+e.target.getData('cluster');
navMenu('groups', true);
}, false);
}
/* (5) On gere la "redirection" vers la suppression */
for( i = 0 ; i < section.groups.link.remove.length ; i++ ){
section.groups.link.remove[i].addEventListener('click', function(e){
navMenu('groups', 'remove');
pageManager.vars[0] = 'remove';
pageManager.vars[1] = 'u'+e.target.getData('cluster');
navMenu('groups', true);
}, false);
}