Correction de la recherche dynamique (cache/affiche les éléments du DOM) car indexOf(value) était en STRING et non en INT + Repository 'user_cluster' entièrement géré par l'ORM

This commit is contained in:
xdrm-brackets 2016-07-23 17:34:24 +02:00
parent 0dc67f1fc7
commit 19a1626a38
11 changed files with 201 additions and 212 deletions

View File

@ -698,6 +698,7 @@
* *
* @return data<Array> Tableau contenant les champs sélectionnés * @return data<Array> Tableau contenant les champs sélectionnés
* @return data<mixed> Valeur du champ sélectionné (si 1 seul champ) * @return data<mixed> Valeur du champ sélectionné (si 1 seul champ)
* @return ERROR<FALSE> Retourne FALSE si rien n'est trouvé
* *
*/ */
public function fetch($unique=null){ public function fetch($unique=null){

View File

@ -263,8 +263,7 @@
=========================================================*/ =========================================================*/
$machine = Table::get('machine') $machine = Table::get('machine')
->whereIdWarehouse($id_warehouse) ->whereIdWarehouse($id_warehouse)
->select(['id_machine', 'name']) ->select(['id_machine', 'name']);
->unique();
return $machine->fetch(); return $machine->fetch();
} }

View File

@ -4,6 +4,8 @@
use \manager\Database; use \manager\Database;
use \manager\ManagerError; use \manager\ManagerError;
use \manager\Repo; use \manager\Repo;
use \manager\ORM\Table;
use \manager\ORM\Rows;
class machine_cluster extends parentRepo{ class machine_cluster extends parentRepo{
@ -363,16 +365,16 @@
* *
*/ */
public static function search($id_warehouse, $keyword){ public static function search($id_warehouse, $keyword){
// On recupere les donnees /* [1] On rédige/exécute la requête
$searchmachine_clusters = Database::getPDO()->prepare("SELECT * FROM machine_cluster =========================================================*/
WHERE id_warehouse = :id_warehouse $search = Table::get('machine_cluster')
AND name LIKE '%".$keyword."%'"); ->whereIdWarehouse($id_warehouse)
->whereName(["%$keyword%", Rows::COND_LIKE])
->select('*');
$searchmachine_clusters->execute([ /* [2] On retourne le résultat
':id_warehouse' => $id_warehouse =========================================================*/
]); return $search->fetch();
return Database::delNumeric( $searchmachine_clusters->fetchAll() );
} }

View File

@ -4,6 +4,8 @@
use \manager\Database; use \manager\Database;
use \manager\ManagerError; use \manager\ManagerError;
use \manager\Repo; use \manager\Repo;
use \manager\ORM\Table;
use \manager\ORM\Rows;
class user_cluster extends parentRepo{ class user_cluster extends parentRepo{
@ -21,23 +23,19 @@
public static function create($id_warehouse, $name){ public static function create($id_warehouse, $name){
/* [1] Verification de l'unicite de name /* [1] Verification de l'unicite de name
=========================================================*/ =========================================================*/
$check_unique = ( self::getByName($id_warehouse, $name) === false ); $inserted = Table::get('user_cluster')
->insert([
'id_user_cluster' => Rows::DEFAULT,
'id_warehouse' => $id_warehouse,
'name' => $name
]);
// Si un groupe a deja ce nom, on renvoie une erreur // Si erreur (car name doit être unique)
if( !$check_unique ) if( !$inserted )
return false; return false;
/* [2] Creation du groupe /* [2] On retourne l'id_group ou FALSE si erreur
=========================================================*/
$insert_user = Database::getPDO()->prepare("INSERT INTO user_cluster(id_user_cluster, id_warehouse, name)
VALUES(DEFAULT, :id_warehouse, :name)");
$insert_user->execute([
':id_warehouse' => $id_warehouse,
':name' => $name
]);
/* [3] On retourne l'id_group ou FALSE si erreur
=========================================================*/ =========================================================*/
$check_group = self::getByName($id_warehouse, $name); $check_group = self::getByName($id_warehouse, $name);
@ -66,57 +64,66 @@
* *
*/ */
public static function link($id_warehouse, $id_user_cluster, $id_user){ public static function link($id_warehouse, $id_user_cluster, $id_user){
/* [1] Verification de l'existence du groupe /* [1] On vérifie que tout existe
=========================================================*/ =========================================================*/
$group_check = self::getById($id_warehouse, $id_user_cluster); /* (1) On récupère le groupe */
$clusterR = Table::get('user_cluster')
->whereIdWarehouse($id_warehouse)
->whereId($id_user_cluster)
->unique()
->select('id_user_cluster');
$cluster = $clusterR->fetch();
// Si le groupe n'existe pas, on retourne ue erreur // Si le groupe n'existe pas
if( $group_check === false ) if( $cluster === false )
return ManagerError::NoMatchFound; return ManagerError::NoMatchFound;
/* (2) On récupère l'utilisateur */
$userR = Table::get('user')
->whereIdWarehouse($id_warehouse)
->whereId($id_user)
->unique()
->select('id_user');
$user = $userR->fetch();
// Si l'utilisateur n'existe pas
/* [2] Verification de l'existente de l'utilisateur if( $user === false )
=========================================================*/
$user_checkReq = new Repo('user/getById', [$id_warehouse, $id_user]);
$user_check = $user_checkReq->answer();
// Si aucune user existante, on retourne une erreur
if( $user_check === false )
return ManagerError::NoMatchFound; return ManagerError::NoMatchFound;
/* (3) On vérifie qu'il n'y a pas déja d'appartenance */
$cluster_mergeR = Table::get('user_cluster_merge')
->select('id_user_cluster_merge')
->join('id_user_cluster', $clusterR)
->join('id_user', $userR)
->unique();
$cluster_merge_exists = $cluster_mergeR->fetch();
/* [3] Verification que l'existente n'existe pas deja // Si la relation existe déja, on ne fait rien
=========================================================*/ if( $cluster_merge_exists !== false )
$already_user_cluster_merge = self::getMerge($id_warehouse, $id_user_cluster, $id_user);
// Si l'association existe deja, on ne la cree donc pas
if( $already_user_cluster_merge !== false )
return ManagerError::Success; return ManagerError::Success;
/* [4] On cree l'association
/* [2] On crée la relation
=========================================================*/ =========================================================*/
$link_entity = Database::getPDO()->prepare("INSERT INTO user_cluster_merge(id_user_cluster_merge, id_user_cluster, id_user) /* (1) On insère la relation */
VALUES(DEFAULT, :id_user_cluster, :id_user)"); $inserted = Table::get('user_cluster_merge')
$link_entity->execute([ ->insert([
':id_user_cluster' => $id_user_cluster, 'id_user_cluster_merge' => Rows::DEFAULT,
':id_user' => $id_user 'id_user_cluster' => $id_user_cluster,
'id_user' => $id_user
]); ]);
/* [5] On retourne l'id_user_cluster_merge ou FALSE si erreur
=========================================================*/
$check_user_cluster_merge = self::getMerge($id_warehouse, $id_user_cluster, $id_user);
// Si n'existe pas on retourne FALSE /* (2) Si erreur, on la retourne */
if( !is_array($check_user_cluster_merge) ) if( !$inserted )
return ManagerError::RepoError; return ManagerError::RepoError;
// Sinon, on retourne son id /* (3) On vérifie quand même que l'entrée existe */
return ManagerError::Success; $cluster_merge_inserted = $cluster_mergeR->fetch();
/* (4) Sinon, on renvoie que tout s'est bien passé */
return is_array($cluster_merge_inserted) ? ManagerError::Success : ManagerError::RepoError;
} }
@ -148,12 +155,13 @@
/* [2] On supprime le lien /* [2] On supprime le lien
=========================================================*/ =========================================================*/
$delete_user_cluster_merge = Database::getPDO()->prepare("DELETE FROM user_cluster_merge $deleted = Table::get('user_cluster_merge')
WHERE id_user_cluster_merge = :uid"); ->whereId($get_merge_id['id_user_cluster_merge'])
$delete_user_cluster_merge->execute([ ->delete();
':uid' => $get_merge_id['id_user_cluster_merge']
]);
// Si erreur
if( !$deleted )
return ManagerError::RepoError;
/* [2] On verifie que l'association n'existe plus /* [2] On verifie que l'association n'existe plus
=========================================================*/ =========================================================*/
@ -181,30 +189,19 @@
* *
*/ */
public static function getMerge($id_warehouse, $id_user_cluster, $id_user){ public static function getMerge($id_warehouse, $id_user_cluster, $id_user){
// On ecrit la requete /* [1] On rédige/exécute la requête
$request = Database::getPDO()->prepare("SELECT cm.* =========================================================*/
FROM user_cluster_merge as cm, user_cluster as c $cluster_merge = Table::get('user_cluster_merge')
WHERE cm.id_user_cluster = c.id_user_cluster ->whereIdWarehouse($id_warehouse)
AND c.id_warehouse = :id_warehouse ->whereIdUserCluster($id_user_cluster)
AND cm.id_user_cluster = :id_user_cluster ->whereIdUser($id_user)
AND cm.id_user = :id_user"); ->select('*')
->unique()
->fetch();
// On execute la requete /* [2] On retourne le résultat (FALSE si rien trouvé)
$request->execute([ =========================================================*/
':id_warehouse' => $id_warehouse, return $cluster_merge;
':id_user_cluster' => $id_user_cluster,
':id_user' => $id_user
]);
// On recupere 1 seule relation
$answer = $request->fetch();
// Gestion d'erreur -> aucun resultat
if( $answer === false )
return false;
// On retourne en supprimant les indices numeriques
return Database::delNumeric( $answer, true );
} }
@ -222,19 +219,17 @@
* *
*/ */
public static function getAll($id_warehouse){ public static function getAll($id_warehouse){
// On ecrit la requete /* [1] On rédige/exécute la requête
$request = Database::getPDO()->prepare("SELECT c.id_user_cluster, c.name =========================================================*/
FROM user_cluster as c $user_clusters = Table::get('user_cluster')
WHERE c.id_warehouse = :id_warehouse ->whereIdWarehouse($id_warehouse)
ORDER BY c.name ASC"); ->select('*');
// On execute la requete //TODO: ORDER BY c.name ASC
$request->execute([
':id_warehouse' => $id_warehouse
]);
// On retourne en supprimant les indices numeriques /* [2] On retourne le résultat
return Database::delNumeric( $request->fetchAll() ); =========================================================*/
return $user_clusters->fetch();
} }
@ -253,26 +248,17 @@
* *
*/ */
public static function getById($id_warehouse, $id){ public static function getById($id_warehouse, $id){
// On ecrit la requete /* [1] On rédige/exécute la requête
$request = Database::getPDO()->prepare("SELECT c.* =========================================================*/
FROM user_cluster as c $user_cluster = Table::get('user_cluster')
WHERE c.id_warehouse = :id_warehouse ->whereIdWarehouse($id_warehouse)
AND c.id_user_cluster = :id"); ->whereId($id)
->select('*')
->unique();
// On execute la requete /* [2] On retourne le résultat
$request->execute([ =========================================================*/
':id_warehouse' => $id_warehouse, return $user_cluster->fetch();
':id' => $id
]);
$fetch = $request->fetch();
// Si aucun résultat
if( $fetch == false )
return false;
// On retourne en supprimant les indices numeriques
return Database::delNumeric( $fetch, true );
} }
@ -291,26 +277,17 @@
* *
*/ */
public static function getByName($id_warehouse, $name){ public static function getByName($id_warehouse, $name){
// On ecrit la requete /* [1] On rédige/exécute la requête
$request = Database::getPDO()->prepare("SELECT c.* =========================================================*/
FROM user_cluster as c $user_cluster = Table::get('user_cluster')
WHERE c.id_warehouse = :id_warehouse ->whereIdWarehouse($id_warehouse)
AND c.name = :name"); ->whereName($name)
->select('*')
->unique();
// On execute la requete /* [2] On retourne le résultat
$request->execute([ =========================================================*/
':id_warehouse' => $id_warehouse, return $user_cluster->fetch();
':name' => $name
]);
$fetch = $request->fetch();
// Si aucun résultat
if( $fetch == false )
return false;
// On retourne en supprimant les indices numeriques
return Database::delNumeric( $fetch, true );
} }
@ -332,22 +309,20 @@
public static function getMembers($id_warehouse, $id_user_cluster){ public static function getMembers($id_warehouse, $id_user_cluster){
/* [1] On recupere la liste des associations /* [1] On recupere la liste des associations
=========================================================*/ =========================================================*/
$get_users = Database::getPDO()->prepare("SELECT u.* $user_cluster = Table::get('user_cluster')
FROM user_cluster_merge as cm, user_cluster as c, user as u ->whereIdWarehouse($id_warehouse)
WHERE cm.id_user_cluster = c.id_user_cluster ->whereId($id_user_cluster);
AND c.id_user_cluster = :id_user_cluster
AND c.id_warehouse = :id_warehouse $user = Table::get('user')->select('*');
AND cm.id_user = u.id_user
ORDER BY u.username"); $user_cluster_merge = Table::get('user_cluster_merge')
$get_users->execute([ ->join('id_user_cluster', $user_cluster)
':id_warehouse' => $id_warehouse, ->join('id_user', $user);
':id_user_cluster' => $id_user_cluster
]);
/* [2] On verifie que le groupe n'existe plus /* [2] On verifie que le groupe n'existe plus
=========================================================*/ =========================================================*/
return Database::delNumeric( $get_users->fetchAll() );; return $user_cluster_merge->fetch();
} }
@ -363,16 +338,16 @@
* *
*/ */
public static function search($id_warehouse, $keyword){ public static function search($id_warehouse, $keyword){
// On recupere les donnees /* [1] On rédige/exécute la requête
$searchuser_clusters = Database::getPDO()->prepare("SELECT * FROM user_cluster =========================================================*/
WHERE id_warehouse = :id_warehouse $search = Table::get('user_cluster')
AND name LIKE '%".$keyword."%'"); ->whereIdWarehouse($id_warehouse)
->whereName(["%$keyword%", Rows::COND_LIKE])
->select('*');
$searchuser_clusters->execute([ /* [2] On retourne le résultat
':id_warehouse' => $id_warehouse =========================================================*/
]); return $search->fetch();
return Database::delNumeric( $searchuser_clusters->fetchAll() );
} }
@ -390,17 +365,15 @@
* *
*/ */
public static function edit($id_warehouse, $id_user_cluster, $name){ public static function edit($id_warehouse, $id_user_cluster, $name){
/* [1] On rédige la requête /* [1] On redige/execute la requete
=========================================================*/ =========================================================*/
$edit_group = Database::getPDO()->prepare("UPDATE user_cluster $edited = Table::get('user_cluster')
SET name = :name ->whereIdWarehouse($id_warehouse)
WHERE id_user_cluster = :id_user_cluster"); ->whereId($id_user_cluster)
$edited = $edit_group->execute([ ->edit([ 'name' => $name ]);
':name' => $name,
':id_user_cluster' => $id_user_cluster
]);
/* [2] On retourne le résultat
=========================================================*/
return $edited; return $edited;
} }
@ -419,18 +392,14 @@
public static function delete($id_warehouse, $id_user_cluster){ public static function delete($id_warehouse, $id_user_cluster){
/* [1] On redige/execute la requete /* [1] On redige/execute la requete
=========================================================*/ =========================================================*/
$delete_group = Database::getPDO()->prepare("DELETE FROM user_cluster $deleted = Table::get('user_cluster')
WHERE id_warehouse = :id_warehouse ->whereIdWarehouse($id_warehouse)
AND id_user_cluster = :id_user_cluster"); ->whereId($id_user_cluster)
$delete_group->execute([ ->delete();
':id_warehouse' => $id_warehouse,
':id_user_cluster' => $id_user_cluster
]);
/* [2] On retourne le résultat
/* [2] On verifie que le groupe n'existe plus
=========================================================*/ =========================================================*/
return ( self::getById($id_warehouse, $id_user_cluster) === false ); return $deleted;
} }

View File

@ -427,23 +427,37 @@
// ->delete(); // ->delete();
$keyword = 'h%s'; $id_warehouse = 7;
$id_user_cluster = 2;
////////////////////////////
$searchmachines = Database::getPDO()->prepare("SELECT id_machine, name FROM machine $get_users = Database::getPDO()->prepare("SELECT u.*
WHERE id_warehouse = :id_warehouse FROM user_cluster_merge as cm, user_cluster as c, user as u
AND name LIKE '%".$keyword."%'"); WHERE cm.id_user_cluster = c.id_user_cluster
AND c.id_user_cluster = :id_user_cluster
$searchmachines->execute([ AND c.id_warehouse = :id_warehouse
':id_warehouse' => 7 AND cm.id_user = u.id_user");
$get_users->execute([
':id_warehouse' => $id_warehouse,
':id_user_cluster' => $id_user_cluster
]); ]);
var_dump($searchmachines->fetchAll());
/* [2] On verifie que le groupe n'existe plus
=========================================================*/
var_dump( count($get_users->fetchAll()) );
var_dump( Table::get('machine') $user_cluster = Table::get('user_cluster')
->whereIdWarehouse(7) ->whereIdWarehouse($id_warehouse)
->whereName(["%$keyword%", Rows::COND_LIKE]) ->whereId($id_user_cluster);
->select('id_machine')
->select('name')->fetch() ); $user = Table::get('user')->select('*');
$user_cluster_merge = Table::get('user_cluster_merge')
->join('id_user_cluster', $user_cluster)
->join('id_user', $user);
var_dump( count($user_cluster_merge->fetch()) );
?> ?>

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

@ -2,25 +2,26 @@ var section={view:{text:'#CONTAINER > section[data-sublink="view"] ',element:doc
edit:{text:'#CONTAINER > section[data-sublink="edit"] ',element:document.querySelector('#CONTAINER > section[data-sublink="edit"]')},members:{text:'#CONTAINER > section[data-sublink="members"] ',element:document.querySelector('#CONTAINER > section[data-sublink="members"]'),chooser:{text:'#CONTAINER > section[data-sublink="members"] form#choose-cluster ',element:document.querySelector('#CONTAINER > section[data-sublink="members"] form#choose-cluster')}},permissions:{text:'#CONTAINER > section[data-sublink="permissions"] ', edit:{text:'#CONTAINER > section[data-sublink="edit"] ',element:document.querySelector('#CONTAINER > section[data-sublink="edit"]')},members:{text:'#CONTAINER > section[data-sublink="members"] ',element:document.querySelector('#CONTAINER > section[data-sublink="members"]'),chooser:{text:'#CONTAINER > section[data-sublink="members"] form#choose-cluster ',element:document.querySelector('#CONTAINER > section[data-sublink="members"] form#choose-cluster')}},permissions:{text:'#CONTAINER > section[data-sublink="permissions"] ',
element:document.querySelector('#CONTAINER > section[data-sublink="permissions"]')}}; element:document.querySelector('#CONTAINER > section[data-sublink="permissions"]')}};
if(null!=section.view.element){1<pageManager.vars.length&&/^(u|m)\d+$/.test(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-cluster]"),remove:document.querySelectorAll(section.view.text+".link_remove[data-cluster]")};section.view.group={rem:document.querySelectorAll(section.view.text+".rem-member[data-cluster][data-member]"),add:document.querySelectorAll(section.view.text+ if(null!=section.view.element){1<pageManager.vars.length&&/^(u|m)\d+$/.test(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-cluster]"),remove:document.querySelectorAll(section.view.text+".link_remove[data-cluster]")};section.view.group={rem:document.querySelectorAll(section.view.text+".rem-member[data-cluster][data-member]"),add:document.querySelectorAll(section.view.text+
".add-member[data-cluster]")};section.view.searchbar.addEventListener("keyup",function(a){api.send({path:"clusterDefault/search",keywords:section.view.searchbar.value},function(a){if(0==a.ModuleError){for(var d=[],c=0;c<a.clusters.length;c++)d.push(a.clusters[c].id_cluster);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);var i;for(i=0;i<section.view.link.edit.length;i++)section.view.link.edit[i].addEventListener("click", ".add-member[data-cluster]")};section.view.searchbar.addEventListener("keyup",function(a){api.send({path:"clusterDefault/search",keywords:section.view.searchbar.value},function(a){if(0==a.ModuleError){for(var d=[],b=0;b<a.clusters.length;b++)a.clusters[b].hasOwnProperty("id_user_cluster")?d.push("u"+a.clusters[b].id_user_cluster):d.push("m"+a.clusters[b].id_machine_cluster);a=document.querySelectorAll(section.view.text+"> article.inline-box[id]");for(b=0;b<a.length;b++)-1<d.indexOf(a[b].id)?a[b].remClass("hidden"):
function(a){pageManager.vars[1]=a.target.getData("cluster");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("cluster");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=a.target.getData("cluster")[0],d=a.target.getData("cluster").slice(1);console.log(a.target); a[b].addClass("hidden")}})},!1);var i;for(i=0;i<section.view.link.edit.length;i++)section.view.link.edit[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("cluster");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("cluster");navSubMenu("remove");document.location=""},!1);for(i=0;i<section.view.group.rem.length;i++)section.view.group.rem[i].addEventListener("click",
var c={};c.path="u"==b?"userDefault/unlink":"machineDefault/unlink";c.id_cluster=d;"u"==b?c.id_user=a.target.getData("member"):c.id_machine=a.target.getData("member");api.send(c,function(b){if(0!=b.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1);for(i=0;i<section.view.group.add.length;i++)section.view.group.add[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("cluster");navSubMenu("members");document.location=""},!1)} function(a){var c=a.target.getData("cluster")[0],d=a.target.getData("cluster").slice(1);console.log(a.target);var b={};b.path="u"==c?"userDefault/unlink":"machineDefault/unlink";b.id_cluster=d;"u"==c?b.id_user=a.target.getData("member"):b.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.view.group.add.length;i++)section.view.group.add[i].addEventListener("click",function(a){pageManager.vars[1]=
null!=section.create.element&&(section.create.input={name:document.querySelector(section.create.text+"#create_name"),"class":document.querySelector(section.create.text+"#create_class"),submit:document.querySelector(section.create.text+"#create_submit")},section.create.input.submit.addEventListener("click",function(a){a.preventDefault();var b={path:"clusterDefault/create",name:section.create.input.name.value,"class":section.create.input["class"].value};api.send(b,function(a){0==a.ModuleError&&(console.log("Groupe cree!"), a.target.getData("cluster");navSubMenu("members");document.location=""},!1)}
pageManager.vars[1]=(0==b["class"]?"u":"m")+a.id_cluster,navSubMenu("view"),document.location="",section.create.input.submit.anim("active",1500))})},!1)); null!=section.create.element&&(section.create.input={name:document.querySelector(section.create.text+"#create_name"),"class":document.querySelector(section.create.text+"#create_class"),submit:document.querySelector(section.create.text+"#create_submit")},section.create.input.submit.addEventListener("click",function(a){a.preventDefault();var c={path:"clusterDefault/create",name:section.create.input.name.value,"class":section.create.input["class"].value};api.send(c,function(a){0==a.ModuleError&&(console.log("Groupe cree!"),
if(null!=section.remove.element){var autofill_remove=function(){var a="",b="",d="",c=!0;null==found_remove[searchindex_remove]?searchindex_remove=section.remove.input.search.num.innerHTML=0:(found_remove[searchindex_remove].hasOwnProperty("id_user_cluster")?(a=found_remove[searchindex_remove].id_user_cluster,b=0):(a=found_remove[searchindex_remove].id_machine_cluster,b=1),d=found_remove[searchindex_remove].name,c=!1,section.remove.input.search.num.innerHTML=searchindex_remove+1);section.remove.input.search.id.value= pageManager.vars[1]=(0==c["class"]?"u":"m")+a.id_cluster,navSubMenu("view"),document.location="",section.create.input.submit.anim("active",1500))})},!1));
a;section.remove.input.name.value=d;section.remove.input["class"].value=0==b?"utilisateur":"machine";section.remove.input.submit.disabled=c};section.remove.input={search:{view:document.querySelector(section.remove.text+".remove_search_view"),num:document.querySelector(section.remove.text+".remove_search_num"),sum:document.querySelector(section.remove.text+".remove_search_sum"),keyword:document.querySelector(section.remove.text+"#remove_search_keyword"),id:document.querySelector(section.remove.text+ if(null!=section.remove.element){var autofill_remove=function(){var a="",c="",d="",b=!0;null==found_remove[searchindex_remove]?searchindex_remove=section.remove.input.search.num.innerHTML=0:(found_remove[searchindex_remove].hasOwnProperty("id_user_cluster")?(a=found_remove[searchindex_remove].id_user_cluster,c=0):(a=found_remove[searchindex_remove].id_machine_cluster,c=1),d=found_remove[searchindex_remove].name,b=!1,section.remove.input.search.num.innerHTML=searchindex_remove+1);section.remove.input.search.id.value=
a;section.remove.input.name.value=d;section.remove.input["class"].value=0==c?"utilisateur":"machine";section.remove.input.submit.disabled=b};section.remove.input={search:{view:document.querySelector(section.remove.text+".remove_search_view"),num:document.querySelector(section.remove.text+".remove_search_num"),sum:document.querySelector(section.remove.text+".remove_search_sum"),keyword:document.querySelector(section.remove.text+"#remove_search_keyword"),id:document.querySelector(section.remove.text+
"#remove_search_id"),submit:document.querySelector(section.remove.text+"#remove_search_submit")},name:document.querySelector(section.remove.text+"#remove_name"),"class":document.querySelector(section.remove.text+"#remove_class"),submit:document.querySelector(section.remove.text+"#remove_submit")};var lastkeywords_remove="",found_remove=[],searchindex_remove=0;if(2<=pageManager.vars.length&&/^(u|m)\d+$/.test(pageManager.vars[1])){var prefix=pageManager.vars[1][0],cluster=pageManager.vars[1].slice(1), "#remove_search_id"),submit:document.querySelector(section.remove.text+"#remove_search_submit")},name:document.querySelector(section.remove.text+"#remove_name"),"class":document.querySelector(section.remove.text+"#remove_class"),submit:document.querySelector(section.remove.text+"#remove_submit")};var lastkeywords_remove="",found_remove=[],searchindex_remove=0;if(2<=pageManager.vars.length&&/^(u|m)\d+$/.test(pageManager.vars[1])){var 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_remove=[a.cluster],searchindex_remove=0,autofill_remove())})}section.remove.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.remove.input.search.keyword.value)if(section.remove.input.search.keyword.value==lastkeywords_remove)searchindex_remove=(searchindex_remove+1)%found_remove.length,autofill_remove();else{var b={path:"clusterDefault/search", request={path:"clusterDefault/getById",id_cluster:cluster,"class":"u"==prefix?0:1};api.send(request,function(a){0==a.ModuleError&&(found_remove=[a.cluster],searchindex_remove=0,autofill_remove())})}section.remove.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.remove.input.search.keyword.value)if(section.remove.input.search.keyword.value==lastkeywords_remove)searchindex_remove=(searchindex_remove+1)%found_remove.length,autofill_remove();else{var c={path:"clusterDefault/search",
keywords:section.remove.input.search.keyword.value};api.send(b,function(a){0==a.ModuleError&&(section.remove.input.search.submit.anim("active",1E3),searchindex_remove=0,found_remove=a.clusters,section.remove.input.search.sum.innerHTML=found_remove.length,autofill_remove());lastkeywords_remove=b.keywords})}},!1);section.remove.input.submit.addEventListener("click",function(a){a.preventDefault();""!=section.remove.input.search.id.value&&(a=found_remove[searchindex_remove].hasOwnProperty("id_user_cluster")? keywords:section.remove.input.search.keyword.value};api.send(c,function(a){0==a.ModuleError&&(section.remove.input.search.submit.anim("active",1E3),searchindex_remove=0,found_remove=a.clusters,section.remove.input.search.sum.innerHTML=found_remove.length,autofill_remove());lastkeywords_remove=c.keywords})}},!1);section.remove.input.submit.addEventListener("click",function(a){a.preventDefault();""!=section.remove.input.search.id.value&&(a=found_remove[searchindex_remove].hasOwnProperty("id_user_cluster")?
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)} 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= if(null!=section.edit.element){var autofill_edit=function(){var a="",c="",d=!0;if(null==found_edit[searchindex_edit])searchindex_edit=section.edit.input.search.num.innerHTML=0;else{var b;found_edit[searchindex_remove].hasOwnProperty("id_user_cluster")?(a=found_edit[searchindex_remove].id_user_cluster,b=0):(a=found_edit[searchindex_remove].id_machine_cluster,b=1);c=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+ a;section.edit.input.name.value=c;section.edit.input["class"].value=0==b?"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])&&(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, "#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", 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 c={path:"clusterDefault/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.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== 1E3),searchindex_edit=0,found_edit=a.clusters,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=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":c};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)} a.ModuleError&&1==a.status?(console.log("Groupe modifiee!"),section.edit.input.submit.anim("active",1500),pageManager.vars[1]=(0==c?"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= 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)); "")},!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 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 c=[],d=[],b=section.members.deflater.deflate().members;b 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= Array||(b=[b]);for(a=0;a<b.length;a++)-1==section.members.baseData.indexOf(b[a])&&c.push(b[a]);for(a=0;a<section.members.baseData.length;a++)-1==b.indexOf(section.members.baseData[a])&&d.push(section.members.baseData[a]);for(a=0;a<c.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=c[a]:e.id_machine=c[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)); 0;a<d.length;a++)c={},c.path=0==section.members["class"]?"userDefault/unlink":"machineDefault/unlink",c.id_cluster=section.members.idcluster,0==section.members["class"]?c.id_user=d[a]:c.id_machine=d[a],api.send(c,function(a){0!=a.ModuleError&&console.error("Erreur d'ajout de membre")});section.members.baseData=b},!1));

View File

@ -80,7 +80,10 @@ if( section.view.element != null ){
// On enregistre tous les UID dans un tableau // On enregistre tous les UID dans un tableau
var uid_list = []; var uid_list = [];
for( var i = 0 ; i < result.clusters.length ; i++ ) for( var i = 0 ; i < result.clusters.length ; i++ )
uid_list.push( result.clusters[i].id_cluster); if( result.clusters[i].hasOwnProperty('id_user_cluster') )
uid_list.push( 'u'+result.clusters[i].id_user_cluster);
else
uid_list.push( 'm'+result.clusters[i].id_machine_cluster);
// On recupere la liste des elements correspondants aux utilisateurs // On recupere la liste des elements correspondants aux utilisateurs
var cluster_list = document.querySelectorAll(section.view.text + '> article.inline-box[id]'); var cluster_list = document.querySelectorAll(section.view.text + '> article.inline-box[id]');

View File

@ -17,6 +17,6 @@ searchindex_edit=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&api.
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, 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", 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]= 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(parseInt(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")}; "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)}; 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

@ -648,7 +648,7 @@ if( section.groups.element != null ){
// Pour chaque cluster // Pour chaque cluster
for( var i = 0 ; i < cluster_list.length ; i++ ){ for( var i = 0 ; i < cluster_list.length ; i++ ){
// Si doit etre visible // Si doit etre visible
if( uid_list.indexOf(cluster_list[i].id) > -1 ) if( uid_list.indexOf( parseInt(cluster_list[i].id) ) > -1 )
cluster_list[i].remClass('hidden'); cluster_list[i].remClass('hidden');
// Si ne doit pas etre visible // Si ne doit pas etre visible
else else

View File

@ -20,6 +20,6 @@ id:document.querySelector(section.edit.text+"#edit_search_id"),submit:document.q
{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=""): {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)} 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", 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"+ 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(parseInt(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]=
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, "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)}; 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

@ -688,7 +688,7 @@ if( section.groups.element != null ){
// Pour chaque cluster // Pour chaque cluster
for( var i = 0 ; i < cluster_list.length ; i++ ){ for( var i = 0 ; i < cluster_list.length ; i++ ){
// Si doit etre visible // Si doit etre visible
if( uid_list.indexOf(cluster_list[i].id) > -1 ) if( uid_list.indexOf( parseInt(cluster_list[i].id) ) > -1 )
cluster_list[i].remClass('hidden'); cluster_list[i].remClass('hidden');
// Si ne doit pas etre visible // Si ne doit pas etre visible
else else