quelques modification pour les clubs
darcs-hash:20041127210001-4ec08-4877fa4d97b2b7fb79600899d672a558c0424390.gz
This commit is contained in:
parent
1f2bcef775
commit
8176459ae5
1 changed files with 199 additions and 56 deletions
|
@ -321,7 +321,7 @@ def set_etudes(adher) :
|
|||
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0]
|
||||
dialog(arg)
|
||||
return set_etudes(adher)
|
||||
|
||||
|
||||
def set_mail(adher) :
|
||||
"""
|
||||
Choix d'une adresse mail crans ou extérieure.
|
||||
|
@ -379,6 +379,7 @@ def set_compte(adher) :
|
|||
"""
|
||||
Créé un compte sur zamok pour un adhérent.
|
||||
"""
|
||||
|
||||
# Message d'avertissement
|
||||
arg = u'--title "Création compte sur zamok pour %s" ' % adher.Nom()
|
||||
arg+= u'--colors --yesno "\Zr\Z1AVERTISSEMENT :\Zn \n'
|
||||
|
@ -460,7 +461,58 @@ def set_droits(adher) :
|
|||
|
||||
# Traitement
|
||||
adher.droits(result)
|
||||
|
||||
|
||||
def set_shell(adher) :
|
||||
""" Modification du shell d'un adhérent """
|
||||
while 1 :
|
||||
arg = u'--title "Nouveau shell pour %s" ' % adher.Nom()
|
||||
arg+= u'--inputbox "Shell : " 0 0 "%s" ' % adher.chsh()
|
||||
annul,res = dialog(arg)
|
||||
if annul : return 1
|
||||
|
||||
try :
|
||||
adher.chsh(res[0])
|
||||
break
|
||||
except ValueError, c :
|
||||
arg = u'--title "Changement du shell de %s" ' % adher.Nom()
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0]
|
||||
dialog(arg)
|
||||
|
||||
def set_adresse(adher) :
|
||||
""" Modification de l'édresse d'un adhérent """
|
||||
arg = u'--title "Déménagement de %s" ' % adher.Nom()
|
||||
arg+= u'--menu "Question :" 0 0 0 '
|
||||
arg+= u'"1" "Déménagement à l\'extérieur ?" '
|
||||
arg+= u'"2" "Déménagement sur le campus ? " '
|
||||
annul , result = dialog(arg)
|
||||
if annul : return 1
|
||||
if result[0]=='1' :
|
||||
if set_addr_ext(adher) :
|
||||
# Annulation
|
||||
return 1
|
||||
else :
|
||||
while 1 :
|
||||
arg = u'--title "Déménagement de %s" ' % adher.Nom()
|
||||
arg+= u'--inputbox "Chambre ?" 0 0 '
|
||||
annul,res = dialog(arg)
|
||||
if annul : return 1
|
||||
|
||||
e=0
|
||||
try :
|
||||
c = adher.chbre(res[0])
|
||||
if c =='EXT' :
|
||||
# Il faut demander l'adresse extérieure
|
||||
if set_addr_ext(adher) :
|
||||
# Annulation
|
||||
continue
|
||||
break
|
||||
except EnvironmentError, c : e = c.args[0]
|
||||
except ValueError, c : e = c.args[0]
|
||||
if e :
|
||||
arg = u'--title "Déménagement de %s" ' % adher.Nom()
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % e
|
||||
dialog(arg)
|
||||
|
||||
def del_adher(adher) :
|
||||
"""
|
||||
Destruction adhérent
|
||||
|
@ -520,7 +572,90 @@ def del_adher(adher) :
|
|||
arg = u'--title "Destruction adhérent" '
|
||||
arg+= u'--msgbox "Adhérent détruit\n\n\n" 0 0'
|
||||
dialog(arg)
|
||||
|
||||
###############################################################
|
||||
## Fonctions de remplissage ou modification des paramètres club
|
||||
|
||||
def set_responsable(club) :
|
||||
""" Modifie le responsable d'un club """
|
||||
arg = u'--title "Responsable du club" '
|
||||
arg+= u'--msgbox "Séléctionnez l\'adhérent responsable du club\n\n\n" 0 0'
|
||||
dialog(arg)
|
||||
resp = select(club,u'du responsable du club a','ro')
|
||||
if not resp : return 1
|
||||
else :
|
||||
club.responsable(resp)
|
||||
|
||||
def set_club_nom(club) :
|
||||
# Nom du club
|
||||
arg = u'--title "Nom" '
|
||||
arg+= u'--inputbox "Nom du club ?" 0 0 "%s"' % club.Nom()
|
||||
annul, res = dialog(arg)
|
||||
if annul : return 1
|
||||
else :
|
||||
try :
|
||||
club.Nom(res[0])
|
||||
except ValueError, c :
|
||||
arg = u'--title "Nom club" '
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0]
|
||||
dialog(arg)
|
||||
|
||||
def set_local(club) :
|
||||
""" Défini le local d'un club """
|
||||
try :
|
||||
club.chbre('&é"') # Fait une erreur
|
||||
except ValueError, c :
|
||||
locaux = c.args[1]
|
||||
|
||||
arg = u'--title "Local du club" '
|
||||
arg+= u'--default-item "%s" ' % club.chbre()
|
||||
arg+= u'--menu "Choisissez le local du club :" 0 0 0 '
|
||||
key = locaux.keys()
|
||||
key.sort()
|
||||
for k in key :
|
||||
arg+= u'"%s" "%s" ' % ( k , locaux[k] )
|
||||
annul , result = dialog(arg)
|
||||
if annul : return 1
|
||||
else :
|
||||
club.chbre(result[0])
|
||||
|
||||
|
||||
def set_club_compte(club) :
|
||||
"""
|
||||
Créé un compte sur zamok pour un club.
|
||||
"""
|
||||
|
||||
while 1 :
|
||||
arg = u'--title "Création d\'un compte sur zamok pour %s" ' % club.Nom()
|
||||
arg+= u'--inputbox "Choix du login\n'
|
||||
arg+= u'Le nom pour le login doit faire au maximum %s caractères\n' % config.maxlen_login
|
||||
arg+= u'Le login sur zamok sera club-\'nom du club\'\n'
|
||||
arg+= u'Le site web du club sera accessible via l\'adresse http://clubs.crans.ens-cachan.fr/\'nom du club\'\n'
|
||||
arg+= u'Seuls les caractères alphabétiques et le - sont autorisés" '
|
||||
arg+= u'0 0 ""'
|
||||
annul , result = dialog(arg)
|
||||
if annul : return 1
|
||||
login=result[0]
|
||||
|
||||
e = 0
|
||||
try : login = club.compte(login)
|
||||
except EnvironmentError, c : e = c.args[0]
|
||||
except ValueError, c : e = c.args[0]
|
||||
if e :
|
||||
arg = u'--title "Création compte sur zamok pour %s" ' % club.Nom()
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % e
|
||||
dialog(arg)
|
||||
continue
|
||||
break
|
||||
|
||||
txt = u"Le compte ne sera créé que lors de l'enregistrement des données\n\n"
|
||||
txt+= u"L'adresse mail du club est : %s@crans.org\n" % login
|
||||
|
||||
txt+= u'\n'
|
||||
|
||||
arg = u'--title "Création compte sur zamok pour %s" ' % club.Nom()
|
||||
arg+= u'--colors --msgbox "%s\n\n\n" 0 0' % txt
|
||||
dialog(arg)
|
||||
|
||||
######################################################################################
|
||||
## Fonctions de remplissage ou modification des paramètres adhérent ou machine ou club
|
||||
|
@ -730,67 +865,30 @@ def set_admin(proprio) :
|
|||
###############################################################
|
||||
## Fonctions de remplissage ou modification des paramètres club
|
||||
|
||||
def set_club(club) :
|
||||
def new_club(club) :
|
||||
step = 1
|
||||
while 1 :
|
||||
|
||||
if step == 1 :
|
||||
# Responsable
|
||||
resp = club.responsable()
|
||||
if resp :
|
||||
arg = u'--title "Responsable du club" '
|
||||
arg+= u'--yesno "\nLe responsable du club est-il toujours %s ?\n\n\n" 0 0' % resp.Nom()
|
||||
no, res = dialog(arg)
|
||||
if not resp or no :
|
||||
arg = u'--title "Responsable du club" '
|
||||
arg+= u'--msgbox "Séléctionnez l\'adhérent responsable du club\n\n\n" 0 0'
|
||||
dialog(arg)
|
||||
resp = select(club,u'du responsable du club a','ro')
|
||||
if not resp : return 1
|
||||
else :
|
||||
club.responsable(resp)
|
||||
step += 1
|
||||
else :
|
||||
step += 1
|
||||
if set_responsable(club) : return 1
|
||||
else : step +=1
|
||||
|
||||
if step == 2 :
|
||||
# Nom du club
|
||||
arg = u'--title "Nom" '
|
||||
arg+= u'--inputbox "Nom du club ?" 0 0 "%s"' % club.Nom()
|
||||
annul, res = dialog(arg)
|
||||
if annul : step -= 1
|
||||
else :
|
||||
try :
|
||||
club.Nom(res[0])
|
||||
step += 1
|
||||
except ValueError, c :
|
||||
arg = u'--title "Nom club" '
|
||||
arg+= u'--msgbox "%s\n\n\n" 0 0' % c.args[0]
|
||||
dialog(arg)
|
||||
|
||||
if set_club_nom(club) : step -= 1
|
||||
else : step +=1
|
||||
|
||||
if step == 3 :
|
||||
# Local
|
||||
try :
|
||||
club.chbre('&é"') # Fait une erreur
|
||||
except ValueError, c :
|
||||
locaux = c.args[1]
|
||||
|
||||
arg = u'--title "Local du club" '
|
||||
arg+= u'--default-item "%s" ' % club.chbre()
|
||||
arg+= u'--menu "Choisissez le local du club :" 0 0 0 '
|
||||
key = locaux.keys()
|
||||
key.sort()
|
||||
for k in key :
|
||||
arg+= u'"%s" "%s" ' % ( k , locaux[k] )
|
||||
annul , result = dialog(arg)
|
||||
if annul : step -= 1
|
||||
else :
|
||||
club.chbre(result[0])
|
||||
step += 1
|
||||
if set_local(club) : step -= 1
|
||||
else : step += 1
|
||||
|
||||
if step == 4 :
|
||||
# Administratif
|
||||
if set_admin(club) : step -=1
|
||||
if set_admin(club) : step -= 1
|
||||
else : step += 1
|
||||
|
||||
|
||||
if step == 5 :
|
||||
# Remarque
|
||||
if set_rque(club) : step -= 1
|
||||
|
@ -801,9 +899,54 @@ def set_club(club) :
|
|||
if confirm(club) : step -= 1
|
||||
else : break
|
||||
|
||||
def modif_club(club) :
|
||||
"""
|
||||
Modification du club fourni (instance de club)
|
||||
Retourne 1 si annulation.
|
||||
"""
|
||||
arg = u'--title "Modification du club %s" ' % club.Nom()
|
||||
arg+= u'--menu "Que souhaitez vous modifier ?" 0 0 0 '
|
||||
arg+= u'"NomClub" "Modifier le nom du club" '
|
||||
arg+= u'"Responsable" "Changer le responsable du club %s" ' % club.responsable().Nom()
|
||||
arg+= u'"Admistratif" "Précâblage" '
|
||||
arg+= u'"Local" "Modifier le locaal du club" '
|
||||
arg+= u'"Compte" "Créer/détruire un compte sur zamok" '
|
||||
if club.compte() :
|
||||
arg+= u'"Alias" "Créer ou supprimer un alias mail" '
|
||||
if isadm and club.compte() :
|
||||
arg+= u'"Shell" "Changer le shell du club" '
|
||||
if isdeconnecteur :
|
||||
arg+= u'"Blackliste" "Modifier la blackliste du club" '
|
||||
arg+= u'"Remarque" "Ajouter ou modifer un commentaire" '
|
||||
annul, res = dialog(arg)
|
||||
|
||||
if annul : return 1
|
||||
|
||||
elif res[0]=='NomClub' :
|
||||
set_club_nom(club)
|
||||
elif res[0]=='Responsable' :
|
||||
set_responsable(club)
|
||||
elif res[0]=='Admistratif' :
|
||||
set_admin(club)
|
||||
elif res[0]=='Compte' :
|
||||
set_club_compte(club)
|
||||
elif res[0]=='Remarque' :
|
||||
set_rque(club)
|
||||
elif res[0]=='Blackliste' :
|
||||
set_blackliste(club)
|
||||
elif res[0]=='Local' :
|
||||
set_local(club)
|
||||
elif res[0]=='Alias' :
|
||||
__prompt_input_menu(club.alias,'Alias mail', "Entrez ou modifier un alias mail.\nPour ajouter un alias modifier le dernier de la liste.")
|
||||
elif res[0]=='Shell' :
|
||||
set_shell(club)
|
||||
|
||||
if club.modifs :
|
||||
return confirm(club)
|
||||
|
||||
def select_club(clas) :
|
||||
""" Choix d'un club """
|
||||
arg = u'--title "Recherche d\'unclub" '
|
||||
arg = u'--title "Recherche d\'un club" '
|
||||
|
||||
clubs = clas.search('cid=*')['club']
|
||||
if not clubs :
|
||||
|
@ -973,7 +1116,7 @@ def del_machine(machine) :
|
|||
####################################
|
||||
## Fonctions principales d'interface
|
||||
|
||||
def all(adher) :
|
||||
def new_adher(adher) :
|
||||
"""
|
||||
Définition des propriétés d'un adhérent
|
||||
4 etapes :
|
||||
|
@ -1384,7 +1527,7 @@ def menu_principal() :
|
|||
if choix=='aA' :
|
||||
# Inscription nouvel adhérent
|
||||
proprio = adherent()
|
||||
if all(proprio) :
|
||||
if new_adher(proprio) :
|
||||
del proprio
|
||||
proprio = None
|
||||
else : choix = 'aMc' # ajout d'une machine
|
||||
|
@ -1422,7 +1565,7 @@ def menu_principal() :
|
|||
elif choix=='aC' :
|
||||
# Ajout d'un club
|
||||
proprio = club()
|
||||
if set_club(proprio) :
|
||||
if new_club(proprio) :
|
||||
del proprio ; proprio = None
|
||||
else : choix = 'aMc' # ajout d'une machine
|
||||
|
||||
|
@ -1534,7 +1677,7 @@ def menu_principal() :
|
|||
|
||||
elif choix=='mCc' :
|
||||
# Modif club courant
|
||||
if set_club(proprio) :
|
||||
if modif_club(proprio) :
|
||||
# Annulation des modifs
|
||||
proprio.restore()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue