removed useless context arg from evaluations

This commit is contained in:
Emmanuel Viennet 2021-07-29 11:19:00 +03:00
parent eff9ae59bc
commit 8c02c6ef7e
71 changed files with 383 additions and 506 deletions

View File

@ -639,7 +639,7 @@ class GenTable(object):
H.append(html_title) H.append(html_title)
H.append(self.html()) H.append(self.html())
if with_html_headers: if with_html_headers:
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
elif format == "pdf": elif format == "pdf":
objects = self.pdf() objects = self.pdf()
@ -700,7 +700,7 @@ class SeqGenTable(object):
# ----- Exemple d'utilisation minimal. # ----- Exemple d'utilisation minimal.
if __name__ == "__main__": if __name__ == "__main__":
T = gen_tables.GenTable( T = GenTable(
rows=[{"nom": "Hélène", "age": 26}, {"nom": "Titi&çà§", "age": 21}], rows=[{"nom": "Hélène", "age": 26}, {"nom": "Titi&çà§", "age": 21}],
columns_ids=("nom", "age"), columns_ids=("nom", "age"),
) )
@ -715,7 +715,7 @@ if __name__ == "__main__":
from reportlab.platypus import KeepInFrame from reportlab.platypus import KeepInFrame
from app.scodoc import sco_preferences, sco_pdf from app.scodoc import sco_preferences, sco_pdf
preferences = sco_preferences.SemPreferences(None) preferences = sco_preferences.SemPreferences()
T.preferences = preferences T.preferences = preferences
objects = T.gen(format="pdf") objects = T.gen(format="pdf")
objects = [KeepInFrame(0, 0, objects, mode="shrink")] objects = [KeepInFrame(0, 0, objects, mode="shrink")]

View File

@ -28,7 +28,7 @@
"""HTML Header/Footer for ScoDoc pages """HTML Header/Footer for ScoDoc pages
""" """
import cgi import html
from flask_login import current_user from flask_login import current_user
@ -124,9 +124,9 @@ _HTML_BEGIN = """<?xml version="1.0" encoding="%(encoding)s"?>
""" """
def scodoc_top_html_header(context, REQUEST, page_title="ScoDoc"): def scodoc_top_html_header(page_title="ScoDoc: bienvenue"):
H = [ H = [
_HTML_BEGIN % {"page_title": "ScoDoc: bienvenue", "encoding": scu.SCO_ENCODING}, _HTML_BEGIN % {"page_title": page_title, "encoding": scu.SCO_ENCODING},
_TOP_LEVEL_CSS, _TOP_LEVEL_CSS,
"""</head><body class="gtrcontent" id="gtrcontent">""", """</head><body class="gtrcontent" id="gtrcontent">""",
scu.CUSTOM_HTML_HEADER_CNX, scu.CUSTOM_HTML_HEADER_CNX,
@ -158,9 +158,8 @@ def sco_header(
"Main HTML page header for ScoDoc" "Main HTML page header for ScoDoc"
from app.scodoc.sco_formsemestre_status import formsemestre_page_title from app.scodoc.sco_formsemestre_status import formsemestre_page_title
context = None # XXX TODO à enlever #context
# context est une instance de ZScolar. container est une instance qui "acquiert" ZScolar # context est une instance de ZScolar. container est une instance qui "acquiert" ZScolar
if container:
context = container # je pense que cela suffit pour ce qu'on veut.
# Add a HTTP header (can be used by Apache to log requests) # Add a HTTP header (can be used by Apache to log requests)
if REQUEST.AUTHENTICATED_USER: if REQUEST.AUTHENTICATED_USER:
@ -308,7 +307,7 @@ def sco_header(
H.append(scu.CUSTOM_HTML_HEADER) H.append(scu.CUSTOM_HTML_HEADER)
# #
if not no_side_bar: if not no_side_bar:
H.append(html_sidebar.sidebar(context, REQUEST)) H.append(html_sidebar.sidebar(REQUEST))
H.append("""<div class="gtrcontent" id="gtrcontent">""") H.append("""<div class="gtrcontent" id="gtrcontent">""")
# #
# Barre menu semestre: # Barre menu semestre:
@ -327,7 +326,7 @@ def sco_header(
) )
# #
if head_message: if head_message:
H.append('<div class="head_message">' + cgi.escape(head_message) + "</div>") H.append('<div class="head_message">' + html.escape(head_message) + "</div>")
# #
# div pour affichage messages temporaires # div pour affichage messages temporaires
H.append('<div id="sco_msg" class="head_message"></div>') H.append('<div id="sco_msg" class="head_message"></div>')
@ -335,7 +334,7 @@ def sco_header(
return "".join(H) return "".join(H)
def sco_footer(context, REQUEST=None): def sco_footer():
"""Main HTMl pages footer""" """Main HTMl pages footer"""
return ( return (
"""</div><!-- /gtrcontent -->""" + scu.CUSTOM_HTML_FOOTER + """</body></html>""" """</div><!-- /gtrcontent -->""" + scu.CUSTOM_HTML_FOOTER + """</body></html>"""

View File

@ -35,7 +35,7 @@ from app.scodoc import sco_preferences
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
def sidebar_common(context, REQUEST=None): def sidebar_common(REQUEST=None):
"partie commune à toutes les sidebar" "partie commune à toutes les sidebar"
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
params = { params = {
@ -50,7 +50,7 @@ def sidebar_common(context, REQUEST=None):
'<a class="scodoc_title" href="about">ScoDoc 8</a>', '<a class="scodoc_title" href="about">ScoDoc 8</a>',
'<div id="authuser"><a id="authuserlink" href="%(ScoURL)s/Users/user_info_page">%(authuser)s</a><br/><a id="deconnectlink" href="%(LogoutURL)s">déconnexion</a></div>' '<div id="authuser"><a id="authuserlink" href="%(ScoURL)s/Users/user_info_page">%(authuser)s</a><br/><a id="deconnectlink" href="%(LogoutURL)s">déconnexion</a></div>'
% params, % params,
sidebar_dept(context, REQUEST), sidebar_dept(REQUEST),
"""<h2 class="insidebar">Scolarit&eacute;</h2> """<h2 class="insidebar">Scolarit&eacute;</h2>
<a href="%(ScoURL)s" class="sidebar">Semestres</a> <br/> <a href="%(ScoURL)s" class="sidebar">Semestres</a> <br/>
<a href="%(NotesURL)s" class="sidebar">Programmes</a> <br/> <a href="%(NotesURL)s" class="sidebar">Programmes</a> <br/>
@ -75,7 +75,7 @@ def sidebar_common(context, REQUEST=None):
return "".join(H) return "".join(H)
def sidebar(context, REQUEST=None): def sidebar(REQUEST=None):
"Main HTML page sidebar" "Main HTML page sidebar"
# rewritten from legacy DTML code # rewritten from legacy DTML code
from app.scodoc import sco_abs from app.scodoc import sco_abs
@ -86,7 +86,7 @@ def sidebar(context, REQUEST=None):
"SCO_USER_MANUAL": scu.SCO_USER_MANUAL, "SCO_USER_MANUAL": scu.SCO_USER_MANUAL,
} }
H = ['<div class="sidebar">', sidebar_common(context, REQUEST)] H = ['<div class="sidebar">', sidebar_common(REQUEST)]
H.append( H.append(
"""<div class="box-chercheetud">Chercher étudiant:<br/> """<div class="box-chercheetud">Chercher étudiant:<br/>
@ -168,7 +168,7 @@ def sidebar(context, REQUEST=None):
return "".join(H) return "".join(H)
def sidebar_dept(context, REQUEST=None): def sidebar_dept(REQUEST=None):
"""Partie supérieure de la marge de gauche""" """Partie supérieure de la marge de gauche"""
infos = { infos = {
"BASE0": REQUEST.BASE0, "BASE0": REQUEST.BASE0,

View File

@ -1302,7 +1302,7 @@ class NotesTable(object):
"""[ {...evaluation et son etat...} ]""" """[ {...evaluation et son etat...} ]"""
if self._evaluations_etats is None: if self._evaluations_etats is None:
self._evaluations_etats = sco_evaluations.do_evaluation_list_in_sem( self._evaluations_etats = sco_evaluations.do_evaluation_list_in_sem(
self.context, self.formsemestre_id self.formsemestre_id
) )
return self._evaluations_etats return self._evaluations_etats

View File

@ -44,10 +44,7 @@ Created on Fri Sep 9 09:15:05 2016
import os import os
try: from io import StringIO
from io import StringIO ## for Python 3
except ImportError:
from cStringIO import StringIO ## for Python 2
from zipfile import ZipFile, BadZipfile from zipfile import ZipFile, BadZipfile
import pprint import pprint
@ -498,7 +495,7 @@ class JuryPE(object):
lastdate = max(sesdates) # date de fin de l'inscription la plus récente lastdate = max(sesdates) # date de fin de l'inscription la plus récente
# if PETable.AFFICHAGE_DEBUG_PE == True : pe_tools.pe_print(" derniere inscription = ", lastDateSem) # if PETable.AFFICHAGE_DEBUG_PE == True : pe_tools.pe_print(" derniere inscription = ", lastDateSem)
semestresDeScoDoc = sco_formsemestre.formsemestre_list(self.context) semestresDeScoDoc = sco_formsemestre.do_formsemestre_list(self.context)
semestresSuperieurs = [ semestresSuperieurs = [
sem for sem in semestresDeScoDoc if sem["semestre_id"] > sonDernierSidValide sem for sem in semestresDeScoDoc if sem["semestre_id"] > sonDernierSidValide
] # Semestre de rang plus élevé que son dernier sem valide ] # Semestre de rang plus élevé que son dernier sem valide
@ -1243,9 +1240,9 @@ def get_cosemestres_diplomants(context, semBase, avec_meme_formation=False):
> dont la formation est la même (optionnel) > dont la formation est la même (optionnel)
> ne prenant en compte que les etudiants sans redoublement > ne prenant en compte que les etudiants sans redoublement
""" """
tousLesSems = sco_formsemestre.formsemestre_list( tousLesSems = sco_formsemestre.do_formsemestre_list(
context context
) # tous les semestres memorises dans scodoc ) # tous les semestres memorisés dans scodoc
diplome = get_annee_diplome_semestre(semBase) diplome = get_annee_diplome_semestre(semBase)
if avec_meme_formation: # si une formation est imposee if avec_meme_formation: # si une formation est imposee

View File

@ -73,7 +73,7 @@ def _pe_view_sem_recap_form(context, formsemestre_id, REQUEST=None):
formsemestre_id=formsemestre_id formsemestre_id=formsemestre_id
), ),
] ]
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def pe_view_sem_recap( def pe_view_sem_recap(

View File

@ -157,7 +157,7 @@ def doSignaleAbsence(
% etud % etud
) )
H.append(sco_find_etud.form_search_etud(context, REQUEST)) H.append(sco_find_etud.form_search_etud(context, REQUEST))
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -278,7 +278,7 @@ Raison: <input type="text" name="description" size="42"/> (optionnel)
"menu_module": menu_module, "menu_module": menu_module,
"disabled": "disabled" if disabled else "", "disabled": "disabled" if disabled else "",
}, },
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -367,7 +367,7 @@ def doJustifAbsence(
% etud % etud
) )
H.append(sco_find_etud.form_search_etud(context, REQUEST)) H.append(sco_find_etud.form_search_etud(context, REQUEST))
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -424,7 +424,7 @@ Raison: <input type="text" name="description" size="42"/> (optionnel)
</form> """ </form> """
% etud, % etud,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -477,7 +477,7 @@ autre absence pour <b>%(nomprenom)s</b></a></li>
% etud % etud
) )
H.append(sco_find_etud.form_search_etud(context, REQUEST)) H.append(sco_find_etud.form_search_etud(context, REQUEST))
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -565,7 +565,7 @@ def AnnuleAbsenceEtud(context, REQUEST=None): # etudid implied
</form> </form>
</td></tr></table>""" </td></tr></table>"""
% etud, % etud,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -618,7 +618,7 @@ autre absence pour <b>%(nomprenom)s</b></a></li>
% etud % etud
) )
H.append(sco_find_etud.form_search_etud(context, REQUEST)) H.append(sco_find_etud.form_search_etud(context, REQUEST))
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -696,7 +696,7 @@ def EtatAbsences(context, REQUEST=None):
</td></tr></table> </td></tr></table>
</form>""" </form>"""
% (scu.AnneeScolaire(REQUEST), datetime.datetime.now().strftime("%d/%m/%Y")), % (scu.AnneeScolaire(REQUEST), datetime.datetime.now().strftime("%d/%m/%Y")),
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -799,7 +799,7 @@ def CalAbs(context, REQUEST=None): # etud implied
H.append("selected") H.append("selected")
H.append(""">%s</option>""" % y) H.append(""">%s</option>""" % y)
H.append("""</select></form>""") H.append("""</select></form>""")
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -884,7 +884,7 @@ def ListeAbsEtud(
H.append(tab_absjust.html()) H.append(tab_absjust.html())
else: else:
H.append("""<h3>Pas d'absences justifiées</h3>""") H.append("""<h3>Pas d'absences justifiées</h3>""")
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
elif format == "text": elif format == "text":
T = [] T = []

View File

@ -85,7 +85,7 @@ def apo_compare_csv_form(context, REQUEST=None):
<input type="submit" value="Comparer ces fichiers"/> <input type="submit" value="Comparer ces fichiers"/>
</div> </div>
</form>""", </form>""",
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -105,7 +105,7 @@ def apo_compare_csv(context, A_file, B_file, autodetect=True, REQUEST=None):
_apo_compare_csv(context, A, B, REQUEST=None), _apo_compare_csv(context, A, B, REQUEST=None),
"</div>", "</div>",
"""<p><a href="apo_compare_csv_form" class="stdlink">Autre comparaison</a></p>""", """<p><a href="apo_compare_csv_form" class="stdlink">Autre comparaison</a></p>""",
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)

View File

@ -313,7 +313,7 @@ def do_formsemestre_archive(
'<h2 class="fontorange">Valeurs archivées le %s</h2>' % date, '<h2 class="fontorange">Valeurs archivées le %s</h2>' % date,
'<style type="text/css">table.notes_recapcomplet tr { color: rgb(185,70,0); }</style>', '<style type="text/css">table.notes_recapcomplet tr { color: rgb(185,70,0); }</style>',
data, data,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
) )
PVArchive.store(archive_id, "Tableau_moyennes.html", data) PVArchive.store(archive_id, "Tableau_moyennes.html", data)
@ -406,7 +406,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
F = [ F = [
"""<p><em>Note: les documents sont aussi affectés par les réglages sur la page "<a href="edit_preferences">Paramétrage</a>" (accessible à l'administrateur du département).</em> """<p><em>Note: les documents sont aussi affectés par les réglages sur la page "<a href="edit_preferences">Paramétrage</a>" (accessible à l'administrateur du département).</em>
</p>""", </p>""",
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
descr = [ descr = [
@ -539,7 +539,7 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id):
H.append("</ul></li>") H.append("</ul></li>")
H.append("</ul>") H.append("</ul>")
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def formsemestre_get_archived_file( def formsemestre_get_archived_file(

View File

@ -164,7 +164,7 @@ def etud_upload_file_form(context, REQUEST, etudid):
cancelbutton="Annuler", cancelbutton="Annuler",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid) url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
@ -289,7 +289,7 @@ def etudarchive_import_files_form(context, group_id, REQUEST=None):
""" """
% group_id, % group_id,
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, REQUEST.URL0,
REQUEST.form, REQUEST.form,
@ -342,4 +342,4 @@ def etudarchive_import_files(
r = sco_trombino.zip_excel_import_files( r = sco_trombino.zip_excel_import_files(
context, xlsfile, zipfile, REQUEST, callback, filename_title, page_title context, xlsfile, zipfile, REQUEST, callback, filename_title, page_title
) )
return r + html_sco_header.sco_footer(context, REQUEST) return r + html_sco_header.sco_footer()

View File

@ -99,7 +99,7 @@ def make_context_dict(context, sem, etud):
C.update(etud) C.update(etud)
# copie preferences # copie preferences
# XXX devrait acceder directement à un dict de preferences, à revoir # XXX devrait acceder directement à un dict de preferences, à revoir
for name in sco_preferences.get_base_preferences(context).prefs_name: for name in sco_preferences.get_base_preferences().prefs_name:
C[name] = sco_preferences.get_preference(name, sem["formsemestre_id"]) C[name] = sco_preferences.get_preference(name, sem["formsemestre_id"])
# ajoute groupes et group_0, group_1, ... # ajoute groupes et group_0, group_1, ...
@ -564,7 +564,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
if sco_preferences.get_preference("bul_show_all_evals", formsemestre_id): if sco_preferences.get_preference("bul_show_all_evals", formsemestre_id):
complete_eval_ids = set([e["evaluation_id"] for e in evals]) complete_eval_ids = set([e["evaluation_id"] for e in evals])
all_evals = sco_evaluations.do_evaluation_list( all_evals = sco_evaluations.do_evaluation_list(
context, args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
) )
all_evals.reverse() # plus ancienne d'abord all_evals.reverse() # plus ancienne d'abord
for e in all_evals: for e in all_evals:
@ -832,7 +832,7 @@ def formsemestre_bulletinetud(
H.append('<div id="radar_bulletin"></div>') H.append('<div id="radar_bulletin"></div>')
# --- Pied de page # --- Pied de page
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "".join(H) return "".join(H)

View File

@ -229,9 +229,7 @@ class BulletinGenerator(object):
margins=self.margins, margins=self.margins,
server_name=self.server_name, server_name=self.server_name,
filigranne=self.filigranne, filigranne=self.filigranne,
preferences=sco_preferences.SemPreferences( preferences=sco_preferences.SemPreferences(formsemestre_id),
self.context, formsemestre_id
),
) )
) )
document.build(objects) document.build(objects)

View File

@ -293,7 +293,7 @@ def formsemestre_bulletinetud_published_dict(
"bul_show_all_evals", formsemestre_id "bul_show_all_evals", formsemestre_id
): ):
all_evals = sco_evaluations.do_evaluation_list( all_evals = sco_evaluations.do_evaluation_list(
context, args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
) )
all_evals.reverse() # plus ancienne d'abord all_evals.reverse() # plus ancienne d'abord
for e in all_evals: for e in all_evals:

View File

@ -97,7 +97,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
columns_ids=colkeys, columns_ids=colkeys,
pdf_table_style=pdf_style, pdf_table_style=pdf_style,
pdf_col_widths=[colWidths[k] for k in colkeys], pdf_col_widths=[colWidths[k] for k in colkeys],
preferences=sco_preferences.SemPreferences(self.context, formsemestre_id), preferences=sco_preferences.SemPreferences(formsemestre_id),
html_class="notes_bulletin", html_class="notes_bulletin",
html_class_ignore_default=True, html_class_ignore_default=True,
html_with_td_classes=True, html_with_td_classes=True,
@ -667,9 +667,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
else: else:
t["_module_colspan"] = 2 t["_module_colspan"] = 2
if prefs["bul_show_minmax_eval"] or prefs["bul_show_moypromo"]: if prefs["bul_show_minmax_eval"] or prefs["bul_show_moypromo"]:
etat = sco_evaluations.do_evaluation_etat( etat = sco_evaluations.do_evaluation_etat(e["evaluation_id"])
self.context, e["evaluation_id"]
)
if prefs["bul_show_minmax_eval"]: if prefs["bul_show_minmax_eval"]:
t["min"] = scu.fmt_note(etat["mini"]) t["min"] = scu.fmt_note(etat["mini"])
t["max"] = scu.fmt_note(etat["maxi"]) t["max"] = scu.fmt_note(etat["maxi"])

View File

@ -298,7 +298,7 @@ def make_xml_formsemestre_bulletinetud(
"bul_show_all_evals", formsemestre_id "bul_show_all_evals", formsemestre_id
): ):
all_evals = sco_evaluations.do_evaluation_list( all_evals = sco_evaluations.do_evaluation_list(
context, args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
) )
all_evals.reverse() # plus ancienne d'abord all_evals.reverse() # plus ancienne d'abord
for e in all_evals: for e in all_evals:

View File

@ -228,7 +228,7 @@ def do_moduleimpl_moyennes(context, nt, mod):
for e in evals: for e in evals:
e["nb_inscrits"] = e["etat"]["nb_inscrits"] e["nb_inscrits"] = e["etat"]["nb_inscrits"]
NotesDB = sco_evaluations.do_evaluation_get_all_notes( NotesDB = sco_evaluations.do_evaluation_get_all_notes(
context, e["evaluation_id"] e["evaluation_id"]
) # toutes, y compris demissions ) # toutes, y compris demissions
# restreint aux étudiants encore inscrits à ce module # restreint aux étudiants encore inscrits à ce module
notes = [ notes = [

View File

@ -200,7 +200,7 @@ def report_debouche_ask_date(context, REQUEST=None):
+ """<form method="GET"> + """<form method="GET">
Date de départ de la recherche: <input type="text" name="start_year" value="" size=10/> Date de départ de la recherche: <input type="text" name="start_year" value="" size=10/>
</form>""" </form>"""
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )

View File

@ -181,7 +181,7 @@ Chercher étape courante: <input name="etape_apo" type="text" size="8" spellchec
return ( return (
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ "\n".join(H) + "\n".join(H)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )

View File

@ -125,7 +125,7 @@ def sco_dump_and_send_db(context, REQUEST=None):
fcntl.flock(x, fcntl.LOCK_UN) fcntl.flock(x, fcntl.LOCK_UN)
log("sco_dump_and_send_db: done.") log("sco_dump_and_send_db: done.")
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def _duplicate_db(db_name, ano_db_name): def _duplicate_db(db_name, ano_db_name):

View File

@ -94,7 +94,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
% scu.NotesURL() % scu.NotesURL()
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -115,8 +115,6 @@ def do_formation_delete(context, oid, REQUEST):
# news # news
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
object=oid, object=oid,
text="Suppression de la formation %(acronyme)s" % F, text="Suppression de la formation %(acronyme)s" % F,
@ -228,7 +226,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
submitlabel=submitlabel, submitlabel=submitlabel,
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(scu.NotesURL()) return REQUEST.RESPONSE.redirect(scu.NotesURL())
else: else:
@ -251,7 +249,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
"Valeurs incorrectes: il existe déjà une formation avec même titre, acronyme et version." "Valeurs incorrectes: il existe déjà une formation avec même titre, acronyme et version."
) )
+ tf[1] + tf[1]
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
# #
if create: if create:
@ -279,8 +277,6 @@ def do_formation_create(context, args, REQUEST):
r = sco_formations._formationEditor.create(cnx, args) r = sco_formations._formationEditor.create(cnx, args)
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
text="Création de la formation %(titre)s (%(acronyme)s)" % args, text="Création de la formation %(titre)s (%(acronyme)s)" % args,
) )

View File

@ -85,8 +85,6 @@ def do_matiere_create(context, args, REQUEST):
context, args={"formation_id": ue["formation_id"]} context, args={"formation_id": ue["formation_id"]}
)[0] )[0]
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
object=ue["formation_id"], object=ue["formation_id"],
text="Modification de la formation %(acronyme)s" % F, text="Modification de la formation %(acronyme)s" % F,
@ -140,7 +138,7 @@ associé.
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"] dest_url = scu.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"]
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -151,7 +149,7 @@ associé.
"\n".join(H) "\n".join(H)
+ tf_error_message("Titre de matière déjà existant dans cette UE") + tf_error_message("Titre de matière déjà existant dans cette UE")
+ tf[1] + tf[1]
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
_ = do_matiere_create(context, tf[2], REQUEST) _ = do_matiere_create(context, tf[2], REQUEST)
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
@ -186,8 +184,6 @@ def do_matiere_delete(context, oid, REQUEST):
context, args={"formation_id": ue["formation_id"]} context, args={"formation_id": ue["formation_id"]}
)[0] )[0]
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
object=ue["formation_id"], object=ue["formation_id"],
text="Modification de la formation %(acronyme)s" % F, text="Modification de la formation %(acronyme)s" % F,
@ -217,7 +213,7 @@ def matiere_delete(context, matiere_id=None, REQUEST=None):
cancelbutton="Annuler", cancelbutton="Annuler",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -292,9 +288,7 @@ associé.
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + U["formation_id"] dest_url = scu.NotesURL() + "/ue_list?formation_id=" + U["formation_id"]
if tf[0] == 0: if tf[0] == 0:
return ( return "\n".join(H) + tf[1] + help + html_sco_header.sco_footer()
"\n".join(H) + tf[1] + help + html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -307,7 +301,7 @@ associé.
"\n".join(H) "\n".join(H)
+ tf_error_message("Titre de matière déjà existant dans cette UE") + tf_error_message("Titre de matière déjà existant dans cette UE")
+ tf[1] + tf[1]
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
# changement d'UE ? # changement d'UE ?

View File

@ -109,8 +109,6 @@ def do_module_create(context, args, REQUEST):
context, args={"formation_id": args["formation_id"]} context, args={"formation_id": args["formation_id"]}
)[0] )[0]
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
object=args["formation_id"], object=args["formation_id"],
text="Modification de la formation %(acronyme)s" % F, text="Modification de la formation %(acronyme)s" % F,
@ -237,7 +235,7 @@ def module_create(context, matiere_id=None, REQUEST=None):
submitlabel="Créer ce module", submitlabel="Créer ce module",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
else: else:
do_module_create(context, tf[2], REQUEST) do_module_create(context, tf[2], REQUEST)
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
@ -274,8 +272,6 @@ def do_module_delete(context, oid, REQUEST):
context, args={"formation_id": mod["formation_id"]} context, args={"formation_id": mod["formation_id"]}
)[0] )[0]
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
object=mod["formation_id"], object=mod["formation_id"],
text="Modification de la formation %(acronyme)s" % F, text="Modification de la formation %(acronyme)s" % F,
@ -307,7 +303,7 @@ def module_delete(context, module_id=None, REQUEST=None):
cancelbutton="Annuler", cancelbutton="Annuler",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -504,7 +500,7 @@ def module_edit(context, module_id=None, REQUEST=None):
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -561,7 +557,7 @@ def module_list(context, formation_id, REQUEST=None):
) )
H.append("</li>") H.append("</li>")
H.append("</ul>") H.append("</ul>")
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)

View File

@ -102,8 +102,6 @@ def do_ue_create(context, args, REQUEST):
context, args={"formation_id": args["formation_id"]} context, args={"formation_id": args["formation_id"]}
)[0] )[0]
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
object=args["formation_id"], object=args["formation_id"],
text="Modification de la formation %(acronyme)s" % F, text="Modification de la formation %(acronyme)s" % F,
@ -167,8 +165,6 @@ def do_ue_delete(context, ue_id, delete_validations=False, REQUEST=None, force=F
context, args={"formation_id": ue["formation_id"]} context, args={"formation_id": ue["formation_id"]}
)[0] )[0]
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
object=ue["formation_id"], object=ue["formation_id"],
text="Modification de la formation %(acronyme)s" % F, text="Modification de la formation %(acronyme)s" % F,
@ -330,7 +326,7 @@ def ue_edit(context, ue_id=None, create=False, formation_id=None, REQUEST=None):
if tf[0] == 0: if tf[0] == 0:
X = """<div id="ue_list_code"></div> X = """<div id="ue_list_code"></div>
""" """
return "\n".join(H) + tf[1] + X + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + X + html_sco_header.sco_footer()
else: else:
if create: if create:
if not tf[2]["ue_code"]: if not tf[2]["ue_code"]:
@ -824,7 +820,7 @@ Si vous souhaitez modifier cette formation (par exemple pour y ajouter un module
warn, _ = sco_formsemestre_validation.check_formation_ues(context, formation_id) warn, _ = sco_formsemestre_validation.check_formation_ues(context, formation_id)
H.append(warn) H.append(warn)
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "".join(H) return "".join(H)

View File

@ -198,7 +198,7 @@ def experimental_calendar(context, group_id=None, formsemestre_id=None, REQUEST=
"""</form><div id="loading">loading...</div> """</form><div id="loading">loading...</div>
<div id="calendar"></div> <div id="calendar"></div>
""", """,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
"""<script> """<script>
$(document).ready(function() { $(document).ready(function() {

View File

@ -430,7 +430,7 @@ def apo_semset_maq_status(
""" """
% (APO_INPUT_ENCODING,) % (APO_INPUT_ENCODING,)
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -605,7 +605,7 @@ def _view_etuds_page(
% semset_id % semset_id
) )
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def view_apo_csv_store( def view_apo_csv_store(
@ -743,11 +743,7 @@ def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=Non
# Liste des étudiants (sans les résultats pour le moment): TODO # Liste des étudiants (sans les résultats pour le moment): TODO
etuds = apo_data.etuds etuds = apo_data.etuds
if not etuds: if not etuds:
return ( return "\n".join(H) + "<p>Aucun étudiant</p>" + html_sco_header.sco_footer()
"\n".join(H)
+ "<p>Aucun étudiant</p>"
+ html_sco_header.sco_footer(context, REQUEST)
)
# Ajout infos sur ScoDoc vs Apogee # Ajout infos sur ScoDoc vs Apogee
for e in etuds: for e in etuds:
@ -792,7 +788,7 @@ def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=Non
"""<div><a class="stdlink" href="apo_semset_maq_status?semset_id=%s">Retour</a> """<div><a class="stdlink" href="apo_semset_maq_status?semset_id=%s">Retour</a>
</div>""" </div>"""
% semset_id, % semset_id,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)

View File

@ -702,8 +702,6 @@ def create_etud(context, cnx, args={}, REQUEST=None):
fill_etuds_info([etud]) fill_etuds_info([etud])
etud["url"] = url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid) etud["url"] = url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_INSCR, typ=sco_news.NEWS_INSCR,
object=None, # pas d'object pour ne montrer qu'un etudiant object=None, # pas d'object pour ne montrer qu'un etudiant
text='Nouvel étudiant <a href="%(url)s">%(nomprenom)s</a>' % etud, text='Nouvel étudiant <a href="%(url)s">%(nomprenom)s</a>' % etud,

View File

@ -33,6 +33,11 @@ import pprint
import time import time
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
import flask
from flask import url_for
from flask import g
from flask_login import current_user
from app.scodoc.notes_log import log, logCallStack from app.scodoc.notes_log import log, logCallStack
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
@ -124,7 +129,7 @@ _evaluationEditor = ndb.EditableTable(
) )
def do_evaluation_list(context, args, sortkey=None): def do_evaluation_list(args, sortkey=None):
"""List evaluations, sorted by numero (or most recent date first). """List evaluations, sorted by numero (or most recent date first).
Ajoute les champs: Ajoute les champs:
@ -172,19 +177,19 @@ def do_evaluation_list(context, args, sortkey=None):
return evals return evals
def do_evaluation_list_in_formsemestre(context, formsemestre_id): def do_evaluation_list_in_formsemestre(formsemestre_id):
"list evaluations in this formsemestre" "list evaluations in this formsemestre"
context = None # #context
mods = sco_moduleimpl.do_moduleimpl_list(context, formsemestre_id=formsemestre_id) mods = sco_moduleimpl.do_moduleimpl_list(context, formsemestre_id=formsemestre_id)
evals = [] evals = []
for mod in mods: for mod in mods:
evals += do_evaluation_list( evals += do_evaluation_list(args={"moduleimpl_id": mod["moduleimpl_id"]})
context, args={"moduleimpl_id": mod["moduleimpl_id"]}
)
return evals return evals
def _check_evaluation_args(context, args): def _check_evaluation_args(args):
"Check coefficient, dates and duration, raises exception if invalid" "Check coefficient, dates and duration, raises exception if invalid"
context = None # #context
moduleimpl_id = args["moduleimpl_id"] moduleimpl_id = args["moduleimpl_id"]
# check bareme # check bareme
note_max = args.get("note_max", None) note_max = args.get("note_max", None)
@ -236,7 +241,6 @@ def _check_evaluation_args(context, args):
def do_evaluation_create( def do_evaluation_create(
context,
moduleimpl_id=None, moduleimpl_id=None,
jour=None, jour=None,
heure_debut=None, heure_debut=None,
@ -252,26 +256,21 @@ def do_evaluation_create(
**kw # ceci pour absorber les arguments excedentaires de tf #sco8 **kw # ceci pour absorber les arguments excedentaires de tf #sco8
): ):
"""Create an evaluation""" """Create an evaluation"""
if not sco_permissions_check.can_edit_evaluation( context = None # #context
context, REQUEST, moduleimpl_id=moduleimpl_id if not sco_permissions_check.can_edit_evaluation(moduleimpl_id=moduleimpl_id):
):
raise AccessDenied( raise AccessDenied(
"Modification évaluation impossible pour %s" "Modification évaluation impossible pour %s" % current_user.get_nomplogin()
% scu.get_current_user_name(REQUEST)
) )
args = locals() args = locals()
log("do_evaluation_create: args=" + str(args)) log("do_evaluation_create: args=" + str(args))
_check_evaluation_args(context, args) _check_evaluation_args(args)
# Check numeros # Check numeros
module_evaluation_renumber( module_evaluation_renumber(moduleimpl_id, only_if_unumbered=True)
context, moduleimpl_id, REQUEST=REQUEST, only_if_unumbered=True
)
if not "numero" in args or args["numero"] is None: if not "numero" in args or args["numero"] is None:
n = None n = None
# determine le numero avec la date # determine le numero avec la date
# Liste des eval existantes triees par date, la plus ancienne en tete # Liste des eval existantes triees par date, la plus ancienne en tete
ModEvals = do_evaluation_list( ModEvals = do_evaluation_list(
context,
args={"moduleimpl_id": moduleimpl_id}, args={"moduleimpl_id": moduleimpl_id},
sortkey="jour asc, heure_debut asc", sortkey="jour asc, heure_debut asc",
) )
@ -289,9 +288,7 @@ def do_evaluation_create(
next_eval = e next_eval = e
break break
if next_eval: if next_eval:
n = module_evaluation_insert_before( n = module_evaluation_insert_before(ModEvals, next_eval)
context, ModEvals, next_eval, REQUEST
)
else: else:
n = None # a placer en fin n = None # a placer en fin
if n is None: # pas de date ou en fin: if n is None: # pas de date ou en fin:
@ -313,8 +310,6 @@ def do_evaluation_create(
mod["moduleimpl_id"] = M["moduleimpl_id"] mod["moduleimpl_id"] = M["moduleimpl_id"]
mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_NOTE, typ=sco_news.NEWS_NOTE,
object=moduleimpl_id, object=moduleimpl_id,
text='Création d\'une évaluation dans <a href="%(url)s">%(titre)s</a>' % mod, text='Création d\'une évaluation dans <a href="%(url)s">%(titre)s</a>' % mod,
@ -324,22 +319,20 @@ def do_evaluation_create(
return r return r
def do_evaluation_edit(context, REQUEST, args): def do_evaluation_edit(args):
"edit an evaluation" "edit an evaluation"
context = None # #context
evaluation_id = args["evaluation_id"] evaluation_id = args["evaluation_id"]
the_evals = do_evaluation_list(context, {"evaluation_id": evaluation_id}) the_evals = do_evaluation_list({"evaluation_id": evaluation_id})
if not the_evals: if not the_evals:
raise ValueError("evaluation inexistante !") raise ValueError("evaluation inexistante !")
moduleimpl_id = the_evals[0]["moduleimpl_id"] moduleimpl_id = the_evals[0]["moduleimpl_id"]
if not sco_permissions_check.can_edit_evaluation( if not sco_permissions_check.can_edit_evaluation(moduleimpl_id=moduleimpl_id):
context, REQUEST, moduleimpl_id=moduleimpl_id
):
raise AccessDenied( raise AccessDenied(
"Modification évaluation impossible pour %s" "Modification évaluation impossible pour %s" % current_user.get_nomplogin()
% scu.get_current_user_name(REQUEST)
) )
args["moduleimpl_id"] = moduleimpl_id args["moduleimpl_id"] = moduleimpl_id
_check_evaluation_args(context, args) _check_evaluation_args(args)
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
_evaluationEditor.edit(cnx, args) _evaluationEditor.edit(cnx, args)
@ -348,20 +341,18 @@ def do_evaluation_edit(context, REQUEST, args):
sco_cache.invalidate_formsemestre(formsemestre_id=M["formsemestre_id"]) sco_cache.invalidate_formsemestre(formsemestre_id=M["formsemestre_id"])
def do_evaluation_delete(context, REQUEST, evaluation_id): def do_evaluation_delete(evaluation_id):
"delete evaluation" "delete evaluation"
the_evals = do_evaluation_list(context, {"evaluation_id": evaluation_id}) context = None # #context
the_evals = do_evaluation_list({"evaluation_id": evaluation_id})
if not the_evals: if not the_evals:
raise ValueError("evaluation inexistante !") raise ValueError("evaluation inexistante !")
moduleimpl_id = the_evals[0]["moduleimpl_id"] moduleimpl_id = the_evals[0]["moduleimpl_id"]
if not sco_permissions_check.can_edit_evaluation( if not sco_permissions_check.can_edit_evaluation(moduleimpl_id=moduleimpl_id):
context, REQUEST, moduleimpl_id=moduleimpl_id
):
raise AccessDenied( raise AccessDenied(
"Modification évaluation impossible pour %s" "Modification évaluation impossible pour %s" % current_user.get_nomplogin()
% scu.get_current_user_name(REQUEST)
) )
NotesDB = do_evaluation_get_all_notes(context, evaluation_id) # { etudid : value } NotesDB = do_evaluation_get_all_notes(evaluation_id) # { etudid : value }
notes = [x["value"] for x in NotesDB.values()] notes = [x["value"] for x in NotesDB.values()]
if notes: if notes:
raise ScoValueError( raise ScoValueError(
@ -381,8 +372,6 @@ def do_evaluation_delete(context, REQUEST, evaluation_id):
scu.NotesURL() + "/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod scu.NotesURL() + "/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod
) )
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_NOTE, typ=sco_news.NEWS_NOTE,
object=moduleimpl_id, object=moduleimpl_id,
text='Suppression d\'une évaluation dans <a href="%(url)s">%(titre)s</a>' % mod, text='Suppression d\'une évaluation dans <a href="%(url)s">%(titre)s</a>' % mod,
@ -393,9 +382,7 @@ def do_evaluation_delete(context, REQUEST, evaluation_id):
_DEE_TOT = 0 _DEE_TOT = 0
def do_evaluation_etat( def do_evaluation_etat(evaluation_id, partition_id=None, select_first_partition=False):
context, evaluation_id, partition_id=None, select_first_partition=False
):
"""donne infos sur l'etat du evaluation """donne infos sur l'etat du evaluation
{ nb_inscrits, nb_notes, nb_abs, nb_neutre, nb_att, { nb_inscrits, nb_notes, nb_abs, nb_neutre, nb_att,
moyenne, mediane, mini, maxi, moyenne, mediane, mini, maxi,
@ -404,12 +391,11 @@ def do_evaluation_etat(
à ce module ont des notes) à ce module ont des notes)
evalattente est vrai s'il ne manque que des notes en attente evalattente est vrai s'il ne manque que des notes en attente
""" """
context = None # #context
nb_inscrits = len( nb_inscrits = len(
sco_groups.do_evaluation_listeetuds_groups( sco_groups.do_evaluation_listeetuds_groups(evaluation_id, getallstudents=True)
context, evaluation_id, getallstudents=True
)
) )
NotesDB = do_evaluation_get_all_notes(context, evaluation_id) # { etudid : value } NotesDB = do_evaluation_get_all_notes(evaluation_id) # { etudid : value }
notes = [x["value"] for x in NotesDB.values()] notes = [x["value"] for x in NotesDB.values()]
nb_abs = len([x for x in notes if x is None]) nb_abs = len([x for x in notes if x is None])
nb_neutre = len([x for x in notes if x == scu.NOTES_NEUTRALISE]) nb_neutre = len([x for x in notes if x == scu.NOTES_NEUTRALISE])
@ -432,7 +418,7 @@ def do_evaluation_etat(
else: else:
last_modif = None last_modif = None
# ---- Liste des groupes complets et incomplets # ---- Liste des groupes complets et incomplets
E = do_evaluation_list(context, args={"evaluation_id": evaluation_id})[0] E = do_evaluation_list(args={"evaluation_id": evaluation_id})[0]
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0]
is_malus = Mod["module_type"] == scu.MODULE_MALUS # True si module de malus is_malus = Mod["module_type"] == scu.MODULE_MALUS # True si module de malus
@ -568,7 +554,7 @@ def do_evaluation_etat(
} }
def do_evaluation_list_in_sem(context, formsemestre_id, with_etat=True): def do_evaluation_list_in_sem(formsemestre_id, with_etat=True):
"""Liste les evaluations de tous les modules de ce semestre. """Liste les evaluations de tous les modules de ce semestre.
Donne pour chaque eval son état (voir do_evaluation_etat) Donne pour chaque eval son état (voir do_evaluation_etat)
{ evaluation_id,nb_inscrits, nb_notes, nb_abs, nb_neutre, moy, median, last_modif ... } { evaluation_id,nb_inscrits, nb_notes, nb_abs, nb_neutre, moy, median, last_modif ... }
@ -625,14 +611,14 @@ def do_evaluation_list_in_sem(context, formsemestre_id, with_etat=True):
for r in res: for r in res:
r["jour"] = r["jour"] or datetime.date(1900, 1, 1) # pour les comparaisons r["jour"] = r["jour"] or datetime.date(1900, 1, 1) # pour les comparaisons
if with_etat: if with_etat:
r["etat"] = do_evaluation_etat(context, r["evaluation_id"]) r["etat"] = do_evaluation_etat(r["evaluation_id"])
return res return res
# ancien _notes_getall # ancien _notes_getall
def do_evaluation_get_all_notes( def do_evaluation_get_all_notes(
context, evaluation_id, table="notes_notes", filter_suppressed=True, by_uid=None evaluation_id, table="notes_notes", filter_suppressed=True, by_uid=None
): ):
"""Toutes les notes pour une evaluation: { etudid : { 'value' : value, 'date' : date ... }} """Toutes les notes pour une evaluation: { etudid : { 'value' : value, 'date' : date ... }}
Attention: inclut aussi les notes des étudiants qui ne sont plus inscrits au module. Attention: inclut aussi les notes des étudiants qui ne sont plus inscrits au module.
@ -703,7 +689,7 @@ def _eval_etat(evals):
} }
def do_evaluation_etat_in_sem(context, formsemestre_id, REQUEST=None): def do_evaluation_etat_in_sem(formsemestre_id):
"""-> nb_eval_completes, nb_evals_en_cours, nb_evals_vides, """-> nb_eval_completes, nb_evals_en_cours, nb_evals_vides,
date derniere modif, attente""" date derniere modif, attente"""
nt = sco_cache.NotesTableCache.get( nt = sco_cache.NotesTableCache.get(
@ -716,7 +702,7 @@ def do_evaluation_etat_in_sem(context, formsemestre_id, REQUEST=None):
return etat return etat
def do_evaluation_etat_in_mod(context, nt, moduleimpl_id): def do_evaluation_etat_in_mod(nt, moduleimpl_id):
"""""" """"""
evals = nt.get_mod_evaluation_etat_list(moduleimpl_id) evals = nt.get_mod_evaluation_etat_list(moduleimpl_id)
etat = _eval_etat(evals) etat = _eval_etat(evals)
@ -726,8 +712,9 @@ def do_evaluation_etat_in_mod(context, nt, moduleimpl_id):
return etat return etat
def formsemestre_evaluations_cal(context, formsemestre_id, REQUEST=None): def formsemestre_evaluations_cal(formsemestre_id, REQUEST=None):
"""Page avec calendrier de toutes les evaluations de ce semestre""" """Page avec calendrier de toutes les evaluations de ce semestre"""
context = None # #context
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > liste evaluations nt = sco_cache.NotesTableCache.get(formsemestre_id) # > liste evaluations
@ -810,16 +797,16 @@ def formsemestre_evaluations_cal(context, formsemestre_id, REQUEST=None):
"""<p><a href="formsemestre_evaluations_delai_correction?formsemestre_id=%s" class="stdlink">voir les délais de correction</a></p> """<p><a href="formsemestre_evaluations_delai_correction?formsemestre_id=%s" class="stdlink">voir les délais de correction</a></p>
""" """
% (formsemestre_id,), % (formsemestre_id,),
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
def evaluation_date_first_completion(context, evaluation_id): def evaluation_date_first_completion(evaluation_id):
"""Première date à laquelle l'évaluation a été complète """Première date à laquelle l'évaluation a été complète
ou None si actuellement incomplète ou None si actuellement incomplète
""" """
etat = do_evaluation_etat(context, evaluation_id) etat = do_evaluation_etat(evaluation_id)
if not etat["evalcomplete"]: if not etat["evalcomplete"]:
return None return None
@ -827,7 +814,7 @@ def evaluation_date_first_completion(context, evaluation_id):
# Il faut considerer les inscriptions au semestre # Il faut considerer les inscriptions au semestre
# (pour avoir l'etat et le groupe) et aussi les inscriptions # (pour avoir l'etat et le groupe) et aussi les inscriptions
# au module (pour gerer les modules optionnels correctement) # au module (pour gerer les modules optionnels correctement)
# E = do_evaluation_list(context, args={"evaluation_id": evaluation_id})[0] # E = do_evaluation_list(args={"evaluation_id": evaluation_id})[0]
# M = sco_moduleimpl.do_moduleimpl_list(context,moduleimpl_id=E["moduleimpl_id"])[0] # M = sco_moduleimpl.do_moduleimpl_list(context,moduleimpl_id=E["moduleimpl_id"])[0]
# formsemestre_id = M["formsemestre_id"] # formsemestre_id = M["formsemestre_id"]
# insem = sco_formsemestre_inscriptions.do_formsemestre_inscription_listinscrits(context, formsemestre_id) # insem = sco_formsemestre_inscriptions.do_formsemestre_inscription_listinscrits(context, formsemestre_id)
@ -837,13 +824,11 @@ def evaluation_date_first_completion(context, evaluation_id):
# ins = [i for i in insem if i["etudid"] in insmodset] # ins = [i for i in insem if i["etudid"] in insmodset]
notes = list( notes = list(
do_evaluation_get_all_notes( do_evaluation_get_all_notes(evaluation_id, filter_suppressed=False).values()
context, evaluation_id, filter_suppressed=False
).values()
) )
notes_log = list( notes_log = list(
do_evaluation_get_all_notes( do_evaluation_get_all_notes(
context, evaluation_id, filter_suppressed=False, table="notes_notes_log" evaluation_id, filter_suppressed=False, table="notes_notes_log"
).values() ).values()
) )
date_premiere_note = {} # etudid : date date_premiere_note = {} # etudid : date
@ -861,13 +846,14 @@ def evaluation_date_first_completion(context, evaluation_id):
def formsemestre_evaluations_delai_correction( def formsemestre_evaluations_delai_correction(
context, formsemestre_id, format="html", REQUEST=None formsemestre_id, format="html", REQUEST=None
): ):
"""Experimental: un tableau indiquant pour chaque évaluation """Experimental: un tableau indiquant pour chaque évaluation
le nombre de jours avant la publication des notes. le nombre de jours avant la publication des notes.
N'indique pas les évaluations de ratrapage ni celles des modules de bonus/malus. N'indique pas les évaluations de ratrapage ni celles des modules de bonus/malus.
""" """
context = None # #context
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > liste evaluations nt = sco_cache.NotesTableCache.get(formsemestre_id) # > liste evaluations
@ -884,9 +870,7 @@ def formsemestre_evaluations_delai_correction(
Mod["module_type"] == scu.MODULE_MALUS Mod["module_type"] == scu.MODULE_MALUS
): ):
continue continue
e["date_first_complete"] = evaluation_date_first_completion( e["date_first_complete"] = evaluation_date_first_completion(e["evaluation_id"])
context, e["evaluation_id"]
)
if e["date_first_complete"]: if e["date_first_complete"]:
e["delai_correction"] = (e["date_first_complete"].date() - e["jour"]).days e["delai_correction"] = (e["date_first_complete"].date() - e["jour"]).days
else: else:
@ -938,7 +922,7 @@ def formsemestre_evaluations_delai_correction(
return tab.make_page(context, format=format, REQUEST=REQUEST) return tab.make_page(context, format=format, REQUEST=REQUEST)
def module_evaluation_insert_before(context, ModEvals, next_eval, REQUEST): def module_evaluation_insert_before(ModEvals, next_eval):
"""Renumber evals such that an evaluation with can be inserted before next_eval """Renumber evals such that an evaluation with can be inserted before next_eval
Returns numero suitable for the inserted evaluation Returns numero suitable for the inserted evaluation
""" """
@ -946,9 +930,9 @@ def module_evaluation_insert_before(context, ModEvals, next_eval, REQUEST):
n = next_eval["numero"] n = next_eval["numero"]
if not n: if not n:
log("renumbering old evals") log("renumbering old evals")
module_evaluation_renumber(context, next_eval["moduleimpl_id"], REQUEST) module_evaluation_renumber(next_eval["moduleimpl_id"])
next_eval = do_evaluation_list( next_eval = do_evaluation_list(
context, args={"evaluation_id": next_eval["evaluation_id"]} args={"evaluation_id": next_eval["evaluation_id"]}
)[0] )[0]
n = next_eval["numero"] n = next_eval["numero"]
else: else:
@ -959,35 +943,30 @@ def module_evaluation_insert_before(context, ModEvals, next_eval, REQUEST):
if e["numero"] >= n: if e["numero"] >= n:
e["numero"] += 1 e["numero"] += 1
# log('incrementing %s to %s' % (e['evaluation_id'], e['numero'])) # log('incrementing %s to %s' % (e['evaluation_id'], e['numero']))
do_evaluation_edit(context, REQUEST, e) do_evaluation_edit(e)
return n return n
def module_evaluation_move(context, evaluation_id, after=0, REQUEST=None, redirect=1): def module_evaluation_move(evaluation_id, after=0, redirect=1):
"""Move before/after previous one (decrement/increment numero) """Move before/after previous one (decrement/increment numero)
(published) (published)
""" """
e = do_evaluation_list(context, args={"evaluation_id": evaluation_id})[0] e = do_evaluation_list(args={"evaluation_id": evaluation_id})[0]
redirect = int(redirect) redirect = int(redirect)
# access: can change eval ? # access: can change eval ?
if not sco_permissions_check.can_edit_evaluation( if not sco_permissions_check.can_edit_evaluation(moduleimpl_id=e["moduleimpl_id"]):
context, REQUEST, moduleimpl_id=e["moduleimpl_id"]
):
raise AccessDenied( raise AccessDenied(
"Modification évaluation impossible pour %s" "Modification évaluation impossible pour %s" % current_user.get_nomplogin()
% scu.get_current_user_name(REQUEST)
) )
module_evaluation_renumber( module_evaluation_renumber(e["moduleimpl_id"], only_if_unumbered=True)
context, e["moduleimpl_id"], REQUEST=REQUEST, only_if_unumbered=True e = do_evaluation_list(args={"evaluation_id": evaluation_id})[0]
)
e = do_evaluation_list(context, args={"evaluation_id": evaluation_id})[0]
after = int(after) # 0: deplace avant, 1 deplace apres after = int(after) # 0: deplace avant, 1 deplace apres
if after not in (0, 1): if after not in (0, 1):
raise ValueError('invalid value for "after"') raise ValueError('invalid value for "after"')
ModEvals = do_evaluation_list(context, {"moduleimpl_id": e["moduleimpl_id"]}) ModEvals = do_evaluation_list({"moduleimpl_id": e["moduleimpl_id"]})
# log('ModEvals=%s' % [ x['evaluation_id'] for x in ModEvals] ) # log('ModEvals=%s' % [ x['evaluation_id'] for x in ModEvals] )
if len(ModEvals) > 1: if len(ModEvals) > 1:
idx = [p["evaluation_id"] for p in ModEvals].index(evaluation_id) idx = [p["evaluation_id"] for p in ModEvals].index(evaluation_id)
@ -999,18 +978,20 @@ def module_evaluation_move(context, evaluation_id, after=0, REQUEST=None, redire
if neigh: # if neigh: #
# swap numero with neighbor # swap numero with neighbor
e["numero"], neigh["numero"] = neigh["numero"], e["numero"] e["numero"], neigh["numero"] = neigh["numero"], e["numero"]
do_evaluation_edit(context, REQUEST, e) do_evaluation_edit(e)
do_evaluation_edit(context, REQUEST, neigh) do_evaluation_edit(neigh)
# redirect to moduleimpl page: # redirect to moduleimpl page:
if redirect: if redirect:
return REQUEST.RESPONSE.redirect( return flask.redirect(
"moduleimpl_status?moduleimpl_id=" + e["moduleimpl_id"] url_for(
"notes.moduleimpl_status",
scodoc_dept=g.scodoc_dept,
moduleimpl_id=e["moduleimpl_id"],
)
) )
def module_evaluation_renumber( def module_evaluation_renumber(moduleimpl_id, only_if_unumbered=False, redirect=0):
context, moduleimpl_id, REQUEST=None, only_if_unumbered=False, redirect=0
):
"""Renumber evaluations in this module, according to their date. (numero=0: oldest one) """Renumber evaluations in this module, according to their date. (numero=0: oldest one)
Needed because previous versions of ScoDoc did not have eval numeros Needed because previous versions of ScoDoc did not have eval numeros
Note: existing numeros are ignored Note: existing numeros are ignored
@ -1020,7 +1001,6 @@ def module_evaluation_renumber(
# List sorted according to date/heure, ignoring numeros: # List sorted according to date/heure, ignoring numeros:
# (note that we place evaluations with NULL date at the end) # (note that we place evaluations with NULL date at the end)
ModEvals = do_evaluation_list( ModEvals = do_evaluation_list(
context,
args={"moduleimpl_id": moduleimpl_id}, args={"moduleimpl_id": moduleimpl_id},
sortkey="jour asc, heure_debut asc", sortkey="jour asc, heure_debut asc",
) )
@ -1034,24 +1014,29 @@ def module_evaluation_renumber(
i = 1 i = 1
for e in ModEvals: for e in ModEvals:
e["numero"] = i e["numero"] = i
do_evaluation_edit(context, REQUEST, e) do_evaluation_edit(e)
i += 1 i += 1
# If requested, redirect to moduleimpl page: # If requested, redirect to moduleimpl page:
if redirect: if redirect:
return REQUEST.RESPONSE.redirect( return flask.redirect(
"moduleimpl_status?moduleimpl_id=" + moduleimpl_id url_for(
"notes.moduleimpl_status",
scodoc_dept=g.scodoc_dept,
moduleimpl_id=moduleimpl_id,
)
) )
# -------------- VIEWS # -------------- VIEWS
def evaluation_describe(context, evaluation_id="", edit_in_place=True, REQUEST=None): def evaluation_describe(evaluation_id="", edit_in_place=True, REQUEST=None):
"""HTML description of evaluation, for page headers """HTML description of evaluation, for page headers
edit_in_place: allow in-place editing when permitted (not implemented) edit_in_place: allow in-place editing when permitted (not implemented)
""" """
context = None # #context
from app.scodoc import sco_saisie_notes from app.scodoc import sco_saisie_notes
E = do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = do_evaluation_list({"evaluation_id": evaluation_id})[0]
moduleimpl_id = E["moduleimpl_id"] moduleimpl_id = E["moduleimpl_id"]
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0]
@ -1122,7 +1107,6 @@ def evaluation_describe(context, evaluation_id="", edit_in_place=True, REQUEST=N
def evaluation_create_form( def evaluation_create_form(
context,
moduleimpl_id=None, moduleimpl_id=None,
evaluation_id=None, evaluation_id=None,
REQUEST=None, REQUEST=None,
@ -1131,8 +1115,9 @@ def evaluation_create_form(
page_title="Evaluation", page_title="Evaluation",
): ):
"formulaire creation/edition des evaluations (pas des notes)" "formulaire creation/edition des evaluations (pas des notes)"
context = None # #context
if evaluation_id != None: if evaluation_id != None:
the_eval = do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] the_eval = do_evaluation_list({"evaluation_id": evaluation_id})[0]
moduleimpl_id = the_eval["moduleimpl_id"] moduleimpl_id = the_eval["moduleimpl_id"]
# #
M = sco_moduleimpl.do_moduleimpl_withmodule_list( M = sco_moduleimpl.do_moduleimpl_withmodule_list(
@ -1142,18 +1127,16 @@ def evaluation_create_form(
formsemestre_id = M["formsemestre_id"] formsemestre_id = M["formsemestre_id"]
min_note_max = scu.NOTES_PRECISION # le plus petit bareme possible min_note_max = scu.NOTES_PRECISION # le plus petit bareme possible
if not readonly: if not readonly:
if not sco_permissions_check.can_edit_evaluation( if not sco_permissions_check.can_edit_evaluation(moduleimpl_id=moduleimpl_id):
context, REQUEST, moduleimpl_id=moduleimpl_id
):
return ( return (
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ "<h2>Opération non autorisée</h2><p>" + "<h2>Opération non autorisée</h2><p>"
+ "Modification évaluation impossible pour %s" + "Modification évaluation impossible pour %s"
% scu.get_current_user_name(REQUEST) % current_user.get_nomplogin()
+ "</p>" + "</p>"
+ '<p><a href="moduleimpl_status?moduleimpl_id=%s">Revenir</a></p>' + '<p><a href="moduleimpl_status?moduleimpl_id=%s">Revenir</a></p>'
% (moduleimpl_id,) % (moduleimpl_id,)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
if readonly: if readonly:
edit = True # montre les donnees existantes edit = True # montre les donnees existantes
@ -1187,7 +1170,7 @@ def evaluation_create_form(
action = "Modification d'une é" action = "Modification d'une é"
link = "" link = ""
# Note maximale actuelle dans cette eval ? # Note maximale actuelle dans cette eval ?
etat = do_evaluation_etat(context, evaluation_id) etat = do_evaluation_etat(evaluation_id)
if etat["maxi_num"] is not None: if etat["maxi_num"] is not None:
min_note_max = max(scu.NOTES_PRECISION, etat["maxi_num"]) min_note_max = max(scu.NOTES_PRECISION, etat["maxi_num"])
else: else:
@ -1242,7 +1225,7 @@ def evaluation_create_form(
if not readonly: if not readonly:
H = ["<h3>%svaluation en %s</h3>" % (action, mod_descr)] H = ["<h3>%svaluation en %s</h3>" % (action, mod_descr)]
else: else:
return evaluation_describe(context, evaluation_id, REQUEST=REQUEST) return evaluation_describe(evaluation_id, REQUEST=REQUEST)
heures = ["%02dh%02d" % (h, m) for h in range(8, 19) for m in (0, 30)] heures = ["%02dh%02d" % (h, m) for h in range(8, 19) for m in (0, 30)]
# #
@ -1377,14 +1360,7 @@ def evaluation_create_form(
dest_url = "moduleimpl_status?moduleimpl_id=%s" % M["moduleimpl_id"] dest_url = "moduleimpl_status?moduleimpl_id=%s" % M["moduleimpl_id"]
if tf[0] == 0: if tf[0] == 0:
head = html_sco_header.sco_header(context, REQUEST, page_title=page_title) head = html_sco_header.sco_header(context, REQUEST, page_title=page_title)
return ( return head + "\n".join(H) + "\n" + tf[1] + help + html_sco_header.sco_footer()
head
+ "\n".join(H)
+ "\n"
+ tf[1]
+ help
+ html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -1395,8 +1371,8 @@ def evaluation_create_form(
tf[2]["visibulletin"] = 0 tf[2]["visibulletin"] = 0
if not edit: if not edit:
# creation d'une evaluation # creation d'une evaluation
evaluation_id = do_evaluation_create(context, REQUEST=REQUEST, **tf[2]) evaluation_id = do_evaluation_create(REQUEST=REQUEST, **tf[2])
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
do_evaluation_edit(context, REQUEST, tf[2]) do_evaluation_edit(tf[2])
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)

View File

@ -306,7 +306,7 @@ def scodoc_table_results(
""", """,
"\n".join(info_sems), "\n".join(info_sems),
"""</div>""", """</div>""",
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)

View File

@ -90,7 +90,7 @@ def form_search_etud(
context, REQUEST, page_title="Choix d'un étudiant" context, REQUEST, page_title="Choix d'un étudiant"
) )
+ "\n".join(H) + "\n".join(H)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
else: else:
return "\n".join(H) return "\n".join(H)
@ -183,7 +183,7 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
H.append( H.append(
"""<p class="help">La recherche porte sur tout ou partie du NOM ou du NIP de l'étudiant</p>""" """<p class="help">La recherche porte sur tout ou partie du NOM ou du NIP de l'étudiant</p>"""
) )
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
# Was chercheEtudsInfo() # Was chercheEtudsInfo()
@ -318,9 +318,7 @@ def table_etud_in_accessible_depts(expnom=None):
""" """
) )
return ( return (
html_sco_header.scodoc_top_html_header( html_sco_header.scodoc_top_html_header(page_title="Choix d'un étudiant")
None, None, page_title="Choix d'un étudiant"
)
+ "\n".join(H) + "\n".join(H)
+ html_sco_header.standard_html_footer() + html_sco_header.standard_html_footer()
) )

View File

@ -345,8 +345,6 @@ def formation_create_new_version(context, formation_id, redirect=True, REQUEST=N
# news # news
F = formation_list(context, args={"formation_id": new_id})[0] F = formation_list(context, args={"formation_id": new_id})[0]
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_FORM, typ=sco_news.NEWS_FORM,
object=new_id, object=new_id,
text="Nouvelle version de la formation %(acronyme)s" % F, text="Nouvelle version de la formation %(acronyme)s" % F,

View File

@ -248,8 +248,6 @@ def do_formsemestre_create(context, args, REQUEST, silent=False):
args["url"] = "Notes/formsemestre_status?formsemestre_id=%(formsemestre_id)s" % args args["url"] = "Notes/formsemestre_status?formsemestre_id=%(formsemestre_id)s" % args
if not silent: if not silent:
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_SEM, typ=sco_news.NEWS_SEM,
text='Création du semestre <a href="%(url)s">%(titre)s</a>' % args, text='Création du semestre <a href="%(url)s">%(titre)s</a>' % args,
url=args["url"], url=args["url"],

View File

@ -128,9 +128,7 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
name="tf", name="tf",
) )
if tf[0] == 0: if tf[0] == 0:
return ( return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer()
"\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:

View File

@ -82,7 +82,7 @@ def formsemestre_createwithmodules(context, REQUEST=None):
H.append(r) H.append(r)
else: else:
return r # response redirect return r # response redirect
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def formsemestre_editwithmodules(context, REQUEST, formsemestre_id): def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
@ -119,7 +119,7 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
<p class="help">Les modules ont toujours un responsable. Par défaut, c'est le directeur des études.</p>""" <p class="help">Les modules ont toujours un responsable. Par défaut, c'est le directeur des études.</p>"""
) )
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def can_edit_sem(context, REQUEST, formsemestre_id="", sem=None): def can_edit_sem(context, REQUEST, formsemestre_id="", sem=None):
@ -871,9 +871,7 @@ def formsemestre_delete_moduleimpls(context, formsemestre_id, module_ids_to_del)
)[0]["moduleimpl_id"] )[0]["moduleimpl_id"]
mod = sco_edit_module.do_module_list(context, {"module_id": module_id})[0] mod = sco_edit_module.do_module_list(context, {"module_id": module_id})[0]
# Evaluations dans ce module ? # Evaluations dans ce module ?
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
context, {"moduleimpl_id": moduleimpl_id}
)
if evals: if evals:
msg += [ msg += [
'<b>impossible de supprimer %s (%s) car il y a %d évaluations définies (<a href="moduleimpl_status?moduleimpl_id=%s" class="stdlink">supprimer les d\'abord</a>)</b>' '<b>impossible de supprimer %s (%s) car il y a %d évaluations définies (<a href="moduleimpl_status?moduleimpl_id=%s" class="stdlink">supprimer les d\'abord</a>)</b>'
@ -995,7 +993,7 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None):
if ndb.DateDMYtoISO(tf[2]["date_debut"]) > ndb.DateDMYtoISO(tf[2]["date_fin"]): if ndb.DateDMYtoISO(tf[2]["date_debut"]) > ndb.DateDMYtoISO(tf[2]["date_fin"]):
msg = '<ul class="tf-msg"><li class="tf-msg">Dates de début et fin incompatibles !</li></ul>' msg = '<ul class="tf-msg"><li class="tf-msg">Dates de début et fin incompatibles !</li></ul>'
if tf[0] == 0 or msg: if tf[0] == 0 or msg:
return "".join(H) + msg + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "".join(H) + msg + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: # cancel elif tf[0] == -1: # cancel
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"formsemestre_status?formsemestre_id=%s" % formsemestre_id "formsemestre_status?formsemestre_id=%s" % formsemestre_id
@ -1061,15 +1059,13 @@ def do_formsemestre_clone(
# optionally, copy evaluations # optionally, copy evaluations
if clone_evaluations: if clone_evaluations:
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list(
context, args={"moduleimpl_id": mod_orig["moduleimpl_id"]} args={"moduleimpl_id": mod_orig["moduleimpl_id"]}
) )
for e in evals: for e in evals:
args = e.copy() args = e.copy()
del args["jour"] # erase date del args["jour"] # erase date
args["moduleimpl_id"] = mid args["moduleimpl_id"] = mid
_ = sco_evaluations.do_evaluation_create( _ = sco_evaluations.do_evaluation_create(REQUEST=REQUEST, **args)
context, REQUEST=REQUEST, **args
)
# 3- copy uecoefs # 3- copy uecoefs
objs = sco_formsemestre.formsemestre_uecoef_list( objs = sco_formsemestre.formsemestre_uecoef_list(
@ -1297,7 +1293,7 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None):
</ol></div>""", </ol></div>""",
] ]
evals = sco_evaluations.do_evaluation_list_in_formsemestre(context, formsemestre_id) evals = sco_evaluations.do_evaluation_list_in_formsemestre(formsemestre_id)
if evals: if evals:
H.append( H.append(
"""<p class="warning">Attention: il y a %d évaluations dans ce semestre (sa suppression entrainera l'effacement définif des notes) !</p>""" """<p class="warning">Attention: il y a %d évaluations dans ce semestre (sa suppression entrainera l'effacement définif des notes) !</p>"""
@ -1324,7 +1320,7 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None):
) )
else: else:
H.append(tf[1]) H.append(tf[1])
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
elif tf[0] == -1: # cancel elif tf[0] == -1: # cancel
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
@ -1379,7 +1375,7 @@ def do_formsemestre_delete(context, formsemestre_id, REQUEST):
for mod in mods: for mod in mods:
# evaluations # evaluations
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list(
context, args={"moduleimpl_id": mod["moduleimpl_id"]} args={"moduleimpl_id": mod["moduleimpl_id"]}
) )
for e in evals: for e in evals:
ndb.SimpleQuery( ndb.SimpleQuery(
@ -1443,8 +1439,6 @@ def do_formsemestre_delete(context, formsemestre_id, REQUEST):
from app.scodoc import sco_news from app.scodoc import sco_news
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_SEM, typ=sco_news.NEWS_SEM,
object=formsemestre_id, object=formsemestre_id,
text="Suppression du semestre %(titre)s" % sem, text="Suppression du semestre %(titre)s" % sem,
@ -1566,7 +1560,7 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
return err return err
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
help = """<p class="help"> help = """<p class="help">
Seuls les modules ont un coefficient. Cependant, il est nécessaire d'affecter un coefficient aux UE capitalisée pour pouvoir les prendre en compte dans la moyenne générale. Seuls les modules ont un coefficient. Cependant, il est nécessaire d'affecter un coefficient aux UE capitalisée pour pouvoir les prendre en compte dans la moyenne générale.
</p> </p>

View File

@ -105,7 +105,7 @@ def formsemestre_ext_create_form(context, etudid, formsemestre_id, REQUEST=None)
etud["nomprenom"], etud["nomprenom"],
), ),
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
orig_sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) orig_sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
# Ne propose que des semestres de semestre_id strictement inférieur au semestre courant # Ne propose que des semestres de semestre_id strictement inférieur au semestre courant
# et seulement si pas inscrit au même semestre_id d'un semestre ordinaire ScoDoc. # et seulement si pas inscrit au même semestre_id d'un semestre ordinaire ScoDoc.
@ -297,7 +297,7 @@ def _make_page(context, etud, sem, tf, message="", REQUEST=None):
</a></div> </a></div>
""" """
% (sem["formsemestre_id"], etud["etudid"]), % (sem["formsemestre_id"], etud["etudid"]),
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return H return H

View File

@ -291,7 +291,7 @@ def formsemestre_inscription_with_modules_form(
</p> </p>
<h3>Choisir un semestre:</h3>""" <h3>Choisir un semestre:</h3>"""
) )
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
sems = sco_formsemestre.do_formsemestre_list(context, args={"etat": "1"}) sems = sco_formsemestre.do_formsemestre_list(context, args={"etat": "1"})
insem = do_formsemestre_inscription_list( insem = do_formsemestre_inscription_list(
context, args={"etudid": etudid, "etat": "I"} context, args={"etudid": etudid, "etat": "I"}
@ -348,7 +348,7 @@ def formsemestre_inscription_with_modules(
sem, sem,
) )
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
# Check 1: déjà inscrit ici ? # Check 1: déjà inscrit ici ?
ins = do_formsemestre_inscription_list(context, {"etudid": etudid}) ins = do_formsemestre_inscription_list(context, {"etudid": etudid})
already = False already = False
@ -453,7 +453,7 @@ def formsemestre_inscription_option(context, etudid, formsemestre_id, REQUEST=No
etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0] etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0]
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etud_ue_status nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etud_ue_status
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
H = [ H = [
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ "<h2>Inscription de %s aux modules de %s (%s - %s)</h2>" + "<h2>Inscription de %s aux modules de %s (%s - %s)</h2>"
@ -731,7 +731,7 @@ def do_moduleimpl_incription_options(
Retour à la fiche étudiant</a></p> Retour à la fiche étudiant</a></p>
""" """
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid), % url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -823,4 +823,4 @@ def formsemestre_inscrits_ailleurs(context, formsemestre_id, REQUEST=None):
) )
else: else:
H.append("""<p>Aucun étudiant en inscription multiple (c'est normal) !</p>""") H.append("""<p>Aucun étudiant en inscription multiple (c'est normal) !</p>""")
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()

View File

@ -491,7 +491,7 @@ def retreive_formsemestre_from_request(context, REQUEST):
formsemestre_id = modimpl["formsemestre_id"] formsemestre_id = modimpl["formsemestre_id"]
elif "evaluation_id" in REQUEST.form: elif "evaluation_id" in REQUEST.form:
E = sco_evaluations.do_evaluation_list( E = sco_evaluations.do_evaluation_list(
context, {"evaluation_id": REQUEST.form["evaluation_id"]} {"evaluation_id": REQUEST.form["evaluation_id"]}
) )
if not E: if not E:
return None # evaluation suppressed ? return None # evaluation suppressed ?
@ -971,7 +971,7 @@ def formsemestre_status_head(
) )
H.append("</td></tr>") H.append("</td></tr>")
evals = sco_evaluations.do_evaluation_etat_in_sem(context, formsemestre_id) evals = sco_evaluations.do_evaluation_etat_in_sem(formsemestre_id)
H.append( H.append(
'<tr><td class="fichetitre2">Evaluations: </td><td> %(nb_evals_completes)s ok, %(nb_evals_en_cours)s en cours, %(nb_evals_vides)s vides' '<tr><td class="fichetitre2">Evaluations: </td><td> %(nb_evals_completes)s ok, %(nb_evals_en_cours)s en cours, %(nb_evals_vides)s vides'
% evals % evals
@ -1118,9 +1118,7 @@ def formsemestre_status(context, formsemestre_id=None, REQUEST=None):
else: else:
fontorange = "" fontorange = ""
etat = sco_evaluations.do_evaluation_etat_in_mod( etat = sco_evaluations.do_evaluation_etat_in_mod(nt, M["moduleimpl_id"])
context, nt, M["moduleimpl_id"]
)
if ( if (
etat["nb_evals_completes"] > 0 etat["nb_evals_completes"] > 0
and etat["nb_evals_en_cours"] == 0 and etat["nb_evals_en_cours"] == 0
@ -1207,4 +1205,4 @@ def formsemestre_status(context, formsemestre_id=None, REQUEST=None):
'<p><a class="stdlink" href="mailto:?cc=%s">Courrier aux %d enseignants du semestre</a></p>' '<p><a class="stdlink" href="mailto:?cc=%s">Courrier aux %d enseignants du semestre</a></p>'
% (",".join(adrlist), len(adrlist)) % (",".join(adrlist), len(adrlist))
) )
return "".join(H) + html_sco_header.sco_footer(context, REQUEST) return "".join(H) + html_sco_header.sco_footer()

View File

@ -128,7 +128,7 @@ def formsemestre_validation_etud_form(
% (formsemestre_id, etud_index_next, etud_n["nomprenom"]) % (formsemestre_id, etud_index_next, etud_n["nomprenom"])
) )
Footer.append("</p>") Footer.append("</p>")
Footer.append(html_sco_header.sco_footer(context, REQUEST)) Footer.append(html_sco_header.sco_footer())
H.append('<table style="width: 100%"><tr><td>') H.append('<table style="width: 100%"><tr><td>')
if not check: if not check:
@ -224,7 +224,7 @@ def formsemestre_validation_etud_form(
'<a href="formsemestre_validation_suppress_etud?etudid=%s&formsemestre_id=%s" class="stdlink">Supprimer décision existante</a>' '<a href="formsemestre_validation_suppress_etud?etudid=%s&formsemestre_id=%s" class="stdlink">Supprimer décision existante</a>'
% (etudid, formsemestre_id) % (etudid, formsemestre_id)
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
# Infos sur decisions déjà saisies # Infos sur decisions déjà saisies
@ -267,7 +267,7 @@ def formsemestre_validation_etud_form(
H.append('<input type="hidden" name="sortcol" value="%s"/>' % sortcol) H.append('<input type="hidden" name="sortcol" value="%s"/>' % sortcol)
H.append("</form></div>") H.append("</form></div>")
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
# Explication sur barres actuelles # Explication sur barres actuelles
@ -851,7 +851,7 @@ def formsemestre_validation_auto(context, formsemestre_id, REQUEST):
</form> </form>
""" """
% formsemestre_id, % formsemestre_id,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -944,7 +944,7 @@ def do_formsemestre_validation_auto(context, formsemestre_id, REQUEST):
'<a href="formsemestre_recapcomplet?formsemestre_id=%s&modejury=1&hidemodules=1&hidebac=1&pref_override=0">continuer</a>' '<a href="formsemestre_recapcomplet?formsemestre_id=%s&modejury=1&hidemodules=1&hidebac=1&pref_override=0">continuer</a>'
% formsemestre_id % formsemestre_id
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -1082,13 +1082,7 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
<div id="ue_list_code"><!-- filled by ue_sharing_code --></div> <div id="ue_list_code"><!-- filled by ue_sharing_code --></div>
""" """
warn, ue_multiples = check_formation_ues(context, Fo["formation_id"]) warn, ue_multiples = check_formation_ues(context, Fo["formation_id"])
return ( return "\n".join(H) + tf[1] + X + warn + html_sco_header.sco_footer()
"\n".join(H)
+ tf[1]
+ X
+ warn
+ html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id

View File

@ -914,7 +914,7 @@ def editPartitionForm(context, formsemestre_id=None, REQUEST=None):
</div> </div>
""" """
) )
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def partition_set_attr(context, partition_id, attr, value, REQUEST=None): def partition_set_attr(context, partition_id, attr, value, REQUEST=None):
@ -1053,7 +1053,7 @@ def partition_rename(context, partition_id, REQUEST=None):
+ "\n".join(H) + "\n".join(H)
+ "\n" + "\n"
+ tf[1] + tf[1]
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
@ -1155,7 +1155,7 @@ def group_rename(context, group_id, REQUEST=None):
+ "\n".join(H) + "\n".join(H)
+ "\n" + "\n"
+ tf[1] + tf[1]
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
@ -1218,9 +1218,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
name="tf", name="tf",
) )
if tf[0] == 0: if tf[0] == 0:
return ( return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer()
"\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -1241,7 +1239,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
# checkGroupName(group_name) # checkGroupName(group_name)
# except: # except:
# H.append('<p class="warning">Nom de groupe invalide: %s</p>'%group_name) # H.append('<p class="warning">Nom de groupe invalide: %s</p>'%group_name)
# return '\n'.join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) # return '\n'.join(H) + tf[1] + html_sco_header.sco_footer( REQUEST)
group_ids.append( group_ids.append(
createGroup(context, partition_id, group_name, REQUEST=REQUEST) createGroup(context, partition_id, group_name, REQUEST=REQUEST)
) )
@ -1342,7 +1340,7 @@ def create_etapes_partition(context, formsemestre_id, partition_name="apo_etapes
def do_evaluation_listeetuds_groups( def do_evaluation_listeetuds_groups(
context, evaluation_id, groups=None, getallstudents=False, include_dems=False evaluation_id, groups=None, getallstudents=False, include_dems=False
): ):
"""Donne la liste des etudids inscrits a cette evaluation dans les """Donne la liste des etudids inscrits a cette evaluation dans les
groupes indiqués. groupes indiqués.

View File

@ -97,6 +97,6 @@ Editer groupes de
</div> </div>
""", """,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)

View File

@ -156,7 +156,7 @@ def groups_view(
) )
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)

View File

@ -250,7 +250,7 @@ def students_import_excel(
H.append("</ul>") H.append("</ul>")
H.append("<p>Import terminé !</p>") H.append("<p>Import terminé !</p>")
H.append('<p><a class="stdlink" href="%s">Continuer</a></p>' % dest) H.append('<p><a class="stdlink" href="%s">Continuer</a></p>' % dest)
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def scolars_import_excel_file( def scolars_import_excel_file(
@ -475,8 +475,6 @@ def scolars_import_excel_file(
diag.append("Import et inscription de %s étudiants" % len(created_etudids)) diag.append("Import et inscription de %s étudiants" % len(created_etudids))
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_INSCR, typ=sco_news.NEWS_INSCR,
text="Inscription de %d étudiants" # peuvent avoir ete inscrits a des semestres differents text="Inscription de %d étudiants" # peuvent avoir ete inscrits a des semestres differents
% len(created_etudids), % len(created_etudids),
@ -519,7 +517,7 @@ def students_import_admission(
if diag: if diag:
H.append("<p>Diagnostic: <ul><li>%s</li></ul></p>" % "</li><li>".join(diag)) H.append("<p>Diagnostic: <ul><li>%s</li></ul></p>" % "</li><li>".join(diag))
return "\n".join(H) + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
def _import_one_student( def _import_one_student(

View File

@ -290,7 +290,7 @@ def formsemestre_inscr_passage(
header = html_sco_header.sco_header( header = html_sco_header.sco_header(
context, REQUEST, page_title="Passage des étudiants" context, REQUEST, page_title="Passage des étudiants"
) )
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
H = [header] H = [header]
if type(etuds) == type(""): if type(etuds) == type(""):
etuds = etuds.split(",") # vient du form de confirmation etuds = etuds.split(",") # vient du form de confirmation

View File

@ -64,15 +64,11 @@ def do_evaluation_listenotes(context, REQUEST):
if "evaluation_id" in REQUEST.form: if "evaluation_id" in REQUEST.form:
evaluation_id = REQUEST.form["evaluation_id"] evaluation_id = REQUEST.form["evaluation_id"]
mode = "eval" mode = "eval"
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
context, {"evaluation_id": evaluation_id}
)
if "moduleimpl_id" in REQUEST.form: if "moduleimpl_id" in REQUEST.form:
moduleimpl_id = REQUEST.form["moduleimpl_id"] moduleimpl_id = REQUEST.form["moduleimpl_id"]
mode = "module" mode = "module"
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
context, {"moduleimpl_id": moduleimpl_id}
)
if not mode: if not mode:
raise ValueError("missing argument: evaluation or module") raise ValueError("missing argument: evaluation or module")
if not evals: if not evals:
@ -84,7 +80,7 @@ def do_evaluation_listenotes(context, REQUEST):
if mode == "eval": if mode == "eval":
H = [ H = [
sco_evaluations.evaluation_describe( sco_evaluations.evaluation_describe(
context, evaluation_id=evaluation_id, REQUEST=REQUEST evaluation_id=evaluation_id, REQUEST=REQUEST
) )
] ]
else: else:
@ -257,7 +253,7 @@ def _make_table_notes(
gr_title_filename = sco_groups.listgroups_filename(groups) gr_title_filename = sco_groups.listgroups_filename(groups)
etudids = sco_groups.do_evaluation_listeetuds_groups( etudids = sco_groups.do_evaluation_listeetuds_groups(
context, E["evaluation_id"], groups, include_dems=True E["evaluation_id"], groups, include_dems=True
) )
if anonymous_listing: if anonymous_listing:
@ -367,9 +363,7 @@ def _make_table_notes(
} }
# Ajoute les notes de chaque évaluation: # Ajoute les notes de chaque évaluation:
for e in evals: for e in evals:
e["eval_state"] = sco_evaluations.do_evaluation_etat( e["eval_state"] = sco_evaluations.do_evaluation_etat(e["evaluation_id"])
context, e["evaluation_id"]
)
notes, nb_abs, nb_att = _add_eval_columns( notes, nb_abs, nb_att = _add_eval_columns(
context, context,
e, e,
@ -534,7 +528,7 @@ def _make_table_notes(
return ( return (
sco_evaluations.evaluation_describe( sco_evaluations.evaluation_describe(
context, evaluation_id=E["evaluation_id"], REQUEST=REQUEST evaluation_id=E["evaluation_id"], REQUEST=REQUEST
) )
+ eval_info + eval_info
+ html_form + html_form
@ -553,7 +547,7 @@ def _add_eval_columns(
sum_notes = 0 sum_notes = 0
notes = [] # liste des notes numeriques, pour calcul histogramme uniquement notes = [] # liste des notes numeriques, pour calcul histogramme uniquement
evaluation_id = e["evaluation_id"] evaluation_id = e["evaluation_id"]
NotesDB = sco_evaluations.do_evaluation_get_all_notes(context, evaluation_id) NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
for row in rows: for row in rows:
etudid = row["etudid"] etudid = row["etudid"]
if etudid in NotesDB: if etudid in NotesDB:
@ -717,12 +711,12 @@ def evaluation_check_absences(context, evaluation_id):
EXC et pas justifie EXC et pas justifie
Ramene 3 listes d'etudid Ramene 3 listes d'etudid
""" """
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
if not E["jour"]: if not E["jour"]:
return [], [], [], [], [] # evaluation sans date return [], [], [], [], [] # evaluation sans date
etudids = sco_groups.do_evaluation_listeetuds_groups( etudids = sco_groups.do_evaluation_listeetuds_groups(
context, evaluation_id, getallstudents=True evaluation_id, getallstudents=True
) )
am, pm, demijournee = _eval_demijournee(E) am, pm, demijournee = _eval_demijournee(E)
@ -738,7 +732,7 @@ def evaluation_check_absences(context, evaluation_id):
Justs = set([x["etudid"] for x in Just]) # ensemble des etudiants avec justif Justs = set([x["etudid"] for x in Just]) # ensemble des etudiants avec justif
# Les notes: # Les notes:
NotesDB = sco_evaluations.do_evaluation_get_all_notes(context, evaluation_id) NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
ValButAbs = [] # une note mais noté absent ValButAbs = [] # une note mais noté absent
AbsNonSignalee = [] # note ABS mais pas noté absent AbsNonSignalee = [] # note ABS mais pas noté absent
ExcNonSignalee = [] # note EXC mais pas noté absent ExcNonSignalee = [] # note EXC mais pas noté absent
@ -773,7 +767,7 @@ def evaluation_check_absences_html(
): ):
"""Affiche etat verification absences d'une evaluation""" """Affiche etat verification absences d'une evaluation"""
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
am, pm, demijournee = _eval_demijournee(E) am, pm, demijournee = _eval_demijournee(E)
( (
@ -790,7 +784,7 @@ def evaluation_check_absences_html(
context, REQUEST, "Vérification absences à l'évaluation" context, REQUEST, "Vérification absences à l'évaluation"
), ),
sco_evaluations.evaluation_describe( sco_evaluations.evaluation_describe(
context, evaluation_id=evaluation_id, REQUEST=REQUEST evaluation_id=evaluation_id, REQUEST=REQUEST
), ),
"""<p class="help">Vérification de la cohérence entre les notes saisies et les absences signalées.</p>""", """<p class="help">Vérification de la cohérence entre les notes saisies et les absences signalées.</p>""",
] ]
@ -867,7 +861,7 @@ def evaluation_check_absences_html(
etudlist(AbsButExc) etudlist(AbsButExc)
if with_header: if with_header:
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -892,7 +886,7 @@ def formsemestre_check_absences_html(context, formsemestre_id, REQUEST=None):
) )
for M in Mlist: for M in Mlist:
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list(
context, {"moduleimpl_id": M["moduleimpl_id"]} {"moduleimpl_id": M["moduleimpl_id"]}
) )
if evals: if evals:
H.append( H.append(
@ -911,5 +905,5 @@ def formsemestre_check_absences_html(context, formsemestre_id, REQUEST=None):
) )
if evals: if evals:
H.append("</div>") H.append("</div>")
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)

View File

@ -97,7 +97,7 @@ def scodoc_table_etuds_lycees(context, format="html", REQUEST=None):
"""<div id="lyc_map_canvas"></div> """<div id="lyc_map_canvas"></div>
""", """,
js_coords_lycees(etuds_by_lycee), js_coords_lycees(etuds_by_lycee),
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -212,7 +212,7 @@ def formsemestre_etuds_lycees(
"""<div id="lyc_map_canvas"></div> """<div id="lyc_map_canvas"></div>
""", """,
js_coords_lycees(etuds_by_lycee), js_coords_lycees(etuds_by_lycee),
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)

View File

@ -77,7 +77,7 @@ def moduleimpl_inscriptions_edit(
init_qtip=True, init_qtip=True,
javascripts=["js/etud_info.js"], javascripts=["js/etud_info.js"],
) )
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
H = [ H = [
header, header,
"""<h2>Inscriptions au module <a href="moduleimpl_status?moduleimpl_id=%s">%s</a> (%s)</a></h2> """<h2>Inscriptions au module <a href="moduleimpl_status?moduleimpl_id=%s">%s</a> (%s)</a></h2>
@ -425,7 +425,7 @@ def moduleimpl_inscriptions_stats(context, formsemestre_id, REQUEST=None):
""" """
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)

View File

@ -55,7 +55,7 @@ from app.scodoc import sco_users
# menu evaluation dans moduleimpl # menu evaluation dans moduleimpl
def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None): def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
"Menu avec actions sur une evaluation" "Menu avec actions sur une evaluation"
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
modimpl = sco_moduleimpl.do_moduleimpl_list( modimpl = sco_moduleimpl.do_moduleimpl_list(
context, moduleimpl_id=E["moduleimpl_id"] context, moduleimpl_id=E["moduleimpl_id"]
)[0] )[0]
@ -170,9 +170,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
) )
nt = sco_cache.NotesTableCache.get(formsemestre_id) nt = sco_cache.NotesTableCache.get(formsemestre_id)
ModEvals = sco_evaluations.do_evaluation_list( ModEvals = sco_evaluations.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
context, {"moduleimpl_id": moduleimpl_id}
)
ModEvals.sort( ModEvals.sort(
key=lambda x: (x["numero"], x["jour"], x["heure_debut"]), reverse=True key=lambda x: (x["numero"], x["jour"], x["heure_debut"]), reverse=True
) # la plus RECENTE en tête ) # la plus RECENTE en tête
@ -369,7 +367,6 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
first = True first = True
for eval in ModEvals: for eval in ModEvals:
etat = sco_evaluations.do_evaluation_etat( etat = sco_evaluations.do_evaluation_etat(
context,
eval["evaluation_id"], eval["evaluation_id"],
partition_id=partition_id, partition_id=partition_id,
select_first_partition=True, select_first_partition=True,
@ -654,5 +651,5 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
scu.icontag("status_visible_img"), scu.icontag("status_visible_img"),
) )
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "".join(H) return "".join(H)

View File

@ -39,6 +39,8 @@ from operator import itemgetter
import six import six
import PyRSS2Gen # pylint: disable=import-error import PyRSS2Gen # pylint: disable=import-error
from flask_login import current_user
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
@ -80,12 +82,12 @@ scolar_news_list = _scolar_news_editor.list
_LAST_NEWS = {} # { (authuser_name, type, object) : time } _LAST_NEWS = {} # { (authuser_name, type, object) : time }
def add(context, REQUEST, typ, object=None, text="", url=None, max_frequency=False): def add(typ, object=None, text="", url=None, max_frequency=False):
"""Ajoute une nouvelle. """Ajoute une nouvelle.
Si max_frequency, ne genere pas 2 nouvelles identiques à moins de max_frequency Si max_frequency, ne genere pas 2 nouvelles identiques à moins de max_frequency
secondes d'intervalle. secondes d'intervalle.
""" """
authuser_name = str(REQUEST.AUTHENTICATED_USER) authuser_name = current_user.user_name
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
args = { args = {
"authenticated_user": authuser_name, "authenticated_user": authuser_name,
@ -106,7 +108,7 @@ def add(context, REQUEST, typ, object=None, text="", url=None, max_frequency=Fal
_LAST_NEWS[(authuser_name, typ, object)] = t _LAST_NEWS[(authuser_name, typ, object)] = t
_send_news_by_mail(context, args) _send_news_by_mail(args)
return scolar_news_create(cnx, args, has_uniq_values=False) return scolar_news_create(cnx, args, has_uniq_values=False)
@ -256,8 +258,9 @@ def scolar_news_summary_rss(context, title, sco_url, n=5):
return data return data
def _send_news_by_mail(context, n): def _send_news_by_mail(n):
"""Notify by email""" """Notify by email"""
context = None # #context
infos = _get_formsemestre_infos_from_news(context, n) infos = _get_formsemestre_infos_from_news(context, n)
formsemestre_id = infos.get("formsemestre_id", None) formsemestre_id = infos.get("formsemestre_id", None)
prefs = sco_preferences.SemPreferences(formsemestre_id=formsemestre_id) prefs = sco_preferences.SemPreferences(formsemestre_id=formsemestre_id)

View File

@ -491,7 +491,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
"js/etud_debouche.js", "js/etud_debouche.js",
], ],
) )
return header + tmpl % info + html_sco_header.sco_footer(context, REQUEST) return header + tmpl % info + html_sco_header.sco_footer()
def menus_etud(context, REQUEST=None): def menus_etud(context, REQUEST=None):

View File

@ -52,12 +52,13 @@ def can_edit_notes(context, authuser, moduleimpl_id, allow_ens=True):
return True return True
def can_edit_evaluation(context, REQUEST, moduleimpl_id=None): def can_edit_evaluation(moduleimpl_id=None):
"""Vérifie que l'on a le droit de modifier, créer ou détruire une """Vérifie que l'on a le droit de modifier, créer ou détruire une
évaluation dans ce module. évaluation dans ce module.
Sinon, lance une exception. Sinon, lance une exception.
(nb: n'implique pas le droit de saisir ou modifier des notes) (nb: n'implique pas le droit de saisir ou modifier des notes)
""" """
context = None # #context
# was _evaluation_check_write_access # was _evaluation_check_write_access
# AccessDenied("Modification évaluation impossible pour %s" % (uid,)) # AccessDenied("Modification évaluation impossible pour %s" % (uid,))
from app.scodoc import sco_formsemestre from app.scodoc import sco_formsemestre
@ -66,13 +67,12 @@ def can_edit_evaluation(context, REQUEST, moduleimpl_id=None):
# acces pour resp. moduleimpl et resp. form semestre (dir etud) # acces pour resp. moduleimpl et resp. form semestre (dir etud)
if moduleimpl_id is None: if moduleimpl_id is None:
raise ValueError("no moduleimpl specified") # bug raise ValueError("no moduleimpl specified") # bug
authuser = REQUEST.AUTHENTICATED_USER uid = current_user.user_name
uid = str(authuser)
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=moduleimpl_id)[0]
sem = sco_formsemestre.get_formsemestre(context, M["formsemestre_id"]) sem = sco_formsemestre.get_formsemestre(context, M["formsemestre_id"])
if ( if (
authuser.has_permission(Permission.ScoEditAllEvals) current_user.has_permission(Permission.ScoEditAllEvals)
or uid == M["responsable_id"] or uid == M["responsable_id"]
or uid in sem["responsables"] or uid in sem["responsables"]
): ):
@ -156,7 +156,7 @@ def check_access_diretud(
header = html_sco_header.sco_header( header = html_sco_header.sco_header(
context, page_title="Accès interdit", REQUEST=REQUEST context, page_title="Accès interdit", REQUEST=REQUEST
) )
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
if (str(authuser) not in sem["responsables"]) and not authuser.has_permission( if (str(authuser) not in sem["responsables"]) and not authuser.has_permission(
required_permission required_permission
): ):

View File

@ -59,7 +59,7 @@ def do_placement_selectetuds(context, REQUEST):
Choisi les étudiants et les infos sur la salle pour leur placement. Choisi les étudiants et les infos sur la salle pour leur placement.
""" """
evaluation_id = REQUEST.form["evaluation_id"] evaluation_id = REQUEST.form["evaluation_id"]
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id}) E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
if not E: if not E:
raise ScoValueError("invalid evaluation_id") raise ScoValueError("invalid evaluation_id")
E = E[0] E = E[0]
@ -75,7 +75,7 @@ def do_placement_selectetuds(context, REQUEST):
# description de l'evaluation # description de l'evaluation
H = [ H = [
sco_evaluations.evaluation_describe( sco_evaluations.evaluation_describe(
context, evaluation_id=evaluation_id, REQUEST=REQUEST evaluation_id=evaluation_id, REQUEST=REQUEST
), ),
"<h3>Placement et émargement des étudiants</h3>", "<h3>Placement et émargement des étudiants</h3>",
] ]
@ -244,7 +244,7 @@ def do_placement(context, REQUEST):
raise ScoValueError( raise ScoValueError(
"Formulaire incomplet ! Vous avez sans doute attendu trop longtemps, veuillez vous reconnecter. Si le problème persiste, contacter l'administrateur. Merci." "Formulaire incomplet ! Vous avez sans doute attendu trop longtemps, veuillez vous reconnecter. Si le problème persiste, contacter l'administrateur. Merci."
) )
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
# Check access # Check access
# (admin, respformation, and responsable_id) # (admin, respformation, and responsable_id)
@ -278,7 +278,7 @@ def do_placement(context, REQUEST):
else: else:
getallstudents = False getallstudents = False
etudids = sco_groups.do_evaluation_listeetuds_groups( etudids = sco_groups.do_evaluation_listeetuds_groups(
context, evaluation_id, groups, getallstudents=getallstudents, include_dems=True evaluation_id, groups, getallstudents=getallstudents, include_dems=True
) )
if not etudids: if not etudids:
return "<p>Aucun groupe sélectionné !</p>" return "<p>Aucun groupe sélectionné !</p>"
@ -403,9 +403,7 @@ def do_placement(context, REQUEST):
def placement_eval_selectetuds(context, evaluation_id, REQUEST=None): def placement_eval_selectetuds(context, evaluation_id, REQUEST=None):
"""Dialogue placement etudiants: choix methode et localisation""" """Dialogue placement etudiants: choix methode et localisation"""
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
context, {"evaluation_id": evaluation_id}
)
if not evals: if not evals:
raise ScoValueError("invalid evaluation_id") raise ScoValueError("invalid evaluation_id")
theeval = evals[0] theeval = evals[0]
@ -444,7 +442,7 @@ def placement_eval_selectetuds(context, evaluation_id, REQUEST=None):
</ul> </ul>
""" """
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)

View File

@ -1973,7 +1973,7 @@ class BasePreferences(object):
submitlabel="Enregistrer les modifications", submitlabel="Enregistrer les modifications",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(scu.ScoURL()) # cancel return REQUEST.RESPONSE.redirect(scu.ScoURL()) # cancel
else: else:
@ -2149,7 +2149,7 @@ function set_global_pref(el, pref_name) {
) )
context = None # XXX TO REMOVE context = None # XXX TO REMOVE
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
dest_url + "&head_message=Annulé" dest_url + "&head_message=Annulé"

View File

@ -510,7 +510,7 @@ def formsemestre_pvjury(
"""Page récapitulant les décisions de jury """Page récapitulant les décisions de jury
dpv: result of dict_pvjury dpv: result of dict_pvjury
""" """
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
dpv = dict_pvjury(context, formsemestre_id, with_prev=True) dpv = dict_pvjury(context, formsemestre_id, with_prev=True)
if not dpv: if not dpv:
@ -659,7 +659,7 @@ def formsemestre_pvjury_pdf(
F = [ F = [
"""<p><em>Voir aussi si besoin les réglages sur la page "Paramétrage" (accessible à l'administrateur du département).</em> """<p><em>Voir aussi si besoin les réglages sur la page "Paramétrage" (accessible à l'administrateur du département).</em>
</p>""", </p>""",
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
descr = descrform_pvjury(context, sem) descr = descrform_pvjury(context, sem)
if etudid: if etudid:
@ -839,7 +839,7 @@ def formsemestre_lettres_individuelles(
""" """
% formsemestre_id, % formsemestre_id,
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
descr = descrform_lettres_individuelles() descr = descrform_lettres_individuelles()
menu_choix_groupe = ( menu_choix_groupe = (
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """ """<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """

View File

@ -358,7 +358,7 @@ def pdf_lettres_individuelles(
"htab2": "1cm", "htab2": "1cm",
} }
# copie preferences # copie preferences
for name in sco_preferences.get_base_preferences(context).prefs_name: for name in sco_preferences.get_base_preferences().prefs_name:
params[name] = sco_preferences.get_preference(name, sem["formsemestre_id"]) params[name] = sco_preferences.get_preference(name, sem["formsemestre_id"])
bookmarks = {} bookmarks = {}

View File

@ -192,7 +192,7 @@ def formsemestre_recapcomplet(
<p class="infop">utilise les coefficients d'UE pour calculer la moyenne générale.</p> <p class="infop">utilise les coefficients d'UE pour calculer la moyenne générale.</p>
""" """
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "".join(H) # HTML or binary data... return "".join(H) # HTML or binary data...
@ -804,9 +804,7 @@ def _list_notes_evals(context, evals, etudid):
or e["etat"]["evalattente"] or e["etat"]["evalattente"]
or e["publish_incomplete"] or e["publish_incomplete"]
): ):
NotesDB = sco_evaluations.do_evaluation_get_all_notes( NotesDB = sco_evaluations.do_evaluation_get_all_notes(e["evaluation_id"])
context, e["evaluation_id"]
)
if etudid in NotesDB: if etudid in NotesDB:
val = NotesDB[etudid]["value"] val = NotesDB[etudid]["value"]
else: else:
@ -876,7 +874,7 @@ def _formsemestre_recapcomplet_xml(
doc = ElementTree.Element( doc = ElementTree.Element(
"recapsemestre", formsemestre_id=formsemestre_id, date=docdate "recapsemestre", formsemestre_id=formsemestre_id, date=docdate
) )
evals = sco_evaluations.do_evaluation_etat_in_sem(context, formsemestre_id) evals = sco_evaluations.do_evaluation_etat_in_sem(formsemestre_id)
doc.append( doc.append(
ElementTree.Element( ElementTree.Element(
"evals_info", "evals_info",
@ -920,7 +918,7 @@ def _formsemestre_recapcomplet_json(
docdate = "" docdate = ""
else: else:
docdate = datetime.datetime.now().isoformat() docdate = datetime.datetime.now().isoformat()
evals = sco_evaluations.do_evaluation_etat_in_sem(context, formsemestre_id) evals = sco_evaluations.do_evaluation_etat_in_sem(formsemestre_id)
J = { J = {
"docdate": docdate, "docdate": docdate,
"formsemestre_id": formsemestre_id, "formsemestre_id": formsemestre_id,

View File

@ -373,7 +373,7 @@ def formsemestre_report_counts(
pour les lignes et les colonnes. Le <tt>codedecision</tt> est le code de la décision pour les lignes et les colonnes. Le <tt>codedecision</tt> est le code de la décision
du jury. du jury.
</p>""", </p>""",
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -777,7 +777,7 @@ def formsemestre_suivi_cohorte(
t, t,
help, help,
expl, expl,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -1238,7 +1238,7 @@ def formsemestre_suivi_parcours(
"""<h2 class="formsemestre">Parcours suivis par les étudiants de ce semestre</h2>""", """<h2 class="formsemestre">Parcours suivis par les étudiants de ce semestre</h2>""",
"\n".join(F), "\n".join(F),
t, t,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -1597,7 +1597,7 @@ def formsemestre_graph_parcours(
passant la souris sur le chiffre). passant la souris sur le chiffre).
</p>""" </p>"""
% MAX_ETUD_IN_DESCR, % MAX_ETUD_IN_DESCR,
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
else: else:

View File

@ -165,7 +165,7 @@ def do_evaluation_upload_xls(context, REQUEST):
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
evaluation_id = REQUEST.form["evaluation_id"] evaluation_id = REQUEST.form["evaluation_id"]
comment = REQUEST.form["comment"] comment = REQUEST.form["comment"]
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
M = sco_moduleimpl.do_moduleimpl_withmodule_list( M = sco_moduleimpl.do_moduleimpl_withmodule_list(
context, moduleimpl_id=E["moduleimpl_id"] context, moduleimpl_id=E["moduleimpl_id"]
)[0] )[0]
@ -243,9 +243,7 @@ def do_evaluation_upload_xls(context, REQUEST):
context, authuser, evaluation_id, L, comment context, authuser, evaluation_id, L, comment
) )
# news # news
E = sco_evaluations.do_evaluation_list( E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
context, {"evaluation_id": evaluation_id}
)[0]
M = sco_moduleimpl.do_moduleimpl_list( M = sco_moduleimpl.do_moduleimpl_list(
context, moduleimpl_id=E["moduleimpl_id"] context, moduleimpl_id=E["moduleimpl_id"]
)[0] )[0]
@ -255,8 +253,6 @@ def do_evaluation_upload_xls(context, REQUEST):
mod["moduleimpl_id"] = M["moduleimpl_id"] mod["moduleimpl_id"] = M["moduleimpl_id"]
mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_NOTE, typ=sco_news.NEWS_NOTE,
object=M["moduleimpl_id"], object=M["moduleimpl_id"],
text='Chargement notes dans <a href="%(url)s">%(titre)s</a>' % mod, text='Chargement notes dans <a href="%(url)s">%(titre)s</a>' % mod,
@ -290,7 +286,7 @@ def do_evaluation_set_missing(
"""Initialisation des notes manquantes""" """Initialisation des notes manquantes"""
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
evaluation_id = REQUEST.form["evaluation_id"] evaluation_id = REQUEST.form["evaluation_id"]
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
M = sco_moduleimpl.do_moduleimpl_withmodule_list( M = sco_moduleimpl.do_moduleimpl_withmodule_list(
context, moduleimpl_id=E["moduleimpl_id"] context, moduleimpl_id=E["moduleimpl_id"]
)[0] )[0]
@ -300,9 +296,9 @@ def do_evaluation_set_missing(
# XXX imaginer un redirect + msg erreur # XXX imaginer un redirect + msg erreur
raise AccessDenied("Modification des notes impossible pour %s" % authuser) raise AccessDenied("Modification des notes impossible pour %s" % authuser)
# #
NotesDB = sco_evaluations.do_evaluation_get_all_notes(context, evaluation_id) NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
etudids = sco_groups.do_evaluation_listeetuds_groups( etudids = sco_groups.do_evaluation_listeetuds_groups(
context, evaluation_id, getallstudents=True, include_dems=False evaluation_id, getallstudents=True, include_dems=False
) )
notes = [] notes = []
for etudid in etudids: # pour tous les inscrits for etudid in etudids: # pour tous les inscrits
@ -318,7 +314,7 @@ def do_evaluation_set_missing(
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ '<h2>%s</h2><p><a href="saisie_notes?evaluation_id=%s">Recommencer</a>' + '<h2>%s</h2><p><a href="saisie_notes?evaluation_id=%s">Recommencer</a>'
% (diag, evaluation_id) % (diag, evaluation_id)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
# Confirm action # Confirm action
if not dialog_confirmed: if not dialog_confirmed:
@ -346,8 +342,6 @@ def do_evaluation_set_missing(
mod["moduleimpl_id"] = M["moduleimpl_id"] mod["moduleimpl_id"] = M["moduleimpl_id"]
mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_NOTE, typ=sco_news.NEWS_NOTE,
object=M["moduleimpl_id"], object=M["moduleimpl_id"],
text='Initialisation notes dans <a href="%(url)s">%(titre)s</a>' % mod, text='Initialisation notes dans <a href="%(url)s">%(titre)s</a>' % mod,
@ -364,27 +358,27 @@ def do_evaluation_set_missing(
</ul> </ul>
""" """
% (nb_changed, evaluation_id, M["moduleimpl_id"]) % (nb_changed, evaluation_id, M["moduleimpl_id"])
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
def evaluation_suppress_alln(context, evaluation_id, REQUEST, dialog_confirmed=False): def evaluation_suppress_alln(context, evaluation_id, REQUEST, dialog_confirmed=False):
"suppress all notes in this eval" "suppress all notes in this eval"
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
if sco_permissions_check.can_edit_notes( if sco_permissions_check.can_edit_notes(
context, authuser, E["moduleimpl_id"], allow_ens=False context, authuser, E["moduleimpl_id"], allow_ens=False
): ):
# On a le droit de modifier toutes les notes # On a le droit de modifier toutes les notes
# recupere les etuds ayant une note # recupere les etuds ayant une note
NotesDB = sco_evaluations.do_evaluation_get_all_notes(context, evaluation_id) NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
elif sco_permissions_check.can_edit_notes( elif sco_permissions_check.can_edit_notes(
context, authuser, E["moduleimpl_id"], allow_ens=True context, authuser, E["moduleimpl_id"], allow_ens=True
): ):
# Enseignant associé au module: ne peut supprimer que les notes qu'il a saisi # Enseignant associé au module: ne peut supprimer que les notes qu'il a saisi
NotesDB = sco_evaluations.do_evaluation_get_all_notes( NotesDB = sco_evaluations.do_evaluation_get_all_notes(
context, evaluation_id, by_uid=str(authuser) evaluation_id, by_uid=str(authuser)
) )
else: else:
raise AccessDenied("Modification des notes impossible pour %s" % authuser) raise AccessDenied("Modification des notes impossible pour %s" % authuser)
@ -428,8 +422,6 @@ def evaluation_suppress_alln(context, evaluation_id, REQUEST, dialog_confirmed=F
mod["moduleimpl_id"] = M["moduleimpl_id"] mod["moduleimpl_id"] = M["moduleimpl_id"]
mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_NOTE, typ=sco_news.NEWS_NOTE,
object=M["moduleimpl_id"], object=M["moduleimpl_id"],
text='Suppression des notes d\'une évaluation dans <a href="%(url)s">%(titre)s</a>' text='Suppression des notes d\'une évaluation dans <a href="%(url)s">%(titre)s</a>'
@ -440,7 +432,7 @@ def evaluation_suppress_alln(context, evaluation_id, REQUEST, dialog_confirmed=F
return ( return (
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ "\n".join(H) + "\n".join(H)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
@ -461,7 +453,7 @@ def _notes_add(context, uid, evaluation_id, notes, comment=None, do_it=True):
# Verifie inscription et valeur note # Verifie inscription et valeur note
_ = {}.fromkeys( _ = {}.fromkeys(
sco_groups.do_evaluation_listeetuds_groups( sco_groups.do_evaluation_listeetuds_groups(
context, evaluation_id, getallstudents=True, include_dems=True evaluation_id, getallstudents=True, include_dems=True
) )
) )
for (etudid, value) in notes: for (etudid, value) in notes:
@ -470,13 +462,13 @@ def _notes_add(context, uid, evaluation_id, notes, comment=None, do_it=True):
"etudiant %s: valeur de note invalide (%s)" % (etudid, value) "etudiant %s: valeur de note invalide (%s)" % (etudid, value)
) )
# Recherche notes existantes # Recherche notes existantes
NotesDB = sco_evaluations.do_evaluation_get_all_notes(context, evaluation_id) NotesDB = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
# Met a jour la base # Met a jour la base
cnx = ndb.GetDBConnexion(autocommit=False) cnx = ndb.GetDBConnexion(autocommit=False)
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
nb_changed = 0 nb_changed = 0
nb_suppress = 0 nb_suppress = 0
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
existing_decisions = ( existing_decisions = (
[] []
@ -578,9 +570,7 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
"""Saisie des notes via un fichier Excel""" """Saisie des notes via un fichier Excel"""
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
authusername = str(authuser) authusername = str(authuser)
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
context, {"evaluation_id": evaluation_id}
)
if not evals: if not evals:
raise ScoValueError("invalid evaluation_id") raise ScoValueError("invalid evaluation_id")
E = evals[0] E = evals[0]
@ -595,7 +585,7 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
<p><a href="moduleimpl_status?moduleimpl_id=%s">Continuer</a></p> <p><a href="moduleimpl_status?moduleimpl_id=%s">Continuer</a></p>
""" """
% E["moduleimpl_id"] % E["moduleimpl_id"]
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
if E["description"]: if E["description"]:
@ -623,7 +613,7 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
init_qtip=True, init_qtip=True,
), ),
sco_evaluations.evaluation_describe( sco_evaluations.evaluation_describe(
context, evaluation_id=evaluation_id, REQUEST=REQUEST evaluation_id=evaluation_id, REQUEST=REQUEST
), ),
"""<span class="eval_title">Saisie des notes par fichier</span>""", """<span class="eval_title">Saisie des notes par fichier</span>""",
] ]
@ -750,15 +740,13 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
</ol> </ol>
""" """
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
def feuille_saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None): def feuille_saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
"""Document Excel pour saisie notes dans l'évaluation et les groupes indiqués""" """Document Excel pour saisie notes dans l'évaluation et les groupes indiqués"""
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
context, {"evaluation_id": evaluation_id}
)
if not evals: if not evals:
raise ScoValueError("invalid evaluation_id") raise ScoValueError("invalid evaluation_id")
E = evals[0] E = evals[0]
@ -801,7 +789,7 @@ def feuille_saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
else: else:
getallstudents = False getallstudents = False
etudids = sco_groups.do_evaluation_listeetuds_groups( etudids = sco_groups.do_evaluation_listeetuds_groups(
context, evaluation_id, groups, getallstudents=getallstudents, include_dems=True evaluation_id, groups, getallstudents=getallstudents, include_dems=True
) )
# une liste de liste de chaines: lignes de la feuille de calcul # une liste de liste de chaines: lignes de la feuille de calcul
@ -859,9 +847,7 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
authusername = str(authuser) authusername = str(authuser)
evals = sco_evaluations.do_evaluation_list( evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
context, {"evaluation_id": evaluation_id}
)
if not evals: if not evals:
raise ScoValueError("invalid evaluation_id") raise ScoValueError("invalid evaluation_id")
E = evals[0] E = evals[0]
@ -880,7 +866,7 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
<p><a href="moduleimpl_status?moduleimpl_id=%s">Continuer</a></p> <p><a href="moduleimpl_status?moduleimpl_id=%s">Continuer</a></p>
""" """
% E["moduleimpl_id"] % E["moduleimpl_id"]
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
@ -909,7 +895,7 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
init_qtip=True, init_qtip=True,
), ),
sco_evaluations.evaluation_describe( sco_evaluations.evaluation_describe(
context, evaluation_id=evaluation_id, REQUEST=REQUEST evaluation_id=evaluation_id, REQUEST=REQUEST
), ),
'<div id="saisie_notes"><span class="eval_title">Saisie des notes</span>', '<div id="saisie_notes"><span class="eval_title">Saisie des notes</span>',
] ]
@ -972,14 +958,14 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
</div>""" </div>"""
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
def _get_sorted_etuds(context, E, etudids, formsemestre_id): def _get_sorted_etuds(context, E, etudids, formsemestre_id):
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
NotesDB = sco_evaluations.do_evaluation_get_all_notes( NotesDB = sco_evaluations.do_evaluation_get_all_notes(
context, E["evaluation_id"] E["evaluation_id"]
) # Notes existantes ) # Notes existantes
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
etuds = [] etuds = []
@ -1053,7 +1039,7 @@ def _form_saisie_notes(context, E, M, group_ids, destination="", REQUEST=None):
formsemestre_id = M["formsemestre_id"] formsemestre_id = M["formsemestre_id"]
etudids = sco_groups.do_evaluation_listeetuds_groups( etudids = sco_groups.do_evaluation_listeetuds_groups(
context, evaluation_id, getallstudents=True, include_dems=True evaluation_id, getallstudents=True, include_dems=True
) )
if not etudids: if not etudids:
return '<div class="ue_warning"><span>Aucun étudiant sélectionné !</span></div>' return '<div class="ue_warning"><span>Aucun étudiant sélectionné !</span></div>'
@ -1227,7 +1213,7 @@ def save_note(
"save_note: evaluation_id=%s etudid=%s uid=%s value=%s" "save_note: evaluation_id=%s etudid=%s uid=%s value=%s"
% (evaluation_id, etudid, authuser, value) % (evaluation_id, etudid, authuser, value)
) )
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0]
Mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % M Mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % M
@ -1242,8 +1228,6 @@ def save_note(
context, authuser, evaluation_id, L, comment=comment, do_it=True context, authuser, evaluation_id, L, comment=comment, do_it=True
) )
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_NOTE, typ=sco_news.NEWS_NOTE,
object=M["moduleimpl_id"], object=M["moduleimpl_id"],
text='Chargement notes dans <a href="%(url)s">%(titre)s</a>' % Mod, text='Chargement notes dans <a href="%(url)s">%(titre)s</a>' % Mod,

View File

@ -527,4 +527,4 @@ def semset_page(context, format="html", REQUEST=None):
""" """
) )
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()

View File

@ -110,7 +110,7 @@ def formsemestre_synchro_etuds(
header = html_sco_header.sco_header( header = html_sco_header.sco_header(
context, REQUEST, page_title="Synchronisation étudiants" context, REQUEST, page_title="Synchronisation étudiants"
) )
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id)
if anneeapogee: if anneeapogee:
base_url += "&anneeapogee=%s" % anneeapogee base_url += "&anneeapogee=%s" % anneeapogee
@ -676,8 +676,6 @@ def do_import_etuds_from_portal(context, sem, a_importer, etudsapo_ident, REQUES
raise raise
sco_news.add( sco_news.add(
context,
REQUEST,
typ=sco_news.NEWS_INSCR, typ=sco_news.NEWS_INSCR,
text="Import Apogée de %d étudiants en " % len(created_etudids), text="Import Apogée de %d étudiants en " % len(created_etudids),
object=sem["formsemestre_id"], object=sem["formsemestre_id"],

View File

@ -97,7 +97,7 @@ def trombino(
return _listeappel_photos_pdf(context, groups_infos, REQUEST) return _listeappel_photos_pdf(context, groups_infos, REQUEST)
else: else:
raise Exception("invalid format") raise Exception("invalid format")
# return _trombino_html_header(context, REQUEST) + trombino_html(context, group, members, REQUEST=REQUEST) + html_sco_header.sco_footer(context, REQUEST) # return _trombino_html_header(context, REQUEST) + trombino_html(context, group, members, REQUEST=REQUEST) + html_sco_header.sco_footer( REQUEST)
def _trombino_html_header(context, REQUEST): def _trombino_html_header(context, REQUEST):
@ -260,7 +260,7 @@ def trombino_copy_photos(context, group_ids=[], REQUEST=None, dialog_confirmed=F
header = html_sco_header.sco_header( header = html_sco_header.sco_header(
context, REQUEST, page_title="Chargement des photos" context, REQUEST, page_title="Chargement des photos"
) )
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
if not portal_url: if not portal_url:
return ( return (
header header
@ -527,7 +527,7 @@ def photos_import_files_form(context, group_ids=[], REQUEST=None):
""" """
% groups_infos.groups_query_args, % groups_infos.groups_query_args,
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
REQUEST.form["group_ids"] = groups_infos.group_ids REQUEST.form["group_ids"] = groups_infos.group_ids
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, REQUEST.URL0,

View File

@ -160,16 +160,13 @@ def external_ue_inscrit_et_note(
) )
# Création d'une évaluation si il n'y en a pas déjà: # Création d'une évaluation si il n'y en a pas déjà:
ModEvals = sco_evaluations.do_evaluation_list( ModEvals = sco_evaluations.do_evaluation_list(args={"moduleimpl_id": moduleimpl_id})
context, args={"moduleimpl_id": moduleimpl_id}
)
if len(ModEvals): if len(ModEvals):
# met la note dans le première évaluation existante: # met la note dans le première évaluation existante:
evaluation_id = ModEvals[0]["evaluation_id"] evaluation_id = ModEvals[0]["evaluation_id"]
else: else:
# crée une évaluation: # crée une évaluation:
evaluation_id = sco_evaluations.do_evaluation_create( evaluation_id = sco_evaluations.do_evaluation_create(
context,
REQUEST=REQUEST, REQUEST=REQUEST,
moduleimpl_id=moduleimpl_id, moduleimpl_id=moduleimpl_id,
note_max=20.0, note_max=20.0,
@ -250,7 +247,7 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None):
</p> </p>
""", """,
] ]
html_footer = html_sco_header.sco_footer(context, REQUEST) html_footer = html_sco_header.sco_footer()
Fo = sco_formations.formation_list( Fo = sco_formations.formation_list(
context, args={"formation_id": sem["formation_id"]} context, args={"formation_id": sem["formation_id"]}
)[0] )[0]

View File

@ -104,12 +104,12 @@ def list_operations(context, evaluation_id):
"""returns list of NotesOperation for this evaluation""" """returns list of NotesOperation for this evaluation"""
notes = list( notes = list(
sco_evaluations.do_evaluation_get_all_notes( sco_evaluations.do_evaluation_get_all_notes(
context, evaluation_id, filter_suppressed=False evaluation_id, filter_suppressed=False
).values() ).values()
) )
notes_log = list( notes_log = list(
sco_evaluations.do_evaluation_get_all_notes( sco_evaluations.do_evaluation_get_all_notes(
context, evaluation_id, filter_suppressed=False, table="notes_notes_log" evaluation_id, filter_suppressed=False, table="notes_notes_log"
).values() ).values()
) )
dt = OPERATION_DATE_TOLERANCE dt = OPERATION_DATE_TOLERANCE
@ -146,7 +146,7 @@ def list_operations(context, evaluation_id):
def evaluation_list_operations(context, REQUEST, evaluation_id): def evaluation_list_operations(context, REQUEST, evaluation_id):
"""Page listing operations on evaluation""" """Page listing operations on evaluation"""
E = sco_evaluations.do_evaluation_list(context, {"evaluation_id": evaluation_id})[0] E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
Ops = list_operations(context, evaluation_id) Ops = list_operations(context, evaluation_id)

View File

@ -128,7 +128,7 @@ def index_html(context, REQUEST, all_depts=False, with_inactives=False, format="
return L return L
H.append(L) H.append(L)
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
return "\n".join(H) + F return "\n".join(H) + F
@ -303,7 +303,7 @@ def user_info_page(context, user_name=None, REQUEST=None):
page_title="Utilisateur %s" % user.user_name, page_title="Utilisateur %s" % user.user_name,
) )
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
H.append("<h2>Utilisateur: %s" % user.user_name) H.append("<h2>Utilisateur: %s" % user.user_name)
info = user.to_dict() info = user.to_dict()
if info: if info:

View File

@ -373,15 +373,6 @@ def UsersURL():
return url_for("users.index_html", scodoc_dept=g.scodoc_dept)[: -len("/index_html")] return url_for("users.index_html", scodoc_dept=g.scodoc_dept)[: -len("/index_html")]
def get_current_user_name(REQUEST):
"""return a displayable string identifying the current user.
XXX For now, the login, but will be the name. #sco8
"""
authuser = REQUEST.AUTHENTICATED_USER
uid = str(authuser)
return uid
# ---- Simple python utilities # ---- Simple python utilities
@ -879,7 +870,7 @@ def confirm_dialog(
return ( return (
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ "\n".join(H) + "\n".join(H)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
else: else:
return "\n".join(H) return "\n".join(H)

View File

@ -185,7 +185,7 @@ saisir les absences de toute cette semaine.</p>
"""<p class="scoinfo">Vous n'avez pas l'autorisation d'ajouter, justifier ou supprimer des absences.</p>""" """<p class="scoinfo">Vous n'avez pas l'autorisation d'ajouter, justifier ou supprimer des absences.</p>"""
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -329,7 +329,7 @@ def SignaleAbsenceGrHebdo(
context, page_title="Saisie des absences", REQUEST=REQUEST context, page_title="Saisie des absences", REQUEST=REQUEST
) )
+ "<h3>Aucun étudiant !</h3>" + "<h3>Aucun étudiant !</h3>"
+ html_sco_header.sco_footer(REQUEST) + html_sco_header.sco_footer()
) )
base_url = "SignaleAbsenceGrHebdo?datelundi=%s&%s&destination=%s" % ( base_url = "SignaleAbsenceGrHebdo?datelundi=%s&%s&destination=%s" % (
@ -473,7 +473,7 @@ def SignaleAbsenceGrHebdo(
context, etuds, datessem, destination, moduleimpl_id, require_module context, etuds, datessem, destination, moduleimpl_id, require_module
) )
H.append(html_sco_header.sco_footer(REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -500,7 +500,7 @@ def SignaleAbsenceGrSemestre(
context, page_title="Saisie des absences", REQUEST=REQUEST context, page_title="Saisie des absences", REQUEST=REQUEST
) )
+ "<h3>Aucun étudiant !</h3>" + "<h3>Aucun étudiant !</h3>"
+ html_sco_header.sco_footer(REQUEST) + html_sco_header.sco_footer()
) )
formsemestre_id = groups_infos.formsemestre_id formsemestre_id = groups_infos.formsemestre_id
require_module = sco_preferences.get_preference( require_module = sco_preferences.get_preference(
@ -664,7 +664,7 @@ onchange="document.location='%(url)s&moduleimpl_id='+document.getElementById('mo
H += _gen_form_saisie_groupe( H += _gen_form_saisie_groupe(
context, etuds, dates, destination, moduleimpl_id, require_module context, etuds, dates, destination, moduleimpl_id, require_module
) )
H.append(html_sco_header.sco_footer(REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -1078,7 +1078,7 @@ def EtatAbsencesDate(
""" """
) )
return "\n".join(H) + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
# ----- Gestion des "billets d'absence": signalement par les etudiants eux mêmes (à travers le portail) # ----- Gestion des "billets d'absence": signalement par les etudiants eux mêmes (à travers le portail)
@ -1169,7 +1169,7 @@ def AddBilletAbsenceForm(context, etudid, REQUEST=None):
), ),
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(scu.ScoURL()) return REQUEST.RESPONSE.redirect(scu.ScoURL())
else: else:
@ -1305,7 +1305,7 @@ def listeBillets(context, REQUEST=None):
submitbutton=False, submitbutton=False,
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + T + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + tf[1] + T + html_sco_header.sco_footer()
else: else:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"ProcessBilletAbsenceForm?billet_id=" + tf[2]["billet_id"] "ProcessBilletAbsenceForm?billet_id=" + tf[2]["billet_id"]
@ -1472,7 +1472,7 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
) )
F += '<p><a class="stdlink" href="listeBillets">Liste de tous les billets en attente</a></p>' F += '<p><a class="stdlink" href="listeBillets">Liste de tous les billets en attente</a></p>'
return "\n".join(H) + "<br/>" + tf[1] + F + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + "<br/>" + tf[1] + F + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(scu.ScoURL()) return REQUEST.RESPONSE.redirect(scu.ScoURL())
else: else:
@ -1497,7 +1497,7 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
billets = sco_abs.billet_absence_list(cnx, {"etudid": etud["etudid"]}) billets = sco_abs.billet_absence_list(cnx, {"etudid": etud["etudid"]})
tab = _tableBillets(context, billets, etud=etud) tab = _tableBillets(context, billets, etud=etud)
H.append(tab.html()) H.append(tab.html())
return "\n".join(H) + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
@bp.route("/XMLgetAbsEtud") @bp.route("/XMLgetAbsEtud")

View File

@ -63,21 +63,22 @@ def entreprise_header(context, REQUEST=None, page_title=""):
def entreprise_footer(context, REQUEST): def entreprise_footer(context, REQUEST):
"common entreprise footer" "common entreprise footer"
return html_sco_header.sco_footer(context, REQUEST) return html_sco_header.sco_footer( REQUEST)
security.declareProtected(ScoEntrepriseView, "sidebar") security.declareProtected(ScoEntrepriseView, "sidebar")
def sidebar(context, REQUEST): def sidebar(REQUEST):
"barre gauche (overide std sco sidebar)" "barre gauche (overide std sco sidebar)"
# rewritten from legacy DTML code # rewritten from legacy DTML code
# XXX rare cas restant d'utilisation de l'acquisition Zope2: à revoir # XXX rare cas restant d'utilisation de l'acquisition Zope2: à revoir
params = {"ScoURL": scu.ScoURL()} params = {"ScoURL": scu.ScoURL()}
context=None # XXX #context
H = [ H = [
"""<div id="sidebar-container"> """<div id="sidebar-container">
<div class="sidebar">""", <div class="sidebar">""",
html_sidebar.sidebar_common(context, REQUEST), html_sidebar.sidebar_common(REQUEST),
"""<h2 class="insidebar"><a href="%(ScoURL)s/Entreprises" class="sidebar">Entreprises</a></h2> """<h2 class="insidebar"><a href="%(ScoURL)s/Entreprises" class="sidebar">Entreprises</a></h2>
<ul class="insidebar">""" <ul class="insidebar">"""
% params, % params,

View File

@ -402,7 +402,7 @@ def index_html(context, REQUEST=None):
""" """
) )
H.append(html_sco_header.sco_footer(context, REQUEST)) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@ -476,7 +476,7 @@ def formation_import_xml_form(context, REQUEST):
à partir un fichier XML (réservé aux utilisateurs avertis)</p> à partir un fichier XML (réservé aux utilisateurs avertis)</p>
""", """,
] ]
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, REQUEST.URL0,
REQUEST.form, REQUEST.form,
@ -683,7 +683,7 @@ def edit_enseignants_form(context, REQUEST, moduleimpl_id):
cssstyles=["css/autosuggest_inquisitor.css"], cssstyles=["css/autosuggest_inquisitor.css"],
bodyOnLoad="init_tf_form('')", bodyOnLoad="init_tf_form('')",
) )
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer()
# Liste des enseignants avec forme pour affichage / saisie avec suggestion # Liste des enseignants avec forme pour affichage / saisie avec suggestion
userlist = sco_users.get_user_list() userlist = sco_users.get_user_list()
@ -842,12 +842,7 @@ def edit_moduleimpl_resp(context, REQUEST, moduleimpl_id):
initvalues=initvalues, initvalues=initvalues,
) )
if tf[0] == 0: if tf[0] == 0:
return ( return "\n".join(H) + tf[1] + help_str + html_sco_header.sco_footer()
"\n".join(H)
+ tf[1]
+ help_str
+ html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"moduleimpl_status?moduleimpl_id=" + moduleimpl_id "moduleimpl_status?moduleimpl_id=" + moduleimpl_id
@ -940,7 +935,7 @@ def edit_moduleimpl_expr(context, REQUEST, moduleimpl_id):
initvalues=initvalues, initvalues=initvalues,
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"moduleimpl_status?moduleimpl_id=" + moduleimpl_id "moduleimpl_status?moduleimpl_id=" + moduleimpl_id
@ -1019,7 +1014,7 @@ def view_module_abs(context, REQUEST, moduleimpl_id, format="html"):
return ( return (
"\n".join(H) "\n".join(H)
+ "<p>Aucune absence signalée</p>" + "<p>Aucune absence signalée</p>"
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
tab = GenTable( tab = GenTable(
@ -1041,7 +1036,7 @@ def view_module_abs(context, REQUEST, moduleimpl_id, format="html"):
if format != "html": if format != "html":
return tab.make_page(context, format=format, REQUEST=REQUEST) return tab.make_page(context, format=format, REQUEST=REQUEST)
return "\n".join(H) + tab.html() + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tab.html() + html_sco_header.sco_footer()
@bp.route("/edit_ue_expr", methods=["GET", "POST"]) @bp.route("/edit_ue_expr", methods=["GET", "POST"])
@ -1096,7 +1091,7 @@ def edit_ue_expr(context, REQUEST, formsemestre_id, ue_id):
initvalues=initvalues, initvalues=initvalues,
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"formsemestre_status?formsemestre_id=" + formsemestre_id "formsemestre_status?formsemestre_id=" + formsemestre_id
@ -1333,7 +1328,7 @@ def formsemestre_desinscription(
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ '<p>Etudiant désinscrit !</p><p><a class="stdlink" href="%s">retour à la fiche</a>' + '<p>Etudiant désinscrit !</p><p><a class="stdlink" href="%s">retour à la fiche</a>'
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid) % url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
@ -1427,16 +1422,14 @@ sco_publish(
@scodoc7func(context) @scodoc7func(context)
def evaluation_delete(context, REQUEST, evaluation_id): def evaluation_delete(context, REQUEST, evaluation_id):
"""Form delete evaluation""" """Form delete evaluation"""
El = sco_evaluations.do_evaluation_list( El = sco_evaluations.do_evaluation_list(args={"evaluation_id": evaluation_id})
context, args={"evaluation_id": evaluation_id}
)
if not El: if not El:
raise ValueError("Evalution inexistante ! (%s)" % evaluation_id) raise ValueError("Evalution inexistante ! (%s)" % evaluation_id)
E = El[0] E = El[0]
M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0] M = sco_moduleimpl.do_moduleimpl_list(context, moduleimpl_id=E["moduleimpl_id"])[0]
Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0] Mod = sco_edit_module.do_module_list(context, args={"module_id": M["module_id"]})[0]
tit = "Suppression de l'évaluation %(description)s (%(jour)s)" % E tit = "Suppression de l'évaluation %(description)s (%(jour)s)" % E
etat = sco_evaluations.do_evaluation_etat(context, evaluation_id) etat = sco_evaluations.do_evaluation_etat(evaluation_id)
H = [ H = [
html_sco_header.html_sem_header(context, REQUEST, tit, with_h2=False), html_sco_header.html_sem_header(context, REQUEST, tit, with_h2=False),
"""<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod, """<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod,
@ -1465,7 +1458,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
"""<p>Suppression impossible (effacer les notes d'abord)</p><p><a class="stdlink" href="moduleimpl_status?moduleimpl_id=%s">retour au tableau de bord du module</a></p></div>""" """<p>Suppression impossible (effacer les notes d'abord)</p><p><a class="stdlink" href="moduleimpl_status?moduleimpl_id=%s">retour au tableau de bord du module</a></p></div>"""
% E["moduleimpl_id"] % E["moduleimpl_id"]
) )
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
if warning: if warning:
H.append("""</div>""") H.append("""</div>""")
@ -1478,7 +1471,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
cancelbutton="Annuler", cancelbutton="Annuler",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
scu.ScoURL() scu.ScoURL()
@ -1486,7 +1479,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
+ E["moduleimpl_id"] + E["moduleimpl_id"]
) )
else: else:
sco_evaluations.do_evaluation_delete(context, REQUEST, E["evaluation_id"]) sco_evaluations.do_evaluation_delete(E["evaluation_id"])
return ( return (
"\n".join(H) "\n".join(H)
+ """<p>OK, évaluation supprimée.</p> + """<p>OK, évaluation supprimée.</p>
@ -1496,7 +1489,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
+ "/Notes/moduleimpl_status?moduleimpl_id=" + "/Notes/moduleimpl_status?moduleimpl_id="
+ E["moduleimpl_id"] + E["moduleimpl_id"]
) )
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
@ -1510,20 +1503,20 @@ sco_publish(
@bp.route("/evaluation_edit", methods=["GET", "POST"]) @bp.route("/evaluation_edit", methods=["GET", "POST"])
@permission_required(Permission.ScoEnsView) @permission_required(Permission.ScoEnsView)
@scodoc7func(context) @scodoc7func(context)
def evaluation_edit(context, evaluation_id, REQUEST): def evaluation_edit(evaluation_id, REQUEST):
"form edit evaluation" "form edit evaluation"
return sco_evaluations.evaluation_create_form( return sco_evaluations.evaluation_create_form(
context, evaluation_id=evaluation_id, REQUEST=REQUEST, edit=True evaluation_id=evaluation_id, REQUEST=REQUEST, edit=True
) )
@bp.route("/evaluation_create", methods=["GET", "POST"]) @bp.route("/evaluation_create", methods=["GET", "POST"])
@permission_required(Permission.ScoEnsView) @permission_required(Permission.ScoEnsView)
@scodoc7func(context) @scodoc7func(context)
def evaluation_create(context, moduleimpl_id, REQUEST): def evaluation_create(moduleimpl_id, REQUEST):
"form create evaluation" "form create evaluation"
return sco_evaluations.evaluation_create_form( return sco_evaluations.evaluation_create_form(
context, moduleimpl_id=moduleimpl_id, REQUEST=REQUEST, edit=False moduleimpl_id=moduleimpl_id, REQUEST=REQUEST, edit=False
) )
@ -1540,7 +1533,7 @@ def evaluation_listenotes(context, REQUEST=None):
javascripts=["js/etud_info.js"], javascripts=["js/etud_info.js"],
init_qtip=True, init_qtip=True,
) )
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
else: else:
H, F = "", "" H, F = "", ""
B = sco_liste_notes.do_evaluation_listenotes(context, REQUEST) B = sco_liste_notes.do_evaluation_listenotes(context, REQUEST)
@ -1718,7 +1711,7 @@ def formsemestre_bulletins_choice(
H.append("""<p class="help">""" + explanation + """</p>""") H.append("""<p class="help">""" + explanation + """</p>""")
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
@bp.route("/formsemestre_bulletins_mailetuds") @bp.route("/formsemestre_bulletins_mailetuds")
@ -1774,7 +1767,7 @@ def formsemestre_bulletins_mailetuds(
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ '<p>%d bulletins sur %d envoyés par mail !</p><p><a class="stdlink" href="formsemestre_status?formsemestre_id=%s">continuer</a></p>' + '<p>%d bulletins sur %d envoyés par mail !</p><p><a class="stdlink" href="formsemestre_status?formsemestre_id=%s">continuer</a></p>'
% (nb_send, len(etudids), formsemestre_id) % (nb_send, len(etudids), formsemestre_id)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
@ -1839,7 +1832,7 @@ def appreciation_add_form(
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ "<h2>%s d'une appréciation sur %s</h2>" % (a, etud["nomprenom"]) + "<h2>%s d'une appréciation sur %s</h2>" % (a, etud["nomprenom"])
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
descr = [ descr = [
("edit", {"input_type": "hidden", "default": edit}), ("edit", {"input_type": "hidden", "default": edit}),
("etudid", {"input_type": "hidden"}), ("etudid", {"input_type": "hidden"}),
@ -2425,7 +2418,7 @@ def check_sem_integrity(context, formsemestre_id, REQUEST, fix=False):
else: else:
H.append("""<p class="alert">Problème détecté !</p>""") H.append("""<p class="alert">Problème détecté !</p>""")
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
@bp.route("/check_form_integrity") @bp.route("/check_form_integrity")
@ -2467,7 +2460,7 @@ def check_form_integrity(context, formation_id, fix=False, REQUEST=None):
return ( return (
html_sco_header.sco_header(context, REQUEST=REQUEST) html_sco_header.sco_header(context, REQUEST=REQUEST)
+ txth + txth
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
@ -2519,7 +2512,7 @@ def check_formsemestre_integrity(context, formsemestre_id, REQUEST=None):
return ( return (
html_sco_header.sco_header(context, REQUEST=REQUEST) html_sco_header.sco_header(context, REQUEST=REQUEST)
+ "<br/>".join(diag) + "<br/>".join(diag)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
@ -2539,7 +2532,7 @@ def check_integrity_all(context, REQUEST=None):
return ( return (
html_sco_header.sco_header(context, REQUEST=REQUEST) html_sco_header.sco_header(context, REQUEST=REQUEST)
+ "<p>empty page: see logs and mails</p>" + "<p>empty page: see logs and mails</p>"
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )

View File

@ -131,12 +131,6 @@ log("ScoDoc8 restarting...")
# #
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# sco_publish(
# "/formsemestre_evaluations_delai_correction",
# sco_evaluations.formsemestre_evaluations_delai_correction,
# Permission.ScoView,
# )
@bp.route("/about") @bp.route("/about")
@permission_required(Permission.ScoView) @permission_required(Permission.ScoView)
@ -164,7 +158,7 @@ def about(context, REQUEST):
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ "\n".join(H) + "\n".join(H)
+ d + d
+ html_sco_header.sco_footer(REQUEST) + html_sco_header.sco_footer()
) )
@ -180,7 +174,7 @@ def about(context, REQUEST):
@scodoc7func(context) @scodoc7func(context)
def edit_preferences(context, REQUEST): def edit_preferences(context, REQUEST):
"""Edit global preferences (lien "Paramétrage" département)""" """Edit global preferences (lien "Paramétrage" département)"""
return sco_preferences.get_base_preferences(context).edit(REQUEST=REQUEST) return sco_preferences.get_base_preferences().edit(REQUEST=REQUEST)
@bp.route("/formsemestre_edit_preferences", methods=["GET", "POST"]) @bp.route("/formsemestre_edit_preferences", methods=["GET", "POST"])
@ -205,10 +199,10 @@ def formsemestre_edit_preferences(context, formsemestre_id, REQUEST):
@bp.route("/doc_preferences") @bp.route("/doc_preferences")
@permission_required(Permission.ScoView) @permission_required(Permission.ScoView)
@scodoc7func(context) @scodoc7func(context)
def doc_preferences(context, REQUEST): def doc_preferences(REQUEST):
"""List preferences for wiki documentation""" """List preferences for wiki documentation"""
REQUEST.RESPONSE.setHeader("content-type", "text/plain") REQUEST.RESPONSE.setHeader("content-type", "text/plain")
return sco_preferences.doc_preferences(context) return sco_preferences.doc_preferences()
# -------------------------------------------------------------------- # --------------------------------------------------------------------
@ -607,7 +601,7 @@ def formChangeCoordonnees(context, etudid, REQUEST):
) )
dest_url = url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid) dest_url = url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
if tf[0] == 0: if tf[0] == 0:
return header + "\n".join(H) + tf[1] + html_sco_header.sco_footer(REQUEST) return header + "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
@ -734,7 +728,7 @@ def etud_photo_orig_page(context, etudid=None, REQUEST=None):
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid), % url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
sco_photos.etud_photo_orig_html(context, etud), sco_photos.etud_photo_orig_html(context, etud),
"</a></div>", "</a></div>",
html_sco_header.sco_footer(REQUEST), html_sco_header.sco_footer(),
] ]
return "\n".join(H) return "\n".join(H)
@ -784,7 +778,7 @@ def formChangePhoto(context, etudid=None, REQUEST=None):
+ tf[1] + tf[1]
+ '<p><a class="stdlink" href="formSuppressPhoto?etudid=%s">Supprimer cette photo</a></p>' + '<p><a class="stdlink" href="formSuppressPhoto?etudid=%s">Supprimer cette photo</a></p>'
% etudid % etudid
+ html_sco_header.sco_footer(REQUEST) + html_sco_header.sco_footer()
) )
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
@ -795,7 +789,7 @@ def formChangePhoto(context, etudid=None, REQUEST=None):
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
H.append('<p class="warning">Erreur:' + diag + "</p>") H.append('<p class="warning">Erreur:' + diag + "</p>")
return "\n".join(H) + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
@bp.route("/formSuppressPhoto") @bp.route("/formSuppressPhoto")
@ -899,7 +893,7 @@ def _formDem_of_Def(
</form>""" </form>"""
% etud % etud
) )
return header + "\n".join(H) + html_sco_header.sco_footer(REQUEST) return header + "\n".join(H) + html_sco_header.sco_footer()
@bp.route("/doDemEtudiant") @bp.route("/doDemEtudiant")
@ -1108,7 +1102,7 @@ def etudident_edit_form(context, REQUEST=None):
def _etudident_create_or_edit_form(context, REQUEST, edit): def _etudident_create_or_edit_form(context, REQUEST, edit):
"Le formulaire HTML" "Le formulaire HTML"
H = [html_sco_header.sco_header(context, REQUEST, init_jquery_ui=True)] H = [html_sco_header.sco_header(context, REQUEST, init_jquery_ui=True)]
F = html_sco_header.sco_footer(REQUEST) F = html_sco_header.sco_footer()
etudid = REQUEST.form.get("etudid", None) etudid = REQUEST.form.get("etudid", None)
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
descr = [] descr = []
@ -1727,7 +1721,7 @@ def check_group_apogee(
) )
) )
return "\n".join(H) + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
@bp.route("/form_students_import_excel") @bp.route("/form_students_import_excel")
@ -1800,7 +1794,7 @@ def form_students_import_excel(context, REQUEST, formsemestre_id=None):
<li>""" <li>"""
) )
F = html_sco_header.sco_footer(REQUEST) F = html_sco_header.sco_footer()
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, REQUEST.URL0,
REQUEST.form, REQUEST.form,
@ -1914,7 +1908,7 @@ def import_generate_admission_sample(context, REQUEST, formsemestre_id):
def form_students_import_infos_admissions(context, REQUEST, formsemestre_id=None): def form_students_import_infos_admissions(context, REQUEST, formsemestre_id=None):
"formulaire import xls" "formulaire import xls"
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
F = html_sco_header.sco_footer(REQUEST) F = html_sco_header.sco_footer()
if not authuser.has_permission(Permission.ScoEtudInscrit): if not authuser.has_permission(Permission.ScoEtudInscrit):
# autorise juste l'export # autorise juste l'export
H = [ H = [
@ -2050,7 +2044,7 @@ def formsemestre_import_etud_admission(
"%s: <tt>%s</tt> devient <tt>%s</tt><br/>" "%s: <tt>%s</tt> devient <tt>%s</tt><br/>"
% (info["nom"], info["email"], new_mail) % (info["nom"], info["email"], new_mail)
) )
return "\n".join(H) + html_sco_header.sco_footer(REQUEST) return "\n".join(H) + html_sco_header.sco_footer()
sco_publish( sco_publish(

View File

@ -99,7 +99,7 @@ def create_user_form(context, REQUEST, user_name=None, edit=0):
initvalues = {} initvalues = {}
edit = int(edit) edit = int(edit)
H = [html_sco_header.sco_header(context, REQUEST, bodyOnLoad="init_tf_form('')")] H = [html_sco_header.sco_header(context, REQUEST, bodyOnLoad="init_tf_form('')")]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
if edit: if edit:
if not user_name: if not user_name:
raise ValueError("missing argument: user_name") raise ValueError("missing argument: user_name")
@ -504,7 +504,7 @@ def form_change_password(REQUEST, user_name=None):
else: else:
u = User.query.filter_by(user_name=user_name).first() u = User.query.filter_by(user_name=user_name).first()
H = [html_sco_header.sco_header(context, REQUEST, user_check=False)] H = [html_sco_header.sco_header(context, REQUEST, user_check=False)]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
# check access # check access
if not can_handle_passwd(u): if not can_handle_passwd(u):
return ( return (
@ -545,7 +545,7 @@ def change_password(user_name, password, password2, REQUEST):
) )
raise AccessDenied("vous n'avez pas la permission de changer ce mot de passe") raise AccessDenied("vous n'avez pas la permission de changer ce mot de passe")
H = [] H = []
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer()
# check password # check password
if password != password2: if password != password2:
H.append( H.append(
@ -601,7 +601,7 @@ def delete_user_form(REQUEST, user_name, dialog_confirmed=False):
return ( return (
html_sco_header.sco_header(context, REQUEST, user_check=False) html_sco_header.sco_header(context, REQUEST, user_check=False)
+ "<p>Vous n'avez pas la permission de supprimer cet utilisateur</p>" + "<p>Vous n'avez pas la permission de supprimer cet utilisateur</p>"
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer()
) )
if not dialog_confirmed: if not dialog_confirmed:
return scu.confirm_dialog( return scu.confirm_dialog(

View File

@ -31,6 +31,7 @@ cli.register(app)
@app.shell_context_processor @app.shell_context_processor
def make_shell_context(): def make_shell_context():
from app.scodoc import notesdb as ndb from app.scodoc import notesdb as ndb
from app.scodoc import sco_utils as scu
return { return {
"db": db, "db": db,
@ -40,6 +41,7 @@ def make_shell_context():
"notes": notes, "notes": notes,
"scolar": scolar, "scolar": scolar,
"ndb": ndb, "ndb": ndb,
"scu": scu,
"pp": pp, "pp": pp,
"flask": flask, "flask": flask,
"current_app": flask.current_app, "current_app": flask.current_app,

View File

@ -45,22 +45,29 @@ mi = G.create_moduleimpl(
# --- Création d'un étudiant # --- Création d'un étudiant
etud = G.create_etud(code_nip=None) etud = G.create_etud(code_nip=None)
G.inscrit_etudiant(sem, etud) G.inscrit_etudiant(sem, etud)
etudid=etud["etudid"] etudid = etud["etudid"]
# --- Création d'une absence # --- Création d'une absence
sco_abs_views.doSignaleAbsence(context.Absences, datedebut="22/01/2021", datefin="22/01/2021", demijournee=2, etudid=etudid, REQUEST=REQUEST) sco_abs_views.doSignaleAbsence(
context.Absences,
datedebut="22/01/2021",
datefin="22/01/2021",
demijournee=2,
etudid=etudid,
REQUEST=REQUEST,
)
# --- Création d'un billet # --- Création d'un billet
b1 = context.Absences.AddBilletAbsence( b1 = context.Absences.AddBilletAbsence(
begin="2021-01-22 00:00", begin="2021-01-22 00:00",
end="2021-01-22 23:59", end="2021-01-22 23:59",
etudid=etudid, etudid=etudid,
description = "abs du 22", description="abs du 22",
justified=False, justified=False,
code_nip=etud["code_nip"], code_nip=etud["code_nip"],
code_ine=etud["code_ine"], code_ine=etud["code_ine"],
REQUEST=REQUEST, REQUEST=REQUEST,
) )
# --- XMLgetBilletEtud # --- XMLgetBilletEtud
@ -76,7 +83,9 @@ load_li_bi = json.loads(li_bi)
_ = context.Absences.deleteBilletAbsence(load_li_bi[0]["billet_id"], REQUEST=REQUEST) _ = context.Absences.deleteBilletAbsence(load_li_bi[0]["billet_id"], REQUEST=REQUEST)
li_bi2 = context.Absences.listeBilletsEtud(etudid=etudid, REQUEST=REQUEST, format="json") li_bi2 = context.Absences.listeBilletsEtud(
etudid=etudid, REQUEST=REQUEST, format="json"
)
load_li_bi2 = json.loads(li_bi) load_li_bi2 = json.loads(li_bi)
assert len(load_li_bi2) == 0 assert len(load_li_bi2) == 0
@ -90,7 +99,7 @@ deleteBilletsEtud : erreur
File "/opt/scodoc/Products/ScoDoc/ZAbsences.py", line 1809, in deleteBilletAbsence File "/opt/scodoc/Products/ScoDoc/ZAbsences.py", line 1809, in deleteBilletAbsence
parameters={"billet_id": billet_id}, parameters={"billet_id": billet_id},
File "/opt/scodoc/Products/ScoDoc/ZScolar.py", line 2664, in confirmDialog File "/opt/scodoc/Products/ScoDoc/ZScolar.py", line 2664, in confirmDialog
return self.sco_header(REQUEST) + "\n".join(H) + self.sco_footer(REQUEST) return self.sco_header(REQUEST) + "\n".join(H) + self.sco_footer()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 223: ordinal not in range(128) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 223: ordinal not in range(128)
""" """

View File

@ -45,7 +45,7 @@ def test_cache_evaluations(test_client):
sem_evals = [] sem_evals = []
for sem in sems: for sem in sems:
sem_evals = sco_evaluations.do_evaluation_list_in_sem( sem_evals = sco_evaluations.do_evaluation_list_in_sem(
None, sem["formsemestre_id"], with_etat=False sem["formsemestre_id"], with_etat=False
) )
if sem_evals: if sem_evals:
break break
@ -53,7 +53,7 @@ def test_cache_evaluations(test_client):
raise Exception("no evaluations") raise Exception("no evaluations")
# #
evaluation_id = sem_evals[0]["evaluation_id"] evaluation_id = sem_evals[0]["evaluation_id"]
sco_evaluations.do_evaluation_get_all_notes(None, evaluation_id) sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
# should have been be cached: # should have been be cached:
assert sco_cache.EvaluationCache.get(evaluation_id) assert sco_cache.EvaluationCache.get(evaluation_id)
sco_cache.invalidate_formsemestre(sem["formsemestre_id"]) sco_cache.invalidate_formsemestre(sem["formsemestre_id"])