Compare commits
9 Commits
ae752bc581
...
2bfa7eb4a8
Author | SHA1 | Date | |
---|---|---|---|
2bfa7eb4a8 | |||
0e7857e5ca | |||
76d7a21ec7 | |||
390141f145 | |||
1476df8ecf | |||
bb589ae3ae | |||
09f9124b01 | |||
9b9ed47e96 | |||
d6b6ab3ea7 |
21
ZAbsences.py
21
ZAbsences.py
@ -380,6 +380,7 @@ class ZAbsences(
|
||||
security.declareProtected(ScoView, "CountAbsJust")
|
||||
|
||||
def CountAbsJust(self, etudid, debut, fin, matin=None, moduleimpl_id=None):
|
||||
"Count just. abs"
|
||||
if matin != None:
|
||||
matin = _toboolean(matin)
|
||||
ismatin = " AND A.MATIN = %(matin)s "
|
||||
@ -697,6 +698,7 @@ class ZAbsences(
|
||||
return int(self.get_preference("work_saturday"))
|
||||
|
||||
security.declareProtected(ScoView, "day_names")
|
||||
|
||||
def day_names(self):
|
||||
"""Returns week day names.
|
||||
If work_saturday property is set, include saturday
|
||||
@ -1993,22 +1995,3 @@ ou entrez une date pour visualiser les absents un jour donné :
|
||||
doc._pop()
|
||||
log("XMLgetAbsEtud (%gs)" % (time.time() - t0))
|
||||
return repr(doc)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
#
|
||||
# Zope Product Administration
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
def manage_addZAbsences(
|
||||
self, id="id_ZAbsences", title="The Title for ZAbsences Object", REQUEST=None
|
||||
):
|
||||
"Add a ZAbsences instance to a folder."
|
||||
self._setObject(id, ZAbsences(id, title))
|
||||
if REQUEST is not None:
|
||||
return self.manage_main(self, REQUEST)
|
||||
# return self.manage_editForm(self, REQUEST)
|
||||
|
||||
|
||||
# The form used to get the instance id from the user.
|
||||
# manage_addZAbsencesForm = DTMLFile('dtml/manage_addZAbsencesForm', globals())
|
||||
|
950
ZEntreprises.py
950
ZEntreprises.py
File diff suppressed because it is too large
Load Diff
21
ZNotes.py
21
ZNotes.py
@ -1077,6 +1077,8 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
|
||||
)
|
||||
return formsemestre_id
|
||||
|
||||
security.declareProtected(ScoView, "formsemestre_list")
|
||||
|
||||
def formsemestre_list(
|
||||
self,
|
||||
format=None,
|
||||
@ -3640,22 +3642,3 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
|
||||
)
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
#
|
||||
# Zope Product Administration
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
def manage_addZNotes(
|
||||
self, id="id_ZNotes", title="The Title for ZNotes Object", REQUEST=None
|
||||
):
|
||||
"Add a ZNotes instance to a folder."
|
||||
self._setObject(id, ZNotes(id, title))
|
||||
if REQUEST is not None:
|
||||
return self.manage_main(self, REQUEST)
|
||||
# return self.manage_editForm(self, REQUEST)
|
||||
|
||||
|
||||
# The form used to get the instance id from the user.
|
||||
manage_addZNotesForm = DTMLFile("dtml/manage_addZNotesForm", globals())
|
||||
|
13
ZScoDoc.py
13
ZScoDoc.py
@ -83,7 +83,7 @@ from sco_permissions import ScoView, ScoSuperAdmin
|
||||
from sco_exceptions import AccessDenied
|
||||
from notes_log import log
|
||||
import sco_find_etud
|
||||
from ZScoUsers import pwdFascistCheck
|
||||
import sco_users
|
||||
|
||||
|
||||
class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Implicit):
|
||||
@ -101,13 +101,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
||||
manage_options = (
|
||||
({"label": "Contents", "action": "manage_main"},)
|
||||
+ PropertyManager.manage_options # add the 'Properties' tab
|
||||
+ (
|
||||
# this line is kept as an example with the files :
|
||||
# dtml/manage_editZScolarForm.dtml
|
||||
# html/ZScolar-edit.stx
|
||||
# {'label': 'Properties', 'action': 'manage_editForm',},
|
||||
{"label": "View", "action": "index_html"},
|
||||
)
|
||||
+ ({"label": "View", "action": "index_html"},)
|
||||
+ Item.manage_options # add the 'Undo' & 'Owner' tab
|
||||
+ RoleManager.manage_options # add the 'Security' tab
|
||||
)
|
||||
@ -231,7 +225,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
||||
raise AccessDenied("vous n'avez pas le droit d'effectuer cette opération")
|
||||
log("trying to change admin password")
|
||||
# 1-- check strong password
|
||||
if pwdFascistCheck(password) != None:
|
||||
if not sco_users.is_valid_password(password):
|
||||
log("refusing weak password")
|
||||
return REQUEST.RESPONSE.redirect(
|
||||
"change_admin_user_form?message=Mot%20de%20passe%20trop%20simple,%20recommencez"
|
||||
@ -622,6 +616,7 @@ E. Viennet (Université Paris 13).</p>
|
||||
security.declareProtected("View", "standard_html_footer")
|
||||
|
||||
def standard_html_footer(self, REQUEST=None):
|
||||
"""Le pied de page HTML de la page d'accueil."""
|
||||
return """<p class="footer">
|
||||
Problème de connexion (identifiant, mot de passe): <em>contacter votre responsable ou chef de département</em>.</p>
|
||||
<p>Problèmes et suggestions sur le logiciel: <a href="mailto:%s">%s</a></p>
|
||||
|
41
ZScoUsers.py
41
ZScoUsers.py
@ -47,24 +47,7 @@ from TrivialFormulator import TrivialFormulator, TF
|
||||
from gen_tables import GenTable
|
||||
import scolars
|
||||
import sco_cache
|
||||
|
||||
# ----------------- password checking
|
||||
import cracklib
|
||||
|
||||
|
||||
def pwdFascistCheck(cleartxt):
|
||||
"returns None if OK"
|
||||
if (
|
||||
hasattr(CONFIG, "MIN_PASSWORD_LENGTH")
|
||||
and CONFIG.MIN_PASSWORD_LENGTH > 0
|
||||
and len(cleartxt) < CONFIG.MIN_PASSWORD_LENGTH
|
||||
):
|
||||
return True # invalid
|
||||
try:
|
||||
x = cracklib.FascistCheck(cleartxt)
|
||||
return None
|
||||
except ValueError as e:
|
||||
return str(e)
|
||||
import sco_users
|
||||
|
||||
|
||||
# ---------------
|
||||
@ -105,20 +88,6 @@ class ZScoUsers(
|
||||
self.id = id
|
||||
self.title = title
|
||||
|
||||
# The form used to edit this object
|
||||
# def manage_editZScousers(self, title, RESPONSE=None):
|
||||
# "Changes the instance values"
|
||||
# self.title = title
|
||||
# self._p_changed = 1
|
||||
# RESPONSE.redirect("manage_editForm")
|
||||
|
||||
# Ajout (dans l'instance) d'un dtml modifiable par Zope
|
||||
def defaultDocFile(self, id, title, file):
|
||||
f = open(file_path + "/dtml-editable/" + file + ".dtml")
|
||||
file = f.read()
|
||||
f.close()
|
||||
self.manage_addDTMLMethod(id, title, file)
|
||||
|
||||
# Connexion to SQL database of users:
|
||||
|
||||
# Ugly but necessary during transition out of Zope:
|
||||
@ -372,10 +341,6 @@ class ZScoUsers(
|
||||
else:
|
||||
return False
|
||||
|
||||
def _is_valid_passwd(self, passwd):
|
||||
"check if passwd is secure enough"
|
||||
return not pwdFascistCheck(passwd)
|
||||
|
||||
def do_change_password(self, user_name, password):
|
||||
user = self._user_list(args={"user_name": user_name})
|
||||
assert len(user) == 1, "database inconsistency: len(user)=%d" % len(user)
|
||||
@ -421,7 +386,7 @@ class ZScoUsers(
|
||||
% user_name
|
||||
)
|
||||
else:
|
||||
if not self._is_valid_passwd(password):
|
||||
if not sco_users.is_valid_password(password):
|
||||
H.append(
|
||||
"""<p><b>ce mot de passe n\'est pas assez compliqué !</b><br/>(oui, il faut un mot de passe vraiment compliqué !)</p>
|
||||
<p><a href="form_change_password?user_name=%s" class="stdlink">Recommencer</a></p>
|
||||
@ -904,7 +869,7 @@ class ZScoUsers(
|
||||
"""Les deux mots de passes ne correspondent pas !"""
|
||||
)
|
||||
return "\n".join(H) + msg + "\n" + tf[1] + F
|
||||
if not self._is_valid_passwd(vals["passwd"]):
|
||||
if not sco_users.is_valid_password(vals["passwd"]):
|
||||
msg = tf_error_message(
|
||||
"""Mot de passe trop simple, recommencez !"""
|
||||
)
|
||||
|
18
ZScolar.py
18
ZScolar.py
@ -133,13 +133,7 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
||||
manage_options = (
|
||||
({"label": "Contents", "action": "manage_main"},)
|
||||
+ PropertyManager.manage_options # add the 'Properties' tab
|
||||
+ (
|
||||
# this line is kept as an example with the files :
|
||||
# dtml/manage_editZScolarForm.dtml
|
||||
# html/ZScolar-edit.stx
|
||||
# {'label': 'Properties', 'action': 'manage_editForm',},
|
||||
{"label": "View", "action": "index_html"},
|
||||
)
|
||||
+ ({"label": "View", "action": "index_html"},)
|
||||
+ Item.manage_options # add the 'Undo' & 'Owner' tab
|
||||
+ RoleManager.manage_options # add the 'Security' tab
|
||||
)
|
||||
@ -152,17 +146,7 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
||||
self.title = title
|
||||
self._db_cnx_string = db_cnx_string
|
||||
self._cnx = None
|
||||
# --- add editable DTML documents:
|
||||
# self.defaultDocFile('sidebar_dept',
|
||||
# 'barre gauche (partie haute)',
|
||||
# 'sidebar_dept')
|
||||
|
||||
# --- add DB connector
|
||||
# id = 'DB'
|
||||
# da = ZopeDA.Connection(
|
||||
# id, 'DB connector', db_cnx_string, False,
|
||||
# check=1, tilevel=2, encoding='utf-8')
|
||||
# self._setObject(id, da)
|
||||
# --- add Scousers instance
|
||||
id = "Users"
|
||||
obj = ZScoUsers.ZScoUsers(id, "Gestion utilisateurs zope")
|
||||
|
18
__init__.py
18
__init__.py
@ -27,8 +27,6 @@
|
||||
|
||||
from ZScolar import ZScolar, manage_addZScolarForm, manage_addZScolar
|
||||
|
||||
# from ZNotes import ZNotes, manage_addZNotesForm, manage_addZNotes
|
||||
|
||||
from ZScoDoc import ZScoDoc, manage_addZScoDoc
|
||||
|
||||
# from sco_zope import *
|
||||
@ -53,23 +51,7 @@ def initialize(context):
|
||||
icon="static/icons/sco_icon.png",
|
||||
)
|
||||
|
||||
# context.registerHelp()
|
||||
# context.registerHelpTitle("ZScolar")
|
||||
|
||||
# --- ZScoDoc
|
||||
context.registerClass(
|
||||
ZScoDoc, constructors=(manage_addZScoDoc,), icon="static/icons/sco_icon.png"
|
||||
)
|
||||
|
||||
# --- ZNotes
|
||||
# context.registerClass(
|
||||
# ZNotes,
|
||||
# constructors = (
|
||||
# manage_addZNotesForm,
|
||||
# manage_addZNotes
|
||||
# ),
|
||||
# icon = 'static/icons/notes_icon.png'
|
||||
# )
|
||||
|
||||
# context.registerHelp()
|
||||
# context.registerHelpTitle("ZNotes")
|
||||
|
@ -1,62 +0,0 @@
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
|
||||
<dtml-call "REQUEST.set( 'E', do_entreprise_list( args={ 'entreprise_id' : entreprise_id } )[0])">
|
||||
|
||||
<dtml-call "REQUEST.set( 'curtime', ZopeTime().strftime('%d/%m/%Y') )">
|
||||
<dtml-call "REQUEST.set( 'link_create_corr', make_link_create_corr(entreprise_id) )">
|
||||
<dtml-call "REQUEST.set( 'correspondants',
|
||||
do_entreprise_correspondant_listnames( args={ 'entreprise_id' : entreprise_id }) )">
|
||||
<dtml-if "len(correspondants) == 0">
|
||||
<dtml-call "REQUEST.set( 'correspondants', [ ('inconnu','') ])">
|
||||
</dtml-if>
|
||||
|
||||
<h2 class="entreprise_contact">Nouveau "contact" avec l'entreprise <dtml-var "E['nom']"></h2>
|
||||
|
||||
|
||||
<dtml-call "REQUEST.set('tf', TrivialFormulator( URL0, REQUEST.form,
|
||||
(
|
||||
('entreprise_id', { 'input_type' : 'hidden', 'default' : entreprise_id }),
|
||||
|
||||
('type_contact', { 'input_type' : 'menu', 'title' : 'Objet',
|
||||
'allowed_values' : ('Prospection', 'Stage étudiant',
|
||||
'Contrat Apprentissage DUT GTR1',
|
||||
'Contrat Apprentissage DUT GTR2',
|
||||
'Contrat Apprentissage Licence SQRT',
|
||||
'Projet', 'Autre' ),
|
||||
'default' : 'Stage étudiant'
|
||||
}),
|
||||
|
||||
('date', { 'size' : 12, 'title' : 'Date du contact (j/m/a)', 'allow_null' : False,
|
||||
'default': curtime }),
|
||||
|
||||
('entreprise_corresp_id', { 'input_type' : 'menu', 'title' : 'Correspondant entreprise',
|
||||
'explanation' : link_create_corr, 'allow_null' : True,
|
||||
'labels' : [ x[0] for x in correspondants ],
|
||||
'allowed_values' : [ x[1] for x in correspondants ] }),
|
||||
|
||||
('etudiant', { 'size' : 16, 'title' : 'Etudiant concerné', 'allow_null' : True,
|
||||
'explanation' : 'nom (si pas ambigu) ou code' }),
|
||||
('enseignant', { 'size' : 16, 'title' : 'Enseignant (tuteur)', 'allow_null' : True }),
|
||||
('description', { 'input_type' : 'textarea', 'rows' : 3, 'cols': 40, 'title' : 'Description' }),
|
||||
|
||||
),
|
||||
cancelbutton='Annuler',
|
||||
submitlabel = 'Ajouter ce contact', readonly = REQUEST['_read_only']
|
||||
))">
|
||||
|
||||
<dtml-call "REQUEST.set( 'etudok', do_entreprise_check_etudiant(etudiant) )">
|
||||
|
||||
<dtml-if "(tf[0] == 0) or (etudok[0] == 0)">
|
||||
<dtml-if "etudok[0] == 0">
|
||||
<p class="entreprise_warning"><dtml-var "etudok[1]"></p>
|
||||
</dtml-if>
|
||||
<dtml-var "tf[1]">
|
||||
<dtml-elif "tf[0] == -1">
|
||||
<dtml-call "RESPONSE.redirect( URL1 )">
|
||||
<dtml-else>
|
||||
<dtml-call "tf[2].update( { 'etudid' : etudok[1] })">
|
||||
<dtml-var "REQUEST.set( 'matiere_id', do_entreprise_contact_create( tf[2] ) )">
|
||||
<dtml-call "RESPONSE.redirect( URL1 )">
|
||||
</dtml-if tf>
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,27 +0,0 @@
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
|
||||
<dtml-call "REQUEST.set( 'F', do_entreprise_contact_list( args={ 'entreprise_contact_id' : entreprise_contact_id } )[0])">
|
||||
|
||||
<h2>Suppression du contact</h2>
|
||||
|
||||
|
||||
<dtml-call "REQUEST.set('tf', TrivialFormulator( URL0, REQUEST.form,
|
||||
( ('entreprise_contact_id', { 'input_type' : 'hidden' }),
|
||||
),
|
||||
initvalues = F,
|
||||
submitlabel = 'Confirmer la suppression',
|
||||
cancelbutton = 'Annuler', readonly = REQUEST['_read_only']
|
||||
))">
|
||||
|
||||
<dtml-if "tf[0] == 0">
|
||||
<dtml-var "tf[1]">
|
||||
<dtml-else>
|
||||
<dtml-if "tf[0] == -1">
|
||||
<dtml-call "RESPONSE.redirect( URL1 )">
|
||||
<dtml-else>
|
||||
<dtml-call "do_entreprise_contact_delete( F['entreprise_contact_id'] )">
|
||||
<dtml-call "RESPONSE.redirect(URL1)">
|
||||
</dtml-if>
|
||||
</dtml-if>
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,62 +0,0 @@
|
||||
<dtml-call "REQUEST.set( 'F', do_entreprise_contact_list( args={ 'entreprise_contact_id' : entreprise_contact_id } )[0])">
|
||||
<dtml-call "REQUEST.set( 'entreprise_id', F['entreprise_id'])">
|
||||
<dtml-call "REQUEST.set( 'link_create_corr', make_link_create_corr(F['entreprise_id']) )">
|
||||
<dtml-call "REQUEST.set( 'E', do_entreprise_list( args={ 'entreprise_id' : F['entreprise_id'] } )[0])">
|
||||
<dtml-call "REQUEST.set( 'correspondants',
|
||||
do_entreprise_correspondant_listnames( args={ 'entreprise_id' : F['entreprise_id'] })+ [ ('inconnu','') ])">
|
||||
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
<h2 class="entreprise_contact"><dtml-var title_or_id></h2>
|
||||
|
||||
|
||||
<h3>Contact avec entreprise <dtml-var "E['nom']"></h3>
|
||||
|
||||
<dtml-call "REQUEST.set('tf', TrivialFormulator( URL0, REQUEST.form,
|
||||
( ('entreprise_contact_id', { 'default' : entreprise_contact_id, 'input_type' : 'hidden' }),
|
||||
|
||||
('entreprise_id', { 'input_type' : 'hidden', 'default' : F['entreprise_id'] }),
|
||||
|
||||
('type_contact', { 'input_type' : 'menu', 'title' : 'Objet',
|
||||
'allowed_values' : ('Prospection', 'Stage étudiant', 'Contrat Apprentissage', 'Projet', 'Autre' ),
|
||||
}),
|
||||
|
||||
('date', { 'size' : 12, 'title' : 'Date du contact (j/m/a)', 'allow_null' : False }),
|
||||
|
||||
('entreprise_corresp_id', { 'input_type' : 'menu', 'title' : 'Correspondant entreprise',
|
||||
'explanation' : link_create_corr,
|
||||
'allow_null' : True,
|
||||
'labels' : [ x[0] for x in correspondants ],
|
||||
'allowed_values' : [ x[1] for x in correspondants ] }),
|
||||
|
||||
('etudiant', { 'size' : 16, 'title' : 'Etudiant concerné', 'allow_null' : True,
|
||||
'default' : F['etudid'],
|
||||
'explanation' : 'nom (si pas ambigu) ou code' }),
|
||||
('enseignant', { 'size' : 16, 'title' : 'Enseignant (tuteur)', 'allow_null' : True }),
|
||||
('description', { 'input_type' : 'textarea', 'rows' : 3, 'cols': 40, 'title' : 'Description' }),
|
||||
),
|
||||
cancelbutton = 'Annuler',
|
||||
initvalues = F,
|
||||
submitlabel = 'Modifier les valeurs', readonly = REQUEST['_read_only']
|
||||
))">
|
||||
|
||||
<dtml-call "REQUEST.set( 'etudok', do_entreprise_check_etudiant(etudiant) )">
|
||||
|
||||
<dtml-if "(tf[0] == 0) or (etudok[0] == 0)">
|
||||
<dtml-if "etudok[0] == 0">
|
||||
<p class="entreprise_warning"><dtml-var "etudok[1]"></p>
|
||||
</dtml-if>
|
||||
|
||||
<dtml-var "tf[1]">
|
||||
<dtml-unless "REQUEST['_read_only']">
|
||||
<p class="entreprise_descr"><a class="entreprise_delete" href="entreprise_contact_delete?entreprise_contact_id=<dtml-var entreprise_contact_id>">Supprimer ce contact</a> </p>
|
||||
</dtml-unless>
|
||||
<dtml-elif "tf[0] == -1">
|
||||
<dtml-call "RESPONSE.redirect( URL1 )" >
|
||||
<dtml-else>
|
||||
<dtml-call "tf[2].update( { 'etudid' : etudok[1] })">
|
||||
<dtml-call "do_entreprise_contact_edit( tf[2] )">
|
||||
<dtml-call "RESPONSE.redirect( URL1 + '/entreprise_contact_list?entreprise_id=' + str(F['entreprise_id']) )" >
|
||||
</dtml-if>
|
||||
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,54 +0,0 @@
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
|
||||
<dtml-if entreprise_id>
|
||||
<dtml-call "REQUEST.set( 'E', do_entreprise_list( args={ 'entreprise_id' : entreprise_id } )[0])">
|
||||
<dtml-call "REQUEST.set( 'C', do_entreprise_contact_list( args={ 'entreprise_id' : entreprise_id }) )">
|
||||
|
||||
<h2 class="entreprise_contact">Listes des contacts avec l'entreprise <dtml-var "E['nom']"> </h2>
|
||||
|
||||
<dtml-else>
|
||||
<h2 class="entreprise_contact">Listes des contacts</h2>
|
||||
<dtml-call "REQUEST.set( 'C', do_entreprise_contact_list( args={ }))">
|
||||
</dtml-if entreprise_id>
|
||||
|
||||
<table class="contact_list">
|
||||
|
||||
<tr><th>Date</th><th>Objet</th><dtml-unless entreprise_id><th>Entreprise</th></dtml-unless><th>Etudiant</th><th>Description</th></tr>
|
||||
|
||||
<dtml-in "C">
|
||||
<dtml-let F="_['sequence-item']">
|
||||
<dtml-call "REQUEST.set( 'Ec', do_entreprise_list( args={ 'entreprise_id' : F['entreprise_id'] } )[0])">
|
||||
|
||||
<tr class="<dtml-if sequence-odd>contact_list_odd<dtml-else>contact_list_even</dtml-if>">
|
||||
|
||||
<td><a class="contact_edit" href="entreprise_contact_edit?entreprise_contact_id=<dtml-var "F['entreprise_contact_id']">">
|
||||
<dtml-var "F['date']">
|
||||
</td>
|
||||
|
||||
<td class="contact_descr"><dtml-var "F['type_contact']"></td>
|
||||
<dtml-unless entreprise_id><td class="contact_descr"><dtml-var "Ec['nom']"></td></dtml-unless>
|
||||
<td class="contact_descr">
|
||||
<dtml-if "F['etudid']">
|
||||
<dtml-in "getEtudInfo(etudid=F['etudid'],filled=1)" mapping>
|
||||
<a href="<dtml-var ScoURL>/ficheEtud?etudid=<dtml-var "F['etudid']">"><dtml-var nomprenom></a>
|
||||
</dtml-in>
|
||||
</dtml-if etudid>
|
||||
</td>
|
||||
<td class="contact_descr"><dtml-var "F['description']"></td>
|
||||
</tr>
|
||||
</dtml-let F>
|
||||
|
||||
<dtml-else>
|
||||
<tr><td colspan="4"><font color="red"><em>Aucun contact !</em></font></td></tr>
|
||||
</dtml-in>
|
||||
</table>
|
||||
|
||||
<dtml-unless "REQUEST['_read_only']">
|
||||
<dtml-if entreprise_id>
|
||||
<p class="entreprise_create">
|
||||
<a class="entreprise_create" href="entreprise_contact_create?entreprise_id=<dtml-var "E['entreprise_id']">">nouveau "contact"</a>
|
||||
</p>
|
||||
</dtml-if>
|
||||
</dtml-unless>
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,43 +0,0 @@
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
|
||||
<dtml-call "REQUEST.set( 'UE', do_entreprise_list( args={ 'entreprise_id' : entreprise_id } )[0])">
|
||||
|
||||
|
||||
<h2 class="entreprise_correspondant"><dtml-var title_or_id> dans l'entreprise <dtml-var "UE['nom']"></h2>
|
||||
|
||||
|
||||
|
||||
<dtml-call "REQUEST.set('tf', TrivialFormulator( URL0, REQUEST.form,
|
||||
( ('entreprise_id', { 'input_type' : 'hidden', 'default' : entreprise_id }),
|
||||
('civilite', { 'input_type' : 'menu',
|
||||
'labels' : [ 'M.', 'Mme' ], 'allowed_values' : [ 'M.', 'Mme' ] }),
|
||||
('nom', { 'size' : 25, 'title' : 'Nom', 'allow_null' : False }),
|
||||
('prenom', { 'size' : 25, 'title' : 'Prénom' }),
|
||||
('fonction', { 'input_type' : 'menu',
|
||||
'allowed_values' : ('Directeur', 'RH', 'Resp. Administratif', 'Tuteur', 'Autre'),
|
||||
'default' : 'Tuteur',
|
||||
'explanation' : 'fonction via à vis de l\'IUT' }),
|
||||
('phone1', { 'size' : 14, 'title' : 'Téléphone 1', }),
|
||||
('phone2', { 'size' : 14, 'title' : 'Téléphone 2', }),
|
||||
('mobile', { 'size' : 14, 'title' : 'Tél. mobile', }),
|
||||
('fax', { 'size' : 14, 'title' : 'Fax', }),
|
||||
('mail1', { 'size' : 25, 'title' : 'e-mail', }),
|
||||
('mail2', { 'size' : 25, 'title' : 'e-mail 2', }),
|
||||
|
||||
('note', { 'input_type' : 'textarea', 'rows' : 3, 'cols': 40, 'title' : 'Note' }),
|
||||
|
||||
),
|
||||
cancelbutton='Annuler',
|
||||
submitlabel = 'Ajouter ce correspondant', readonly = REQUEST['_read_only']
|
||||
))">
|
||||
|
||||
<dtml-if "tf[0] == 0">
|
||||
<dtml-var "tf[1]">
|
||||
<dtml-else>
|
||||
<dtml-var "REQUEST.set( 'matiere_id', do_entreprise_correspondant_create( tf[2] ) )">
|
||||
|
||||
<dtml-call "RESPONSE.redirect( URL1 )">
|
||||
|
||||
</dtml-if>
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,27 +0,0 @@
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
|
||||
<dtml-call "REQUEST.set( 'F', do_entreprise_correspondant_list( args={ 'entreprise_corresp_id' : entreprise_corresp_id } )[0])">
|
||||
|
||||
<h2>Suppression du correspondant <dtml-var "F['nom']"> <dtml-var "F['prenom']"></h2>
|
||||
|
||||
|
||||
<dtml-call "REQUEST.set('tf', TrivialFormulator( URL0, REQUEST.form,
|
||||
( ('entreprise_corresp_id', { 'input_type' : 'hidden' }),
|
||||
),
|
||||
initvalues = F,
|
||||
submitlabel = 'Confirmer la suppression',
|
||||
cancelbutton = 'Annuler', readonly = REQUEST['_read_only']
|
||||
))">
|
||||
|
||||
<dtml-if "tf[0] == 0">
|
||||
<dtml-var "tf[1]">
|
||||
<dtml-else>
|
||||
<dtml-if "tf[0] == -1">
|
||||
<dtml-call "RESPONSE.redirect( URL1 )">
|
||||
<dtml-else>
|
||||
<dtml-call "do_entreprise_correspondant_delete( F['entreprise_corresp_id'] )">
|
||||
<dtml-call "RESPONSE.redirect(URL1)">
|
||||
</dtml-if>
|
||||
</dtml-if>
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,41 +0,0 @@
|
||||
<dtml-call "REQUEST.set( 'F', do_entreprise_correspondant_list( args={ 'entreprise_corresp_id' : entreprise_corresp_id } )[0])">
|
||||
<dtml-call "REQUEST.set( 'entreprise_id', F['entreprise_id'])">
|
||||
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
<h2 class="entreprise_correspondant"><dtml-var title_or_id></h2>
|
||||
|
||||
<dtml-call "REQUEST.set('tf', TrivialFormulator( URL0, REQUEST.form,
|
||||
( ('entreprise_corresp_id', { 'default' : entreprise_corresp_id, 'input_type' : 'hidden' }),
|
||||
('civilite', { 'input_type' : 'menu',
|
||||
'labels' : [ 'M.', 'Mme' ], 'allowed_values' : [ 'M.', 'Mme' ] }),
|
||||
('nom', { 'size' : 25, 'title' : 'Nom', 'allow_null' : False }),
|
||||
('prenom', { 'size' : 25, 'title' : 'Prénom' }),
|
||||
('fonction', { 'input_type' : 'menu',
|
||||
'allowed_values' : ('Directeur', 'RH', 'Resp. Administratif', 'Tuteur', 'Autre'),
|
||||
'explanation' : 'fonction via à vis de l\'IUT' }),
|
||||
('phone1', { 'size' : 14, 'title' : 'Téléphone 1', }),
|
||||
('phone2', { 'size' : 14, 'title' : 'Téléphone 2', }),
|
||||
('mobile', { 'size' : 14, 'title' : 'Tél. mobile', }),
|
||||
('fax', { 'size' : 14, 'title' : 'Fax', }),
|
||||
('mail1', { 'size' : 25, 'title' : 'e-mail', }),
|
||||
('mail2', { 'size' : 25, 'title' : 'e-mail 2', }),
|
||||
|
||||
('note', { 'input_type' : 'textarea', 'rows' : 3, 'cols': 40, 'title' : 'Note' }),
|
||||
),
|
||||
cancelbutton = 'Annuler',
|
||||
initvalues = F,
|
||||
submitlabel = 'Modifier les valeurs', readonly = REQUEST['_read_only']
|
||||
))">
|
||||
|
||||
<dtml-if "tf[0] == 0">
|
||||
<dtml-var "tf[1]">
|
||||
<dtml-elif "tf[0] == -1">
|
||||
<dtml-call "RESPONSE.redirect( REQUEST.HTTP_REFERER )" >
|
||||
<dtml-call "RESPONSE.redirect( URL1 + '/entreprise_correspondant_list?entreprise_id=' + str(F['entreprise_id']) )" >
|
||||
<dtml-else>
|
||||
<dtml-call "do_entreprise_correspondant_edit( tf[2] )">
|
||||
<dtml-call "RESPONSE.redirect( URL1 + '/entreprise_correspondant_list?entreprise_id=' + str(F['entreprise_id']) )" >
|
||||
</dtml-if>
|
||||
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,52 +0,0 @@
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
|
||||
<dtml-call "REQUEST.set( 'E', do_entreprise_list( args={ 'entreprise_id' : entreprise_id } )[0])">
|
||||
|
||||
<h2>Listes des correspondants dans l'entreprise <dtml-var "E['nom']"> </h2>
|
||||
|
||||
<table class="corr_list">
|
||||
|
||||
<tr><th>Nom</th><th>Entreprise</th><th>Fonction</th><th>Téléphone</th><th>Mail</th><th>Note</th></tr>
|
||||
|
||||
<dtml-in "do_entreprise_correspondant_list( args={ 'entreprise_id' : entreprise_id })">
|
||||
<dtml-let F="_['sequence-item']">
|
||||
|
||||
<tr class="<dtml-if sequence-odd>corr_list_odd<dtml-else>corr_list_even</dtml-if>">
|
||||
|
||||
<td><a class="corr_edit" href="entreprise_correspondant_edit?entreprise_corresp_id=<dtml-var "F['entreprise_corresp_id']">">
|
||||
<dtml-if "F['nom']"><dtml-var "F['nom'].lower().capitalize()"></dtml-if>
|
||||
<dtml-if "F['prenom']"> <dtml-var "F['prenom'].lower().capitalize()"></dtml-if>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td class="corr_descr"><dtml-var "E['nom']"></td>
|
||||
|
||||
<td class="corr_descr"><dtml-var "F['fonction']"></td>
|
||||
|
||||
<td class="corr_descr">
|
||||
<dtml-if "F['phone1']"><dtml-var "F['phone1']"></dtml-if>
|
||||
<dtml-if "F['phone2']"> / <dtml-var "F['phone2']"></dtml-if>
|
||||
<dtml-if "F['mobile']"> / <dtml-var "F['mobile']"></dtml-if>
|
||||
</td>
|
||||
|
||||
<td class="corr_descr">
|
||||
<dtml-if "F['mail1']"> <a href="mailto:<dtml-var "F['mail1']">"><dtml-var "F['mail1']"></a></dtml-if>
|
||||
<dtml-if "F['mail1']"> <br> <a href="mailto:<dtml-var "F['mail2']">"><dtml-var "F['mail2']"></a></dtml-if>
|
||||
</td>
|
||||
|
||||
<td class="corr_descr"><dtml-var "F['note']"></td>
|
||||
|
||||
<td class="corr_descr"><a class="corr_delete" href="entreprise_correspondant_edit?entreprise_corresp_id=<dtml-var "F['entreprise_corresp_id']">">modifier</a> </td>
|
||||
<td class="corr_descr"><a class="corr_delete" href="entreprise_correspondant_delete?entreprise_corresp_id=<dtml-var "F['entreprise_corresp_id']">">supprimer</a> </td>
|
||||
</tr>
|
||||
</dtml-let>
|
||||
<dtml-else>
|
||||
<tr><td colspan="4"><font color="red"><em>Aucun correspondant dans cette entreprise !</em></font></td></tr>
|
||||
</dtml-in>
|
||||
</table>
|
||||
|
||||
<p class="entreprise_create"><a class="entreprise_create" href="<dtml-var "URL1 + '/entreprise_correspondant_create?entreprise_id=' + entreprise_id">">
|
||||
Ajouter un correspondant dans l'entreprise <dtml-var "E['nom']"> </a><p>
|
||||
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,60 +0,0 @@
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
|
||||
<dtml-call "REQUEST.set( 'F', do_entreprise_list( args={ 'entreprise_id' : entreprise_id } )[0])">
|
||||
|
||||
|
||||
<h2>Suppression de l'entreprise <dtml-var "F['nom']"> </h2>
|
||||
|
||||
<p class="entreprise_warning">Attention: supression définitive de l'entreprise, de ses correspondants et contacts.
|
||||
</p>
|
||||
|
||||
<dtml-call "REQUEST.set( 'Cl', do_entreprise_correspondant_list( args={ 'entreprise_id' : entreprise_id }))">
|
||||
|
||||
<dtml-if "len(Cl)">
|
||||
<h3>Correspondants dans l'entreprise <dtml-var "F['nom']"> (seront <em>supprimés</em>):</h3>
|
||||
<ul>
|
||||
<dtml-in Cl>
|
||||
<dtml-let c="_['sequence-item']">
|
||||
<li><dtml-if "c['nom']"><dtml-var "c['nom'].lower().capitalize()"></dtml-if>
|
||||
<dtml-if "c['prenom']"> <dtml-var "c['prenom'].lower().capitalize()"></dtml-if>
|
||||
(<dtml-var "c['fonction']">)
|
||||
</li>
|
||||
</dtml-let c>
|
||||
</dtml-in Cl>
|
||||
</ul>
|
||||
</dtml-if Cl>
|
||||
|
||||
<dtml-call "REQUEST.set( 'Cts', do_entreprise_contact_list( args={ 'entreprise_id' : entreprise_id }))">
|
||||
<dtml-if "len(Cts)">
|
||||
<h3>Contacts avec l'entreprise <dtml-var "F['nom']"> (seront <em>supprimés</em>):</h3>
|
||||
<ul>
|
||||
<dtml-in Cts>
|
||||
<dtml-let c="_['sequence-item']">
|
||||
<li><dtml-if "c['date']"><dtml-var "c['date']"></dtml-if>
|
||||
<dtml-if "c['description']">(<dtml-var "c['description']">)</dtml-if>
|
||||
</li>
|
||||
</dtml-let c>
|
||||
</dtml-in Cts>
|
||||
</ul>
|
||||
</dtml-if Cts>
|
||||
|
||||
<dtml-call "REQUEST.set('tf', TrivialFormulator( URL0, REQUEST.form,
|
||||
( ('entreprise_id', { 'input_type' : 'hidden' }),
|
||||
),
|
||||
initvalues = F,
|
||||
submitlabel = 'Confirmer la suppression',
|
||||
cancelbutton = 'Annuler', readonly = REQUEST['_read_only']
|
||||
))">
|
||||
|
||||
<dtml-if "tf[0] == 0">
|
||||
<dtml-var "tf[1]">
|
||||
<dtml-else>
|
||||
<dtml-if "tf[0] == -1">
|
||||
<dtml-call "RESPONSE.redirect( URL1 )">
|
||||
<dtml-else>
|
||||
<dtml-call "do_entreprise_delete( F['entreprise_id'] )">
|
||||
<dtml-call "RESPONSE.redirect(URL1)">
|
||||
</dtml-if>
|
||||
</dtml-if>
|
||||
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
@ -1,139 +0,0 @@
|
||||
<dtml-var "entreprise_header(REQUEST=REQUEST)">
|
||||
|
||||
<script type="text/javascript">
|
||||
function entsub(event,ourform) {
|
||||
if (event && event.which == 13)
|
||||
ourform.submit();
|
||||
else
|
||||
return true;}
|
||||
</script>
|
||||
|
||||
<dtml-if entreprise_page_size>
|
||||
<dtml-call "REQUEST.set( 'entreprise_page_size', int(entreprise_page_size))">
|
||||
<dtml-else>
|
||||
<dtml-call "REQUEST.set( 'entreprise_page_size', 10 )">
|
||||
</dtml-if>
|
||||
|
||||
<h2><dtml-var title_or_id></h2>
|
||||
|
||||
<dtml-comment>
|
||||
<p class="entreprise_warning">
|
||||
Attention: version test préliminaire. Signaler les problèmes à <a href="mailto:viennet@lipn.univ-paris13.fr">Emmanuel</a>
|
||||
</p>
|
||||
</dtml-comment>
|
||||
|
||||
<dtml-unless sort_type><dtml-call "REQUEST.set( 'sort_type', 'nom' )"></dtml-unless>
|
||||
<dtml-call "REQUEST.set( 'sort_on_contact', False )">
|
||||
|
||||
<dtml-if "sort_type=='nom'">
|
||||
<dtml-call "REQUEST.set( 'sort_key', 'nom' )">
|
||||
<dtml-elif "sort_type=='datecontact'">
|
||||
<dtml-call "REQUEST.set( 'sort_on_contact', True )">
|
||||
<dtml-call "REQUEST.set( 'sort_key', None )">
|
||||
<dtml-elif "sort_type=='qualite_relation'">
|
||||
<dtml-call "REQUEST.set( 'sort_key', 'qualite_relation desc, nom asc' )">
|
||||
<dtml-elif "sort_type=='date_creation'">
|
||||
<dtml-call "REQUEST.set( 'sort_key', 'date_creation desc, nom asc' )">
|
||||
<dtml-else>
|
||||
<p class="entreprise_warning">valeur invalide pour 'sort_type' !</p>
|
||||
</dtml-if>
|
||||
|
||||
<dtml-if etud_nom>
|
||||
<dtml-call "REQUEST.set( 'Elist', do_entreprise_list_by_etud( args=REQUEST.form, sort_on_contact=sort_on_contact ) )">
|
||||
<dtml-else>
|
||||
<dtml-call "REQUEST.set( 'Elist', do_entreprise_list( args=REQUEST.form, test='~*', sort_on_contact=sort_on_contact, sortkey=sort_key ) )">
|
||||
</dtml-if>
|
||||
|
||||
<dtml-unless start><dtml-call "REQUEST.set( 'start', 1)"></dtml-unless>
|
||||
|
||||
|
||||
<form action="" method="GET">
|
||||
<table><tr>
|
||||
<th>nom</th><td><input type="text" name="nom" size="12" value="<dtml-if nom><dtml-var nom></dtml-if>" onkeypress="return entsub(event,this.form)"></input></td>
|
||||
<th>ville</th><td><input type="text" name="ville" size="12" value="<dtml-if ville><dtml-var ville></dtml-if>" onkeypress="return entsub(event,this.form)"></input></td>
|
||||
<th>étudiant</th><td><input type="text" name="etud_nom" size="12" value="<dtml-if etud_nom><dtml-var etud_nom></dtml-if>" onkeypress="return entsub(event,this.form)"></input></td>
|
||||
|
||||
<td><input type="submit" value="rechercher"></input></td>
|
||||
<td> </td>
|
||||
<td>Tri par: <select name="sort_type" onchange="this.form.submit()">
|
||||
<option value="nom" <dtml-if "sort_type=='nom'">selected</dtml-if>>nom entreprise</option>
|
||||
<option value="datecontact" <dtml-if "sort_type=='datecontact'">selected</dtml-if>>date dernier contact</option>
|
||||
<option value="qualite_relation" <dtml-if "sort_type=='qualite_relation'">selected</dtml-if>>relation IUT/Entreprise</option>
|
||||
<option value="date_creation" <dtml-if "sort_type=='date_creation'">selected</dtml-if>>date saisie entreprise</option>
|
||||
</select></td>
|
||||
</tr></table>
|
||||
</form>
|
||||
|
||||
<table class="entreprise_list">
|
||||
|
||||
<dtml-in Elist size=entreprise_page_size start=start overlap=1>
|
||||
<dtml-if sequence-start>
|
||||
<table class="entreprise_list_title">
|
||||
<tr class="entreprise_list_title"><td class="entreprise_list_title">Entreprises</td>
|
||||
<td class="entreprise_list_title_res">Résultats <b><dtml-var start></b> - <b><dtml-try><dtml-var "_['next-sequence-start-number']"><dtml-except><dtml-var "len(Elist)"></dtml-try></b> sur <b><dtml-var "len(Elist)"> </b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="entreprise_list">
|
||||
</dtml-if sequence-start>
|
||||
|
||||
<dtml-let F="_['sequence-item']">
|
||||
<dtml-call "REQUEST.set( 'Cl', do_entreprise_correspondant_list( args={ 'entreprise_id' : F['entreprise_id'] }))">
|
||||
<dtml-call "REQUEST.set( 'Ct', do_entreprise_contact_list( args={ 'entreprise_id' : F['entreprise_id'] }))">
|
||||
|
||||
<tr class="<dtml-if sequence-odd>entreprise_list_odd<dtml-else>entreprise_list_even</dtml-if>">
|
||||
|
||||
<td colspan="5" class="entreprise_descr_name"><a class="entreprise_edit" href="entreprise_edit?entreprise_id=<dtml-var "F['entreprise_id']">&start=<dtml-var start>"><dtml-var "F['nom']"></a></td>
|
||||
</tr>
|
||||
<tr class="<dtml-if sequence-odd>entreprise_list_odd<dtml-else>entreprise_list_even</dtml-if>">
|
||||
<td> </td>
|
||||
<td class="entreprise_descr"><dtml-var "str_abbrev(F['ville'], 22)"></td>
|
||||
<td class="entreprise_descr"><dtml-var "F['secteur']"> </td>
|
||||
|
||||
<td class="entreprise_descr_link">
|
||||
<a class="entreprise_delete" href="entreprise_correspondant_list?entreprise_id=<dtml-var "F['entreprise_id']">"><dtml-var "len(Cl)"> corr.</a>
|
||||
<dtml-if "sort_type=='qualite_relation'"><b><dtml-var "{100:'TB',75:'B',50:'M',25:'!' }.get(F['qualite_relation'],'?')"></b></dtml-if>
|
||||
</td>
|
||||
<td class="entreprise_descr_link"><a class="entreprise_delete" href="entreprise_contact_list?entreprise_id=<dtml-var "F['entreprise_id']">"><dtml-var "len(Ct)"> contacts</a>
|
||||
<dtml-try>(<dtml-var "F['etud_nom']">)<dtml-except></dtml-try>
|
||||
<dtml-try>(<dtml-var "F['date']">)<dtml-except></dtml-try>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</dtml-let>
|
||||
<dtml-if sequence-end>
|
||||
</table>
|
||||
</dtml-if sequence-end>
|
||||
<dtml-else Elist>
|
||||
<p class="entreprise_warning">Aucune entreprise !</p>
|
||||
</dtml-in>
|
||||
|
||||
|
||||
<p>
|
||||
<form action="setPageSizeCookie" method="GET">
|
||||
<input type="hidden" name="target_url" value="<dtml-var "URL0+'?'+QUERY_STRING">"></input>
|
||||
|
||||
<dtml-in Elist size=entreprise_page_size start=start overlap=1>
|
||||
<dtml-if sequence-start>
|
||||
<dtml-if previous-sequence>
|
||||
<a href="<dtml-var URL><dtml-var sequence-query>start=<dtml-var previous-sequence-start-number>">
|
||||
page précédente</a>
|
||||
</dtml-if previous-sequence>
|
||||
</dtml-if sequence-start>
|
||||
<dtml-if sequence-end>
|
||||
<dtml-if next-sequence>
|
||||
<a href="<dtml-var URL><dtml-var sequence-query>start=<dtml-var next-sequence-start-number>">
|
||||
page suivante</a>
|
||||
</dtml-if next-sequence>
|
||||
</dtml-if sequence-end>
|
||||
</dtml-in Elist>
|
||||
Résultats par page :
|
||||
<select name="entreprise_page_size" onchange="this.form.submit()">
|
||||
<dtml-in "((5,5),(10,10),(15,15),(20,20),(30,30),(50,50),(1000,'Tous'))" prefix="label">
|
||||
<option value="<dtml-var "label_key">" <dtml-if "label_key == entreprise_page_size">selected</dtml-if>><dtml-var label_item></option>
|
||||
</dtml-in>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
</p>
|
||||
<dtml-var "entreprise_footer(REQUEST=REQUEST)">
|
39
misc/check_zope_usage.py
Executable file
39
misc/check_zope_usage.py
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Check usage of (published) ScoDoc methods
|
||||
|
||||
Quick method: just grep method name in all constant strings from the source code base.
|
||||
|
||||
Usage:
|
||||
check_zope_usage.py methods-list.txt string-constants.txt
|
||||
|
||||
methods-list.txt : fichier texte, module et un nom de méthode / ligne
|
||||
ZScoUsers get_userlist
|
||||
string-constants.txt : les constantes chaines, extraites par extract_code_strings.py
|
||||
"scolars.py" "</li><li>"
|
||||
|
||||
E. Viennet 2021-01-09
|
||||
"""
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
|
||||
methods_filename = sys.argv[1]
|
||||
constants_filename = sys.argv[2]
|
||||
|
||||
with open(methods_filename) as f:
|
||||
methods = [l.strip().split("\t")[1] for l in f]
|
||||
|
||||
print("%d methods" % len(methods))
|
||||
|
||||
with open(constants_filename) as f:
|
||||
constants = [l[:-1].split("\t")[1] for l in f]
|
||||
|
||||
print("%d constants" % len(constants))
|
||||
|
||||
for method in methods:
|
||||
n = 0
|
||||
for c in constants:
|
||||
if method in c:
|
||||
n += 1
|
||||
print("%s\t%s" % (method, n))
|
@ -5,7 +5,7 @@
|
||||
Useful to check if an API function is used in a generated web page !
|
||||
|
||||
Usage:
|
||||
extract_code_strings.py source.py ...
|
||||
extract_code_strings.py source.py ... > string-constants.txt
|
||||
|
||||
(replace RT by an existing departement id)
|
||||
|
||||
@ -15,13 +15,24 @@ from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import ast
|
||||
import types
|
||||
|
||||
L = []
|
||||
for srcfilename in sys.argv[1:]:
|
||||
print("processing %s" % srcfilename, file=sys.stderr)
|
||||
# print("processing %s" % srcfilename, file=sys.stderr)
|
||||
with open(srcfilename) as f:
|
||||
p = ast.parse(f.read())
|
||||
L.extend(x.s.strip() for x in ast.walk(p) if x.__class__ == ast.Str)
|
||||
# L.extend(x.s.strip() for x in ast.walk(p) if x.__class__ == ast.Str)
|
||||
for x in ast.walk(p):
|
||||
if x.__class__ == ast.Str:
|
||||
if type(x.s) == types.StringType:
|
||||
s = x.s
|
||||
else:
|
||||
s = x.s.encode("UTF-8")
|
||||
# remove tabs and cr
|
||||
s = s.translate(None, "\t\n")
|
||||
if len(s):
|
||||
print("%s\t%s" % (srcfilename, s))
|
||||
|
||||
L = sorted(set(L)) # uniq | sort
|
||||
print("\n".join(L))
|
||||
# L = sorted(set(L)) # uniq | sort
|
||||
# print("\n".join(L))
|
||||
|
24
notesdb.py
24
notesdb.py
@ -141,6 +141,8 @@ def DBSelectArgs(
|
||||
distinct=True,
|
||||
aux_tables=[],
|
||||
id_name=None,
|
||||
limit="",
|
||||
offset="",
|
||||
):
|
||||
"""Select * from table where values match dict vals.
|
||||
Returns cnx, columns_names, list of tuples
|
||||
@ -155,6 +157,12 @@ def DBSelectArgs(
|
||||
distinct = " distinct "
|
||||
else:
|
||||
distinct = ""
|
||||
if limit != "":
|
||||
limit = " LIMIT %d" % limit
|
||||
if not offset:
|
||||
offset = ""
|
||||
if offset != "":
|
||||
offset = " OFFSET %d" % offset
|
||||
operator = " " + operator + " "
|
||||
# liste des tables (apres "from")
|
||||
tables = [table] + [x[0] for x in aux_tables]
|
||||
@ -195,7 +203,17 @@ def DBSelectArgs(
|
||||
if cond:
|
||||
cond = " where " + cond
|
||||
#
|
||||
req = "select " + distinct + ", ".join(what) + " from " + tables + cond + orderby
|
||||
req = (
|
||||
"select "
|
||||
+ distinct
|
||||
+ ", ".join(what)
|
||||
+ " from "
|
||||
+ tables
|
||||
+ cond
|
||||
+ orderby
|
||||
+ limit
|
||||
+ offset
|
||||
)
|
||||
# open('/tmp/select.log','a').write( req % vals + '\n' )
|
||||
try:
|
||||
cursor.execute(req, vals)
|
||||
@ -329,6 +347,8 @@ class EditableTable:
|
||||
test="=",
|
||||
sortkey=None,
|
||||
disable_formatting=False,
|
||||
limit="",
|
||||
offset="",
|
||||
):
|
||||
"returns list of dicts"
|
||||
# REQLOG.write('%s: %s by %s (%s) %d\n'%(self.table_name,args,sys._getframe(1).f_code.co_name, sys._getframe(2).f_code.co_name, REQN))
|
||||
@ -347,6 +367,8 @@ class EditableTable:
|
||||
operator=operator,
|
||||
aux_tables=self.aux_tables,
|
||||
id_name=self.id_name,
|
||||
limit=limit,
|
||||
offset=offset,
|
||||
)
|
||||
for r in res:
|
||||
self.format_output(r, disable_formatting=disable_formatting)
|
||||
|
@ -779,7 +779,7 @@ def edit_ue_set_code_apogee(context, id=None, value=None, REQUEST=None):
|
||||
|
||||
# ---- Table recap formation
|
||||
def formation_table_recap(context, formation_id, format="html", REQUEST=None):
|
||||
""""""
|
||||
"""Table recapitulant formation."""
|
||||
F = context.formation_list(args={"formation_id": formation_id})
|
||||
if not F:
|
||||
raise ScoValueError("invalid formation_id")
|
||||
|
@ -213,6 +213,8 @@ def etapes_apo_str(etapes):
|
||||
|
||||
|
||||
def do_formsemestre_edit(context, sem, cnx=None, **kw):
|
||||
"""Apply modifications to formsemestre.
|
||||
Update etapes and resps. Invalidate cache."""
|
||||
if not cnx:
|
||||
cnx = context.GetDBConnexion()
|
||||
|
||||
|
53
sco_users.py
Normal file
53
sco_users.py
Normal file
@ -0,0 +1,53 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gestion scolarite IUT
|
||||
#
|
||||
# Copyright (c) 1999 - 2021 Emmanuel Viennet. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Emmanuel Viennet emmanuel.viennet@viennet.net
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
"""Fonctions sur les utilisateurs
|
||||
"""
|
||||
|
||||
# Anciennement dans ZScoUsers.py, séparé pour migration
|
||||
|
||||
import cracklib # pylint: disable=import-error
|
||||
|
||||
import sco_utils as scu
|
||||
from sco_utils import CONFIG, SCO_ENCODING
|
||||
|
||||
|
||||
def is_valid_password(cleartxt):
|
||||
"""Check password.
|
||||
returns True if OK.
|
||||
"""
|
||||
if (
|
||||
hasattr(CONFIG, "MIN_PASSWORD_LENGTH")
|
||||
and CONFIG.MIN_PASSWORD_LENGTH > 0
|
||||
and len(cleartxt) < CONFIG.MIN_PASSWORD_LENGTH
|
||||
):
|
||||
return False # invalid: too short
|
||||
try:
|
||||
_ = cracklib.FascistCheck(cleartxt)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
@ -52,15 +52,16 @@ file_path = Globals.package_home(globals())
|
||||
|
||||
import inspect
|
||||
|
||||
LOG_SECURITY=False # use for dev
|
||||
LOG_SECURITY = False # use for dev
|
||||
|
||||
|
||||
class ClassSecurityInfo(ZopeClassSecurityInfo):
|
||||
def declareProtected(self, perm, funcname):
|
||||
if LOG_SECURITY:
|
||||
frame = inspect.currentframe()
|
||||
module = frame.f_back.f_locals["__module__"]
|
||||
if str(module).strip() == "ZAbsences":
|
||||
raise Exception()
|
||||
module = str(frame.f_back.f_locals["__module__"])
|
||||
assert module.startswith("Products.ScoDoc.")
|
||||
module = module[len("Products.ScoDoc.") :]
|
||||
with open("/tmp/protected_methods.txt", "a") as f:
|
||||
f.write("%s\t%s\n" % (module, funcname))
|
||||
super(ClassSecurityInfo, self).declareProtected(perm, funcname)
|
||||
|
@ -2039,7 +2039,14 @@ table.entreprise_list, table.corr_list, table.contact_list {
|
||||
/* border-style: solid; */
|
||||
border-spacing: 0px 0px;
|
||||
padding: 0px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
table.entreprise_list td.nbcorr a, table.entreprise_list td.nbcontact a, table.contact_list td.etudnom a, table.contact_list td a {
|
||||
color: navy;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
tr.entreprise_list_even, tr.corr_list_even, tr.contact_list_even {
|
||||
background-color: rgb(85%,85%,95%);
|
||||
}
|
||||
@ -2047,6 +2054,19 @@ tr.entreprise_list_odd, tr.corr_list_odd, tr.contact_list_odd {
|
||||
background-color: rgb(90%,90%, 90%);
|
||||
}
|
||||
|
||||
span.table_nav_mid {
|
||||
flex-grow: 1; /* Set the middle element to grow and stretch */
|
||||
}
|
||||
span.table_nav_prev, span.table_nav_next {
|
||||
width: 11em; /* A fixed width as the default */
|
||||
}
|
||||
|
||||
div.table_nav {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
td.entreprise_descr, td.corr_descr, td.contact_descr {
|
||||
padding-left: 2em;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user