Commit 226095f9 authored by Georges Gressot's avatar Georges Gressot 💬
Browse files

rolling on ...

parent e9722413
......@@ -49,17 +49,17 @@
</div>
<div id="content">
<p><form method="post">{% csrf_token %}{% trans "Modification des propriétés d'une bibliothèque" %} : {{ libriform.librname }} <input type="submit" value="{% trans "Valider" %}"></form></p>
<!-- <p><form method="post">{% csrf_token %}{% trans "Modification des propriétés d'une bibliothèque" %} : {{ libriform.librname }} <input type="submit" value="{% trans "Valider" %}"></form></p> -->
{% if g != 0 %}
<p>{% trans "Gestion des bibliothèques" %} ({{ sizelib }}, {% trans "checker inclus" %}) :</p>
<table border="1">
{% for l in liblist %}
<thead>
<th>{% trans "Propriété" %}</th>
<th>{% trans "Valeur actuelle" %}</th>
<th>{% trans "Le cas échéant, nouvelle valeur" %}</th>
<!-- <th>{% trans "Le cas échéant, nouvelle valeur" %}</th> -->
</thead>
......@@ -67,37 +67,77 @@
<tr>
<td>{% trans "Nom de la bibliothèque" %}</td>
<td>{{ libriname }}</td>
<td>{% if libriname != 'checker' %}<form method="post">{% csrf_token %}{{ formlibname.newlibrname }} <input type="submit" value="{% trans "Valider" %}"> {% trans "Rétroactif (instructions)" %}</form>{% else %} ({% trans "Non modifiable" %}) {% endif %}</td>
<td>{{ l.name }}</td>
<!-- <td>{% if l.name != 'checker' %}<form method="post">{% csrf_token %}{{ formlibname.newlibrname }} <input type="submit" value="{% trans "Valider" %}"> {% trans "Rétroactif (instructions)" %}</form>{% else %} ({% trans "Non modifiable" %}) {% endif %}</td> -->
</tr>
<tr>
<td>{% trans "Contact principal" %}</td>
<td>{{ ctcti1 }}</td>
<td><form method="post">{% csrf_token %}{{ formlibct1.contact1 }} <input type="submit" value="{% trans "Valider" %}"></form></td>
<td>{{ l.contact }}</td>
<!-- <td><form method="post">{% csrf_token %}{{ formlibct1.contact1 }} <input type="submit" value="{% trans "Valider" %}"></form></td> -->
</tr>
<tr>
<td>{% trans "Second contact" %}</td>
<td>{% if ctcti2 != None %} {{ ctcti2 }} {% else %} ({% trans "Vacante" %}) {% endif %}</td>
<td><form method="post">{% csrf_token %}{{ formlibct2.contact2 }} <input type="submit" value="{% trans "Valider" %}"></form> {% if ctcti2 != None %}<form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ formlibsu2.suppr2 }} <input type="submit" value="{% trans "Valider" %}"></form>{% else %}{% endif %}</td>
<td>{% if l.contact_bis != None %} {{ l.contact_bis }} {% else %} ({% trans "Vacant" %}) {% endif %}</td>
<!-- <td><form method="post">{% csrf_token %}{{ formlibct2.contact2 }} <input type="submit" value="{% trans "Valider" %}"></form> {% if l.contact_bis != None %}<form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ formlibsu2.suppr2 }} <input type="submit" value="{% trans "Valider" %}"></form>{% else %}{% endif %}</td> -->
</tr>
<tr>
<td>{% trans "Troisième contact" %}</td>
<td>{% if ctcti3 != None %} {{ ctcti3 }} {% else %} ({% trans "Vacante" %}) {% endif %}</td>
<td><form method="post">{% csrf_token %}{{ formlibct3.contact3 }} <input type="submit" value="{% trans "Valider" %}"></form> {% if ctcti3 != None %}<form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ formlibsu3.suppr3 }} <input type="submit" value="{% trans "Valider" %}"></form>{% else %}{% endif %}</td> </tr>
<td>{% if l.contact_ter != None %} {{ l.contact_ter }} {% else %} ({% trans "Vacant" %}) {% endif %}</td>
<!-- <td><form method="post">{% csrf_token %}{{ formlibct3.contact3 }} <input type="submit" value="{% trans "Valider" %}"></form> {% if l.contact_ter != None %}<form method="post">{% csrf_token %} {% trans "ou supprimer" %} {{ formlibsu3.suppr3 }} <input type="submit" value="{% trans "Valider" %}"></form>{% else %}{% endif %}</td> </tr> -->
</tbody>
{% endfor %}
</table>
<!-- <p><b><font color= #FF0000 >{% trans "Le nom courant est à indiquer dans tous les cas (drag & drop) ; une seule validation à la fois" %}</font></b></p> -->
<b><font color= #FF0000 >{{ info }}</font></b>
<p><form method="post"> {% csrf_token %}
{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.currname }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% trans "Nouveau nom de la bibliothèque" %} : {{ formlibname.newlibrname }}
<input type="submit" value="{% trans "Valider" %}"> </form></p>
<p><form method="post"> {% csrf_token %}
{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.currname }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% trans "email contact 1" %} : {{ formlibct1.contact1 }} {% trans "Identifiant" %} : {{ formlibct1.ident }}
<input type="submit" value="{% trans "Valider" %}"> </form></p>
<!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
<p><form method="post"> {% csrf_token %}{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.currname }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% trans "email contact 2" %} : {{ formlibct2.contact2 }} {% trans "Identifiant" %} : {{ formlibct2.ident }}
<input type="submit" value="{% trans "Valider" %}"> </form></p>
<!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
<p><form method="post"> {% csrf_token %}{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.currname }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% trans "email contact 3" %} : {{ formlibct3.contact3 }} {% trans "Identifiant" %} : {{ formlibct3.ident }}
<input type="submit" value="{% trans "Valider" %}"> </form>
</p>
<p><form method="post"> {% csrf_token %}{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.currname }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% trans "Supprimer le contact 2" %} : {{ formlibsu2.suppr2 }}
<input type="submit" value="{% trans "Valider" %}"> </form></p>
<!-- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -->
<p><form method="post"> {% csrf_token %}{% trans "Nom courant de la bibliothèque" %} : {{ formlibname.currname }}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% trans "Supprimer le contact 3" %} : {{ formlibsu3.suppr3 }}
<input type="submit" value="{% trans "Valider" %}"> </form>
</p>
{% endif %}
<HR>
<!-- <p><b><center>{% trans "Attention : Le cas échéant, pensez à administrer les utilisateurs dans la base principale : à moins que .... !!! afficher ici les choses à régler !" %}. <a target="_blank" href="/./admin/">{% trans "OK j'y vais" %}</a></center></b></p>
<HR> -->
<p>{% trans "Gestion des administrateurs" %} ({{ sizeadm }}) :</p>
<p><form method="post"> {% csrf_token %} {% trans "Suppression d'un administrateur" %} : {{ bddadmform.bddadmemail }} {% trans "êtes-vous sûr ?" %} <input type="submit" value="{% trans "Oui, je supprime" %}"> </form><p>
<p><form method="post">{% csrf_token %}{% trans "Ou ajouter un administrateur pour ce projet (email)" %} : {{ projadmform.contact }} <input type="submit" value="{% trans "Valider" %}"></form></p>
<p><form method="post">{% csrf_token %}{% trans "Ajouter un administrateur pour ce projet" %} : &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email {{ projadmform.contact }} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {% trans "Identifiant" %} {{ projadmform.ident }} <input type="submit" value="{% trans "Valider" %}"></form></p>
{% if sizeadm > 1 %}
<p><form method="post"> {% csrf_token %} {% trans "Suppression d'un administrateur" %} : {{ bddadmform.bddadmemail }} {% trans "êtes-vous sûr ?" %} <input type="submit" value="{% trans "Oui, je supprime" %}"> </form><p>
{% endif %}
<HR>
<table border="1">
......
......@@ -157,6 +157,7 @@ def adminbase(request, bdd):
k =logstatus(request)
version =epl_version
url ="/" + bdd + "/adminbase"
info =_('Le nom courant est à indiquer dans tous les cas (drag & drop)')
EXCLUSION_CHOICES = ('', ''),
for e in Exclusion.objects.using(bdd).all().order_by('label'):
......@@ -209,48 +210,42 @@ def adminbase(request, bdd):
for l in Library.objects.using(bdd).all().exclude(name ='checker').order_by('name'):
LIBRARY_CHOICES += (l.name, l.name),
class LibrIForm(forms.Form):
librname = forms.ChoiceField(required =True, widget=forms.Select, choices = LIBRARY_CHOICES, label =_("nom de la bib"))
class LibrMNameForm(forms.Form):
currname = forms.CharField(required =True, widget=forms.TextInput(attrs={'size': '30'}), max_length=30, label =_("nom de la bib"))
newlibrname = forms.CharField(required =True, widget=forms.TextInput(attrs={'size': '30'}), max_length=30, label =_("nom de la bib"))
class LibrMCtc1Form(forms.Form):
contact1 = forms.EmailField(required =True, label ='email 1')
ident = forms.CharField(required =True, widget=forms.TextInput(), max_length=30, label =_("identifiant"))
class LibrMCtc2Form(forms.Form):
contact2 = forms.EmailField(required =True, label ='email 2')
ident = forms.CharField(required =True, widget=forms.TextInput(), max_length=30, label =_("identifiant"))
class LibrMSu2Form(forms.Form):
suppr2 = forms.BooleanField(required=True)
class LibrMCtc3Form(forms.Form):
contact3 = forms.EmailField(required =True, label ='email 3')
ident = forms.CharField(required =True, widget=forms.TextInput(), max_length=30, label =_("identifiant"))
class LibrMSu3Form(forms.Form):
suppr3 = forms.BooleanField(required=True)
libriform = LibrIForm(request.POST or None)
g =0
if libriform.is_valid():
g =1
libriname = libriform.cleaned_data['librname']
lib =Library.objects.using(bdd).get(name =libriname)
ctcti1 =Library.objects.using(bdd).get(name =libriname).contact
ctcti2 =Library.objects.using(bdd).get(name =libriname).contact_bis
ctcti3 =Library.objects.using(bdd).get(name =libriname).contact_ter
formlibname = LibrMNameForm(request.POST or None)
formlibct1 = LibrMCtc1Form(request.POST or None)
formlibct2 = LibrMCtc2Form(request.POST or None)
formlibsu2 = LibrMSu2Form(request.POST or None)
formlibct3 = LibrMCtc3Form(request.POST or None)
formlibsu3 = LibrMSu3Form(request.POST or None)
if formlibname.is_valid():
if not libriname ==formlibname.cleaned_data['newlibrname'] and not formlibname.cleaned_data['newlibrname'] =='checker':
lib.name =formlibname.cleaned_data['newlibrname']
lib.save(using =bdd)
for insn in Instruction.objects.using(bdd).filter(name =formlibname.cleaned_data['newlibrname']):
insn.name =formlibname.cleaned_data['newlibrname']
insn.save(using =bdd)
for inso in Instruction.objects.using(bdd).filter(oname =formlibname.cleaned_data['newlibrname']):
inso.oname =formlibname.cleaned_data['newlibrname']
inso.save(using =bdd)
liblist =Library.objects.using(bdd).all()
sizelib =len(liblist)
formlibname = LibrMNameForm(request.POST or None)
formlibct1 = LibrMCtc1Form(request.POST or None)
formlibct2 = LibrMCtc2Form(request.POST or None)
formlibsu2 = LibrMSu2Form(request.POST or None)
formlibct3 = LibrMCtc3Form(request.POST or None)
formlibsu3 = LibrMSu3Form(request.POST or None)
if formlibname.is_valid():
if not libriname ==formlibname.cleaned_data['newlibrname'] and not formlibname.cleaned_data['newlibrname'] =='checker':
lib.name =formlibname.cleaned_data['newlibrname']
lib.save(using =bdd)
for insn in Instruction.objects.using(bdd).filter(name =formlibname.cleaned_data['newlibrname']):
insn.name =formlibname.cleaned_data['newlibrname']
insn.save(using =bdd)
for inso in Instruction.objects.using(bdd).filter(oname =formlibname.cleaned_data['newlibrname']):
inso.oname =formlibname.cleaned_data['newlibrname']
inso.save(using =bdd)
# pour supprimr contact2 ou contact3 !!!& Changement rétroactif sur l'ensemble des instructions (name et oname aussi)
# class SupAjForm(forms.Form):
......@@ -283,11 +278,12 @@ def adminbase(request, bdd):
bddadmform =AdminForm(request.POST or None)
if bddadmform.is_valid():
seladmin =BddAdmin.objects.using(bdd).get(contact =bddadmform.cleaned_data['bddadmemail'])
seladmin.delete(using =bdd)
seladmin.delete(using =bdd)#suppression impossible quand il n'y a plus qu'un seul bddadmin pour le projet (contrôle dans le template)
return HttpResponseRedirect(url)
class ProjadmForm(forms.Form):
contact = forms.EmailField(required =True, label ='email')
ident = forms.CharField(required =True, widget=forms.TextInput(), max_length=30, label =_("identifiant"))
projadmform =ProjadmForm(request.POST or None)
if projadmform.is_valid():
emaillist =[]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment