1
0
forked from ScoDoc/ScoDoc

Merge branch 'master' of https://scodoc.org/git/viennet/ScoDoc into ScoDoc8

This commit is contained in:
Emmanuel Viennet 2021-01-16 11:05:23 +01:00
commit bb589ae3ae
19 changed files with 888 additions and 770 deletions

View File

@ -697,6 +697,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 +1994,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())

File diff suppressed because it is too large Load Diff

View File

@ -3640,22 +3640,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())

View File

@ -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
)

View File

@ -105,20 +105,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:

View File

@ -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")

View File

@ -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")

View File

@ -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)">

View File

@ -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)">

View File

@ -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)">

View File

@ -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)">

View File

@ -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)">

View File

@ -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)">

View File

@ -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)">

View File

@ -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)">

View File

@ -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)">

View File

@ -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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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>&nbsp;</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>&nbsp;&nbsp;&nbsp;&nbsp;
</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>
&nbsp; 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)">

View File

@ -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)

View File

@ -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;
}