[registration] ajour de plusieurs adresses mac + saisie simplifiée des
adresses mac adaptée pour MacOS avec tous les fichiers cette fois-çi
This commit is contained in:
parent
8d4ab84bb3
commit
74a4c9a256
@ -159,7 +159,10 @@ class NewRegistrationController(AuthenticatedRestController):
|
||||
@expose()
|
||||
def post(self, residence, sn, givenName, mail, phone,
|
||||
room_uid, first_machine_name, first_machine_mac,
|
||||
next_end, extra_name, group_cn
|
||||
next_end, extra_name, group_cn,
|
||||
second_machine_name = "", second_machine_mac = "",
|
||||
third_machine_name = "", third_machine_mac = "",
|
||||
fourth_machine_name = "", fourth_machine_mac = "",
|
||||
):
|
||||
# Initialisation des Users des Controllers Existant appellés
|
||||
self.member_edit_controller.add.user = self.user
|
||||
@ -192,25 +195,30 @@ class NewRegistrationController(AuthenticatedRestController):
|
||||
self.member_edit_controller.room.move.post(residence, member_uid, room_uid, erase = True, go_redirect = False)
|
||||
#end if
|
||||
|
||||
trigerErreur = False
|
||||
try:
|
||||
self.member_edit_controller.machine.add.post(residence, member_uid, first_machine_name, first_machine_mac, go_redirect = False)
|
||||
except:
|
||||
trigerErreur = True
|
||||
try:
|
||||
self.member_edit_controller.cotisation.add.post(residence, member_uid, next_end, extra_name, go_redirect = False)
|
||||
except:
|
||||
trigerErreur = True
|
||||
try:
|
||||
if first_machine_name != "" and first_machine_mac != "":
|
||||
self.member_edit_controller.machine.add.post(residence, member_uid, first_machine_name, first_machine_mac, go_redirect = False)
|
||||
#end if
|
||||
if second_machine_name != "" and second_machine_mac != "":
|
||||
self.member_edit_controller.machine.add.post(residence, member_uid, second_machine_name, second_machine_mac, go_redirect = False)
|
||||
#end if
|
||||
if third_machine_name != "" and third_machine_mac != "":
|
||||
self.member_edit_controller.machine.add.post(residence, member_uid, third_machine_name, third_machine_mac, go_redirect = False)
|
||||
#end if
|
||||
if fourth_machine_name != "" and fourth_machine_mac != "":
|
||||
self.member_edit_controller.machine.add.post(residence, member_uid, fourth_machine_name, fourth_machine_mac, go_redirect = False)
|
||||
#end if
|
||||
|
||||
if next_end != "" or extra_name != "":
|
||||
self.member_edit_controller.cotisation.add.post(residence, member_uid, next_end, extra_name, go_redirect = False)
|
||||
#end if
|
||||
|
||||
if group_cn != "":
|
||||
self.administration_controller.groups.add_member.post(group_cn, member.dn, go_redirect = False)
|
||||
#end if
|
||||
except:
|
||||
trigerErreur = True
|
||||
|
||||
if trigerErreur:
|
||||
redirect("/registration/error/" + member_uid)
|
||||
|
||||
#end trycatch
|
||||
|
||||
redirect("/registration/")
|
||||
#end def
|
||||
|
@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
|
||||
input[type="text"],input[type="password"]
|
||||
input[type="text"],input[type="password"],input[type=email]
|
||||
{
|
||||
height: 28px;
|
||||
}
|
||||
|
@ -1,36 +1,64 @@
|
||||
function mac_address_correcter(event){
|
||||
var valeur = document.getElementById("mac_adress_input").value;
|
||||
console.log(document.getElementById("mac_adress_input").value);
|
||||
var regex = /&/g;
|
||||
valeur = valeur.replace(regex, "1");
|
||||
var regex = /é/g;
|
||||
valeur = valeur.replace(regex, "2");
|
||||
var regex = /"/g;
|
||||
valeur = valeur.replace(regex, "3");
|
||||
var regex = /'/g;
|
||||
valeur = valeur.replace(regex, "4");
|
||||
var regex = /\(/g;
|
||||
valeur = valeur.replace(regex, "5");
|
||||
var regex = /-/g;
|
||||
valeur = valeur.replace(regex, "6");
|
||||
var regex = /è/g;
|
||||
valeur = valeur.replace(regex, "7");
|
||||
var regex = /_/g;
|
||||
valeur = valeur.replace(regex, "8");
|
||||
var regex = /ç/g;
|
||||
valeur = valeur.replace(regex, "9");
|
||||
var regex = /à/g;
|
||||
valeur = valeur.replace(regex, "0");
|
||||
if($("#disablevalid:checked").length == 1){ return; }
|
||||
//si on tape sur backspace ou delete
|
||||
if(event.keyCode == 8 || event.keyCode == 46) { return; }
|
||||
var valeur = $(this).val();
|
||||
var os = $("#osRegister").val();
|
||||
console.log(valeur);
|
||||
var regex = Array();
|
||||
regex['win'] = Array(/&/g, /é/g, /"/g, /'/g, /\(/g, /-/g, /è/g, /_/g, /ç/g, /à/g);
|
||||
regex['mac'] = Array(/&/g, /é/g, /"/g, /'/g, /\(/g, /§/g, /è/g, /\!/g, /ç/g, /à/g);
|
||||
valeur = valeur.replace(regex[os][0], "1");
|
||||
valeur = valeur.replace(regex[os][1], "2");
|
||||
valeur = valeur.replace(regex[os][2], "3");
|
||||
valeur = valeur.replace(regex[os][3], "4");
|
||||
valeur = valeur.replace(regex[os][4], "5");
|
||||
valeur = valeur.replace(regex[os][5], "6");
|
||||
valeur = valeur.replace(regex[os][6], "7");
|
||||
valeur = valeur.replace(regex[os][7], "8");
|
||||
valeur = valeur.replace(regex[os][8], "9");
|
||||
valeur = valeur.replace(regex[os][9], "0");
|
||||
if(valeur.length == 2 || valeur.length == 5 || valeur.length == 8 || valeur.length == 11 || valeur.length == 14){
|
||||
valeur = valeur + ":";
|
||||
document.getElementById("mac_adress_input").value = valeur;
|
||||
$(this).val(valeur);
|
||||
}
|
||||
var regex = /::/g;
|
||||
valeur = valeur.replace(regex, ":");
|
||||
if(document.getElementById("mac_adress_input").value != valeur){
|
||||
document.getElementById("mac_adress_input").value = valeur;
|
||||
if($(this).val() != valeur){
|
||||
$(this).val(valeur);
|
||||
}
|
||||
var regex = /[^A-Fa-f0-9:]/gi;
|
||||
if(valeur.search(regex) != -1)
|
||||
alert("ERREUR");
|
||||
if(valeur.search(regex) != -1 || valeur.length > 17){
|
||||
$(this).parent().find(".macInvalid").css("display", "inline");
|
||||
$(this).css("color", "red");
|
||||
} else {
|
||||
$(this).parent().find(".macInvalid").css("display", "none");
|
||||
$(this).css("color", "");
|
||||
}
|
||||
}
|
||||
compteur = 1;
|
||||
function addMacField(){
|
||||
compteur++;
|
||||
if(compteur > 4){
|
||||
alert("Oui enfin bon on va pas en ajouter 50 non plus...");
|
||||
return;
|
||||
}
|
||||
$("#machine_add").append($("<div></div>"));
|
||||
$("#machine_add div").last().append($("<input></input>").attr("type","text").attr("id", "name_machine_input_"+compteur).attr("placeholder","nom de la machine").addClass("item_name"));
|
||||
$("#machine_add div").last().append($("<input></input>").attr("type","text").attr("placeholder","adresse mac").attr("id", "mac_adress_input_"+compteur).addClass("macValidator"));
|
||||
$("#machine_add div").last().append($("<span>adresse mac invalide</span>").addClass("macInvalid"));
|
||||
if(compteur == 2){
|
||||
$("#machine_add #name_machine_input_"+compteur).attr("name","second_machine_name");
|
||||
$("#machine_add #mac_adress_input_"+compteur).attr("name","second_machine_mac");
|
||||
} else if(compteur == 3){
|
||||
$("#machine_add #name_machine_input_"+compteur).attr("name","third_machine_name");
|
||||
$("#machine_add #mac_adress_input_"+compteur).attr("name","third_machine_mac");
|
||||
} else if(compteur == 4){
|
||||
$("#machine_add #name_machine_input_"+compteur).attr("name","fourth_machine_name");
|
||||
$("#machine_add #mac_adress_input_"+compteur).attr("name","fourth_machine_mac");
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).on("keyup", ".macValidator", mac_address_correcter);
|
||||
});
|
||||
|
@ -5,7 +5,11 @@
|
||||
<head>
|
||||
<link type="text/css" rel="Stylesheet" href="/css/common.css" />
|
||||
<link type="text/css" rel="Stylesheet" href="/css/show.css" />
|
||||
<script src="/js/mac_address_changer.js" />
|
||||
<script src="/js/jquery-1.11.1.min.js" />
|
||||
<script src="/js/mac_address_changer.js" />
|
||||
<style type="text/css">
|
||||
.macInvalid { color:red; display:none; }
|
||||
</style>
|
||||
<xi:include href="common-css-header.html" />
|
||||
</head>
|
||||
<body>
|
||||
|
@ -27,7 +27,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">E-mail</span>
|
||||
<input type="text" name="mail" value="${member_ldap.mail.first('')}" />
|
||||
<input type="email" name="mail" value="${member_ldap.mail.first('')}" />
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">Téléphone</span>
|
||||
@ -80,12 +80,15 @@
|
||||
</py:choose>
|
||||
</div>
|
||||
<div>
|
||||
<strong>Aide à la complétion</strong> -> vous avez un clavier <select id="osRegister"><option value="win">Windows</option><option value="mac">MacOSX</option></select>
|
||||
<input type="checkbox" id="disablevalid">Disable mac validation</input>
|
||||
<form action="/edit/machine/add/" method="post">
|
||||
<input type="text" name="name" placeholder="nom de la machine" class="item_name"/>
|
||||
<input type="text" name="mac" onkeyup="mac_address_correcter()" id="mac_adress_input" placeholder="adresse mac" />
|
||||
<input type="hidden" name="residence" value="${residence}"/>
|
||||
<input type="hidden" name="member_uid" value="${member_ldap.uid.first()}"/>
|
||||
<input type="submit" value="ajouter" class="button"/>
|
||||
<input type="text" name="name" placeholder="nom de la machine" class="item_name"/>
|
||||
<input type="text" name="mac" class="macValidator" id="mac_adress_input" placeholder="adresse mac" />
|
||||
<input type="hidden" name="residence" value="${residence}"/>
|
||||
<input type="hidden" name="member_uid" value="${member_ldap.uid.first()}"/>
|
||||
<span class="macInvalid">adresse mac invalide</span>
|
||||
<input type="submit" value="ajouter" class="button"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -4,7 +4,13 @@
|
||||
<head>
|
||||
<link type="text/css" rel="Stylesheet" href="/css/common.css" />
|
||||
<link type="text/css" rel="Stylesheet" href="/css/show.css" />
|
||||
<script src="/js/mac_address_changer.js" />
|
||||
<script src="/js/jquery-1.11.1.min.js" />
|
||||
<script src="/js/mac_address_changer.js" />
|
||||
<style type="text/css">
|
||||
.macInvalid {
|
||||
color:red; display:none;
|
||||
}
|
||||
</style>
|
||||
<xi:include href="common-css-header.html" />
|
||||
</head>
|
||||
<body>
|
||||
@ -24,7 +30,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">E-mail</span>
|
||||
<input type="text" name="mail" value="" />
|
||||
<input type="email" name="mail" value="" />
|
||||
</div>
|
||||
<div>
|
||||
<span class="item_name">Téléphone</span>
|
||||
@ -45,11 +51,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<span class="section_name show_section_name">MACHINE</span>
|
||||
<div>
|
||||
<span class="section_name show_section_name">MACHINE</span><br />
|
||||
<strong>Aide à la complétion</strong> -> vous avez un clavier <select id="osRegister"><option value="win">Windows</option><option value="mac">MacOSX</option></select>
|
||||
<input type="checkbox" id="disablevalid">Disable mac validation</input>
|
||||
<div id="machine_add">
|
||||
<div>
|
||||
<input type="text" name="first_machine_name" placeholder="nom de la machine" class="item_name"/>
|
||||
<input type="text" name="first_machine_mac" onkeyup="mac_address_correcter()" id="mac_adress_input" placeholder="adresse mac" />
|
||||
<input type="text" name="first_machine_name" placeholder="nom de la machine" class="item_name"/>
|
||||
<input type="text" name="first_machine_mac" class="macValidator" id="mac_adress_input" placeholder="adresse mac" />
|
||||
<span class="macInvalid">adresse mac invalide</span>
|
||||
<a href="#" class="button" onclick="addMacField()">+</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user