ajout d'une interface pour la gestion des machines
darcs-hash:20061110134614-f46e9-a636e37c33caab306cfd87e565f2fad28c78596f.gz
This commit is contained in:
parent
f4d5e3c798
commit
4e7c67e33b
14 changed files with 1124 additions and 406 deletions
|
@ -71,7 +71,7 @@ from plugins.verifdroitsfilter import VerifDroitsFilter
|
||||||
class Intranet:
|
class Intranet:
|
||||||
__ldap = None
|
__ldap = None
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
from pages import monCompte, impression, factures, digicode
|
from pages import monCompte, impression, factures, digicode, mesmachines
|
||||||
self.__ldap = cherrypy.config.configMap["global"]["crans_ldap"]
|
self.__ldap = cherrypy.config.configMap["global"]["crans_ldap"]
|
||||||
|
|
||||||
# liste des modules disponibles
|
# liste des modules disponibles
|
||||||
|
@ -81,8 +81,8 @@ class Intranet:
|
||||||
self.digicode = digicode.root()
|
self.digicode = digicode.root()
|
||||||
|
|
||||||
# liste des modules en developpement
|
# liste des modules en developpement
|
||||||
#if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
|
if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
|
||||||
|
self.mesMachines = mesmachines.root()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,13 +92,15 @@ class Intranet:
|
||||||
return {
|
return {
|
||||||
'template':'accueil',
|
'template':'accueil',
|
||||||
'values':{},
|
'values':{},
|
||||||
|
'stylesheets':['accueil.css'],
|
||||||
}
|
}
|
||||||
index.exposed= True
|
index.exposed= True
|
||||||
|
|
||||||
def info(self):
|
def info(self):
|
||||||
return {
|
return {
|
||||||
'template':'info-diverses',
|
'template':'info-diverses',
|
||||||
'values':{}
|
'values':{},
|
||||||
|
'stylesheets':['accueil.css'],
|
||||||
}
|
}
|
||||||
info.exposed = True
|
info.exposed = True
|
||||||
|
|
||||||
|
|
|
@ -21,4 +21,4 @@ paypal.businessAdress = "gdetrez-buisness@crans.org"
|
||||||
paypal.useSandbox = True
|
paypal.useSandbox = True
|
||||||
|
|
||||||
[/static]
|
[/static]
|
||||||
staticFilter.dir = "/usr/scripts/intranet/static/"
|
staticFilter.dir = "/home/gdetrez/crans.usr.scripts/intranet/static/"
|
||||||
|
|
237
intranet/pages/mesmachines.py
Executable file
237
intranet/pages/mesmachines.py
Executable file
|
@ -0,0 +1,237 @@
|
||||||
|
#! /usr/bin/env python
|
||||||
|
# -*- coding: iso-8859-15 -*-
|
||||||
|
|
||||||
|
import cherrypy, sys, os, datetime
|
||||||
|
from time import strftime, localtime, time
|
||||||
|
# libraries crans
|
||||||
|
sys.path.append('/usr/scripts/gestion/')
|
||||||
|
from config_mail import MailConfig
|
||||||
|
if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
|
||||||
|
from ldap_crans_test import *
|
||||||
|
# print("monCompte : unsing test ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
|
||||||
|
else:
|
||||||
|
from ldap_crans import *
|
||||||
|
# print("monCompte : unsing prod ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class root:
|
||||||
|
__ldap = None
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.__ldap = cherrypy.config.configMap["global"]["crans_ldap"]
|
||||||
|
|
||||||
|
|
||||||
|
def AJAXListeMachines(self):
|
||||||
|
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||||
|
machines = []
|
||||||
|
for une_machine in adh.machines():
|
||||||
|
machineInfos = {}
|
||||||
|
# nom, mac, mid, ip
|
||||||
|
machineInfos['nom'] = une_machine.nom()
|
||||||
|
machineInfos['nomCourt'] = une_machine.nom().split('.',1)[0]
|
||||||
|
machineInfos['mid'] = une_machine.id()
|
||||||
|
# type
|
||||||
|
if une_machine.objectClass == 'machineFixe':
|
||||||
|
machineInfos['type'] = 'fixe'
|
||||||
|
#machineInfos['type'] = 'Machine fixe'
|
||||||
|
else:
|
||||||
|
machineInfos['type'] = 'wifi'
|
||||||
|
#machineInfos['type'] = 'Machine wifi'
|
||||||
|
# clef ipsec
|
||||||
|
machines.append(machineInfos)
|
||||||
|
|
||||||
|
return {"machines":machines}
|
||||||
|
AJAXListeMachines.exposed = True
|
||||||
|
|
||||||
|
def AJAXMachineInfo(self, mid):
|
||||||
|
try:
|
||||||
|
machine = self.__ldap.search('mid=' + mid)['machine'][0]
|
||||||
|
if machine.proprietaire().mail() != cherrypy.session['uid']:
|
||||||
|
raise Exception
|
||||||
|
# zamok -> pour tester l'affichage des ports, des alias
|
||||||
|
#machine = self.__ldap.search('mid=896')['machine'][0]
|
||||||
|
machineInfos = {}
|
||||||
|
# nom, mac, mid, ip
|
||||||
|
machineInfos['nom'] = machine.nom()
|
||||||
|
machineInfos['nomCourt'] = machine.nom().split('.',1)[0]
|
||||||
|
machineInfos['mac'] = machine.mac()
|
||||||
|
machineInfos['mid'] = machine.id()
|
||||||
|
machineInfos['ip'] = machine.ip()
|
||||||
|
# type
|
||||||
|
if machine.objectClass == 'machineFixe':
|
||||||
|
machineInfos['type'] = 'fixe'
|
||||||
|
else:
|
||||||
|
machineInfos['type'] = 'wifi'
|
||||||
|
# clef ipsec
|
||||||
|
try:
|
||||||
|
machineInfos['ipsec'] = machine.ipsec()
|
||||||
|
except:
|
||||||
|
machineInfos['ipsec'] = ''
|
||||||
|
# alias
|
||||||
|
machineInfos['alias'] = machine.alias()
|
||||||
|
# blacklists
|
||||||
|
machineInfos['blacklist'] = []
|
||||||
|
for blacklist_type in machine.blacklist_all()[0].keys():
|
||||||
|
for (begin, end) in machine.blacklist_all()[0][blacklist_type]:
|
||||||
|
blacklist = {}
|
||||||
|
blacklist['begin'] = strftime('%d/%m/%Y %H:%M', localtime(int(begin)))
|
||||||
|
blacklist['end'] = strftime('%d/%m/%Y %H:%M', localtime(int(end)))
|
||||||
|
blacklist['type'] = blacklist_type
|
||||||
|
blacklist['actif'] = 1
|
||||||
|
machineInfos['blacklist'].append(blacklist)
|
||||||
|
for blacklist_type in machine.blacklist_all()[1].keys():
|
||||||
|
for (begin, end) in machine.blacklist_all()[1][blacklist_type]:
|
||||||
|
blacklist = {}
|
||||||
|
blacklist['begin'] = strftime('%d/%m/%Y %H:%M', localtime(int(begin)))
|
||||||
|
blacklist['end'] = strftime('%d/%m/%Y %H:%M', localtime(int(end)))
|
||||||
|
blacklist['type'] = blacklist_type
|
||||||
|
blacklist['actif'] = 0
|
||||||
|
machineInfos['blacklist'].append(blacklist)
|
||||||
|
# ports
|
||||||
|
machineInfos['ports'] = []
|
||||||
|
if machine.portTCPin() != []:
|
||||||
|
machineInfos['ports'].append(
|
||||||
|
{
|
||||||
|
'titre':'Ports TCP ouvert ext->machine',
|
||||||
|
'ports':machine.portTCPin()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if machine.portTCPout() != []:
|
||||||
|
machineInfos['ports'].append(
|
||||||
|
{
|
||||||
|
'titre':'Ports TCP ouvert machine->ext',
|
||||||
|
'ports':machine.portTCPout()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if machine.portUDPin() != []:
|
||||||
|
machineInfos['ports'].append(
|
||||||
|
{
|
||||||
|
'titre':'Ports UDP ouvert ext->machine',
|
||||||
|
'ports':machine.portUDPin()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if machine.portUDPout() != []:
|
||||||
|
machineInfos['ports'].append(
|
||||||
|
{
|
||||||
|
'titre':'Ports TCP ouvert machine->ext',
|
||||||
|
'ports':machine.portUDPout()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return machineInfos
|
||||||
|
except Exception, e:
|
||||||
|
return {"erreur":str(e)}
|
||||||
|
AJAXMachineInfo.exposed = True
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# affichage
|
||||||
|
##########################
|
||||||
|
#
|
||||||
|
# methode qui affiche la template
|
||||||
|
#
|
||||||
|
def index(self):
|
||||||
|
return {
|
||||||
|
'template' :'machines',
|
||||||
|
'values' :{},
|
||||||
|
'stylesheets' :['machines.css'],
|
||||||
|
'scripts':['machines.js'],
|
||||||
|
}
|
||||||
|
index.exposed = True
|
||||||
|
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# methodes pour changer
|
||||||
|
# des valeurs
|
||||||
|
###########################################################################
|
||||||
|
#
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# machine:nom
|
||||||
|
##########################
|
||||||
|
def AJAXChangerNom(self, mid, nouveauNom):
|
||||||
|
try:
|
||||||
|
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||||
|
mach = self.__ldap.search('mid=' + mid, 'w')['machine'][0]
|
||||||
|
# tester si c'est bien la machine de l'adherent
|
||||||
|
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
||||||
|
del adh, mach
|
||||||
|
raise Exception(u"L'uid de l'adherent ne correspond mas au proprietaire de la machine.")
|
||||||
|
mach.nom(nouveauNom)
|
||||||
|
mach.save()
|
||||||
|
del mach
|
||||||
|
except ValueError, e:
|
||||||
|
raise e
|
||||||
|
#return {'error':str(e)}
|
||||||
|
cherrypy.log("Changer nom machine : %s" % nouveauNom, "MESMACHINES")
|
||||||
|
return {'message':u"Modification réussie", 'mid':mid}
|
||||||
|
AJAXChangerNom.exposed = True
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# machine:mac
|
||||||
|
##########################
|
||||||
|
def AJAXchangerMAC(self, mid, nouvelleMAC):
|
||||||
|
try:
|
||||||
|
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||||
|
mach = self.__ldap.search('mid=' + mid, 'w')['machine'][0]
|
||||||
|
# tester si c'est bien la machine de l'adherent
|
||||||
|
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
||||||
|
del adh, mach
|
||||||
|
raise Exception(u"L'uid de l'adherent ne correspond mas au proprietaire de la machine.")
|
||||||
|
mach.mac(nouvelleMAC)
|
||||||
|
mach.save()
|
||||||
|
del mach
|
||||||
|
except ValueError, e:
|
||||||
|
return {'error':e.args[0]}
|
||||||
|
cherrypy.log("Change mac machine", "MESMACHINES")
|
||||||
|
return {'message':u"Modification réussie", 'mid':mid}
|
||||||
|
AJAXchangerMAC.exposed = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# machine:suppression
|
||||||
|
##########################
|
||||||
|
def AJAXSupprimerMachine(self, mid):
|
||||||
|
try:
|
||||||
|
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||||
|
mach = self.__ldap.search('mid=' + mid, 'w')['machine'][0]
|
||||||
|
# tester si c'est bien la machine de l'adherent
|
||||||
|
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
||||||
|
del adh, mach
|
||||||
|
raise Exception(u"L'uid de l'adherent ne correspond mas au proprietaire de la machine.")
|
||||||
|
mach.delete()
|
||||||
|
except ValueError, e:
|
||||||
|
return {'error':e.args[0]}
|
||||||
|
cherrypy.log("Machine supprimee", "MACHINES")
|
||||||
|
return {'message':u"Machine supprimée"}
|
||||||
|
AJAXSupprimerMachine.exposed = True
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# machine:creation
|
||||||
|
##########################
|
||||||
|
def AJAXCreerMachine(self, nomNouvelleMachine, MACNouvelleMachine, typeNouvelleMachine):
|
||||||
|
adh = self.__ldap.search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||||
|
if typeNouvelleMachine=='wifi' and adh.droits() == [] and adh.machines_fixes() != []:
|
||||||
|
return {'error':'Vous avez deja une machine fixe. Vous ne pouvez ajouter que des machines WiFi.'}
|
||||||
|
try:
|
||||||
|
if typeNouvelleMachine=='wifi':
|
||||||
|
m = MachineWifi(adh)
|
||||||
|
elif typeNouvelleMachine=='fixe':
|
||||||
|
m = MachineFixe(adh)
|
||||||
|
else:
|
||||||
|
raise Exception, "type de machine inconnu : %s " % typeNouvelleMachine
|
||||||
|
m.nom(nomNouvelleMachine)
|
||||||
|
m.mac(MACNouvelleMachine)
|
||||||
|
m.ip("<automatique>")
|
||||||
|
message = m.save()
|
||||||
|
del m
|
||||||
|
except ValueError, e:
|
||||||
|
del m
|
||||||
|
return {'error':e.args[0].replace("\n","\\n")}
|
||||||
|
cherrypy.log("Nouvelle machine %s" % nomNouvelleMachine, "MACHINES")
|
||||||
|
return {'message':u"Machine enregistrée avec succès"}
|
||||||
|
AJAXCreerMachine.exposed = True
|
||||||
|
|
||||||
|
|
||||||
|
|
74
intranet/static/css/accueil.css
Normal file
74
intranet/static/css/accueil.css
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/*************************************************************
|
||||||
|
..
|
||||||
|
.... ............ ........
|
||||||
|
. ....... . .... ..
|
||||||
|
. ... .. .. .. .. ..... . ..
|
||||||
|
.. .. ....@@@. .. . ........ .
|
||||||
|
.. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||||
|
.@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||||
|
@@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||||
|
.@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||||
|
...@@@.... @@@ .@@.......... ........ ..... ..
|
||||||
|
. ..@@@@.. . .@@@@. .. ....... . .............
|
||||||
|
. .. .... .. .. . ... ....
|
||||||
|
. . .... ............. .. ...
|
||||||
|
.. .. ... ........ ... ...
|
||||||
|
................................
|
||||||
|
|
||||||
|
==============================================================
|
||||||
|
mainInterface.css - Intranet Style
|
||||||
|
|
||||||
|
Mise en page de l'accueil
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (c) 2006 by www.crans.org
|
||||||
|
|
||||||
|
**************************************************************/
|
||||||
|
|
||||||
|
div.framed_gray {
|
||||||
|
border:5px solid #e2e2e2; /* #acc0ff */
|
||||||
|
background-color:#f2f2f2;
|
||||||
|
padding:10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.framed_gray fieldset {
|
||||||
|
border-width:2px;
|
||||||
|
border-style:solid none none none;
|
||||||
|
border-color:#a2a2a2;
|
||||||
|
padding:10px;
|
||||||
|
margin:10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.framed_gray fieldset legend {
|
||||||
|
color:#a2a2a2;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.framed_gray fieldset ul {
|
||||||
|
list-style-type:none;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.framed_gray fieldset ul li {
|
||||||
|
float:left;
|
||||||
|
height:70px;
|
||||||
|
width:100px;
|
||||||
|
margin:5px;
|
||||||
|
display:block;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.framed_gray fieldset ul li span {
|
||||||
|
margin-bottom:0;
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
div.framed_gray fieldset ul a {
|
||||||
|
color:black;
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.framed_gray fieldset ul li img {
|
||||||
|
margin:2px auto;
|
||||||
|
width:32px;
|
||||||
|
height:32px;
|
||||||
|
}
|
160
intranet/static/css/machines.css
Normal file
160
intranet/static/css/machines.css
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
/*************************************************************
|
||||||
|
..
|
||||||
|
.... ............ ........
|
||||||
|
. ....... . .... ..
|
||||||
|
. ... .. .. .. .. ..... . ..
|
||||||
|
.. .. ....@@@. .. . ........ .
|
||||||
|
.. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||||
|
.@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||||
|
@@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||||
|
.@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||||
|
...@@@.... @@@ .@@.......... ........ ..... ..
|
||||||
|
. ..@@@@.. . .@@@@. .. ....... . .............
|
||||||
|
. .. .... .. .. . ... ....
|
||||||
|
. . .... ............. .. ...
|
||||||
|
.. .. ... ........ ... ...
|
||||||
|
................................
|
||||||
|
|
||||||
|
==============================================================
|
||||||
|
macines.css - Intranet Style
|
||||||
|
|
||||||
|
Copyright (c) 2006 by www.crans.org
|
||||||
|
|
||||||
|
**************************************************************/
|
||||||
|
#globalDiv {
|
||||||
|
padding-left : 25%;
|
||||||
|
margin:0;
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
margin: 0 5px .5em 5px;padding:5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.alias {
|
||||||
|
color:gray;
|
||||||
|
margin:0;
|
||||||
|
padding:0 0 0 60px;
|
||||||
|
display:block;
|
||||||
|
font-weight:normal;
|
||||||
|
font-size:0.6em;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
table.blacklist_table,
|
||||||
|
table.ports_table {
|
||||||
|
border-top: thin black solid;
|
||||||
|
border-left: thin black solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.blacklist_table td,
|
||||||
|
table.blacklist_table th,
|
||||||
|
table.ports_table td,
|
||||||
|
table.ports_table th {
|
||||||
|
border-right: thin black solid;
|
||||||
|
border-bottom: thin black solid;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actif {
|
||||||
|
color:red;
|
||||||
|
}
|
||||||
|
.inactif {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#gestion_machines_main_frame {
|
||||||
|
padding:5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.basicInfos dt {
|
||||||
|
float:left;
|
||||||
|
font-weight:bold;
|
||||||
|
clear:left;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl.basicInfos dd {
|
||||||
|
float:left;
|
||||||
|
margin:0 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#listeMachines {
|
||||||
|
list-style-type:none;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#listeMachines li {
|
||||||
|
float:left;
|
||||||
|
height:70px;
|
||||||
|
width:100px;
|
||||||
|
margin:5px;
|
||||||
|
display:block;
|
||||||
|
text-align:center;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#listeMachines li span {
|
||||||
|
margin-bottom:0;
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#listeMachines li a {
|
||||||
|
display:block;
|
||||||
|
color:black;
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#listeMachines li a:hover {
|
||||||
|
background:#bbbbff;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#listeMachines li a:active {
|
||||||
|
background:#8888ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#listeMachines li img {
|
||||||
|
margin:2px auto;
|
||||||
|
width:32px;
|
||||||
|
height:32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu_actions {
|
||||||
|
background:#eeeeff;
|
||||||
|
padding:.3em;
|
||||||
|
max-width:20%;
|
||||||
|
float:left;
|
||||||
|
position:absolute;
|
||||||
|
top:1em;
|
||||||
|
left:0;
|
||||||
|
border: thin black solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu_actions ul {
|
||||||
|
list-style-type:none;
|
||||||
|
padding:0;
|
||||||
|
margin:.5em;
|
||||||
|
}
|
||||||
|
#menu_actions ul li a {
|
||||||
|
text-decoration:none;
|
||||||
|
}
|
||||||
|
#menu_actions ul li a:hover {
|
||||||
|
text-decoration:underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu_actions h1 {
|
||||||
|
font-size:1em;
|
||||||
|
margin:0;
|
||||||
|
text-align:center;
|
||||||
|
border-bottom: thin black solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// on change la couleur des messages
|
||||||
|
.message {
|
||||||
|
background-color:#000080;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
width:175px;
|
||||||
|
display:block;
|
||||||
|
float:left;
|
||||||
|
}
|
|
@ -28,8 +28,8 @@ Copyright (c) 2006 by www.crans.org
|
||||||
/* STYLE GLOBAL
|
/* STYLE GLOBAL
|
||||||
- body
|
- body
|
||||||
- liens
|
- liens
|
||||||
- titres
|
- messages
|
||||||
- images
|
- aides
|
||||||
- ...
|
- ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -60,8 +60,6 @@ div#pageContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/* LE HAUT DES PAGES
|
/* LE HAUT DES PAGES
|
||||||
- le logo a gauche
|
- le logo a gauche
|
||||||
- petit menu a droite
|
- petit menu a droite
|
||||||
|
@ -126,6 +124,55 @@ ul#main_topContentMenu hr, div#topMenu h1 {
|
||||||
margin:5px;
|
margin:5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* Messages
|
||||||
|
* (les messages affichés sur les pages pour indiquer le bon déroulement
|
||||||
|
* ou non d'une action)
|
||||||
|
**************************************************************************/
|
||||||
|
#_crans_main_message_place_holder {
|
||||||
|
height:0;
|
||||||
|
overflow:visible;
|
||||||
|
position:absolute;
|
||||||
|
top:100px;
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.messageText {
|
||||||
|
padding:2px 10px;
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message {
|
||||||
|
padding: 0;
|
||||||
|
background: #fad163;
|
||||||
|
width: 300px;
|
||||||
|
text-align: center;
|
||||||
|
margin : 1px auto 10px auto;
|
||||||
|
}
|
||||||
|
.errorMessage {
|
||||||
|
display:block;
|
||||||
|
background:white;
|
||||||
|
border:2px #cc0000 solid;
|
||||||
|
padding:5px;
|
||||||
|
text-align:center;
|
||||||
|
min-width:230px;
|
||||||
|
max-width:430px;
|
||||||
|
font-weight:bold;
|
||||||
|
margin : 1px auto 10px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#_crans_main_message_chargement {
|
||||||
|
background:#cc0000;
|
||||||
|
position:fixed;
|
||||||
|
top:1px;
|
||||||
|
right:1px;
|
||||||
|
z-index:1000;
|
||||||
|
display:none;
|
||||||
|
padding:2px 3px;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* DIVERS
|
* DIVERS
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -142,56 +189,8 @@ ul#main_topContentMenu hr, div#topMenu h1 {
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div.visualClear {clear:both;}
|
div.visualClear {clear:both;}
|
||||||
|
|
||||||
div.framed_gray {
|
|
||||||
border:5px solid #e2e2e2; /* #acc0ff */
|
|
||||||
background-color:#f2f2f2;
|
|
||||||
padding:10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.framed_gray fieldset {
|
|
||||||
border-width:2px;
|
|
||||||
border-style:solid none none none;
|
|
||||||
border-color:#a2a2a2;
|
|
||||||
padding:10px;
|
|
||||||
margin:10px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.framed_gray fieldset legend {
|
|
||||||
color:#a2a2a2;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.framed_gray fieldset ul {
|
|
||||||
list-style-type:none;
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.framed_gray fieldset ul li {
|
|
||||||
float:left;
|
|
||||||
height:70px;
|
|
||||||
width:100px;
|
|
||||||
margin:5px;
|
|
||||||
display:block;
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.framed_gray fieldset ul li span {
|
|
||||||
margin-bottom:0;
|
|
||||||
display:block;
|
|
||||||
}
|
|
||||||
div.framed_gray fieldset ul a {
|
|
||||||
color:black;
|
|
||||||
text-decoration:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.framed_gray fieldset ul li img {
|
|
||||||
margin:2px auto;
|
|
||||||
width:32px;
|
|
||||||
height:32px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.aide {
|
.aide {
|
||||||
font-size:0.8em;
|
font-size:0.8em;
|
||||||
|
|
|
@ -1,193 +1,81 @@
|
||||||
function askForName(oldName) {
|
/* ************************************************************
|
||||||
var c = '';
|
* Crans
|
||||||
while ( c == '')
|
************************************************************
|
||||||
c = prompt("Votre nom :",oldName);
|
* Crans.messages : afficher des messages sur les pages
|
||||||
if (c == null)
|
* Crans.loading : afficher l'indicateur de chargement
|
||||||
return false;
|
*/
|
||||||
else
|
Crans = {};
|
||||||
window.location.href= 'changeNomAdherent?nouveauNom=' + c;
|
|
||||||
|
/*****************************
|
||||||
|
Crans.Messages
|
||||||
|
*****************************/
|
||||||
|
Crans.messages = {}
|
||||||
|
Crans.messages.initialized = false;
|
||||||
|
|
||||||
|
Crans.messages.init = function()
|
||||||
|
{
|
||||||
|
if (!Crans.messages.initialized)
|
||||||
|
{
|
||||||
|
updateNodeAttributes(document.body, {'onclick':'Crans.messages.setMessage();'});
|
||||||
|
appendChildNodes(document.body, DIV({'id':'_crans_main_message_place_holder'}));
|
||||||
|
Crans.messages.initialized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function askForSurname(oldSurname) {
|
Crans.messages.setMessage = function(m, messageClass)
|
||||||
var c = '';
|
{
|
||||||
while ( c == '')
|
if (!Crans.messages.initialized)
|
||||||
c = prompt("Votre prénom :",oldSurname);
|
Crans.messages.init();
|
||||||
if (c == null)
|
if (m == null) {
|
||||||
return false;
|
var messageBox = '';
|
||||||
else
|
} else {
|
||||||
window.location.href= 'changePrenomAdherent?nouveauPrenom=' + c;
|
if (messageClass==null)
|
||||||
|
messageClass='message';
|
||||||
|
var textHolder = SPAN({'class':'messageText'},m);
|
||||||
|
var messageBox = DIV({'class':messageClass},textHolder);
|
||||||
|
var messagePlace = document.getElementById("_crans_main_message_place_holder");
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var messagePlace = document.getElementById("_crans_main_message_place_holder");
|
||||||
|
replaceChildNodes(messagePlace,messageBox);
|
||||||
|
try {roundElement(messageBox);} catch (error) {}
|
||||||
|
}
|
||||||
|
catch (error)
|
||||||
|
{
|
||||||
|
logError("élement _crans_main_message_place_holder introuvable")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function askForTel(oldTel) {
|
/*****************************
|
||||||
var c = '';
|
Crans.loading
|
||||||
while ( c == '')
|
*****************************/
|
||||||
c = prompt("Votre numéro de téléphone :",oldTel);
|
Crans.loading = {}
|
||||||
if (c == null)
|
Crans.loading.initialized = false;
|
||||||
return false;
|
|
||||||
else
|
Crans.loading.init = function(){
|
||||||
window.location.href= 'changeTelAdherent?nouveauTel=' + c;
|
try {
|
||||||
|
if (!Crans.loading.initialized) {
|
||||||
|
appendChildNodes(document.body, DIV({'id':'_crans_main_message_chargement'}, "Chargement..."));
|
||||||
|
Crans.loading.initialized = true;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logError(error.description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function askForMachineMac(oldMac, mid) {
|
Crans.loading.display = function(bool) {
|
||||||
var c = '';
|
if (!Crans.loading.initialized)
|
||||||
while ( c == '')
|
Crans.loading.init();
|
||||||
c = prompt("Adresse MAC de la machine :",oldMac);
|
var loadingEl = document.getElementById("_crans_main_message_chargement");
|
||||||
if (c == null)
|
if (loadingEl) {
|
||||||
return false;
|
if (bool) {
|
||||||
var e = loadJSONDoc('changeMACMachine?nouvelleMAC=' + c + '&mid=' + mid);
|
appear(loadingEl);
|
||||||
e.addCallback(machineModifHandler);
|
} else {
|
||||||
e.addErrback(ajaxErrorHandler);
|
fade(loadingEl);
|
||||||
loading(true);
|
}
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
function askForMachineName(oldName, mid) {
|
|
||||||
var c = '';
|
|
||||||
while ( c == '')
|
|
||||||
c = prompt("Nom de la machine :",oldName);
|
|
||||||
if (c == null)
|
|
||||||
return false;
|
|
||||||
var e = loadJSONDoc("changeNomMachine?nouveauNom=" + c + "&mid=" + mid);
|
|
||||||
e.addCallback(machineModifHandler);
|
|
||||||
e.addErrback(ajaxErrorHandler);
|
|
||||||
loading(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function askForDeleteMachine(mid, nom) {
|
|
||||||
if (confirm("Supprimer la machine ?")) {
|
|
||||||
var e = loadJSONDoc('supprimeMachine?mid=' + mid);
|
|
||||||
e.addCallback(machineModifHandler);
|
|
||||||
e.addErrback(ajaxErrorHandler);
|
|
||||||
loading(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function newAlias() {
|
|
||||||
var c = '';
|
|
||||||
while ( c == '')
|
|
||||||
c = prompt("Nouvel alias :");
|
|
||||||
if (c == null)
|
|
||||||
return false;
|
|
||||||
else
|
|
||||||
window.location.href= 'newAlias?alias=' + c + "#mailTab";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function newMachineNode(name, shortName, mac, ip, mid, type, ipsec) {
|
|
||||||
machineName = H3({},shortName);
|
|
||||||
|
|
||||||
var propertiesList = createDOM("DL",{'class':'machineInfos'});
|
|
||||||
valuesList = [
|
|
||||||
{'label':'Type : ', 'value':type},
|
|
||||||
{'label':'Mac : ', 'value':mac},
|
|
||||||
{'label':'IP : ', 'value':ip},
|
|
||||||
{'label':'ipsec : ', 'value':ipsec},
|
|
||||||
] ;
|
|
||||||
for (var i=0; i<valuesList.length; i++) {
|
|
||||||
var item = valuesList[i];
|
|
||||||
if (item.value) {
|
|
||||||
propertiesList.appendChild(createDOM("DT",item.label));
|
|
||||||
propertiesList.appendChild(createDOM("DD",item.value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var actions = SPAN({'class':'actions'},[
|
|
||||||
A({'href':'#','onclick':"return askForMachineName('"+shortName+"','"+mid+"');"},'Renommer'),
|
|
||||||
A({'href':'#','onclick':"return askForMachineMac('"+mac+"','"+mid+"');"},'Changer de MAC'),
|
|
||||||
A({'href':'#','onclick':"return askForDeleteMachine('"+mid+"');"},'Supprimer'),
|
|
||||||
]);
|
|
||||||
return LI({},[
|
|
||||||
machineName,
|
|
||||||
propertiesList,
|
|
||||||
DIV({'class':'clear'},''),
|
|
||||||
actions,
|
|
||||||
DIV({'class':'clear'},''),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function newMachineLiNodeFromDict(adict) {
|
|
||||||
return LI({},newMachineNode(adict.nom, adict.nomCourt, adict.mac, adict.ip, adict.mid, adict.type, adict.ipsec));
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderMachineList(result) {
|
|
||||||
replaceChildNodes('machineList',map(newMachineLiNodeFromDict,result.machines));
|
|
||||||
}
|
|
||||||
function loadMachineList() {
|
|
||||||
var e = loadJSONDoc('listeMachines');
|
|
||||||
e.addCallback(renderMachineList);
|
|
||||||
e.addErrback(ajaxErrorHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ajaxErrorHandler(d) {
|
|
||||||
loading(false);
|
|
||||||
alert(d)
|
|
||||||
logError("AJAX Error");
|
|
||||||
logerror(d);
|
|
||||||
window.location.href= "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function machineModifHandler(result) {
|
|
||||||
loading(false);
|
|
||||||
if (result.message){
|
|
||||||
setMessage(result.message);
|
|
||||||
addMachineForm.clear();
|
|
||||||
logDebug("AJAX Succed");
|
|
||||||
}
|
|
||||||
if (result.error){
|
|
||||||
alert(result.error);
|
|
||||||
logError("AJAX error");
|
|
||||||
}
|
|
||||||
loadMachineList();
|
|
||||||
}
|
|
||||||
|
|
||||||
addMachineForm = {}
|
|
||||||
|
|
||||||
addMachineForm.setFieldValue = function(fieldName, newValue) {
|
|
||||||
document.addMachineForm[fieldName] = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
addMachineForm.clear = function() {
|
|
||||||
document.addMachineForm.reset();
|
|
||||||
logDebug("addMachineForm cleared");
|
|
||||||
}
|
|
||||||
|
|
||||||
function creerMachine(nom, mac, estMachineWifi) {
|
|
||||||
var e = loadJSONDoc("creerMachine?nomNouvelleMachine=" + nom + "&MACNouvelleMachine=" + mac + "&estMachineWifi="+estMachineWifi);
|
|
||||||
e.addCallback(machineModifHandler);
|
|
||||||
e.addErrback(ajaxErrorHandler);
|
|
||||||
loading(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function setMessage(m, messageClass) {
|
|
||||||
if (m == null) {
|
|
||||||
var messagePlace = document.getElementById("messagePlaceHolder");
|
|
||||||
replaceChildNodes(messagePlace,'');
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (messageClass==null)
|
|
||||||
messageClass='message'
|
|
||||||
var textHolder = SPAN({'class':'messageText'},m);
|
|
||||||
var messageBox = DIV({'class':messageClass},textHolder);
|
|
||||||
var messagePlace = document.getElementById("messagePlaceHolder");
|
|
||||||
replaceChildNodes(messagePlace,messageBox);
|
|
||||||
roundElement(messageBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loading(bool) {
|
|
||||||
var loadingEl = document.getElementById("loadings");
|
|
||||||
if (loadingEl) {
|
|
||||||
if (bool) {
|
|
||||||
loadingEl.style.display='block';
|
|
||||||
} else {
|
|
||||||
loadingEl.style.display='none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/* ************************************************************
|
/* ************************************************************
|
||||||
* Digicode
|
* Digicode
|
||||||
************************************************************
|
************************************************************
|
||||||
* Digicode.init : initialisation de la page
|
* Digicode.init : initialisation de la page
|
||||||
* Digicode.makeCode : creation de codes
|
* Digicode.makeCode : creation de codes
|
||||||
* Digicode.codelist : liste des codes
|
* Digicode.codelist : liste des codes
|
||||||
* Digicode.AJAX : ajax
|
* Digicode.AJAX : ajax
|
||||||
*/
|
*/
|
||||||
Digicode = {};
|
Digicode = {};
|
||||||
|
|
||||||
/*****************************
|
/*****************************
|
||||||
|
@ -13,13 +13,13 @@ Digicode = {};
|
||||||
*****************************/
|
*****************************/
|
||||||
Digicode.init = function()
|
Digicode.init = function()
|
||||||
{
|
{
|
||||||
// afficher le tableau codelist
|
// afficher le tableau codelist
|
||||||
appendChildNodes("globalDiv", Digicode.codelist.create())
|
appendChildNodes("globalDiv", Digicode.codelist.create());
|
||||||
// recuperer la liste des codes
|
// recuperer la liste des codes
|
||||||
this.codelist.load();
|
this.codelist.load();
|
||||||
// afficher le formulaire de creation de code
|
// afficher le formulaire de creation de code
|
||||||
appendChildNodes("globalDiv", DIV({"id":"addCodeBox"}));
|
appendChildNodes("globalDiv", DIV({"id":"addCodeBox"}));
|
||||||
Digicode.makeCode.displayForm();
|
Digicode.makeCode.displayForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************
|
/*****************************
|
||||||
|
@ -29,74 +29,76 @@ Digicode.makeCode = {}
|
||||||
|
|
||||||
Digicode.makeCode.displayForm = function()
|
Digicode.makeCode.displayForm = function()
|
||||||
{
|
{
|
||||||
|
var myForm = FORM({'id':'createCodeForm', 'name':'createCodeForm','onsubmit':"Digicode.makeCode.createCode(document.createCodeForm.newCode.value); return false;", 'style':'display: none;'},
|
||||||
var myForm = FORM({'id':'createCodeForm', 'name':'createCodeForm','onsubmit':"Digicode.makeCode.createCode(document.createCodeForm.newCode.value); return false;", 'style':'display: none;'},
|
LABEL({'for':'newCodeLogin', "style":"clear:left;"}, "Login adhérent :"),
|
||||||
BUTTON({"type":"button","onclick":"Digicode.makeCode.createCode(document.createCodeForm.newCode.value)", "style":"float:right;"},"Créer code"),
|
INPUT({"name":"newCodeLogin", "size":"10", "maxlength":"20", "style":"float:rightk;clear:both;"}),
|
||||||
INPUT({"name":"newCode", "size":"6", "maxlength":"6", "style":"float:right;"}),
|
LABEL({'for':'newCode', "style":"clear:left;"}, "Code :"),
|
||||||
BUTTON({"type":"button","onclick":"Digicode.makeCode.createCode()", "style":"float:right;clear:both;"},"Code aléatoire")
|
INPUT({"name":"newCode", "size":"6", "maxlength":"6", "style":"float:rightk;clear:both;"}),
|
||||||
);
|
BUTTON({"type":"button","onclick":"Digicode.makeCode.createCode(document.createCodeForm.newCodeLogin.value, document.createCodeForm.newCode.value)", "style":"float:right;"},"Créer code"),
|
||||||
replaceChildNodes("addCodeBox", H1({},"Nouveau code"), myForm );
|
BUTTON({"type":"button","onclick":"Digicode.makeCode.createCode(document.createCodeForm.newCodeLogin.value)", "style":"float:right;"},"Code aléatoire")
|
||||||
appear(myForm);
|
);
|
||||||
|
replaceChildNodes("addCodeBox", H1({},"Nouveau code"), myForm );
|
||||||
|
appear(myForm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Digicode.makeCode.restoreForm = function()
|
Digicode.makeCode.restoreForm = function()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
removeElement("newCodeDisplay");
|
removeElement("newCodeDisplay");
|
||||||
removeElement("loading");
|
removeElement("loading");
|
||||||
} catch (error){}
|
} catch (error){}
|
||||||
appear("createCodeForm");
|
appear("createCodeForm");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Digicode.makeCode.createCode = function(code)
|
Digicode.makeCode.createCode = function(login, code)
|
||||||
{
|
{
|
||||||
var image = createDOM("IMG",{'style':'margin-right:2px;float:right;','src':'/static/images/indicator.gif'});
|
var image = createDOM("IMG",{'style':'margin-right:2px;float:right;','src':'/static/images/indicator.gif'});
|
||||||
appendChildNodes("addCodeBox", DIV({'id':"loading",'style':'display:none;max-height:1em;float:left;'},image,"Loading"))
|
appendChildNodes("addCodeBox", DIV({'id':"loading",'style':'display:none;max-height:1em;float:left;'},image,"Loading"));
|
||||||
removeElement("createCodeForm");
|
removeElement("createCodeForm");
|
||||||
appear("loading");
|
appear("loading");
|
||||||
if (code)
|
if (code)
|
||||||
Digicode.AJAX.call("createCode?code="+code, this.handleNewCode);
|
Digicode.AJAX.call("createCode?code="+code + "&adherent=" + login, this.handleNewCode);
|
||||||
else
|
else
|
||||||
Digicode.AJAX.call("createCode", this.handleNewCode);
|
Digicode.AJAX.call("createCode?adherent=" + login, this.handleNewCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
Digicode.makeCode.handleNewCode = function(res)
|
Digicode.makeCode.handleNewCode = function(res)
|
||||||
{
|
{
|
||||||
if (res.code)
|
if (res.code)
|
||||||
{
|
{
|
||||||
appendChildNodes("addCodeBox",
|
appendChildNodes("addCodeBox",
|
||||||
DIV({'id':"newCodeDisplay",
|
DIV({'id':"newCodeDisplay",
|
||||||
'style':'display:none;font-size:2em;maring:1em;font-weight:bold;text-align:center;',
|
'style':'display:none;font-size:2em;maring:1em;font-weight:bold;text-align:center;',
|
||||||
'onclick':"Digicode.makeCode.displayForm();"},res.code));
|
'onclick':"Digicode.makeCode.displayForm();"},res.code));
|
||||||
appear("newCodeDisplay");
|
appear("newCodeDisplay");
|
||||||
removeElement("loading")
|
removeElement("loading")
|
||||||
Digicode.codelist.addCode(res);
|
Digicode.codelist.addCode(res);
|
||||||
} else if (res.erreur) {
|
} else if (res.erreur) {
|
||||||
logError("Erreur distante : " + res.erreur);
|
logError("Erreur distante : " + res.erreur);
|
||||||
alert("Erreur sur le serveur, le code est peut-être déjà pris.")
|
alert("Erreur sur le serveur, le code est peut-être déjà pris.")
|
||||||
Digicode.makeCode.displayForm();
|
Digicode.makeCode.displayForm();
|
||||||
} else if (res.formatErreur) {
|
} else if (res.formatErreur) {
|
||||||
alert("Ceci n'est pas un code valide");
|
alert("Ceci n'est pas un code valide");
|
||||||
Digicode.makeCode.displayForm();
|
Digicode.makeCode.displayForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*****************************
|
/*****************************
|
||||||
Digicode.codelist
|
Digicode.codelist
|
||||||
*****************************/
|
*****************************/
|
||||||
Digicode.codelist = {};
|
Digicode.codelist = {};
|
||||||
|
|
||||||
Digicode.codelist.create = function ()
|
Digicode.codelist.create = function ()
|
||||||
{
|
{
|
||||||
var thead = createDOM("thead", {},
|
var thead = createDOM("thead", {},
|
||||||
createDOM("th", {'class':'code'}, "Code" ),
|
createDOM("th", {'class':'code'}, "Code" ),
|
||||||
createDOM("th", {'class':'age'}, "Age")
|
createDOM("th", {'class':'age'}, "Age")
|
||||||
);
|
);
|
||||||
var tbody = createDOM("tbody", {"id":"codeList"});
|
var tbody = createDOM("tbody", {"id":"codeList"});
|
||||||
return TABLE({"id":"codesTable", "cellspacing":"0"}, thead, tbody)
|
return TABLE({"id":"codesTable", "cellspacing":"0"}, thead, tbody)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,28 +110,28 @@ Digicode.codelist.load = function()
|
||||||
|
|
||||||
Digicode.codelist.displayCodes = function(result)
|
Digicode.codelist.displayCodes = function(result)
|
||||||
{
|
{
|
||||||
if (result.codes)
|
if (result.codes)
|
||||||
replaceChildNodes('codeList',map(Digicode.codelist.newCodeTrNodeFromDict,result.codes));
|
replaceChildNodes('codeList',map(Digicode.codelist.newCodeTrNodeFromDict,result.codes));
|
||||||
else if (result.erreur)
|
else if (result.erreur)
|
||||||
logError("Erreur distante : " + result.erreur);
|
logError("Erreur distante : " + result.erreur);
|
||||||
}
|
}
|
||||||
|
|
||||||
Digicode.codelist.newCodeTrNodeFromDict = function (aDict, style)
|
Digicode.codelist.newCodeTrNodeFromDict = function (aDict, style)
|
||||||
{
|
{
|
||||||
if (style) {
|
if (style) {
|
||||||
var aRow = createDOM("TR", {'id':'code'+aDict.code,"style":style});
|
var aRow = createDOM("TR", {'id':'code'+aDict.code,"style":style});
|
||||||
} else
|
} else
|
||||||
var aRow = createDOM("TR", {'id':'code'+aDict.code});
|
var aRow = createDOM("TR", {'id':'code'+aDict.code});
|
||||||
appendChildNodes(aRow, createDOM("TD", {'class':'code'}, aDict.code, SPAN({'style':'color:gray;margin-left:2em;'}, aDict.desc ) ) );
|
appendChildNodes(aRow, createDOM("TD", {'class':'code'}, aDict.code, SPAN({'style':'color:gray;margin-left:2em;'}, aDict.desc ) ) );
|
||||||
appendChildNodes(aRow, createDOM("TD", {'class':'age'}, aDict.age) );
|
appendChildNodes(aRow, createDOM("TD", {'class':'age'}, aDict.age) );
|
||||||
return aRow;
|
return aRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
Digicode.codelist.addCode = function (aDict)
|
Digicode.codelist.addCode = function (aDict)
|
||||||
{
|
{
|
||||||
var newLine = this.newCodeTrNodeFromDict(aDict)
|
var newLine = this.newCodeTrNodeFromDict(aDict);
|
||||||
appendChildNodes("codeList", newLine);
|
appendChildNodes("codeList", newLine);
|
||||||
pulsate(newLine);
|
pulsate(newLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +141,7 @@ Digicode.codelist.addCode = function (aDict)
|
||||||
Digicode.AJAX = {}
|
Digicode.AJAX = {}
|
||||||
|
|
||||||
Digicode.AJAX.call = function(page, callBack) {
|
Digicode.AJAX.call = function(page, callBack) {
|
||||||
logDebug("calling AJAX : " + page)
|
logDebug("calling AJAX : " + page);
|
||||||
var e = loadJSONDoc(page);
|
var e = loadJSONDoc(page);
|
||||||
e.addCallback(callBack);
|
e.addCallback(callBack);
|
||||||
e.addErrback(this.errorHandler);
|
e.addErrback(this.errorHandler);
|
||||||
|
@ -150,12 +152,4 @@ Digicode.AJAX.errorHandler = function(d) {
|
||||||
logError("AJAX Error: " + d);
|
logError("AJAX Error: " + d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setInterval(Digicode.codelist.load, 30000);
|
setInterval(Digicode.codelist.load, 30000);
|
||||||
|
|
348
intranet/static/scripts/machines.js
Normal file
348
intranet/static/scripts/machines.js
Normal file
|
@ -0,0 +1,348 @@
|
||||||
|
/* ************************************************************
|
||||||
|
* Machines
|
||||||
|
************************************************************
|
||||||
|
* Machines.init : initialisation de la page
|
||||||
|
* Machines.listeMachines : liste des machines
|
||||||
|
* Machines.infoPane : information sur une machine
|
||||||
|
* Machines.actions : modifications, ajout...
|
||||||
|
* Machines.AJAX : ajax
|
||||||
|
*/
|
||||||
|
Machines = {};
|
||||||
|
|
||||||
|
/*****************************
|
||||||
|
Machines.init
|
||||||
|
*****************************/
|
||||||
|
Machines.init = function()
|
||||||
|
{
|
||||||
|
// afficher le tableau codelist
|
||||||
|
appendChildNodes("globalDiv", Machines.createFrames());
|
||||||
|
appendChildNodes("globalDiv", Machines.actions.makeMenu());
|
||||||
|
// recuperer la liste des codes
|
||||||
|
this.listeMachines.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.createFrames = function()
|
||||||
|
{
|
||||||
|
var main = DIV({"id":"gestion_machines_main_frame"});
|
||||||
|
var inside = DIV({"id":"__insideDivId", "style":"background:white;margin:5px;padding:5px;"},main);
|
||||||
|
var outside = DIV({"id":"__outsideDivId","style":"background:#000080;z-index:500;padding:0;"}, inside );
|
||||||
|
roundElement(outside);
|
||||||
|
roundElement(inside);
|
||||||
|
log("Creation du cadre");
|
||||||
|
return outside
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************
|
||||||
|
Machines.listeMachines
|
||||||
|
*****************************/
|
||||||
|
Machines.listeMachines = {};
|
||||||
|
|
||||||
|
|
||||||
|
Machines.listeMachines.load = function()
|
||||||
|
{
|
||||||
|
Machines.AJAX.call("AJAXListeMachines", Machines.listeMachines.display);
|
||||||
|
log("Chargement liste...");
|
||||||
|
Machines.currentMachine = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.listeMachines.display = function(result)
|
||||||
|
{
|
||||||
|
Crans.loading.display(false);
|
||||||
|
log("display liste");
|
||||||
|
|
||||||
|
replaceChildNodes( "gestion_machines_main_frame",
|
||||||
|
H2({}, "Mes machines"),
|
||||||
|
UL({"id":"listeMachines"}),
|
||||||
|
DIV( {"style":"clear:both;"} )
|
||||||
|
);
|
||||||
|
if (result.machines) {
|
||||||
|
replaceChildNodes('listeMachines',map(Machines.listeMachines.newMachineNodeFromDict ,result.machines));
|
||||||
|
Machines.actions.updateMenu(Machines.actions.actionForMachineList);
|
||||||
|
aMachines.currentMid = '';
|
||||||
|
}
|
||||||
|
else if (result.erreur)
|
||||||
|
logError("Erreur distante : " + result.erreur);
|
||||||
|
else
|
||||||
|
logError("Probleme bizarre...");
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.listeMachines.newMachineNodeFromDict = function (aDict, style)
|
||||||
|
{
|
||||||
|
var nom = aDict.nomCourt;
|
||||||
|
var mid = aDict.mid;
|
||||||
|
var image = "machines_icon_" + aDict.type + ".png";
|
||||||
|
//log("create an item : " + nom);
|
||||||
|
if (style) {
|
||||||
|
var anIcon = LI({'id':'machine_' + mid,"style":style});
|
||||||
|
} else
|
||||||
|
var anIcon = LI( {'id':'machine_' + mid} );
|
||||||
|
appendChildNodes(anIcon, A({"href":"#", "onclick":"Machines.infoPane.loadInfo('"+mid+"');return false;"}, IMG({"src":"/static/images/" + image}), SPAN({},nom) ) );
|
||||||
|
return anIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************
|
||||||
|
Machines.infoPane
|
||||||
|
*****************************/
|
||||||
|
Machines.infoPane = {};
|
||||||
|
|
||||||
|
Machines.infoPane.loadInfo = function(mid)
|
||||||
|
{
|
||||||
|
if (!mid)
|
||||||
|
if (!Machines.currentMachine) {
|
||||||
|
logError("Machines.infoPane.loadInfo : pas de mid, pas de machine courrante...");
|
||||||
|
return
|
||||||
|
} else
|
||||||
|
mid = Machines.currentMachine.mid;
|
||||||
|
|
||||||
|
log("load info : " + mid);
|
||||||
|
Machines.AJAX.call("AJAXMachineInfo?mid=" + mid, Machines.infoPane.display);
|
||||||
|
try {
|
||||||
|
pulsate('machine_' + mid);
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.infoPane.display = function(result)
|
||||||
|
{
|
||||||
|
Crans.loading.display(false);
|
||||||
|
if (result.nom) {
|
||||||
|
log("displaying info : " + result.mid);
|
||||||
|
// building pane
|
||||||
|
var machinePane = DIV({"id":"machine_pane"});
|
||||||
|
|
||||||
|
// lien pour retourner a la liste des machines
|
||||||
|
var back_link = A({"href":"#", "onclick":"Machines.listeMachines.load(); return false;"},"Retour");
|
||||||
|
appendChildNodes( machinePane, back_link );
|
||||||
|
|
||||||
|
// titre (nom de machine + alias)
|
||||||
|
var title = H2({}, IMG({"src":"/static/images/machines_icon_" + result.type + ".png"}), " ", result.nom);
|
||||||
|
var alias = DIV({"class":"alias"},
|
||||||
|
map(function(a_name) { return SPAN({}, a_name + " ")}, result.alias));
|
||||||
|
appendChildNodes( title, alias );
|
||||||
|
appendChildNodes( machinePane, title );
|
||||||
|
|
||||||
|
// infos de base (type, mac, ip, ipsec...)
|
||||||
|
var basicInfos = createDOM("DL", {"class":"basicInfos"});
|
||||||
|
appendChildNodes(basicInfos, createDOM("DT", "type:" ), createDOM("DD",{},"Machine " + result.type ) );
|
||||||
|
appendChildNodes(basicInfos, createDOM("DT", "mac: " ), createDOM("DD",{},result.mac ) );
|
||||||
|
appendChildNodes(basicInfos, createDOM("DT", "ip: " ), createDOM("DD",{},result.ip ) );
|
||||||
|
if (result.ipsec)
|
||||||
|
appendChildNodes(basicInfos, createDOM("DT", "Clef ipSec:" ), createDOM("DD",{},result.ipsec ) );
|
||||||
|
appendChildNodes( machinePane, basicInfos );
|
||||||
|
appendChildNodes( machinePane, DIV( {"style":"clear:both;"} ) );
|
||||||
|
|
||||||
|
|
||||||
|
// blacklist
|
||||||
|
if (result.blacklist)
|
||||||
|
if (result.blacklist.length) {
|
||||||
|
var subtitle = H3({}, "Blacklist");
|
||||||
|
appendChildNodes( machinePane, subtitle );
|
||||||
|
var blacklist_table = TABLE({"class":"blacklist_table", "cellspacing":"0"},
|
||||||
|
THEAD({},
|
||||||
|
TH({}, "Cause"),
|
||||||
|
TH({}, "Debut"),
|
||||||
|
TH({}, "Fin")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
map(function(a_blacklist_dict) {
|
||||||
|
var style = "inactif";
|
||||||
|
if (a_blacklist_dict.actif)
|
||||||
|
style = "actif";
|
||||||
|
var line = TR({"class":style},
|
||||||
|
TD({}, a_blacklist_dict.type),
|
||||||
|
TD({}, a_blacklist_dict.begin),
|
||||||
|
TD({}, a_blacklist_dict.end)
|
||||||
|
);
|
||||||
|
appendChildNodes(blacklist_table, line);
|
||||||
|
}, result.blacklist );
|
||||||
|
appendChildNodes( machinePane, blacklist_table );
|
||||||
|
}
|
||||||
|
// liste des ports ouverts
|
||||||
|
if (result.ports)
|
||||||
|
if (result.ports.length) {
|
||||||
|
var subtitle = H3({}, "Ports ouverts");
|
||||||
|
appendChildNodes( machinePane, subtitle );
|
||||||
|
var port_table = TABLE({"class":"ports_table", "cellspacing":"0"});
|
||||||
|
map(function(a_port_dict) {
|
||||||
|
var line = TR({},
|
||||||
|
TH({}, a_port_dict.titre),
|
||||||
|
map(function(a_port) {return TD({}, a_port);}, a_port_dict.ports)
|
||||||
|
);
|
||||||
|
appendChildNodes(port_table, line);
|
||||||
|
}, result.ports );
|
||||||
|
appendChildNodes( machinePane, port_table );
|
||||||
|
}
|
||||||
|
|
||||||
|
// attaching pane to document
|
||||||
|
replaceChildNodes( "gestion_machines_main_frame", machinePane);
|
||||||
|
// updationg actions
|
||||||
|
Machines.currentMachine = result;
|
||||||
|
Machines.actions.updateMenu(Machines.actions.actionsForInfoPane);
|
||||||
|
} else if (result.erreur) {
|
||||||
|
logError("Erreur distante : " + result.erreur);
|
||||||
|
} else
|
||||||
|
logError("Probleme bizarr...");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************
|
||||||
|
Machines.actions
|
||||||
|
*****************************/
|
||||||
|
Machines.actions = {}
|
||||||
|
|
||||||
|
Machines.actions.disponibles =
|
||||||
|
{
|
||||||
|
'Ajouter machine fixe':'Machines.actions.formulaire.nouvelleMachine(\'fixe\');',
|
||||||
|
'Ajouter machine wifi':'Machines.actions.formulaire.nouvelleMachine(\'wifi\');',
|
||||||
|
'Modifier Mac':'Machines.actions.formulaire.modifierMac(Machines.currentMid);',
|
||||||
|
'Renommer':'Machines.actions.formulaire.renommer(Machines.currentMid);',
|
||||||
|
'Supprimer':'Machines.actions.formulaire.supprimer(Machines.currentMid);',
|
||||||
|
'Demander l\'ouverture d\'un port':'Machines.actions.formulaire.ouverturePort(Machines.currentMid);'
|
||||||
|
}
|
||||||
|
Machines.actions.actionForMachineList = ['Ajouter machine fixe', 'Ajouter machine wifi'];
|
||||||
|
Machines.actions.actionsForInfoPane = ['Modifier Mac', 'Renommer', 'Supprimer', 'Demander l\'ouverture d\'un port'];
|
||||||
|
|
||||||
|
Machines.actions.makeMenu = function(actionListe)
|
||||||
|
{
|
||||||
|
log("building action menu");
|
||||||
|
var liste = UL({"id":"liste_actions"});
|
||||||
|
//this.updateMenu(actionListe, liste)
|
||||||
|
return DIV( {"id":"menu_actions"},
|
||||||
|
H1( {}, "ACTIONS"),
|
||||||
|
liste
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.actions.updateMenu = function(actionListe, liste_actionsNode)
|
||||||
|
{
|
||||||
|
if (!liste_actionsNode)
|
||||||
|
liste_actionsNode = "liste_actions";
|
||||||
|
replaceChildNodes(liste_actionsNode);
|
||||||
|
map(
|
||||||
|
function(actionName) {
|
||||||
|
appendChildNodes(liste_actionsNode, LI({}, Machines.actions.makeActionLink(actionName)));
|
||||||
|
}
|
||||||
|
, actionListe);
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.actions.makeActionLink = function(actionName)
|
||||||
|
{
|
||||||
|
if (this.disponibles[actionName])
|
||||||
|
{
|
||||||
|
return A({"href":"#", "onclick":this.disponibles[actionName] + "return false;"}, actionName);
|
||||||
|
} else
|
||||||
|
logError("action inconnue " + actionName);
|
||||||
|
return A({}, "???");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Machines.actions.callback = function(result) {
|
||||||
|
Crans.loading.display(false);
|
||||||
|
if (result.message){
|
||||||
|
log(result.message);
|
||||||
|
Crans.messages.setMessage(result.message);
|
||||||
|
if (result.mid)
|
||||||
|
Machines.infoPane.loadInfo(result.mid);
|
||||||
|
else
|
||||||
|
Machines.listeMachines.load();
|
||||||
|
}
|
||||||
|
if (result.error){
|
||||||
|
alert(result.error);
|
||||||
|
logError("AJAX error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// actions : affichage des formulaires
|
||||||
|
Machines.actions.formulaire = {}
|
||||||
|
Machines.actions.formulaire.modifierMac = function()
|
||||||
|
{
|
||||||
|
if (!Machines.currentMachine)
|
||||||
|
logError("pas de machine courrante");
|
||||||
|
else {
|
||||||
|
var c = '';
|
||||||
|
while ( c == '')
|
||||||
|
c = prompt("Adresse MAC de la machine :",Machines.currentMachine.mac);
|
||||||
|
if (c == null)
|
||||||
|
return false;
|
||||||
|
// AJAX stuff
|
||||||
|
Machines.AJAX.call('AJAXchangerMAC?nouvelleMAC=' + c + '&mid=' + Machines.currentMachine.mid,
|
||||||
|
Machines.actions.callback);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Machines.actions.formulaire.renommer = function() {
|
||||||
|
if (!Machines.currentMachine)
|
||||||
|
logError("pas de machine courrante");
|
||||||
|
else {
|
||||||
|
var c = '';
|
||||||
|
while ( c == '')
|
||||||
|
c = prompt("Nom de la machine :",Machines.currentMachine.nomCourt);
|
||||||
|
if (c == null)
|
||||||
|
return false;
|
||||||
|
// AJAX stuff
|
||||||
|
Machines.AJAX.call('AJAXChangerNom?nouveauNom=' + c + '&mid=' + Machines.currentMachine.mid,
|
||||||
|
Machines.actions.callback);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Machines.actions.formulaire.supprimer = function() {
|
||||||
|
if (!Machines.currentMachine)
|
||||||
|
logError("pas de machine courrante");
|
||||||
|
else {
|
||||||
|
if (confirm("Supprimer la machine " + Machines.currentMachine.nomCourt +" ?")) {
|
||||||
|
// AJAX stuff
|
||||||
|
Machines.AJAX.call('AJAXSupprimerMachine?mid=' + Machines.currentMachine.mid,
|
||||||
|
Machines.actions.callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.actions.formulaire.nouvelleMachine = function(type) {
|
||||||
|
replaceChildNodes( "gestion_machines_main_frame",
|
||||||
|
A({"href":"#", "onclick":"Machines.listeMachines.load(); return false;"},"Retour"),
|
||||||
|
H2({}, "Nouvelle machine"),
|
||||||
|
FORM({"style":"clear:both;", 'onsubmit':'Machines.actions.creerMachine(this.typeField.value, this.nom.value, this.mac.value);return false;'},
|
||||||
|
createDOM('label', {'for':'add_machine_nom'}, "Nom de la machine : "),
|
||||||
|
INPUT({"name":"nom"}),
|
||||||
|
BR(),
|
||||||
|
createDOM('label', {'for':'add_machine_mac'}, "Adresse MAC : "),
|
||||||
|
INPUT({"name":"mac"}),
|
||||||
|
BR(),
|
||||||
|
createDOM('label', {'for':'add_machine_type'}, "Type de machine : "),
|
||||||
|
SPAN({'id':'add_machine_type'}, type),
|
||||||
|
INPUT({"name":"typeField", 'type':'hidden', 'value':type}),
|
||||||
|
BR(),
|
||||||
|
BUTTON({"class":"liens", 'type':'submit'}, 'Ajouter')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.actions.creerMachine = function(type, nom, mac) {
|
||||||
|
Machines.AJAX.call('AJAXCreerMachine?nomNouvelleMachine=' + nom
|
||||||
|
+ '&MACNouvelleMachine=' + mac
|
||||||
|
+ '&typeNouvelleMachine=' + type,
|
||||||
|
Machines.actions.callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************
|
||||||
|
Machines.AJAX
|
||||||
|
*****************************/
|
||||||
|
Machines.AJAX = {}
|
||||||
|
|
||||||
|
Machines.AJAX.call = function(page, callBack) {
|
||||||
|
logDebug("calling AJAX : " + page);
|
||||||
|
var e = loadJSONDoc(page);
|
||||||
|
e.addCallback(callBack);
|
||||||
|
e.addErrback(this.errorHandler);
|
||||||
|
Crans.loading.display(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Machines.AJAX.errorHandler = function(d) {
|
||||||
|
//Machines.AJAX..modifPrix("Erreur", false);
|
||||||
|
logError("AJAX Error: " + d);
|
||||||
|
Crans.loading.display(false);
|
||||||
|
}
|
||||||
|
|
41
intranet/static/scripts/moncompte.js
Normal file
41
intranet/static/scripts/moncompte.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
function askForName(oldName) {
|
||||||
|
var c = '';
|
||||||
|
while ( c == '')
|
||||||
|
c = prompt("Votre nom :",oldName);
|
||||||
|
if (c == null)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
window.location.href= 'changeNomAdherent?nouveauNom=' + c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function askForSurname(oldSurname) {
|
||||||
|
var c = '';
|
||||||
|
while ( c == '')
|
||||||
|
c = prompt("Votre prénom :",oldSurname);
|
||||||
|
if (c == null)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
window.location.href= 'changePrenomAdherent?nouveauPrenom=' + c;
|
||||||
|
}
|
||||||
|
|
||||||
|
function askForTel(oldTel) {
|
||||||
|
var c = '';
|
||||||
|
while ( c == '')
|
||||||
|
c = prompt("Votre numéro de téléphone :",oldTel);
|
||||||
|
if (c == null)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
window.location.href= 'changeTelAdherent?nouveauTel=' + c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function newAlias() {
|
||||||
|
var c = '';
|
||||||
|
while ( c == '')
|
||||||
|
c = prompt("Nouvel alias :");
|
||||||
|
if (c == null)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
window.location.href= 'newAlias?alias=' + c + "#mailTab";
|
||||||
|
}
|
|
@ -2,33 +2,34 @@ Popup = {};
|
||||||
Popup.popupNode = null;
|
Popup.popupNode = null;
|
||||||
Popup.visible = false;
|
Popup.visible = false;
|
||||||
|
|
||||||
Popup.display = function() {
|
Popup.display = function()
|
||||||
if (this.popupNode == null) {
|
{
|
||||||
logError("Popup not created, cannot be displayed");
|
if (this.popupNode == null) {
|
||||||
return false;
|
logError("Popup not created, cannot be displayed");
|
||||||
}
|
return false;
|
||||||
appendChildNodes("pageContent", this.popupNode);
|
}
|
||||||
this.visible = true;
|
appendChildNodes("pageContent", this.popupNode);
|
||||||
// logDebug("popup visible");
|
this.visible = true;
|
||||||
|
// logDebug("popup visible");
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup.create = function(options, title_popup, content) {
|
Popup.create = function(options, title_popup, content) {
|
||||||
var inPopup = DIV({"id":"__popupInDivId", "style":"background:white;margin:2px 5px;"}, content);
|
var inPopup = DIV({"id":"__popupInDivId", "style":"background:white;margin:2px 5px;"}, content);
|
||||||
var outPopup = DIV({"id":"__popupOutDivId","style":"background:#AE0F3E;z-index:500;float:left;padding:0;min-width:300px;position:fixed;top:30%;left:30%;right:30%;"}, H1({"style":"font-size:1em;margin:0;text-align:center;color:white;"}, IMG({"src":"/static/images/WindowTitleLogo.png","alt":"icon", "style":"margin:0 5px;"}), title_popup), inPopup );
|
var outPopup = DIV({"id":"__popupOutDivId","style":"background:#AE0F3E;z-index:500;float:left;padding:0;min-width:300px;position:fixed;top:30%;left:30%;right:30%;"}, H1({"style":"font-size:1em;margin:0;text-align:center;color:white;"}, IMG({"src":"/static/images/WindowTitleLogo.png","alt":"icon", "style":"margin:0 5px;"}), title_popup), inPopup );
|
||||||
roundElement(outPopup);
|
roundElement(outPopup);
|
||||||
logDebug("Popup \""+ title_popup +"\" created");
|
logDebug("Popup \""+ title_popup +"\" created");
|
||||||
this.popupNode = outPopup;
|
this.popupNode = outPopup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup.hide = function() {
|
Popup.hide = function() {
|
||||||
if (this.visible) {
|
if (this.visible) {
|
||||||
removeElement(this.popupNode);
|
removeElement(this.popupNode);
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
}
|
||||||
// logDebug("popup not visible");
|
// logDebug("popup not visible");
|
||||||
}
|
}
|
||||||
Popup.closeLink = function(options, text_link) {
|
Popup.closeLink = function(options, text_link) {
|
||||||
options["href"] = "#";
|
options["href"] = "#";
|
||||||
options["onclick"] = "Popup.hide()";
|
options["onclick"] = "Popup.hide()";
|
||||||
return A(options, text_link);
|
return A(options, text_link);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,10 @@ $sys.path.append(cherrypy.config.get('rootDir'))
|
||||||
<img src="/static/images/icon_monCompte.png" alt="icon" />
|
<img src="/static/images/icon_monCompte.png" alt="icon" />
|
||||||
<span>Mon Compte</span>
|
<span>Mon Compte</span>
|
||||||
</a></li>
|
</a></li>
|
||||||
|
<li><a href="/mesMachines">
|
||||||
|
<img src="/static/images/machines_icon_fixe.png" alt="icon" />
|
||||||
|
<span>Mes Machines</span>
|
||||||
|
</a></li>
|
||||||
<li><a href="/impression">
|
<li><a href="/impression">
|
||||||
<img src="/static/images/icon_impression.png" alt="icon" />
|
<img src="/static/images/icon_impression.png" alt="icon" />
|
||||||
<span>Impression</span>
|
<span>Impression</span>
|
||||||
|
|
13
intranet/templates/machines.tmpl
Normal file
13
intranet/templates/machines.tmpl
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<div id="messagePlaceHolder"></div>
|
||||||
|
|
||||||
|
<h1>Gestion de mes machines</h1>
|
||||||
|
<div id="globalDiv">
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
Machines.init();
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<noscript>
|
||||||
|
Cette page utilise javascript. Elle n'est pas supportée par votre navigateur.
|
||||||
|
</noscript>
|
|
@ -1,24 +1,24 @@
|
||||||
<div id="messagePlaceHolder"></div>
|
|
||||||
|
|
||||||
#if $message != ''
|
#if $message != ''
|
||||||
<script type="text/javascript">setMessage('$message.replace("\'","\\\'")')</script>
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
Crans.messages.setMessage('$message.replace("\'","\\\'")')
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
#if $error != ''
|
#if $error != ''
|
||||||
<script type="text/javascript">setMessage('$error.replace("\'","\\\'")', 'errorMessage')</script>
|
<script type="text/javascript">
|
||||||
|
<!--
|
||||||
|
Crans.messages.setMessage('$error.replace("\'","\\\'")', 'errorMessage')
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
#end if
|
#end if
|
||||||
|
|
||||||
|
<div id="globalDiv">
|
||||||
<div id="loadings">
|
|
||||||
Chargement en cours...
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="globalDiv" onclick="setMessage();">
|
|
||||||
<div id="paramCompte" class="domtab">
|
<div id="paramCompte" class="domtab">
|
||||||
<h1>Paramètres de mon compte</h1>
|
<h1>Paramètres de mon compte</h1>
|
||||||
<ul class="domtabs">
|
<ul class="domtabs">
|
||||||
<li><a href="#mainTab">Général</a></li>
|
<li><a href="#mainTab">Général</a></li>
|
||||||
<li><a href="#machinesTab">Machines</a></li>
|
|
||||||
<li><a href="#mailTab">Mails</a></li>
|
<li><a href="#mailTab">Mails</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- +++++++++++++++++++ Infos Utilisateur +++++++++++++++++++ -->
|
<!-- +++++++++++++++++++ Infos Utilisateur +++++++++++++++++++ -->
|
||||||
|
@ -106,49 +106,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- +++++++++++++++++++ Infos Machines +++++++++++++++++++ -->
|
|
||||||
<div>
|
|
||||||
<h2 class="mark"><a name="machinesTab" id="machinesTab"></a></h2>
|
|
||||||
<ul class="tabbed_page" id="machineList">
|
|
||||||
#for $machine in $machines
|
|
||||||
<li>
|
|
||||||
<h3>$machine.nomCourt</h3>
|
|
||||||
<dl class="machineInfos">
|
|
||||||
<dt>Type : </dt><dd>$machine.type</dd>
|
|
||||||
<dt>MAC : </dt><dd>$machine.mac</dd>
|
|
||||||
<dt>IP : </dt><dd>$machine.ip</dd>
|
|
||||||
#if $machine.ipsec
|
|
||||||
<dt>Clef ipsec : </dt><dd>$machine.ipsec</dd>
|
|
||||||
#end if
|
|
||||||
</dl>
|
|
||||||
<div class="clear"></div>
|
|
||||||
<span class="actions">
|
|
||||||
<a href="#" onclick="return askForMachineName('$machine.nomCourt', '$machine.mid')">renommer</a>
|
|
||||||
<a href="#" onclick="return askForMachineMac('$machine.mac', '$machine.mid')">Changer de MAC</a>
|
|
||||||
<a href="#" onclick="return askForDeleteMachine('$machine.mid');">Supprimer</a>
|
|
||||||
</span>
|
|
||||||
<div class="clear"></div>
|
|
||||||
</li>
|
|
||||||
#end for
|
|
||||||
</ul>
|
|
||||||
<ul class="tabbed_page">
|
|
||||||
<li class="last">
|
|
||||||
<h3>Ajouter une machine</h3>
|
|
||||||
<form action="creerMachine" method="post" onsubmit="return creerMachine(this.nomNouvelleMachine.value, this.MACNouvelleMachine.value, this.estMachineWifi.checked)" name="addMachineForm">
|
|
||||||
<label class="textInputLabel" for="nomNouvelleMachine">Nom de la machine :</label>
|
|
||||||
<input type="text" id="nomNouvelleMachine" name="nomNouvelleMachine"/><br />
|
|
||||||
<label class="textInputLabel" for="MACNouvelleMachine">Adresse MAC :</label>
|
|
||||||
<input type="text" id="MACNouvelleMachine" name="MACNouvelleMachine"/><br />
|
|
||||||
<a class="textInputNote" href="http://wiki/VieCrans/Param%c3%a8tresConnexion/AdresseMac" target="_blanc">Comment trouver l'adresse mac ?</a><br />
|
|
||||||
<label class="checkBoxLabel" for="isWifi"><input type="checkbox" id="estMachineWifi" name="estMachineWifi" value="1" />machine wifi</label><br />
|
|
||||||
<input type="submit" value="Ajouter" />
|
|
||||||
</form>
|
|
||||||
<p class="note"><b>Note :</b>Pour les non membres actifs, le nombre de machines fixes est limité à 1</p>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- +++++++++++++++++++ Infos Mails +++++++++++++++++++ -->
|
<!-- +++++++++++++++++++ Infos Mails +++++++++++++++++++ -->
|
||||||
<div>
|
<div>
|
||||||
<h2 class="mark"><a name="mailTab" id="mailTab"></a></h2>
|
<h2 class="mark"><a name="mailTab" id="mailTab"></a></h2>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue