Correction de qui utilisaient l'ancien format du
This commit is contained in:
parent
c629324163
commit
9bbc3e4b79
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,5 @@
|
||||||
var TOKEN={add:{toggle:document.getElementById("add-token"),panel:$("[data-sublink='tokens'] div[data-add]"),state:!0,submit:$("[data-sublink='tokens'] div[data-add] #add-token-submit")},remove:{buttons:$$(".remove-token")}},tokenDeflater=new FormDeflater(TOKEN.add.panel,["input"],["id"]);TOKEN.add.toggle.addEventListener("click",function(a){TOKEN.add.state?TOKEN.add.panel.addClass("active"):TOKEN.add.panel.remClass("active");TOKEN.add.state=!TOKEN.add.state},!1);
|
var TOKEN={add:{toggle:document.getElementById("add-token"),panel:$("[data-sublink='tokens'] div[data-add]"),state:!0,submit:$("[data-sublink='tokens'] div[data-add] #add-token-submit")},remove:{buttons:$$(".remove-token")}},tokenDeflater=new FormDeflater(TOKEN.add.panel,["input"],["id"]);TOKEN.add.toggle.addEventListener("click",function(a){TOKEN.add.state?TOKEN.add.panel.addClass("active"):TOKEN.add.panel.remClass("active");TOKEN.add.state=!TOKEN.add.state},!1);
|
||||||
TOKEN.add.submit.addEventListener("click",function(a){a=tokenDeflater.deflate();api.send({path:"token/generate",name:a["add-name"].value,duration:a["add-duration"].value},function(a){0==a.ModuleError&&reload()})},!1);
|
TOKEN.add.submit.addEventListener("click",function(a){a=tokenDeflater.deflate();api.send({path:"token/generate",name:a["add-name"],duration:a["add-duration"]},function(a){0==a.ModuleError&&reload()})},!1);for(var i=0;i<TOKEN.remove.buttons.length;i++)TOKEN.remove.buttons[i].addEventListener("click",function(a){a=a.target.parentNode.getData("id");0==a?console.warn("id du token non trouvee"):api.send({path:"token/remove",token_id:a},function(a){console.log(a);0==a.ModuleError&&reload()})},!1);
|
||||||
for(var i=0;i<TOKEN.remove.buttons.length;i++)TOKEN.remove.buttons[i].addEventListener("click",function(a){a=a.target.parentNode.getData("id");0==a?console.warn("id du token non trouvee"):api.send({path:"token/remove",token_id:a},function(a){console.log(a);0==a.ModuleError&&reload()})},!1);
|
|
||||||
var USERS={add:{toggle:document.getElementById("add-user"),panel:$("[data-sublink='users'] div[data-add]"),state:!0,submit:$("[data-sublink='users'] div[data-add] #add-user-submit")},remove:{buttons:$$(".remove-user")}},userDefalter=new FormDeflater(USERS.add.panel,["input"],["id"]);USERS.add.toggle.addEventListener("click",function(a){USERS.add.state?USERS.add.panel.addClass("active"):USERS.add.panel.remClass("active");USERS.add.state=!USERS.add.state},!1);
|
var USERS={add:{toggle:document.getElementById("add-user"),panel:$("[data-sublink='users'] div[data-add]"),state:!0,submit:$("[data-sublink='users'] div[data-add] #add-user-submit")},remove:{buttons:$$(".remove-user")}},userDefalter=new FormDeflater(USERS.add.panel,["input"],["id"]);USERS.add.toggle.addEventListener("click",function(a){USERS.add.state?USERS.add.panel.addClass("active"):USERS.add.panel.remClass("active");USERS.add.state=!USERS.add.state},!1);
|
||||||
USERS.add.submit.addEventListener("click",function(a){a=userDefalter.deflate();a["add-password"].value==a["add-password2"].value&&api.send({path:"user/create",login:a["add-login"].value,password:a["add-password"].value,mail:a["add-mail"].value,reference:a["add-reference"].value,permission:a["add-admin"].checked?"admin":"subject"},function(a){console.log(a);0==a.ModuleError&&reload()})},!1);
|
USERS.add.submit.addEventListener("click",function(a){a=userDefalter.deflate();a["add-password"]==a["add-password2"]&&api.send({path:"user/create",login:a["add-login"],password:a["add-password"],mail:a["add-mail"],reference:a["add-reference"],permission:a["add-admin"]},function(a){console.log(a);0==a.ModuleError&&reload()})},!1);
|
||||||
for(i=0;i<USERS.remove.buttons.length;i++)USERS.remove.buttons[i].addEventListener("click",function(a){a=a.target.parentNode.getData("id");0==a?console.warn("id de l'utilisateur non trouvee"):api.send({path:"user/remove",id_user:a},function(a){0==a.ModuleError&&reload()})},!1);
|
for(i=0;i<USERS.remove.buttons.length;i++)USERS.remove.buttons[i].addEventListener("click",function(a){a=a.target.parentNode.getData("id");0==a?console.warn("id de l'utilisateur non trouvee"):api.send({path:"user/remove",id_user:a},function(a){0==a.ModuleError&&reload()})},!1);
|
||||||
|
|
|
@ -38,8 +38,8 @@ var tokenDeflater = new FormDeflater(TOKEN.add.panel, ['input'], ['id']);
|
||||||
// On redige la requete
|
// On redige la requete
|
||||||
var request = { // on ecrit la requete
|
var request = { // on ecrit la requete
|
||||||
'path': 'token/generate',
|
'path': 'token/generate',
|
||||||
'name': form['add-name'].value,
|
'name': form['add-name'],
|
||||||
'duration': form['add-duration'].value
|
'duration': form['add-duration']
|
||||||
};
|
};
|
||||||
|
|
||||||
// On lance la requete
|
// On lance la requete
|
||||||
|
@ -122,7 +122,7 @@ var userDefalter = new FormDeflater(USERS.add.panel, ['input'], ['id']);
|
||||||
var form = userDefalter.deflate();
|
var form = userDefalter.deflate();
|
||||||
|
|
||||||
// On verifie que les 2 mots de passe sont identiques
|
// On verifie que les 2 mots de passe sont identiques
|
||||||
if( form['add-password'].value != form['add-password2'].value ){
|
if( form['add-password'] != form['add-password2'] ){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,11 +130,11 @@ var userDefalter = new FormDeflater(USERS.add.panel, ['input'], ['id']);
|
||||||
// On redige la requete
|
// On redige la requete
|
||||||
var request = { // on ecrit la requete
|
var request = { // on ecrit la requete
|
||||||
'path': 'user/create',
|
'path': 'user/create',
|
||||||
'login': form['add-login'].value,
|
'login': form['add-login'],
|
||||||
'password': form['add-password'].value,
|
'password': form['add-password'],
|
||||||
'mail': form['add-mail'].value,
|
'mail': form['add-mail'],
|
||||||
'reference': form['add-reference'].value,
|
'reference': form['add-reference'],
|
||||||
'permission': (form['add-admin'].checked) ? 'admin' : 'subject'
|
'permission': form['add-admin']
|
||||||
};
|
};
|
||||||
|
|
||||||
// On lance la requete
|
// On lance la requete
|
||||||
|
|
Loading…
Reference in New Issue