Vue de gestion des membres automatisée (automatique entre 'users' et 'machines' en fonction du type de groupe
This commit is contained in:
parent
1c8c390cd1
commit
a0fd5c464e
|
@ -612,16 +612,13 @@ article.check-table{
|
|||
|
||||
color: #333;
|
||||
|
||||
background: #f5f5f5;
|
||||
background: #f8f8f8;
|
||||
border-bottom: 1px solid #eee;
|
||||
|
||||
transition: background .2s ease-in-out;
|
||||
|
||||
&:hover{ background: #f1f1f1; }
|
||||
|
||||
&:nth-child(2n){
|
||||
background: #fdfdfd;
|
||||
&:hover{ background: #fff; }
|
||||
}
|
||||
|
||||
overflow: hidden;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -18,6 +18,8 @@
|
|||
|
||||
private $view;
|
||||
|
||||
public static $htmlError = "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
|
||||
|
||||
|
||||
/* INITIALISATION DE LA VUE VUE
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace manager\view\group;
|
||||
use \manager\View;
|
||||
use \manager\ModuleRequest;
|
||||
use \manager\Authentification;
|
||||
use \manager\ManagerError;
|
||||
|
||||
class machineChoice{
|
||||
|
||||
public static function template($type=null){
|
||||
|
||||
switch($type){
|
||||
case 'machinelist': return "
|
||||
<div>
|
||||
<span>@name</span>
|
||||
<span>
|
||||
|
||||
<input type='checkbox' value='@id_machine' data-name='members' id='checkbox_@id_machine' @already_in>
|
||||
<label for='checkbox_@id_machine'></label>
|
||||
|
||||
</span>
|
||||
|
||||
</div>
|
||||
";
|
||||
break;
|
||||
|
||||
|
||||
default: return "
|
||||
<article class='check-table'>
|
||||
@machinelist
|
||||
</article>";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function view($params){
|
||||
// On vérifie les paramètres
|
||||
if( !isset($params['id_cluster']) && !is_number($params['id_cluster']) )
|
||||
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
|
||||
|
||||
$view = '';
|
||||
|
||||
/* [1] On récupère la liste des machines
|
||||
=========================================================*/
|
||||
$request = new ModuleRequest('machineDefault/getAll'); // On utilise la methode 'getAll' du module 'machineDefault'
|
||||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
|
||||
$MACHINELIST = $answer->get('machines');
|
||||
|
||||
/* [2] On récupère la liste des membres
|
||||
=========================================================*/
|
||||
$get_members = new ModuleRequest('clusterDefault/getMembers', [
|
||||
'id_cluster' => $params['id_cluster']
|
||||
]);
|
||||
$members_response = $get_members->dispatch();
|
||||
|
||||
// On récupère la liste des UID uniquement
|
||||
$members_id = [];
|
||||
foreach($members_response->get('members') as $member)
|
||||
$members_id[] = $member['id_member'];
|
||||
|
||||
|
||||
|
||||
foreach($MACHINELIST as $m=>$machine)
|
||||
$MACHINELIST[$m]['already_in'] = in_array($machine['id_machine'], $members_id) ? 'checked' : '';
|
||||
|
||||
|
||||
$view_user = View::replaceMultiple(
|
||||
self::template('machinelist'),
|
||||
$MACHINELIST, [
|
||||
'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ),
|
||||
'icon_edit' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' ),
|
||||
'icon_card' => file_get_contents( __ROOT__.'/src/static/container/card.svg' ),
|
||||
'icon_mail' => file_get_contents( __ROOT__.'/src/static/container/mail.svg' ),
|
||||
'icon_group' => file_get_contents( __ROOT__.'/src/static/container/group.svg' ),
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return View::replaceSingle(self::template(), [ 'machinelist' => $view_user ]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,183 @@
|
|||
<?php
|
||||
|
||||
namespace manager\view\group;
|
||||
use \manager\View;
|
||||
use \manager\ModuleRequest;
|
||||
use \manager\ManagerError;
|
||||
use \manager\Authentification;
|
||||
use \manager\repo\cluster as clusterRepo;
|
||||
|
||||
class membersChoice{
|
||||
|
||||
public static function template($type=null){
|
||||
|
||||
switch($type){
|
||||
case 'userlist': return "
|
||||
<div>
|
||||
<span>@username</span>
|
||||
<span>@firstname @lastname</span>
|
||||
<span>@code</span>
|
||||
<span>
|
||||
|
||||
<input type='checkbox' value='@id_user' data-name='members' id='checkbox_@id_user' @already_in>
|
||||
<label for='checkbox_@id_user'></label>
|
||||
|
||||
</span>
|
||||
|
||||
</div>";
|
||||
break;
|
||||
|
||||
|
||||
case 'machinelist': return "
|
||||
<div>
|
||||
<span>@name</span>
|
||||
<span>
|
||||
|
||||
<input type='checkbox' value='@id_machine' data-name='members' id='checkbox_@id_machine' @already_in>
|
||||
<label for='checkbox_@id_machine'></label>
|
||||
|
||||
</span>
|
||||
|
||||
</div>";
|
||||
break;
|
||||
|
||||
|
||||
default: return "
|
||||
<article class='check-table'>
|
||||
@members
|
||||
</article>";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function view($params){
|
||||
/* [0] Initialisation
|
||||
=========================================================*/
|
||||
/* (1) On vérifie les paramètres */
|
||||
if( !isset($params['id_cluster']) && !is_number($params['id_cluster']) )
|
||||
return View::$htmlError;
|
||||
|
||||
/* (2) On initialise les vues */
|
||||
$view = '';
|
||||
$members_view = '';
|
||||
|
||||
|
||||
|
||||
/* [1] On vérifie le type de groupe (user/machine)
|
||||
=========================================================*/
|
||||
/* (1) On récupère le groupe */
|
||||
$checktypeRequest = new ModuleRequest('clusterDefault/getById', [
|
||||
'id_cluster' => $params['id_cluster']
|
||||
]);
|
||||
$checktypeResponse = $checktypeRequest->dispatch();
|
||||
|
||||
/* (2) Si on ne le trouve pas, on retourne une erreur */
|
||||
if( $checktypeResponse->error != ManagerError::Success )
|
||||
return View::$htmlError;
|
||||
|
||||
/* (3) On récupère les données du groupe */
|
||||
$currentCluster = $checktypeResponse->get('cluster');
|
||||
|
||||
|
||||
|
||||
/* [2] On récupère les membres du groupe
|
||||
=========================================================*/
|
||||
/* (1) On exécute la requête */
|
||||
$getmembersRequest = new ModuleRequest('clusterDefault/getMembers', [
|
||||
'id_cluster' => $params['id_cluster']
|
||||
]);
|
||||
$getmembersResponse = $getmembersRequest->dispatch();
|
||||
|
||||
/* (2) Si erreur, on retourne l'erreur */
|
||||
if( $getmembersResponse->error != ManagerError::Success )
|
||||
return View::$htmlError;
|
||||
|
||||
/* (3) On récupère la liste des UID uniquement */
|
||||
$members_id = [];
|
||||
foreach($getmembersResponse->get('members') as $member)
|
||||
$members_id[] = $member['id_member'];
|
||||
|
||||
|
||||
|
||||
/* [3] SI GROUPE D'UTILISATEURS -> On récupère les utilisateurs
|
||||
=========================================================*/
|
||||
if( $currentCluster['class'] == clusterRepo::USER_CLASS ){
|
||||
|
||||
/* (1) On récupère les utilisateurs
|
||||
---------------------------------------------------------*/
|
||||
/* (1) On exécute la requête */
|
||||
$getusersRequest = new ModuleRequest('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
|
||||
$getusersResponse = $getusersRequest->dispatch(); // On recupere la reponse
|
||||
|
||||
/* (2) si erreur, on affiche l'explicitation */
|
||||
if( $getusersResponse->error != ManagerError::Success )
|
||||
return View::$htmlError;
|
||||
|
||||
/* (3) On récupère la liste des utilisateurs */
|
||||
$USERLIST = $getusersResponse->get('users');
|
||||
|
||||
|
||||
/* (2) On gère l'affichage des utilisateurs
|
||||
---------------------------------------------------------*/
|
||||
/* (1) On gère l'état 'membre' ou non */
|
||||
foreach($USERLIST as $u=>$user)
|
||||
$USERLIST[$u]['already_in'] = in_array($user['id_user'], $members_id) ? 'checked' : '';
|
||||
|
||||
/* (2) On génère la vue */
|
||||
$members_view = View::replaceMultiple(
|
||||
self::template('userlist'),
|
||||
$USERLIST
|
||||
);
|
||||
|
||||
|
||||
/* [4] SI GROUPE DE MACHINES -> On récupère les machines
|
||||
=========================================================*/
|
||||
}else{
|
||||
|
||||
/* (1) On récupère les machines
|
||||
---------------------------------------------------------*/
|
||||
/* (1) On exécute la requête */
|
||||
$getmachinesRequest = new ModuleRequest('machineDefault/getAll'); // On utilise la methode 'getAll' du module 'machineDefault'
|
||||
$getmachinesResponse = $getmachinesRequest->dispatch(); // On recupere la reponse
|
||||
|
||||
/* (2) si erreur, on affiche l'explicitation */
|
||||
if( $getmachinesResponse->error != ManagerError::Success )
|
||||
return View::$htmlError;
|
||||
|
||||
/* (3) On récupère la liste des machines */
|
||||
$MACHINELIST = $getmachinesResponse->get('machines');
|
||||
|
||||
|
||||
/* (2) On gère l'affichage des machines
|
||||
---------------------------------------------------------*/
|
||||
/* (1) On gère l'état 'membre' ou non */
|
||||
foreach($MACHINELIST as $u=>$user)
|
||||
$MACHINELIST[$u]['already_in'] = in_array($user['id_machine'], $members_id) ? 'checked' : '';
|
||||
|
||||
/* (2) On génère la vue */
|
||||
$members_view = View::replaceMultiple(
|
||||
self::template('machinelist'),
|
||||
$MACHINELIST
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return View::replaceSingle(self::template(), [ 'members' => $members_view ]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -1,104 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace manager\view\group;
|
||||
use \manager\View;
|
||||
use \manager\ModuleRequest;
|
||||
use \manager\Authentification;
|
||||
use \manager\ManagerError;
|
||||
|
||||
class userChoice{
|
||||
|
||||
public static function template($type=null){
|
||||
|
||||
switch($type){
|
||||
case 'userlist': return "
|
||||
<div>
|
||||
<span>@username</span>
|
||||
<span>@firstname @lastname</span>
|
||||
<span>@code</span>
|
||||
<span>
|
||||
|
||||
<input type='checkbox' value='@id_user' data-name='members' id='checkbox_@id_user' @already_in>
|
||||
<label for='checkbox_@id_user'></label>
|
||||
|
||||
</span>
|
||||
|
||||
</div>
|
||||
";
|
||||
break;
|
||||
|
||||
|
||||
default: return "
|
||||
<article class='check-table'>
|
||||
@userlist
|
||||
</article>";
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function view($params){
|
||||
// On vérifie les paramètres
|
||||
if( !isset($params['id_cluster']) && !is_number($params['id_cluster']) )
|
||||
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
|
||||
|
||||
$view = '';
|
||||
|
||||
/* [1] On récupère la liste des utilisateurs
|
||||
=========================================================*/
|
||||
$request = new ModuleRequest('userDefault/getAll'); // On utilise la methode 'getAll' du module 'userDefault'
|
||||
$answer = $request->dispatch(); // On recupere la reponse
|
||||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
|
||||
$USERLIST = $answer->get('users');
|
||||
|
||||
/* [2] On récupère la liste des membres
|
||||
=========================================================*/
|
||||
$get_members = new ModuleRequest('clusterDefault/getMembers', [
|
||||
'id_cluster' => $params['id_cluster']
|
||||
]);
|
||||
$members_response = $get_members->dispatch();
|
||||
|
||||
// On récupère la liste des UID uniquement
|
||||
$members_id = [];
|
||||
foreach($members_response->get('members') as $member)
|
||||
$members_id[] = $member['id_member'];
|
||||
|
||||
|
||||
|
||||
foreach($USERLIST as $u=>$user)
|
||||
$USERLIST[$u]['already_in'] = in_array($user['id_user'], $members_id) ? 'checked' : '';
|
||||
|
||||
|
||||
$view_user = View::replaceMultiple(
|
||||
self::template('userlist'),
|
||||
$USERLIST, [
|
||||
'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ),
|
||||
'icon_edit' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' ),
|
||||
'icon_card' => file_get_contents( __ROOT__.'/src/static/container/card.svg' ),
|
||||
'icon_mail' => file_get_contents( __ROOT__.'/src/static/container/mail.svg' ),
|
||||
'icon_group' => file_get_contents( __ROOT__.'/src/static/container/group.svg' ),
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return View::replaceSingle(self::template(), [ 'userlist' => $view_user ]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
return View::$htmlError;
|
||||
|
||||
$CLUSTERLIST = $answer->get('clusters');
|
||||
|
||||
|
@ -92,10 +92,8 @@
|
|||
self::template('cluster'),
|
||||
$CLUSTERLIST, [
|
||||
'icon_remove' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/remove.svg' ),
|
||||
'icon_edit' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' ),
|
||||
'icon_card' => file_get_contents( __ROOT__.'/src/static/container/card.svg' ),
|
||||
'icon_mail' => file_get_contents( __ROOT__.'/src/static/container/mail.svg' ),
|
||||
'icon_group' => file_get_contents( __ROOT__.'/src/static/container/group.svg' ),
|
||||
'icon_edit' => file_get_contents( __ROOT__.'/src/static/sub-menu-side/edit.svg' )
|
||||
]);
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
return View::$htmlError;
|
||||
|
||||
$MACHINELIST = $answer->get('machines');
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
|
||||
// si erreur, on affiche l'explicitation
|
||||
if( $answer->error != ManagerError::Success )
|
||||
return "<span class='error'>Une erreur est survenue, veuilez contacter le webmaster si cette erreur persiste.</span>";
|
||||
return View::$htmlError;
|
||||
|
||||
$USERLIST = $answer->get('users');
|
||||
|
||||
|
|
|
@ -170,8 +170,8 @@
|
|||
|
||||
debug();
|
||||
|
||||
$userForGroup = new View('group.machineChoice', [
|
||||
'id_cluster' => 201 // groupe "b" de type MACHINE
|
||||
$userForGroup = new View('group.membersChoice', [
|
||||
'id_cluster' => 202 // groupe "b" de type MACHINE
|
||||
]);
|
||||
|
||||
$userForGroup->view();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
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"]')}};
|
||||
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-cluster]"),remove:document.querySelectorAll(section.view.text+".link_remove[data-cluster]")};section.view.group={rem:document.querySelectorAll(section.view.text+".rem-group[data-cluster][data-group]"),add:document.querySelectorAll(section.view.text+
|
||||
".add-group[data-cluster]")};section.view.searchbar.addEventListener("keyup",function(a){api.send({path:"clusterDefault/search",keywords:section.view.searchbar.value},function(b){if(0==b.ModuleError){for(var a=[],c=0;c<b.clusters.length;c++)a.push(b.clusters[c].id_cluster);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-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);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("cluster");autofill_edit(pageManager.vars[1]);navSubMenu("edit")},!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");autofill_remove(pageManager.vars[1]);navSubMenu("remove")},!1);for(i=0;i<section.view.group.rem.length;i++)section.view.group.rem[i].addEventListener("click",function(a){var b={path:"clusterDefault/unlink",id_user:a.target.getData("user"),
|
||||
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"),"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();api.send({path:"clusterDefault/create",name:section.create.input.name.value,"class":section.create.input["class"].value},function(b){0==b.ModuleError&&(console.log("Groupe cree!"),
|
||||
pageManager.vars=["view",b.id_cluster],pageManager.refresh(),document.location="",section.create.input.submit.anim("active",1500))})},!1));
|
||||
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);for(i=0;i<section.view.group.add.length;i++)section.view.group.add[i].addEventListener("click",function(a){var b={path:"clusterDefault/unlink",id_user:a.target.getData("user"),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"),"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();api.send({path:"clusterDefault/create",name:section.create.input.name.value,"class":section.create.input["class"].value},function(a){0==a.ModuleError&&(console.log("Groupe cree!"),
|
||||
pageManager.vars=["view",a.id_cluster],pageManager.refresh(),document.location="",section.create.input.submit.anim("active",1500))})},!1));
|
||||
if(null!=section.remove.element){var autofill_remove=function(){var a="",b="",d=!0;null==found_remove[searchindex_remove]?searchindex_remove=section.remove.input.search.num.innerHTML=0:(a=found_remove[searchindex_remove].id_cluster,b=found_remove[searchindex_remove].name,d=!1,section.remove.input.search.num.innerHTML=searchindex_remove+1);section.remove.input.search.id.value=a;section.remove.input.name.value=b;section.remove.input.submit.disabled=d};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"),submit:document.querySelector(section.remove.text+"#remove_submit")};
|
||||
var lastkeywords_remove="",found_remove=[],searchindex_remove=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&api.send({path:"clusterDefault/getById",id_cluster:pageManager.vars[1]},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=
|
||||
|
|
|
@ -132,6 +132,33 @@ if( section.view.element != null ){
|
|||
|
||||
}
|
||||
|
||||
/* (7) On gere la "modification" d'un groupe */
|
||||
for( var i = 0 ; i < section.view.group.add.length ; i++ ){
|
||||
|
||||
section.view.group.add[i].addEventListener('click', function(e){
|
||||
// {1} On rédige la requête //
|
||||
var request = {
|
||||
path: 'clusterDefault/unlink',
|
||||
id_user: e.target.getData('user'),
|
||||
id_cluster: e.target.getData('group')
|
||||
};
|
||||
|
||||
// {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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue