WIP refactoring: preferences

This commit is contained in:
Emmanuel Viennet 2021-06-13 19:12:20 +02:00
parent d586359e3d
commit 09a65b48ef
62 changed files with 511 additions and 323 deletions

View File

@ -55,20 +55,9 @@ Installer le bon vieux `pyExcelerator` dans l'environnement:
## Migration ZScolar ## Migration ZScolar
### Méthodes qui ne devraient plus être publiées: ### Méthodes qui ne devraient plus être publiées:
security.declareProtected(ScoView, "get_preferences")
def get_preferences(context, formsemestre_id=None):
"Get preferences for this instance (a dict-like instance)"
return sco_preferences.sem_preferences(context, formsemestre_id)
security.declareProtected(ScoView, "get_preference")
def get_preference(context, name, formsemestre_id=None):
"""Returns value of named preference.
All preferences have a sensible default value (see sco_preferences.py),
this function always returns a usable value for all defined preferences names.
"""
return sco_preferences.get_base_preferences(context).get(formsemestre_id, name)

View File

@ -240,7 +240,9 @@ def students_import_excel(
dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id
else: else:
dest = context.NotesURL() dest = context.NotesURL()
H = [html_sco_header.sco_header(context, REQUEST, page_title="Import etudiants")] H = [
html_sco_header.sco_header(context, REQUEST, page_title="Import etudiants")
]
H.append("<ul>") H.append("<ul>")
for d in diag: for d in diag:
H.append("<li>%s</li>" % d) H.append("<li>%s</li>" % d)
@ -266,7 +268,7 @@ def scolars_import_excel_file(
cnx = context.GetDBConnexion(autocommit=False) cnx = context.GetDBConnexion(autocommit=False)
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor) cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
annee_courante = time.localtime()[0] annee_courante = time.localtime()[0]
always_require_ine = context.get_preference("always_require_ine") always_require_ine = sco_preferences.get_preference(context, "always_require_ine")
exceldata = datafile.read() exceldata = datafile.read()
if not exceldata: if not exceldata:
raise ScoValueError("Ficher excel vide ou invalide") raise ScoValueError("Ficher excel vide ou invalide")
@ -789,6 +791,8 @@ def adm_table_description_format(context):
rows=Fmt.values(), rows=Fmt.values(),
html_sortable=True, html_sortable=True,
html_class="table_leftalign", html_class="table_leftalign",
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return tab return tab

View File

@ -129,7 +129,7 @@ def sidebar(context, REQUEST=None):
""" """
% params % params
) )
if context.get_preference("handle_billets_abs"): if sco_preferences.get_preference(context, "handle_billets_abs"):
H.append( H.append(
"""<li> <a href="%(ScoURL)s/Absences/listeBilletsEtud?etudid=%(etudid)s">Billets</a></li>""" """<li> <a href="%(ScoURL)s/Absences/listeBilletsEtud?etudid=%(etudid)s">Billets</a></li>"""
% params % params
@ -166,9 +166,9 @@ def sidebar_dept(context, 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,
"DeptIntranetTitle": context.get_preference("DeptIntranetTitle"), "DeptIntranetTitle": sco_preferences.get_preference(context, "DeptIntranetTitle"),
"DeptIntranetURL": context.get_preference("DeptIntranetURL"), "DeptIntranetURL": sco_preferences.get_preference(context, "DeptIntranetURL"),
"DeptName": context.get_preference("DeptName"), "DeptName": sco_preferences.get_preference(context, "DeptName"),
"ScoURL": context.ScoURL(), "ScoURL": context.ScoURL(),
} }

View File

@ -117,7 +117,7 @@ def sendAlarm(context, subj, txt):
msg = MIMEMultipart() msg = MIMEMultipart()
subj = Header(subj, sco_utils.SCO_ENCODING) subj = Header(subj, sco_utils.SCO_ENCODING)
msg["Subject"] = subj msg["Subject"] = subj
msg["From"] = context.get_preference("email_from_addr") msg["From"] = sco_preferences.get_preference(context, "email_from_addr")
msg["To"] = ALARM_DESTINATION msg["To"] = ALARM_DESTINATION
msg.epilogue = "" msg.epilogue = ""
txt = MIMEText(txt, "plain", sco_utils.SCO_ENCODING) txt = MIMEText(txt, "plain", sco_utils.SCO_ENCODING)

View File

@ -173,7 +173,7 @@ class NotesTable:
self.moduleimpl_stats = {} # { moduleimpl_id : {stats} } self.moduleimpl_stats = {} # { moduleimpl_id : {stats} }
self._uecoef = {} # { ue_id : coef } cache coef manuels ue cap self._uecoef = {} # { ue_id : coef } cache coef manuels ue cap
self._evaluations_etats = None # liste des evaluations avec état self._evaluations_etats = None # liste des evaluations avec état
self.use_ue_coefs = context.get_preference("use_ue_coefs", formsemestre_id) self.use_ue_coefs = sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id)
# Infos sur les etudiants # Infos sur les etudiants
self.inscrlist = context.do_formsemestre_inscription_list( self.inscrlist = context.do_formsemestre_inscription_list(
args={"formsemestre_id": formsemestre_id} args={"formsemestre_id": formsemestre_id}

View File

@ -71,7 +71,7 @@ def get_code_latex_from_scodoc_preference(
Extrait le template (ou le tag d'annotation au regard du champ fourni) des préférences LaTeX Extrait le template (ou le tag d'annotation au regard du champ fourni) des préférences LaTeX
et s'assure qu'il est renvoyé au format unicode et s'assure qu'il est renvoyé au format unicode
""" """
template_latex = context.get_preference(champ, formsemestre_id) template_latex = sco_preferences.get_preference(context, champ, formsemestre_id)
# Conversion du template en unicode: # Conversion du template en unicode:
if template_latex: if template_latex:
template_latex = template_latex.decode(scu.SCO_ENCODING) template_latex = template_latex.decode(scu.SCO_ENCODING)
@ -235,7 +235,7 @@ def get_code_latex_avis_etudiant(
def get_annotation_PE(context, etudid, tag_annotation_pe): def get_annotation_PE(context, etudid, tag_annotation_pe):
"""Renvoie l'annotation PE dans la liste de ces annotations ; """Renvoie l'annotation PE dans la liste de ces annotations ;
Cette annotation est reconnue par la présence d'un tag **PE** Cette annotation est reconnue par la présence d'un tag **PE**
(cf. context.get_preferences -> pe_tag_annotation_avis_latex). (cf. .get_preferences -> pe_tag_annotation_avis_latex).
Result: chaine unicode Result: chaine unicode
""" """

View File

@ -54,7 +54,9 @@ import pe_avislatex
def _pe_view_sem_recap_form(context, formsemestre_id, REQUEST=None): def _pe_view_sem_recap_form(context, formsemestre_id, REQUEST=None):
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Avis de poursuite d'études"), html_sco_header.sco_header(
context, REQUEST, page_title="Avis de poursuite d'études"
),
"""<h2 class="formsemestre">Génération des avis de poursuites d'études</h2> """<h2 class="formsemestre">Génération des avis de poursuites d'études</h2>
<p class="help"> <p class="help">
Cette fonction génère un ensemble de fichiers permettant d'éditer des avis de poursuites d'études. Cette fonction génère un ensemble de fichiers permettant d'éditer des avis de poursuites d'études.
@ -95,7 +97,7 @@ def pe_view_sem_recap(
""" """
if REQUEST and REQUEST.method == "GET": if REQUEST and REQUEST.method == "GET":
return _pe_view_sem_recap_form(context, formsemestre_id, REQUEST=REQUEST) return _pe_view_sem_recap_form(context, formsemestre_id, REQUEST=REQUEST)
prefs = context.get_preferences(formsemestre_id=formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id=formsemestre_id)
semBase = sco_formsemestre.get_formsemestre(context, formsemestre_id) semBase = sco_formsemestre.get_formsemestre(context, formsemestre_id)

View File

@ -45,7 +45,7 @@ import sco_compute_moy
def is_work_saturday(context): def is_work_saturday(context):
"Vrai si le samedi est travaillé" "Vrai si le samedi est travaillé"
return int(context.get_preference("work_saturday")) return int(sco_preferences.get_preference(context, "work_saturday"))
def MonthNbDays(month, year): def MonthNbDays(month, year):

View File

@ -71,7 +71,9 @@ def do_abs_notify(context, sem, etudid, date, nbabs, nbabsjust):
formsemestre_id = sem["formsemestre_id"] formsemestre_id = sem["formsemestre_id"]
else: else:
formsemestre_id = None formsemestre_id = None
prefs = context.get_preferences(formsemestre_id=sem["formsemestre_id"]) prefs = sco_preferences.SemPreferences(
context, formsemestre_id=sem["formsemestre_id"]
)
destinations = abs_notify_get_destinations( destinations = abs_notify_get_destinations(
context, sem, prefs, etudid, date, nbabs, nbabsjust context, sem, prefs, etudid, date, nbabs, nbabsjust
@ -81,7 +83,7 @@ def do_abs_notify(context, sem, etudid, date, nbabs, nbabsjust):
return # abort return # abort
# Vérification fréquence (pour ne pas envoyer de mails trop souvent) # Vérification fréquence (pour ne pas envoyer de mails trop souvent)
abs_notify_max_freq = context.get_preference("abs_notify_max_freq") abs_notify_max_freq = sco_preferences.get_preference(context, "abs_notify_max_freq")
destinations_filtered = [] destinations_filtered = []
for email_addr in destinations: for email_addr in destinations:
nbdays_since_last_notif = user_nbdays_since_last_notif( nbdays_since_last_notif = user_nbdays_since_last_notif(
@ -179,10 +181,10 @@ def abs_notify_is_above_threshold(context, etudid, nbabs, nbabsjust, formsemestr
(nbabs > abs_notify_abs_threshold) (nbabs > abs_notify_abs_threshold)
(nbabs - nbabs_last_notified) > abs_notify_abs_increment (nbabs - nbabs_last_notified) > abs_notify_abs_increment
""" """
abs_notify_abs_threshold = context.get_preference( abs_notify_abs_threshold = sco_preferences.get_preference(context,
"abs_notify_abs_threshold", formsemestre_id "abs_notify_abs_threshold", formsemestre_id
) )
abs_notify_abs_increment = context.get_preference( abs_notify_abs_increment = sco_preferences.get_preference(context,
"abs_notify_abs_increment", formsemestre_id "abs_notify_abs_increment", formsemestre_id
) )
nbabs_last_notified = etud_nbabs_last_notified(context, etudid, formsemestre_id) nbabs_last_notified = etud_nbabs_last_notified(context, etudid, formsemestre_id)

View File

@ -116,8 +116,10 @@ def doSignaleAbsence(
if modimpl["moduleimpl_id"] == moduleimpl_id: if modimpl["moduleimpl_id"] == moduleimpl_id:
M = "dans le module %s" % modimpl["module"]["code"] M = "dans le module %s" % modimpl["module"]["code"]
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, page_title="Signalement d'une absence pour %(nomprenom)s" % etud context,
REQUEST,
page_title="Signalement d'une absence pour %(nomprenom)s" % etud,
), ),
"""<h2>Signalement d'absences</h2>""", """<h2>Signalement d'absences</h2>""",
] ]
@ -151,7 +153,7 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
etudid = etud["etudid"] etudid = etud["etudid"]
disabled = False disabled = False
if not etud["cursem"]: if not etud["cursem"]:
require_module = context.get_preference( require_module = sco_preferences.get_preference(context,
"abs_require_module" "abs_require_module"
) # on utilise la pref globale car pas de sem courant ) # on utilise la pref globale car pas de sem courant
if require_module: if require_module:
@ -162,7 +164,7 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
menu_module = "" menu_module = ""
else: else:
formsemestre_id = etud["cursem"]["formsemestre_id"] formsemestre_id = etud["cursem"]["formsemestre_id"]
require_module = context.get_preference("abs_require_module", formsemestre_id) require_module = sco_preferences.get_preference(context, "abs_require_module", formsemestre_id)
nt = context.Notes._getNotesCache().get_NotesTable( nt = context.Notes._getNotesCache().get_NotesTable(
context.Notes, formsemestre_id context.Notes, formsemestre_id
) )
@ -203,8 +205,10 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
menu_module += """</select></p>""" menu_module += """</select></p>"""
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, page_title="Signalement d'une absence pour %(nomprenom)s" % etud context,
REQUEST,
page_title="Signalement d'une absence pour %(nomprenom)s" % etud,
), ),
"""<table><tr><td> """<table><tr><td>
<h2>Signalement d'une absence pour %(nomprenom)s</h2> <h2>Signalement d'une absence pour %(nomprenom)s</h2>
@ -316,8 +320,10 @@ def doJustifAbsence(
nbadded += 1 nbadded += 1
# #
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, page_title="Justification d'une absence pour %(nomprenom)s" % etud context,
REQUEST,
page_title="Justification d'une absence pour %(nomprenom)s" % etud,
), ),
"""<h2>Justification d'absences</h2>""", """<h2>Justification d'absences</h2>""",
] ]
@ -352,8 +358,10 @@ def JustifAbsenceEtud(context, REQUEST=None): # etudid implied
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0] etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
etudid = etud["etudid"] etudid = etud["etudid"]
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, page_title="Justification d'une absence pour %(nomprenom)s" % etud context,
REQUEST,
page_title="Justification d'une absence pour %(nomprenom)s" % etud,
), ),
"""<table><tr><td> """<table><tr><td>
<h2>Justification d'une absence pour %(nomprenom)s</h2> <h2>Justification d'une absence pour %(nomprenom)s</h2>
@ -421,8 +429,10 @@ def doAnnuleAbsence(
nbadded += 1 nbadded += 1
# #
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, page_title="Annulation d'une absence pour %(nomprenom)s" % etud context,
REQUEST,
page_title="Annulation d'une absence pour %(nomprenom)s" % etud,
), ),
"""<h2>Annulation d'absences pour %(nomprenom)s</h2>""" % etud, """<h2>Annulation d'absences pour %(nomprenom)s</h2>""" % etud,
] ]
@ -458,8 +468,10 @@ def AnnuleAbsenceEtud(context, REQUEST=None): # etudid implied
etudid = etud["etudid"] etudid = etud["etudid"]
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, page_title="Annulation d'une absence pour %(nomprenom)s" % etud context,
REQUEST,
page_title="Annulation d'une absence pour %(nomprenom)s" % etud,
), ),
"""<table><tr><td> """<table><tr><td>
<h2><font color="#FF0000">Annulation</font> d'une absence pour %(nomprenom)s</h2> <h2><font color="#FF0000">Annulation</font> d'une absence pour %(nomprenom)s</h2>
@ -557,7 +569,8 @@ def doAnnuleJustif(
nbadded += 1 nbadded += 1
# #
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Annulation d'une justification pour %(nomprenom)s" % etud, page_title="Annulation d'une justification pour %(nomprenom)s" % etud,
), ),
@ -672,7 +685,8 @@ def CalAbs(context, REQUEST=None): # etud implied
# #
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Calendrier des absences de %(nomprenom)s" % etud, page_title="Calendrier des absences de %(nomprenom)s" % etud,
cssstyles=["css/calabs.css"], cssstyles=["css/calabs.css"],
@ -752,7 +766,9 @@ def ListeAbsEtud(
base_url=base_url_nj, base_url=base_url_nj,
filename="abs_" + scu.make_filename(etud["nomprenom"]), filename="abs_" + scu.make_filename(etud["nomprenom"]),
caption="Absences non justifiées de %(nomprenom)s" % etud, caption="Absences non justifiées de %(nomprenom)s" % etud,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
tab_absjust = GenTable( tab_absjust = GenTable(
titles=titles, titles=titles,
@ -763,7 +779,9 @@ def ListeAbsEtud(
base_url=base_url_j, base_url=base_url_j,
filename="absjust_" + scu.make_filename(etud["nomprenom"]), filename="absjust_" + scu.make_filename(etud["nomprenom"]),
caption="Absences justifiées de %(nomprenom)s" % etud, caption="Absences justifiées de %(nomprenom)s" % etud,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
# Formats non HTML et demande d'une seule table: # Formats non HTML et demande d'une seule table:
@ -777,7 +795,9 @@ def ListeAbsEtud(
# Mise en forme HTML: # Mise en forme HTML:
H = [] H = []
H.append( H.append(
html_sco_header.sco_header(context, REQUEST, page_title="Absences de %s" % etud["nomprenom"]) html_sco_header.sco_header(
context, REQUEST, page_title="Absences de %s" % etud["nomprenom"]
)
) )
H.append( H.append(
"""<h2>Absences de %s (à partir du %s)</h2>""" """<h2>Absences de %s (à partir du %s)</h2>"""
@ -828,7 +848,8 @@ def absences_index_html(context, REQUEST=None):
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Gestion des absences", page_title="Gestion des absences",
cssstyles=["css/calabs.css"], cssstyles=["css/calabs.css"],
@ -844,7 +865,7 @@ def absences_index_html(context, REQUEST=None):
H.append( H.append(
"""<ul><li><a href="EtatAbsences">Afficher l'état des absences (pour tout un groupe)</a></li>""" """<ul><li><a href="EtatAbsences">Afficher l'état des absences (pour tout un groupe)</a></li>"""
) )
if context.get_preference("handle_billets_abs"): if sco_preferences.get_preference(context, "handle_billets_abs"):
H.append( H.append(
"""<li><a href="listeBillets">Traitement des billets d'absence en attente</a></li>""" """<li><a href="listeBillets">Traitement des billets d'absence en attente</a></li>"""
) )

View File

@ -65,7 +65,9 @@ _help_txt = """
def apo_compare_csv_form(context, REQUEST=None): def apo_compare_csv_form(context, REQUEST=None):
"""Form: submit 2 CSV files to compare them.""" """Form: submit 2 CSV files to compare them."""
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Comparaison de fichiers Apogée"), html_sco_header.sco_header(
context, REQUEST, page_title="Comparaison de fichiers Apogée"
),
"""<h2>Comparaison de fichiers Apogée</h2> """<h2>Comparaison de fichiers Apogée</h2>
<form id="apo_csv_add" action="apo_compare_csv" method="post" enctype="multipart/form-data"> <form id="apo_csv_add" action="apo_compare_csv" method="post" enctype="multipart/form-data">
""", """,
@ -95,7 +97,9 @@ def apo_compare_csv(context, A_file, B_file, autodetect=True, REQUEST=None):
B = _load_apo_data(B_file, autodetect=autodetect) B = _load_apo_data(B_file, autodetect=autodetect)
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Comparaison de fichiers Apogée"), html_sco_header.sco_header(
context, REQUEST, page_title="Comparaison de fichiers Apogée"
),
"<h2>Comparaison de fichiers Apogée</h2>", "<h2>Comparaison de fichiers Apogée</h2>",
_help_txt, _help_txt,
'<div class="apo_compare_csv">', '<div class="apo_compare_csv">',
@ -263,7 +267,9 @@ def apo_table_compare_etud_results(context, A, B, REQUEST=None):
columns_ids=("nip", "nom", "prenom", "elt_code", "type_res", "val_A", "val_B"), columns_ids=("nip", "nom", "prenom", "elt_code", "type_res", "val_A", "val_B"),
html_class="table_leftalign", html_class="table_leftalign",
html_with_td_classes=True, html_with_td_classes=True,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return T return T

View File

@ -85,7 +85,7 @@ def make_context_dict(context, sem, etud):
C.update(etud) C.update(etud)
# copie preferences # copie preferences
for name in sco_preferences.PREFS_NAMES: for name in sco_preferences.PREFS_NAMES:
C[name] = context.get_preference(name, sem["formsemestre_id"]) C[name] = sco_preferences.get_preference(context, name, sem["formsemestre_id"])
# ajoute groupes et group_0, group_1, ... # ajoute groupes et group_0, group_1, ...
sco_groups.etud_add_group_infos(context, etud, sem) sco_groups.etud_add_group_infos(context, etud, sem)
@ -116,7 +116,7 @@ def formsemestre_bulletinetud_dict(
if not version in ("short", "long", "selectedevals"): if not version in ("short", "long", "selectedevals"):
raise ValueError("invalid version code !") raise ValueError("invalid version code !")
prefs = context.get_preferences(formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id)
nt = context._getNotesCache().get_NotesTable( nt = context._getNotesCache().get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > toutes notes ) # > toutes notes
@ -403,8 +403,8 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
(ajoute les informations aux modimpls) (ajoute les informations aux modimpls)
Result: liste de modules de l'UE avec les infos dans chacun (seulement ceux où l'étudiant est inscrit). Result: liste de modules de l'UE avec les infos dans chacun (seulement ceux où l'étudiant est inscrit).
""" """
bul_show_mod_rangs = context.get_preference("bul_show_mod_rangs", formsemestre_id) bul_show_mod_rangs = sco_preferences.get_preference(context, "bul_show_mod_rangs", formsemestre_id)
bul_show_abs_modules = context.get_preference( bul_show_abs_modules = sco_preferences.get_preference(context,
"bul_show_abs_modules", formsemestre_id "bul_show_abs_modules", formsemestre_id
) )
if bul_show_abs_modules: if bul_show_abs_modules:
@ -478,7 +478,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
'<a class="bull_link" href="moduleimpl_status?moduleimpl_id=%s" title="%s">' '<a class="bull_link" href="moduleimpl_status?moduleimpl_id=%s" title="%s">'
% (modimpl["moduleimpl_id"], mod["mod_descr_txt"]) % (modimpl["moduleimpl_id"], mod["mod_descr_txt"])
) )
if context.get_preference("bul_show_codemodules", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_codemodules", formsemestre_id):
mod["code"] = modimpl["module"]["code"] mod["code"] = modimpl["module"]["code"]
mod["code_html"] = link_mod + mod["code"] + "</a>" mod["code_html"] = link_mod + mod["code"] + "</a>"
else: else:
@ -497,7 +497,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
'<a class="bull_link" href="moduleimpl_status?moduleimpl_id=%s" title="%s">' '<a class="bull_link" href="moduleimpl_status?moduleimpl_id=%s" title="%s">'
% (modimpl["moduleimpl_id"], mod_descr) % (modimpl["moduleimpl_id"], mod_descr)
) )
if context.get_preference("bul_show_codemodules", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_codemodules", formsemestre_id):
mod["code_txt"] = modimpl["module"]["code"] mod["code_txt"] = modimpl["module"]["code"]
mod["code_html"] = link_mod + mod["code_txt"] + "</a>" mod["code_html"] = link_mod + mod["code_txt"] + "</a>"
else: else:
@ -558,7 +558,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
# Evaluations incomplètes ou futures: # Evaluations incomplètes ou futures:
mod["evaluations_incompletes"] = [] mod["evaluations_incompletes"] = []
if context.get_preference("bul_show_all_evals", formsemestre_id): if sco_preferences.get_preference(context, "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 = context.do_evaluation_list( all_evals = context.do_evaluation_list(
args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
@ -842,7 +842,7 @@ def can_send_bulletin_by_mail(context, formsemestre_id, REQUEST):
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
return ( return (
context.get_preference("bul_mail_allowed_for_all", formsemestre_id) sco_preferences.get_preference(context, "bul_mail_allowed_for_all", formsemestre_id)
or authuser.has_permission(Permission.ScoImplement, context) or authuser.has_permission(Permission.ScoImplement, context)
or str(authuser) in sem["responsables"] or str(authuser) in sem["responsables"]
) )
@ -971,10 +971,10 @@ def mail_bulletin(context, formsemestre_id, I, pdfdata, filename, recipient_addr
If bul_mail_list_abs pref is true, put list of absences in mail body (text). If bul_mail_list_abs pref is true, put list of absences in mail body (text).
""" """
etud = I["etud"] etud = I["etud"]
webmaster = context.get_preference("bul_mail_contact_addr", formsemestre_id) webmaster = sco_preferences.get_preference(context, "bul_mail_contact_addr", formsemestre_id)
dept = scu.unescape_html(context.get_preference("DeptName", formsemestre_id)) dept = scu.unescape_html(sco_preferences.get_preference(context, "DeptName", formsemestre_id))
copy_addr = context.get_preference("email_copy_bulletins", formsemestre_id) copy_addr = sco_preferences.get_preference(context, "email_copy_bulletins", formsemestre_id)
intro_mail = context.get_preference("bul_intro_mail", formsemestre_id) intro_mail = sco_preferences.get_preference(context, "bul_intro_mail", formsemestre_id)
if intro_mail: if intro_mail:
hea = intro_mail % { hea = intro_mail % {
@ -985,7 +985,7 @@ def mail_bulletin(context, formsemestre_id, I, pdfdata, filename, recipient_addr
else: else:
hea = "" hea = ""
if context.get_preference("bul_mail_list_abs"): if sco_preferences.get_preference(context, "bul_mail_list_abs"):
hea += "\n\n" + sco_abs_views.ListeAbsEtud( hea += "\n\n" + sco_abs_views.ListeAbsEtud(
context, etud["etudid"], with_evals=False, format="text" context, etud["etudid"], with_evals=False, format="text"
) )
@ -994,7 +994,7 @@ def mail_bulletin(context, formsemestre_id, I, pdfdata, filename, recipient_addr
subj = Header("Relevé de notes de %s" % etud["nomprenom"], scu.SCO_ENCODING) subj = Header("Relevé de notes de %s" % etud["nomprenom"], scu.SCO_ENCODING)
recipients = [recipient_addr] recipients = [recipient_addr]
msg["Subject"] = subj msg["Subject"] = subj
msg["From"] = context.get_preference("email_from_addr", formsemestre_id) msg["From"] = sco_preferences.get_preference(context, "email_from_addr", formsemestre_id)
msg["To"] = " ,".join(recipients) msg["To"] = " ,".join(recipients)
if copy_addr: if copy_addr:
msg["Bcc"] = copy_addr.strip() msg["Bcc"] = copy_addr.strip()
@ -1027,7 +1027,8 @@ def _formsemestre_bulletinetud_header_html(
authuser = REQUEST.AUTHENTICATED_USER authuser = REQUEST.AUTHENTICATED_USER
uid = str(authuser) uid = str(authuser)
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
page_title="Bulletin de %(nomprenom)s" % etud, page_title="Bulletin de %(nomprenom)s" % etud,
REQUEST=REQUEST, REQUEST=REQUEST,
javascripts=[ javascripts=[

View File

@ -87,7 +87,7 @@ def bulletin_get_class(class_name):
def bulletin_get_class_name_displayed(context, formsemestre_id): def bulletin_get_class_name_displayed(context, formsemestre_id):
"""Le nom du générateur utilisé, en clair""" """Le nom du générateur utilisé, en clair"""
bul_class_name = context.get_preference("bul_class_name", formsemestre_id) bul_class_name = sco_preferences.get_preference(context, "bul_class_name", formsemestre_id)
try: try:
gen_class = bulletin_get_class(bul_class_name) gen_class = bulletin_get_class(bul_class_name)
return gen_class.description return gen_class.description
@ -121,7 +121,7 @@ class BulletinGenerator:
self.server_name = server_name self.server_name = server_name
# Store preferences for convenience: # Store preferences for convenience:
formsemestre_id = self.infos["formsemestre_id"] formsemestre_id = self.infos["formsemestre_id"]
self.preferences = context.get_preferences(formsemestre_id) self.preferences = sco_preferences.SemPreferences(context, formsemestre_id)
self.diagnostic = None # error message if any problem self.diagnostic = None # error message if any problem
# Common PDF styles: # Common PDF styles:
# - Pour tous les champs du bulletin sauf les cellules de table: # - Pour tous les champs du bulletin sauf les cellules de table:
@ -223,7 +223,9 @@ class BulletinGenerator:
margins=self.margins, margins=self.margins,
server_name=self.server_name, server_name=self.server_name,
filigranne=self.filigranne, filigranne=self.filigranne,
preferences=self.context.get_preferences(formsemestre_id), preferences=self.sco_preferences.SemPreferences(
context, formsemestre_id
),
) )
) )
document.build(objects) document.build(objects)
@ -273,7 +275,7 @@ def make_formsemestre_bulletinetud(
raise ValueError("invalid version code !") raise ValueError("invalid version code !")
formsemestre_id = infos["formsemestre_id"] formsemestre_id = infos["formsemestre_id"]
bul_class_name = context.get_preference("bul_class_name", formsemestre_id) bul_class_name = sco_preferences.get_preference(context, "bul_class_name", formsemestre_id)
try: try:
gen_class = bulletin_get_class(bul_class_name) gen_class = bulletin_get_class(bul_class_name)
except: except:

View File

@ -156,7 +156,7 @@ def formsemestre_bulletinetud_published_dict(
mg = scu.fmt_note(nt.get_etud_moy_gen(etudid)) mg = scu.fmt_note(nt.get_etud_moy_gen(etudid))
if ( if (
nt.get_moduleimpls_attente() nt.get_moduleimpls_attente()
or context.get_preference("bul_show_rangs", formsemestre_id) == 0 or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id) == 0
): ):
# n'affiche pas le rang sur le bulletin s'il y a des # n'affiche pas le rang sur le bulletin s'il y a des
# notes en attente dans ce semestre # notes en attente dans ce semestre
@ -249,7 +249,7 @@ def formsemestre_bulletinetud_published_dict(
m["note"][k] = scu.fmt_note(m["note"][k]) m["note"][k] = scu.fmt_note(m["note"][k])
u["module"].append(m) u["module"].append(m)
if context.get_preference("bul_show_mod_rangs", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_mod_rangs", formsemestre_id):
m["rang"] = dict( m["rang"] = dict(
value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid] value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid]
) )
@ -283,7 +283,7 @@ def formsemestre_bulletinetud_published_dict(
) )
# Evaluations incomplètes ou futures: # Evaluations incomplètes ou futures:
complete_eval_ids = set([e["evaluation_id"] for e in evals]) complete_eval_ids = set([e["evaluation_id"] for e in evals])
if context.get_preference("bul_show_all_evals", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_all_evals", formsemestre_id):
all_evals = context.do_evaluation_list( all_evals = context.do_evaluation_list(
args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
) )
@ -327,7 +327,7 @@ def formsemestre_bulletinetud_published_dict(
) )
# --- Absences # --- Absences
if context.get_preference("bul_show_abs", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_abs", formsemestre_id):
AbsEtudSem = sco_abs.getAbsSemEtud(context, sem, etudid) AbsEtudSem = sco_abs.getAbsSemEtud(context, sem, etudid)
nbabs = AbsEtudSem.CountAbs() nbabs = AbsEtudSem.CountAbs()
nbabsjust = AbsEtudSem.CountAbsJust() nbabsjust = AbsEtudSem.CountAbsJust()
@ -336,7 +336,7 @@ def formsemestre_bulletinetud_published_dict(
# --- Decision Jury # --- Decision Jury
if ( if (
context.get_preference("bul_show_decision", formsemestre_id) sco_preferences.get_preference(context, "bul_show_decision", formsemestre_id)
or xml_with_decisions or xml_with_decisions
): ):
infos, dpv = sco_bulletins.etud_descr_situation_semestre( infos, dpv = sco_bulletins.etud_descr_situation_semestre(
@ -344,7 +344,7 @@ def formsemestre_bulletinetud_published_dict(
etudid, etudid,
formsemestre_id, formsemestre_id,
format="xml", format="xml",
show_uevalid=context.get_preference("bul_show_uevalid", formsemestre_id), show_uevalid=sco_preferences.get_preference(context, "bul_show_uevalid", formsemestre_id),
) )
d["situation"] = scu.quote_xml_attr(infos["situation"]) d["situation"] = scu.quote_xml_attr(infos["situation"])
if dpv: if dpv:
@ -367,7 +367,7 @@ def formsemestre_bulletinetud_published_dict(
d["decision_ue"] = [] d["decision_ue"] = []
if decision[ if decision[
"decisions_ue" "decisions_ue"
]: # and context.get_preference('bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee) ]: # and sco_preferences.get_preference(context, 'bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee)
for ue_id in decision["decisions_ue"].keys(): for ue_id in decision["decisions_ue"].keys():
ue = context.do_ue_list({"ue_id": ue_id})[0] ue = context.do_ue_list({"ue_id": ue_id})[0]
d["decision_ue"].append( d["decision_ue"].append(

View File

@ -90,7 +90,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
formsemestre_id = self.infos["formsemestre_id"] formsemestre_id = self.infos["formsemestre_id"]
context = self.context context = self.context
bul_show_abs_modules = context.get_preference( bul_show_abs_modules = sco_preferences.get_preference(context,
"bul_show_abs_modules", formsemestre_id "bul_show_abs_modules", formsemestre_id
) )
@ -106,7 +106,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
H = ['<table class="notes_bulletin" style="background-color: %s;">' % bgcolor] H = ['<table class="notes_bulletin" style="background-color: %s;">' % bgcolor]
if context.get_preference("bul_show_minmax", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_minmax", formsemestre_id):
minmax = ( minmax = (
'<span class="bul_minmax" title="[min, max] promo">[%s, %s]</span>' '<span class="bul_minmax" title="[min, max] promo">[%s, %s]</span>'
% (I["moy_min"], I["moy_max"]) % (I["moy_min"], I["moy_max"])
@ -131,7 +131,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
if mod["mod_moy_txt"] == "NI": if mod["mod_moy_txt"] == "NI":
continue # saute les modules où on n'est pas inscrit continue # saute les modules où on n'est pas inscrit
H.append('<tr class="notes_bulletin_row_mod%s">' % rowstyle) H.append('<tr class="notes_bulletin_row_mod%s">' % rowstyle)
if context.get_preference("bul_show_minmax_mod", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_minmax_mod", formsemestre_id):
rang_minmax = '%s <span class="bul_minmax" title="[min, max] UE">[%s, %s]</span>' % ( rang_minmax = '%s <span class="bul_minmax" title="[min, max] UE">[%s, %s]</span>' % (
mod["mod_rang_txt"], mod["mod_rang_txt"],
scu.fmt_note(mod["stats"]["min"]), scu.fmt_note(mod["stats"]["min"]),
@ -178,7 +178,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
rowstyle = "" rowstyle = ""
plusminus = minuslink # plusminus = minuslink #
if ue["ue_status"]["is_capitalized"]: if ue["ue_status"]["is_capitalized"]:
if context.get_preference("bul_show_ue_cap_details", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_ue_cap_details", formsemestre_id):
plusminus = minuslink plusminus = minuslink
hide = "" hide = ""
else: else:
@ -208,7 +208,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
) )
H.append('<tr class="notes_bulletin_row_ue">') H.append('<tr class="notes_bulletin_row_ue">')
if context.get_preference("bul_show_minmax", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_minmax", formsemestre_id):
moy_txt = ( moy_txt = (
'%s <span class="bul_minmax" title="[min, max] UE">[%s, %s]</span>' '%s <span class="bul_minmax" title="[min, max] UE">[%s, %s]</span>'
% ( % (
@ -444,11 +444,11 @@ def _bulletin_pdf_table_legacy(context, I, version="long"):
S = BulTableStyle() S = BulTableStyle()
P = [] # elems pour gen. pdf P = [] # elems pour gen. pdf
formsemestre_id = I["formsemestre_id"] formsemestre_id = I["formsemestre_id"]
bul_show_abs_modules = context.get_preference( bul_show_abs_modules = sco_preferences.get_preference(context,
"bul_show_abs_modules", formsemestre_id "bul_show_abs_modules", formsemestre_id
) )
if context.get_preference("bul_show_minmax", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_minmax", formsemestre_id):
minmax = ' <font size="8">[%s, %s]</font>' % (I["moy_min"], I["moy_max"]) minmax = ' <font size="8">[%s, %s]</font>' % (I["moy_min"], I["moy_max"])
else: else:
minmax = "" minmax = ""
@ -470,7 +470,7 @@ def _bulletin_pdf_table_legacy(context, I, version="long"):
if mod["mod_moy_txt"] == "NI": if mod["mod_moy_txt"] == "NI":
continue # saute les modules où on n'est pas inscrit continue # saute les modules où on n'est pas inscrit
S.modline(ue_type=ue_type) S.modline(ue_type=ue_type)
if context.get_preference("bul_show_minmax_mod", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_minmax_mod", formsemestre_id):
rang_minmax = '%s <font size="8">[%s, %s]</font>' % ( rang_minmax = '%s <font size="8">[%s, %s]</font>' % (
mod["mod_rang_txt"], mod["mod_rang_txt"],
scu.fmt_note(mod["stats"]["min"]), scu.fmt_note(mod["stats"]["min"]),
@ -510,11 +510,11 @@ def _bulletin_pdf_table_legacy(context, I, version="long"):
coef_ue = "" coef_ue = ""
ue_descr = "(en cours, non prise en compte)" ue_descr = "(en cours, non prise en compte)"
S.ueline() S.ueline()
if context.get_preference("bul_show_ue_cap_details", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_ue_cap_details", formsemestre_id):
list_modules(ue["modules_capitalized"]) list_modules(ue["modules_capitalized"])
ue_type = "cur" ue_type = "cur"
if context.get_preference("bul_show_minmax", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_minmax", formsemestre_id):
moy_txt = '%s <font size="8">[%s, %s]</font>' % ( moy_txt = '%s <font size="8">[%s, %s]</font>' % (
ue["cur_moy_ue_txt"], ue["cur_moy_ue_txt"],
ue["min"], ue["min"],

View File

@ -83,10 +83,10 @@ def pdfassemblebulletins(
return "" return ""
# Paramètres de mise en page # Paramètres de mise en page
margins = ( margins = (
context.get_preference("left_margin", formsemestre_id), sco_preferences.get_preference(context, "left_margin", formsemestre_id),
context.get_preference("top_margin", formsemestre_id), sco_preferences.get_preference(context, "top_margin", formsemestre_id),
context.get_preference("right_margin", formsemestre_id), sco_preferences.get_preference(context, "right_margin", formsemestre_id),
context.get_preference("bottom_margin", formsemestre_id), sco_preferences.get_preference(context, "bottom_margin", formsemestre_id),
) )
report = cStringIO.StringIO() # in-memory document, no disk file report = cStringIO.StringIO() # in-memory document, no disk file
@ -102,7 +102,7 @@ def pdfassemblebulletins(
margins=margins, margins=margins,
pagesbookmarks=pagesbookmarks, pagesbookmarks=pagesbookmarks,
filigranne=filigranne, filigranne=filigranne,
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
) )
document.build(objects) document.build(objects)
@ -191,7 +191,7 @@ def get_formsemestre_bulletins_pdf(
bookmarks[i] = scu.suppress_accents(nt.get_sexnom(etudid)) bookmarks[i] = scu.suppress_accents(nt.get_sexnom(etudid))
i = i + 1 i = i + 1
# #
infos = {"DeptName": context.get_preference("DeptName", formsemestre_id)} infos = {"DeptName": sco_preferences.get_preference(context, "DeptName", formsemestre_id)}
if REQUEST: if REQUEST:
server_name = REQUEST.BASE0 server_name = REQUEST.BASE0
else: else:
@ -241,7 +241,7 @@ def get_etud_bulletins_pdf(context, etudid, REQUEST, version="selectedevals"):
filigrannes[i] = filigranne filigrannes[i] = filigranne
bookmarks[i] = sem["session_id"] # eg RT-DUT-FI-S1-2015 bookmarks[i] = sem["session_id"] # eg RT-DUT-FI-S1-2015
i = i + 1 i = i + 1
infos = {"DeptName": context.get_preference("DeptName")} infos = {"DeptName": sco_preferences.get_preference(context, "DeptName")}
if REQUEST: if REQUEST:
server_name = REQUEST.BASE0 server_name = REQUEST.BASE0
else: else:

View File

@ -105,7 +105,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=self.context.get_preferences(formsemestre_id), preferences=self.sco_preferences.SemPreferences(context, 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,
@ -286,7 +286,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
context = self.context context = self.context
P = [] # elems pour générer table avec gen_table (liste de dicts) P = [] # elems pour générer table avec gen_table (liste de dicts)
formsemestre_id = I["formsemestre_id"] formsemestre_id = I["formsemestre_id"]
prefs = context.get_preferences(formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id)
# Colonnes à afficher: # Colonnes à afficher:
with_col_abs = prefs["bul_show_abs_modules"] with_col_abs = prefs["bul_show_abs_modules"]

View File

@ -76,7 +76,7 @@ class BulletinGeneratorUCAC(sco_bulletins_standard.BulletinGeneratorStandard):
I = self.infos I = self.infos
context = self.context context = self.context
formsemestre_id = I["formsemestre_id"] formsemestre_id = I["formsemestre_id"]
prefs = context.get_preferences(formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id)
P = [] # elems pour générer table avec gen_table (liste de dicts) P = [] # elems pour générer table avec gen_table (liste de dicts)
@ -195,7 +195,7 @@ class BulletinGeneratorUCAC(sco_bulletins_standard.BulletinGeneratorStandard):
ue_type = None ue_type = None
# --- UE capitalisée: # --- UE capitalisée:
if ue["ue_status"]["is_capitalized"]: if ue["ue_status"]["is_capitalized"]:
if context.get_preference("bul_show_ue_cap_details", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_ue_cap_details", formsemestre_id):
nb_modules = len(ue["modules_capitalized"]) nb_modules = len(ue["modules_capitalized"])
hidden = False hidden = False
cssstyle = "" cssstyle = ""

View File

@ -139,7 +139,7 @@ def make_xml_formsemestre_bulletinetud(
mg = scu.fmt_note(nt.get_etud_moy_gen(etudid)) mg = scu.fmt_note(nt.get_etud_moy_gen(etudid))
if ( if (
nt.get_moduleimpls_attente() nt.get_moduleimpls_attente()
or context.get_preference("bul_show_rangs", formsemestre_id) == 0 or sco_preferences.get_preference(context, "bul_show_rangs", formsemestre_id) == 0
): ):
# n'affiche pas le rang sur le bulletin s'il y a des # n'affiche pas le rang sur le bulletin s'il y a des
# notes en attente dans ce semestre # notes en attente dans ce semestre
@ -247,7 +247,7 @@ def make_xml_formsemestre_bulletinetud(
moy=scu.fmt_note(modstat["moy"]), moy=scu.fmt_note(modstat["moy"]),
) )
doc._pop() doc._pop()
if context.get_preference("bul_show_mod_rangs", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_mod_rangs", formsemestre_id):
doc._push() doc._push()
doc.rang(value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid]) doc.rang(value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid])
doc._pop() doc._pop()
@ -283,7 +283,7 @@ def make_xml_formsemestre_bulletinetud(
doc._pop() doc._pop()
# Evaluations incomplètes ou futures: # Evaluations incomplètes ou futures:
complete_eval_ids = set([e["evaluation_id"] for e in evals]) complete_eval_ids = set([e["evaluation_id"] for e in evals])
if context.get_preference("bul_show_all_evals", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_all_evals", formsemestre_id):
all_evals = context.do_evaluation_list( all_evals = context.do_evaluation_list(
args={"moduleimpl_id": modimpl["moduleimpl_id"]} args={"moduleimpl_id": modimpl["moduleimpl_id"]}
) )
@ -336,7 +336,7 @@ def make_xml_formsemestre_bulletinetud(
doc._pop() doc._pop()
doc._pop() doc._pop()
# --- Absences # --- Absences
if context.get_preference("bul_show_abs", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_abs", formsemestre_id):
AbsEtudSem = sco_abs.getAbsSemEtud(context, sem, etudid) AbsEtudSem = sco_abs.getAbsSemEtud(context, sem, etudid)
nbabs = AbsEtudSem.CountAbs() nbabs = AbsEtudSem.CountAbs()
nbabsjust = AbsEtudSem.CountAbsJust() nbabsjust = AbsEtudSem.CountAbsJust()
@ -345,7 +345,7 @@ def make_xml_formsemestre_bulletinetud(
doc._pop() doc._pop()
# --- Decision Jury # --- Decision Jury
if ( if (
context.get_preference("bul_show_decision", formsemestre_id) sco_preferences.get_preference(context, "bul_show_decision", formsemestre_id)
or xml_with_decisions or xml_with_decisions
): ):
infos, dpv = sco_bulletins.etud_descr_situation_semestre( infos, dpv = sco_bulletins.etud_descr_situation_semestre(
@ -353,7 +353,7 @@ def make_xml_formsemestre_bulletinetud(
etudid, etudid,
formsemestre_id, formsemestre_id,
format="xml", format="xml",
show_uevalid=context.get_preference("bul_show_uevalid", formsemestre_id), show_uevalid=sco_preferences.get_preference(context, "bul_show_uevalid", formsemestre_id),
) )
doc.situation(scu.quote_xml_attr(infos["situation"])) doc.situation(scu.quote_xml_attr(infos["situation"]))
if dpv: if dpv:
@ -383,7 +383,7 @@ def make_xml_formsemestre_bulletinetud(
if decision[ if decision[
"decisions_ue" "decisions_ue"
]: # and context.get_preference('bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee) ]: # and sco_preferences.get_preference(context, 'bul_show_uevalid', formsemestre_id): always publish (car utile pour export Apogee)
for ue_id in decision["decisions_ue"].keys(): for ue_id in decision["decisions_ue"].keys():
ue = context.do_ue_list({"ue_id": ue_id})[0] ue = context.do_ue_list({"ue_id": ue_id})[0]
doc._push() doc._push()

View File

@ -124,7 +124,7 @@ def formsemestre_table_estim_cost(
), ),
rows=T, rows=T,
html_sortable=True, html_sortable=True,
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
html_class="table_leftalign table_listegroupe", html_class="table_leftalign table_listegroupe",
xls_before_table=[ xls_before_table=[
["%(titre)s %(num_sem)s %(modalitestr)s" % sem], ["%(titre)s %(num_sem)s %(modalitestr)s" % sem],
@ -193,9 +193,12 @@ def formsemestre_estim_cost(
coef_tp, coef_tp,
) )
tab.html_before_table = h tab.html_before_table = h
tab.base_url = ( tab.base_url = "%s?formsemestre_id=%s&n_group_td=%s&n_group_tp=%s&coef_tp=%s" % (
"%s?formsemestre_id=%s&n_group_td=%s&n_group_tp=%s&coef_tp=%s" REQUEST.URL0,
% (REQUEST.URL0, formsemestre_id, n_group_td, n_group_tp, coef_tp) formsemestre_id,
n_group_td,
n_group_tp,
coef_tp,
) )
return tab.make_page(context, format=format, REQUEST=REQUEST) return tab.make_page(context, format=format, REQUEST=REQUEST)

View File

@ -183,7 +183,9 @@ def table_debouche_etudids(context, etudids, keep_numeric=True):
# html_col_width='4em', # html_col_width='4em',
html_sortable=True, html_sortable=True,
html_class="table_leftalign table_listegroupe", html_class="table_leftalign table_listegroupe",
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return tab return tab

View File

@ -118,7 +118,7 @@ def index_html(context, REQUEST=None, showcodes=0, showsemtable=0):
"""<hr/> """<hr/>
<h2>Semestres de %s</h2> <h2>Semestres de %s</h2>
""" """
% context.get_preference("DeptName") % sco_preferences.get_preference(context, "DeptName")
) )
H.append(_sem_table_gt(context, sems).html()) H.append(_sem_table_gt(context, sems).html())
H.append("</table>") H.append("</table>")
@ -171,7 +171,11 @@ Chercher étape courante: <input name="etape_apo" type="text" size="8" spellchec
""" """
) )
# #
return html_sco_header.sco_header(context, REQUEST) + "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return (
html_sco_header.sco_header(context, REQUEST)
+ "\n".join(H)
+ html_sco_header.sco_footer(context, REQUEST)
)
def _sem_table(context, sems): def _sem_table(context, sems):
@ -239,7 +243,9 @@ def _sem_table_gt(context, sems, showcodes=False):
html_sortable=True, html_sortable=True,
# base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id), # base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id),
# caption='Maquettes enregistrées', # caption='Maquettes enregistrées',
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return tab return tab

View File

@ -188,7 +188,7 @@ def _send_db(context, REQUEST, ano_db_name):
scu.SCO_DUMP_UP_URL, scu.SCO_DUMP_UP_URL,
files=files, files=files,
data={ data={
"dept_name": context.get_preference("DeptName"), "dept_name": sco_preferences.get_preference(context, "DeptName"),
"serial": _get_scodoc_serial(context), "serial": _get_scodoc_serial(context),
"sco_user": str(REQUEST.AUTHENTICATED_USER), "sco_user": str(REQUEST.AUTHENTICATED_USER),
"sent_by": context.Users.user_info(str(REQUEST.AUTHENTICATED_USER))[ "sent_by": context.Users.user_info(str(REQUEST.AUTHENTICATED_USER))[

View File

@ -40,7 +40,9 @@ def matiere_create(context, ue_id=None, REQUEST=None):
"""Creation d'une matiere""" """Creation d'une matiere"""
UE = context.do_ue_list(args={"ue_id": ue_id})[0] UE = context.do_ue_list(args={"ue_id": ue_id})[0]
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Création d'une matière"), html_sco_header.sco_header(
context, REQUEST, page_title="Création d'une matière"
),
"""<h2>Création d'une matière dans l'UE %(titre)s (%(acronyme)s)</h2>""" % UE, """<h2>Création d'une matière dans l'UE %(titre)s (%(acronyme)s)</h2>""" % UE,
"""<p class="help">Les matières sont des groupes de modules dans une UE """<p class="help">Les matières sont des groupes de modules dans une UE
d'une formation donnée. Les matières servent surtout pour la d'une formation donnée. Les matières servent surtout pour la
@ -100,7 +102,9 @@ def matiere_delete(context, matiere_id=None, REQUEST=None):
M = context.do_matiere_list(args={"matiere_id": matiere_id})[0] M = context.do_matiere_list(args={"matiere_id": matiere_id})[0]
UE = context.do_ue_list(args={"ue_id": M["ue_id"]})[0] UE = context.do_ue_list(args={"ue_id": M["ue_id"]})[0]
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Suppression d'une matière"), html_sco_header.sco_header(
context, REQUEST, page_title="Suppression d'une matière"
),
"<h2>Suppression de la matière %(titre)s" % M, "<h2>Suppression de la matière %(titre)s" % M,
" dans l'UE (%(acronyme)s))</h2>" % UE, " dans l'UE (%(acronyme)s))</h2>" % UE,
] ]
@ -138,7 +142,9 @@ def matiere_edit(context, matiere_id=None, REQUEST=None):
ue_names = ["%(acronyme)s (%(titre)s)" % u for u in ues] ue_names = ["%(acronyme)s (%(titre)s)" % u for u in ues]
ue_ids = [u["ue_id"] for u in ues] ue_ids = [u["ue_id"] for u in ues]
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Modification d'une matière"), html_sco_header.sco_header(
context, REQUEST, page_title="Modification d'une matière"
),
"""<h2>Modification de la matière %(titre)s""" % F, """<h2>Modification de la matière %(titre)s""" % F,
"""(formation %(acronyme)s, version %(version)s)</h2>""" % Fo, """(formation %(acronyme)s, version %(version)s)</h2>""" % Fo,
] ]
@ -182,7 +188,9 @@ associé.
dest_url = context.NotesURL() + "/ue_list?formation_id=" + U["formation_id"] dest_url = context.NotesURL() + "/ue_list?formation_id=" + U["formation_id"]
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + help + html_sco_header.sco_footer(context, REQUEST) return (
"\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:
@ -210,3 +218,18 @@ associé.
context.do_matiere_edit(tf[2]) context.do_matiere_edit(tf[2])
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
def matiere_is_locked(context, matiere_id):
"""True if matiere should not be modified
(contains modules used in a locked formsemestre)
"""
r = ndb.SimpleDictFetch(
context,
"""SELECT ma.* from notes_matieres ma, notes_modules mod, notes_formsemestre sem, notes_moduleimpl mi
WHERE ma.matiere_id = mod.matiere_id AND mi.module_id = mod.module_id AND mi.formsemestre_id = sem.formsemestre_id
AND ma.matiere_id = %(matiere_id)s AND sem.etat = 0
""",
{"matiere_id": matiere_id},
)
return len(r) > 0

View File

@ -73,7 +73,9 @@ def ue_edit(context, ue_id=None, create=False, formation_id=None, REQUEST=None):
parcours = sco_codes_parcours.get_parcours_from_code(Fo["type_parcours"]) parcours = sco_codes_parcours.get_parcours_from_code(Fo["type_parcours"])
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title=title, javascripts=["js/edit_ue.js"]), html_sco_header.sco_header(
context, REQUEST, page_title=title, javascripts=["js/edit_ue.js"]
),
"<h2>" + title, "<h2>" + title,
" (formation %(acronyme)s, version %(version)s)</h2>" % Fo, " (formation %(acronyme)s, version %(version)s)</h2>" % Fo,
""" """
@ -323,7 +325,8 @@ def ue_list(context, formation_id=None, msg="", REQUEST=None):
"delete_small_dis_img", title="Suppression impossible (module utilisé)" "delete_small_dis_img", title="Suppression impossible (module utilisé)"
) )
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"], cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"],
javascripts=[ javascripts=[
@ -479,21 +482,25 @@ Si vous souhaitez modifier cette formation (par exemple pour y ajouter un module
for Mat in Matlist: for Mat in Matlist:
if not parcours.UE_IS_MODULE: if not parcours.UE_IS_MODULE:
H.append('<li class="notes_matiere_list">') H.append('<li class="notes_matiere_list">')
if editable and not sco_edit_matiere.matiere_is_locked(context, Mat["matiere_id"]): if editable and not sco_edit_matiere.matiere_is_locked(
context, Mat["matiere_id"]
):
H.append( H.append(
'<a class="stdlink" href="matiere_edit?matiere_id=%(matiere_id)s">' '<a class="stdlink" href="matiere_edit?matiere_id=%(matiere_id)s">'
% Mat % Mat
) )
H.append("%(titre)s" % Mat) H.append("%(titre)s" % Mat)
if editable and not sco_edit_matiere.matiere_is_locked(context, Mat["matiere_id"]): if editable and not sco_edit_matiere.matiere_is_locked(
context, Mat["matiere_id"]
):
H.append("</a>") H.append("</a>")
H.append('<ul class="notes_module_list">') H.append('<ul class="notes_module_list">')
Modlist = context.do_module_list(args={"matiere_id": Mat["matiere_id"]}) Modlist = context.do_module_list(args={"matiere_id": Mat["matiere_id"]})
im = 0 im = 0
for Mod in Modlist: for Mod in Modlist:
Mod["nb_moduleimpls"] = sco_edit_module.module_count_moduleimpls(context, Mod["nb_moduleimpls"] = sco_edit_module.module_count_moduleimpls(
Mod["module_id"] context, Mod["module_id"]
) )
klass = "notes_module_list" klass = "notes_module_list"
if Mod["module_type"] == scu.MODULE_MALUS: if Mod["module_type"] == scu.MODULE_MALUS:
@ -525,9 +532,7 @@ Si vous souhaitez modifier cette formation (par exemple pour y ajouter un module
H.append(delete_disabled_icon) H.append(delete_disabled_icon)
H.append("</span>") H.append("</span>")
mod_editable = ( mod_editable = editable # and not sco_edit_module.module_is_locked(context, Mod['module_id'])
editable # and not sco_edit_module.module_is_locked(context, Mod['module_id'])
)
if mod_editable: if mod_editable:
H.append( H.append(
'<a class="discretelink" title="Modifier le module numéro %(numero)s, utilisé par %(nb_moduleimpls)d sessions" href="module_edit?module_id=%(module_id)s">' '<a class="discretelink" title="Modifier le module numéro %(numero)s, utilisé par %(nb_moduleimpls)d sessions" href="module_edit?module_id=%(module_id)s">'
@ -812,8 +817,8 @@ def formation_table_recap(context, formation_id, format="html", REQUEST=None):
for Mat in Matlist: for Mat in Matlist:
Modlist = context.do_module_list(args={"matiere_id": Mat["matiere_id"]}) Modlist = context.do_module_list(args={"matiere_id": Mat["matiere_id"]})
for Mod in Modlist: for Mod in Modlist:
Mod["nb_moduleimpls"] = sco_edit_module.module_count_moduleimpls(context, Mod["nb_moduleimpls"] = sco_edit_module.module_count_moduleimpls(
Mod["module_id"] context, Mod["module_id"]
) )
# #
T.append( T.append(
@ -876,7 +881,9 @@ def formation_table_recap(context, formation_id, format="html", REQUEST=None):
page_title=title, page_title=title,
html_title="<h2>" + title + "</h2>", html_title="<h2>" + title + "</h2>",
pdf_title=title, pdf_title=title,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return tab.make_page(context, format=format, REQUEST=REQUEST) return tab.make_page(context, format=format, REQUEST=REQUEST)

View File

@ -52,7 +52,7 @@ def formsemestre_get_ics_url(context, sem):
Par exemple: Par exemple:
https://example.fr/agenda/{sem[etapes][0]} https://example.fr/agenda/{sem[etapes][0]}
""" """
ics_url_tmpl = context.get_preference("edt_sem_ics_url", sem["formsemestre_id"]) ics_url_tmpl = sco_preferences.get_preference(context, "edt_sem_ics_url", sem["formsemestre_id"])
if not ics_url_tmpl: if not ics_url_tmpl:
return None return None
try: try:
@ -98,7 +98,7 @@ def get_edt_transcodage_groups(context, formsemestre_id):
edt2sco = {} edt2sco = {}
sco2edt = {} sco2edt = {}
msg = "" # message erreur, '' si ok msg = "" # message erreur, '' si ok
txt = context.get_preference("edt_groups2scodoc", formsemestre_id) txt = sco_preferences.get_preference(context, "edt_groups2scodoc", formsemestre_id)
if not txt: if not txt:
return edt2sco, sco2edt, msg return edt2sco, sco2edt, msg

View File

@ -76,7 +76,9 @@ def apo_semset_maq_status(
block_export_res_modules = int(block_export_res_modules) block_export_res_modules = int(block_export_res_modules)
block_export_res_sdj = int(block_export_res_sdj) block_export_res_sdj = int(block_export_res_sdj)
prefs = context.get_preferences() prefs = sco_preferences.SemPreferences(
context,
)
tab_archives = table_apo_csv_list(context, semset, REQUEST=REQUEST) tab_archives = table_apo_csv_list(context, semset, REQUEST=REQUEST)
@ -98,7 +100,8 @@ def apo_semset_maq_status(
ok_for_export &= semset["jury_ok"] ok_for_export &= semset["jury_ok"]
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Export Apogée", page_title="Export Apogée",
javascripts=["js/apo_semset_maq_status.js"], javascripts=["js/apo_semset_maq_status.js"],
@ -474,7 +477,9 @@ def table_apo_csv_list(context, semset, REQUEST=None):
html_sortable=True, html_sortable=True,
# base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id), # base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id),
# caption='Maquettes enregistrées', # caption='Maquettes enregistrées',
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return tab return tab
@ -559,8 +564,12 @@ def _view_etuds_page(
etuds.sort(key=lambda x: (x["nom"], x["prenom"])) etuds.sort(key=lambda x: (x["nom"], x["prenom"]))
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, page_title=title, init_qtip=True, javascripts=["js/etud_info.js"] context,
REQUEST,
page_title=title,
init_qtip=True,
javascripts=["js/etud_info.js"],
), ),
"<h2>%s</h2>" % title, "<h2>%s</h2>" % title,
] ]
@ -579,7 +588,9 @@ def _view_etuds_page(
html_sortable=True, html_sortable=True,
html_class="table_leftalign", html_class="table_leftalign",
filename="students_apo", filename="students_apo",
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
if format != "html": if format != "html":
return tab.make_page(context, format=format, REQUEST=REQUEST) return tab.make_page(context, format=format, REQUEST=REQUEST)
@ -704,7 +715,8 @@ def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=Non
) = sco_etape_apogee.apo_csv_semset_check(context, semset) ) = sco_etape_apogee.apo_csv_semset_check(context, semset)
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Maquette Apogée enregistrée pour %s" % etape_apo, page_title="Maquette Apogée enregistrée pour %s" % etape_apo,
init_qtip=True, init_qtip=True,
@ -728,7 +740,11 @@ 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 "\n".join(H) + "<p>Aucun étudiant</p>" + html_sco_header.sco_footer(context, REQUEST) return (
"\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:
@ -758,7 +774,9 @@ def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=Non
base_url="%s?etape_apo=%s&semset_id=%s" % (REQUEST.URL0, etape_apo, semset_id), base_url="%s?etape_apo=%s&semset_id=%s" % (REQUEST.URL0, etape_apo, semset_id),
filename="students_" + etape_apo, filename="students_" + etape_apo,
caption="Etudiants Apogée en " + etape_apo, caption="Etudiants Apogée en " + etape_apo,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
if format != "html": if format != "html":
@ -794,7 +812,9 @@ def apo_csv_export_results(
# nota: on peut éventuellement exporter même si tout n'est pas ok # nota: on peut éventuellement exporter même si tout n'est pas ok
# mais le lien via le tableau de bord n'est pas actif # mais le lien via le tableau de bord n'est pas actif
# Les fichiers résultats ne sont pas stockés: pas besoin de permission particulière # Les fichiers résultats ne sont pas stockés: pas besoin de permission particulière
prefs = context.get_preferences() prefs = sco_preferences.SemPreferences(
context,
)
export_res_etape = prefs["export_res_etape"] and not int(block_export_res_etape) export_res_etape = prefs["export_res_etape"] and not int(block_export_res_etape)
export_res_sem = prefs["export_res_sem"] and not int(block_export_res_sem) export_res_sem = prefs["export_res_sem"] and not int(block_export_res_sem)
export_res_ues = prefs["export_res_ues"] and not int(block_export_res_ues) export_res_ues = prefs["export_res_ues"] and not int(block_export_res_ues)
@ -835,7 +855,7 @@ def apo_csv_export_results(
) )
basename = ( basename = (
context.get_preference("DeptName") sco_preferences.get_preference(context, "DeptName")
+ str(annee_scolaire) + str(annee_scolaire)
+ "-%s-" % periode + "-%s-" % periode
+ "-".join(etapes_apo) + "-".join(etapes_apo)

View File

@ -494,8 +494,12 @@ def formsemestre_evaluations_cal(context, formsemestre_id, REQUEST=None):
) )
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
REQUEST, "Evaluations du semestre", sem, cssstyles=["css/calabs.css"] context,
REQUEST,
"Evaluations du semestre",
sem,
cssstyles=["css/calabs.css"],
), ),
'<div class="cal_evaluations">', '<div class="cal_evaluations">',
CalHTML, CalHTML,
@ -622,7 +626,7 @@ def formsemestre_evaluations_delai_correction(
html_sortable=True, html_sortable=True,
html_title="<h2>Correction des évaluations du semestre</h2>", html_title="<h2>Correction des évaluations du semestre</h2>",
caption="Correction des évaluations du semestre", caption="Correction des évaluations du semestre",
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id), base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id),
origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "", origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "",
filename=scu.make_filename("evaluations_delais_" + sem["titreannee"]), filename=scu.make_filename("evaluations_delais_" + sem["titreannee"]),
@ -1055,7 +1059,14 @@ 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 head + "\n".join(H) + "\n" + tf[1] + help + html_sco_header.sco_footer(context, REQUEST) return (
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:

View File

@ -571,7 +571,7 @@ def Excel_feuille_listeappel(
( (
"%s %s (%s - %s)" "%s %s (%s - %s)"
% ( % (
context.get_preference("DeptName", formsemestre_id), sco_preferences.get_preference(context, "DeptName", formsemestre_id),
notesdb.unquote(sem["titre_num"]), notesdb.unquote(sem["titre_num"]),
sem["date_debut"], sem["date_debut"],
sem["date_fin"], sem["date_fin"],

View File

@ -104,7 +104,9 @@ def _build_results_table(context, start_date=None, end_date=None, types_parcours
origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "", origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "",
html_class="table_leftalign", html_class="table_leftalign",
html_sortable=True, html_sortable=True,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return tab, semlist return tab, semlist
@ -279,7 +281,8 @@ def scodoc_table_results(
info_sems.append("</ul>") info_sems.append("</ul>")
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Export résultats", page_title="Export résultats",
init_qtip=True, init_qtip=True,

View File

@ -88,7 +88,9 @@ def form_search_etud(
if add_headers: if add_headers:
return ( return (
html_sco_header.sco_header(context, REQUEST, page_title="Choix d'un étudiant") html_sco_header.sco_header(
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(context, REQUEST)
) )
@ -122,7 +124,8 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
return context.ficheEtud(etudid=etuds[0]["etudid"], REQUEST=REQUEST) return context.ficheEtud(etudid=etuds[0]["etudid"], REQUEST=REQUEST)
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
page_title="Recherche d'un étudiant", page_title="Recherche d'un étudiant",
no_side_bar=True, no_side_bar=True,
init_qtip=True, init_qtip=True,
@ -158,7 +161,9 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
rows=etuds, rows=etuds,
html_sortable=True, html_sortable=True,
html_class="table_leftalign", html_class="table_leftalign",
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
H.append(tab.html()) H.append(tab.html())
if len(etuds) > 20: # si la page est grande if len(etuds) > 20: # si la page est grande
@ -336,7 +341,9 @@ def table_etud_in_accessible_depts(context, expnom=None, REQUEST=None):
H.append("</div>") H.append("</div>")
return ( return (
html_sco_header.scodoc_top_html_header(context, REQUEST, page_title="Choix d'un étudiant") html_sco_header.scodoc_top_html_header(
context, REQUEST, 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

@ -333,5 +333,7 @@ def formation_list_table(context, formation_id=None, args={}, REQUEST=None):
base_url="%s?formation_id=%s" % (REQUEST.URL0, formation_id), base_url="%s?formation_id=%s" % (REQUEST.URL0, formation_id),
page_title=title, page_title=title,
pdf_title=title, pdf_title=title,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )

View File

@ -543,9 +543,13 @@ def table_formsemestres(
"etapes_apo_str": "Apo.", "etapes_apo_str": "Apo.",
} }
if sems: if sems:
preferences = context.get_preferences(sems[0]["formsemestre_id"]) preferences = sco_preferences.SemPreferences(
context, sems[0]["formsemestre_id"]
)
else: else:
preferences = context.get_preferences() preferences = sco_preferences.SemPreferences(
context,
)
tab = GenTable( tab = GenTable(
columns_ids=columns_ids, columns_ids=columns_ids,
rows=sems, rows=sems,

View File

@ -75,7 +75,8 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
# portage from dtml # portage from dtml
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Modification du semestre", "Modification du semestre",
sem, sem,
@ -383,7 +384,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
"size": 32, "size": 32,
"title": "Element(s) Apogée:", "title": "Element(s) Apogée:",
"explanation": "du semestre (ex: VRTW1). Séparés par des virgules.", "explanation": "du semestre (ex: VRTW1). Séparés par des virgules.",
"allow_null": not context.get_preference( "allow_null": not sco_preferences.get_preference(context,
"always_require_apo_sem_codes" "always_require_apo_sem_codes"
), ),
}, },
@ -396,7 +397,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
"size": 32, "size": 32,
"title": "Element(s) Apogée:", "title": "Element(s) Apogée:",
"explanation": "de l'année (ex: VRT1A). Séparés par des virgules.", "explanation": "de l'année (ex: VRT1A). Séparés par des virgules.",
"allow_null": not context.get_preference( "allow_null": not sco_preferences.get_preference(context,
"always_require_apo_sem_codes" "always_require_apo_sem_codes"
), ),
}, },
@ -642,7 +643,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
# check dates # check dates
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 context.get_preference("always_require_apo_sem_codes") and not any( if sco_preferences.get_preference(context, "always_require_apo_sem_codes") and not any(
[tf[2]["etape_apo" + str(n)] for n in range(0, scu.EDIT_NB_ETAPES + 1)] [tf[2]["etape_apo" + str(n)] for n in range(0, scu.EDIT_NB_ETAPES + 1)]
): ):
msg = '<ul class="tf-msg"><li class="tf-msg">Code étape Apogée manquant</li></ul>' msg = '<ul class="tf-msg"><li class="tf-msg">Code étape Apogée manquant</li></ul>'
@ -867,7 +868,8 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None):
} }
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Copie du semestre", "Copie du semestre",
sem, sem,
@ -1035,7 +1037,7 @@ def do_formsemestre_clone(
# NB: don't copy notes_formsemestre_custommenu (usually specific) # NB: don't copy notes_formsemestre_custommenu (usually specific)
# 4- Copy new style preferences # 4- Copy new style preferences
prefs = context.get_preferences(orig_formsemestre_id) prefs = sco_preferences.SemPreferences(context, orig_formsemestre_id)
if orig_formsemestre_id in prefs.base_prefs.prefs: if orig_formsemestre_id in prefs.base_prefs.prefs:
for pname in prefs.base_prefs.prefs[orig_formsemestre_id]: for pname in prefs.base_prefs.prefs[orig_formsemestre_id]:
@ -1223,7 +1225,9 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None):
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0] F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
H = [ H = [
html_sco_header.html_sem_header(context, REQUEST, "Suppression du semestre", sem), html_sco_header.html_sem_header(
context, REQUEST, "Suppression du semestre", sem
),
"""<div class="ue_warning"><span>Attention !</span> """<div class="ue_warning"><span>Attention !</span>
<p class="help">A n'utiliser qu'en cas d'erreur lors de la saisie d'une formation. Normalement, <p class="help">A n'utiliser qu'en cas d'erreur lors de la saisie d'une formation. Normalement,
<b>un semestre ne doit jamais être supprimé</b> (on perd la mémoire des notes et de tous les événements liés à ce semestre !).</p> <b>un semestre ne doit jamais être supprimé</b> (on perd la mémoire des notes et de tous les événements liés à ce semestre !).</p>
@ -1404,7 +1408,7 @@ def formsemestre_edit_options(context, formsemestre_id, target_url=None, REQUEST
ok, err = context._check_access_diretud(formsemestre_id, REQUEST) ok, err = context._check_access_diretud(formsemestre_id, REQUEST)
if not ok: if not ok:
return err return err
return context.get_preferences(formsemestre_id).edit( return sco_preferences.SemPreferences(context, formsemestre_id).edit(
REQUEST=REQUEST, categories=["bul"] REQUEST=REQUEST, categories=["bul"]
) )
@ -1523,7 +1527,12 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
<p class="warning">Les coefficients indiqués ici ne s'appliquent que pour le traitement des UE capitalisées. <p class="warning">Les coefficients indiqués ici ne s'appliquent que pour le traitement des UE capitalisées.
</p> </p>
""" """
H = [html_sco_header.html_sem_header(context, REQUEST, "Coefficients des UE du semestre", sem), help] H = [
html_sco_header.html_sem_header(
context, REQUEST, "Coefficients des UE du semestre", sem
),
help,
]
# #
ues, modimpls = notes_table.get_sem_ues_modimpls(context, formsemestre_id) ues, modimpls = notes_table.get_sem_ues_modimpls(context, formsemestre_id)
for ue in ues: for ue in ues:
@ -1633,8 +1642,8 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
formsemestre_id=formsemestre_id formsemestre_id=formsemestre_id
) # > modif coef UE cap (modifs notes de _certains_ etudiants) ) # > modif coef UE cap (modifs notes de _certains_ etudiants)
header = html_sco_header.html_sem_header(context, header = html_sco_header.html_sem_header(
REQUEST, "Coefficients des UE du semestre", sem context, REQUEST, "Coefficients des UE du semestre", sem
) )
return ( return (
header header
@ -1664,9 +1673,9 @@ def get_formsemestre_session_id(context, sem, F, parcours):
# F = context.formation_list( args={ 'formation_id' : sem['formation_id'] } )[0] # F = context.formation_list( args={ 'formation_id' : sem['formation_id'] } )[0]
# parcours = sco_codes_parcours.get_parcours_from_code(F['type_parcours']) # parcours = sco_codes_parcours.get_parcours_from_code(F['type_parcours'])
ImputationDept = context.get_preference("ImputationDept", sem["formsemestre_id"]) ImputationDept = sco_preferences.get_preference(context, "ImputationDept", sem["formsemestre_id"])
if not ImputationDept: if not ImputationDept:
ImputationDept = context.get_preference("DeptName") ImputationDept = sco_preferences.get_preference(context, "DeptName")
ImputationDept = ImputationDept.upper() ImputationDept = ImputationDept.upper()
parcours_type = parcours.NAME parcours_type = parcours.NAME
modalite = sem["modalite"] modalite = sem["modalite"]

View File

@ -261,7 +261,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
"title": "Synchroniser avec étape Apogée", "title": "Synchroniser avec étape Apogée",
"url": "formsemestre_synchro_etuds?formsemestre_id=" + formsemestre_id, "url": "formsemestre_synchro_etuds?formsemestre_id=" + formsemestre_id,
"enabled": authuser.has_permission(Permission.ScoView, context) "enabled": authuser.has_permission(Permission.ScoView, context)
and context.get_preference("portal_url") and sco_preferences.get_preference(context, "portal_url")
and (sem["etat"] == "1"), and (sem["etat"] == "1"),
}, },
{ {
@ -288,7 +288,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
"url": "formsemestre_import_etud_admission?formsemestre_id=" "url": "formsemestre_import_etud_admission?formsemestre_id="
+ formsemestre_id, + formsemestre_id,
"enabled": authuser.has_permission(Permission.ScoEtudChangeAdr, context) "enabled": authuser.has_permission(Permission.ScoEtudChangeAdr, context)
and context.get_preference("portal_url"), and sco_preferences.get_preference(context, "portal_url"),
}, },
{ {
"title": "Exporter table des étudiants", "title": "Exporter table des étudiants",
@ -518,7 +518,7 @@ def fill_formsemestre(context, sem, REQUEST=None):
) )
else: else:
sem["locklink"] = "" sem["locklink"] = ""
if context.get_preference("bul_display_publication", formsemestre_id): if sco_preferences.get_preference(context, "bul_display_publication", formsemestre_id):
if sem["bul_hide_xml"] != "0": if sem["bul_hide_xml"] != "0":
eyeicon = scu.icontag("hide_img", border="0", title="Bulletins NON publiés") eyeicon = scu.icontag("hide_img", border="0", title="Bulletins NON publiés")
else: else:
@ -568,7 +568,7 @@ def formsemestre_description_table(
nt = context._getNotesCache().get_NotesTable( nt = context._getNotesCache().get_NotesTable(
context, formsemestre_id context, formsemestre_id
) # > liste evaluations ) # > liste evaluations
use_ue_coefs = context.get_preference("use_ue_coefs", formsemestre_id) use_ue_coefs = sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id)
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0] F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"]) parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"])
Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list( Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list(
@ -654,7 +654,7 @@ def formsemestre_description_table(
sums = {"_css_row_class": "moyenne sortbottom", "ects": sum_ects, "Coef.": sum_coef} sums = {"_css_row_class": "moyenne sortbottom", "ects": sum_ects, "Coef.": sum_coef}
R.append(sums) R.append(sums)
columns_ids = ["UE", "Code", "Module", "Coef."] columns_ids = ["UE", "Code", "Module", "Coef."]
if context.get_preference("bul_show_ects", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_ects", formsemestre_id):
columns_ids += ["ects"] columns_ids += ["ects"]
columns_ids += ["Inscrits", "Responsable", "Enseignants"] columns_ids += ["Inscrits", "Responsable", "Enseignants"]
if with_evals: if with_evals:
@ -687,11 +687,11 @@ def formsemestre_description_table(
base_url="%s?formsemestre_id=%s&with_evals=%s" base_url="%s?formsemestre_id=%s&with_evals=%s"
% (REQUEST.URL0, formsemestre_id, with_evals), % (REQUEST.URL0, formsemestre_id, with_evals),
page_title=title, page_title=title,
html_title=html_sco_header.html_sem_header(context, html_title=html_sco_header.html_sem_header(
REQUEST, "Description du semestre", sem, with_page_header=False context, REQUEST, "Description du semestre", sem, with_page_header=False
), ),
pdf_title=title, pdf_title=title,
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
@ -882,8 +882,8 @@ def formsemestre_status_head(
page_title = page_title or "Modules de " page_title = page_title or "Modules de "
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
REQUEST, page_title, sem, with_page_header=False, with_h2=False context, REQUEST, page_title, sem, with_page_header=False, with_h2=False
), ),
"""<table> """<table>
<tr><td class="fichetitre2">Formation: </td><td> <tr><td class="fichetitre2">Formation: </td><td>
@ -927,7 +927,7 @@ Il y a des notes en attente ! Le classement des étudiants n'a qu'une valeur ind
H.append( H.append(
'<p class="fontorange"><em>Attention: ce semestre couvre plusieurs années scolaires !</em></p>' '<p class="fontorange"><em>Attention: ce semestre couvre plusieurs années scolaires !</em></p>'
) )
# elif context.get_preference('bul_display_publication', formsemestre_id): # elif sco_preferences.get_preference(context, 'bul_display_publication', formsemestre_id):
# H.append('<p><em>Bulletins publiés sur le portail</em></p>') # H.append('<p><em>Bulletins publiés sur le portail</em></p>')
return "".join(H) return "".join(H)
@ -1007,7 +1007,7 @@ def formsemestre_status(context, formsemestre_id=None, REQUEST=None):
prev_ue_id = ue["ue_id"] prev_ue_id = ue["ue_id"]
acronyme = ue["acronyme"] acronyme = ue["acronyme"]
titre = ue["titre"] titre = ue["titre"]
if context.get_preference("use_ue_coefs", formsemestre_id): if sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id):
titre += " <b>(coef. %s)</b>" % (ue["coefficient"] or 0.0) titre += " <b>(coef. %s)</b>" % (ue["coefficient"] or 0.0)
H.append( H.append(
"""<tr class="formsemestre_status_ue"><td colspan="4"> """<tr class="formsemestre_status_ue"><td colspan="4">
@ -1118,7 +1118,7 @@ def formsemestre_status(context, formsemestre_id=None, REQUEST=None):
H.append("</td></tr>") H.append("</td></tr>")
H.append("</table></p>") H.append("</table></p>")
if context.get_preference("use_ue_coefs", formsemestre_id): if sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id):
H.append( H.append(
""" """
<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>

View File

@ -656,7 +656,7 @@ def formsemestre_recap_parcours_table(
H.append("</tr>") H.append("</tr>")
# 3eme ligne: ECTS # 3eme ligne: ECTS
if ( if (
context.get_preference("bul_show_ects", sem["formsemestre_id"]) sco_preferences.get_preference(context, "bul_show_ects", sem["formsemestre_id"])
or nt.parcours.ECTS_ONLY or nt.parcours.ECTS_ONLY
): ):
etud_moy_infos = nt.get_etud_moy_infos(etudid) etud_moy_infos = nt.get_etud_moy_infos(etudid)

View File

@ -102,8 +102,12 @@ def groups_view(
) )
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
REQUEST, javascripts=JAVASCRIPTS, cssstyles=CSSSTYLES, init_qtip=True context,
REQUEST,
javascripts=JAVASCRIPTS,
cssstyles=CSSSTYLES,
init_qtip=True,
) )
] ]
# Menu choix groupe # Menu choix groupe
@ -578,7 +582,7 @@ def groups_table(
else: else:
filename = "etudiants_%s" % groups_infos.groups_filename filename = "etudiants_%s" % groups_infos.groups_filename
prefs = context.get_preferences(groups_infos.formsemestre_id) prefs = sco_preferences.SemPreferences(context, groups_infos.formsemestre_id)
tab = GenTable( tab = GenTable(
rows=groups_infos.members, rows=groups_infos.members,
columns_ids=columns_ids, columns_ids=columns_ids,
@ -979,7 +983,7 @@ def export_groups_as_moodle_csv(context, formsemestre_id=None, REQUEST=None):
elts.append(group_name) elts.append(group_name)
T.append({"email": etud["email"], "semestre_groupe": "-".join(elts)}) T.append({"email": etud["email"], "semestre_groupe": "-".join(elts)})
# Make table # Make table
prefs = context.get_preferences(formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id)
tab = GenTable( tab = GenTable(
rows=T, rows=T,
columns_ids=("email", "semestre_groupe"), columns_ids=("email", "semestre_groupe"),

View File

@ -227,7 +227,7 @@ Pour plus d'informations sur ce logiciel, voir %s
msg["Subject"] = Header("Mot de passe ScoDoc", scu.SCO_ENCODING) msg["Subject"] = Header("Mot de passe ScoDoc", scu.SCO_ENCODING)
else: else:
msg["Subject"] = Header("Votre accès ScoDoc", scu.SCO_ENCODING) msg["Subject"] = Header("Votre accès ScoDoc", scu.SCO_ENCODING)
msg["From"] = context.get_preference("email_from_addr") msg["From"] = sco_preferences.get_preference(context, "email_from_addr")
msg["To"] = u["email"] msg["To"] = u["email"]
msg.epilogue = "" msg.epilogue = ""
txt = MIMEText(txt, "plain", scu.SCO_ENCODING) txt = MIMEText(txt, "plain", scu.SCO_ENCODING)

View File

@ -278,7 +278,9 @@ def formsemestre_inscr_passage(
# -- check lock # -- check lock
if sem["etat"] != "1": if sem["etat"] != "1":
raise ScoValueError("opération impossible: semestre verrouille") raise ScoValueError("opération impossible: semestre verrouille")
header = html_sco_header.sco_header(context, REQUEST, page_title="Passage des étudiants") header = html_sco_header.sco_header(
context, REQUEST, page_title="Passage des étudiants"
)
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer(context, REQUEST)
H = [header] H = [header]
if type(etuds) == type(""): if type(etuds) == type(""):
@ -412,8 +414,8 @@ def build_page(
inscrit_groupes_checked = "" inscrit_groupes_checked = ""
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
REQUEST, "Passages dans le semestre", sem, with_page_header=False context, REQUEST, "Passages dans le semestre", sem, with_page_header=False
), ),
"""<form method="post" action="%s">""" % REQUEST.URL0, """<form method="post" action="%s">""" % REQUEST.URL0,
"""<input type="hidden" name="formsemestre_id" value="%(formsemestre_id)s"/> """<input type="hidden" name="formsemestre_id" value="%(formsemestre_id)s"/>
@ -628,6 +630,8 @@ def etuds_select_box_xls(context, src_cat):
columns_ids=columns_ids, columns_ids=columns_ids,
rows=etuds, rows=etuds,
caption="%(title)s. %(help)s" % src_cat["infos"], caption="%(title)s. %(help)s" % src_cat["infos"],
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return tab.excel() return tab.excel()

View File

@ -301,9 +301,9 @@ def _make_table_notes(
grc = inscr["etat"] grc = inscr["etat"]
code = "" # code pour listings anonyme, à la place du nom code = "" # code pour listings anonyme, à la place du nom
if context.get_preference("anonymous_lst_code") == "INE": if sco_preferences.get_preference(context, "anonymous_lst_code") == "INE":
code = etud["code_ine"] code = etud["code_ine"]
elif context.get_preference("anonymous_lst_code") == "NIP": elif sco_preferences.get_preference(context, "anonymous_lst_code") == "NIP":
code = etud["code_nip"] code = etud["code_nip"]
if not code: # laisser le code vide n'aurait aucun sens, prenons l'etudid if not code: # laisser le code vide n'aurait aucun sens, prenons l'etudid
code = etudid code = etudid
@ -472,7 +472,7 @@ def _make_table_notes(
html_title=html_title, html_title=html_title,
pdf_title=pdf_title, pdf_title=pdf_title,
html_class="table_leftalign notes_evaluation", html_class="table_leftalign notes_evaluation",
preferences=context.get_preferences(M["formsemestre_id"]), preferences=sco_preferences.SemPreferences(context, M["formsemestre_id"]),
# html_generate_cells=False # la derniere ligne (moyennes) est incomplete # html_generate_cells=False # la derniere ligne (moyennes) est incomplete
) )
@ -775,7 +775,9 @@ def evaluation_check_absences_html(
if with_header: if with_header:
H = [ H = [
html_sco_header.html_sem_header(context, REQUEST, "Vérification absences à l'évaluation"), html_sco_header.html_sem_header(
context, REQUEST, "Vérification absences à l'évaluation"
),
sco_evaluations.evaluation_describe( sco_evaluations.evaluation_describe(
context, evaluation_id=evaluation_id, REQUEST=REQUEST context, evaluation_id=evaluation_id, REQUEST=REQUEST
), ),
@ -859,8 +861,11 @@ def formsemestre_check_absences_html(context, formsemestre_id, REQUEST=None):
"""Affiche etat verification absences pour toutes les evaluations du semestre !""" """Affiche etat verification absences pour toutes les evaluations du semestre !"""
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
REQUEST, "Vérification absences aux évaluations de ce semestre", sem context,
REQUEST,
"Vérification absences aux évaluations de ce semestre",
sem,
), ),
"""<p class="help">Vérification de la cohérence entre les notes saisies et les absences signalées. """<p class="help">Vérification de la cohérence entre les notes saisies et les absences signalées.
Sont listés tous les modules avec des évaluations.<br/>Aucune action n'est effectuée: Sont listés tous les modules avec des évaluations.<br/>Aucune action n'est effectuée:

View File

@ -54,7 +54,11 @@ def formsemestre_table_etuds_lycees(
primostr = "du " primostr = "du "
title = "Lycées des étudiants %ssemestre " % primostr + sem["titreannee"] title = "Lycées des étudiants %ssemestre " % primostr + sem["titreannee"]
return _table_etuds_lycees( return _table_etuds_lycees(
context, etuds, group_lycees, title, context.get_preferences(formsemestre_id) context,
etuds,
group_lycees,
title,
sco_preferences.SemPreferences(context, formsemestre_id),
) )
@ -70,7 +74,9 @@ def scodoc_table_etuds_lycees(context, format="html", REQUEST=None):
etuds, etuds,
False, False,
"Lycées de TOUS les étudiants", "Lycées de TOUS les étudiants",
context.get_preferences(), sco_preferences.SemPreferences(
context,
),
no_links=True, no_links=True,
) )
tab.base_url = REQUEST.URL0 tab.base_url = REQUEST.URL0
@ -78,7 +84,8 @@ def scodoc_table_etuds_lycees(context, format="html", REQUEST=None):
if format != "html": if format != "html":
return t return t
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title=tab.page_title, page_title=tab.page_title,
init_google_maps=True, init_google_maps=True,
@ -194,7 +201,8 @@ def formsemestre_etuds_lycees(
) )
] ]
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title=tab.page_title, page_title=tab.page_title,
init_google_maps=True, init_google_maps=True,

View File

@ -254,7 +254,7 @@ def _send_news_by_mail(context, n):
"""Notify by email""" """Notify by email"""
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 = context.get_preferences(formsemestre_id=formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id=formsemestre_id)
destinations = prefs["emails_notifications"] or "" destinations = prefs["emails_notifications"] or ""
destinations = [x.strip() for x in destinations.split(",")] destinations = [x.strip() for x in destinations.split(",")]
destinations = [x for x in destinations if x] destinations = [x for x in destinations if x]

View File

@ -344,7 +344,7 @@ def copy_portal_photo_to_fs(context, etud, REQUEST=None):
url = photo_portal_url(context, etud) url = photo_portal_url(context, etud)
if not url: if not url:
return None, "%(nomprenom)s: pas de code NIP" % etud return None, "%(nomprenom)s: pas de code NIP" % etud
portal_timeout = context.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
f = None f = None
try: try:
log("copy_portal_photo_to_fs: getting %s" % url) log("copy_portal_photo_to_fs: getting %s" % url)

View File

@ -309,7 +309,7 @@ def do_placement(context, REQUEST):
listetud.append((nom, prenom)) listetud.append((nom, prenom))
random.shuffle(listetud) random.shuffle(listetud)
sem_preferences = context.get_preferences() sem_preferences = sco_preferences.SemPreferences(context)
space = sem_preferences.get("feuille_placement_emargement") space = sem_preferences.get("feuille_placement_emargement")
maxlines = sem_preferences.get("feuille_placement_positions") maxlines = sem_preferences.get("feuille_placement_positions")
@ -386,7 +386,7 @@ def do_placement(context, REQUEST):
+ "", + "",
pdf_title=pdf_title, pdf_title=pdf_title,
# pdf_shorttitle = '', # pdf_shorttitle = '',
preferences=context.get_preferences(M["formsemestre_id"]), preferences=sco_preferences.SemPreferences(context, M["formsemestre_id"]),
# html_generate_cells=False # la derniere ligne (moyennes) est incomplete # html_generate_cells=False # la derniere ligne (moyennes) est incomplete
) )
t = tab.make_page( t = tab.make_page(

View File

@ -55,7 +55,7 @@ class PortalInterface:
def get_portal_url(self, context): def get_portal_url(self, context):
"URL of portal" "URL of portal"
portal_url = context.get_preference("portal_url") portal_url = sco_preferences.get_preference(context, "portal_url")
if not self.warning: if not self.warning:
if portal_url: if portal_url:
log("Portal URL=%s" % portal_url) log("Portal URL=%s" % portal_url)
@ -66,7 +66,7 @@ class PortalInterface:
def get_etapes_url(self, context): def get_etapes_url(self, context):
"Full URL of service giving list of etapes (in XML)" "Full URL of service giving list of etapes (in XML)"
etapes_url = context.get_preference("etapes_url") etapes_url = sco_preferences.get_preference(context, "etapes_url")
if not etapes_url: if not etapes_url:
# Default: # Default:
portal_url = self.get_portal_url(context) portal_url = self.get_portal_url(context)
@ -81,7 +81,7 @@ class PortalInterface:
def get_etud_url(self, context): def get_etud_url(self, context):
"Full URL of service giving list of students (in XML)" "Full URL of service giving list of students (in XML)"
etud_url = context.get_preference("etud_url") etud_url = sco_preferences.get_preference(context, "etud_url")
if not etud_url: if not etud_url:
# Default: # Default:
portal_url = self.get_portal_url(context) portal_url = self.get_portal_url(context)
@ -96,7 +96,7 @@ class PortalInterface:
def get_photo_url(self, context): def get_photo_url(self, context):
"Full URL of service giving photo of student" "Full URL of service giving photo of student"
photo_url = context.get_preference("photo_url") photo_url = sco_preferences.get_preference(context, "photo_url")
if not photo_url: if not photo_url:
# Default: # Default:
portal_url = self.get_portal_url(context) portal_url = self.get_portal_url(context)
@ -111,7 +111,7 @@ class PortalInterface:
def get_maquette_url(self, context): def get_maquette_url(self, context):
"""Full URL of service giving Apogee maquette pour une étape (fichier "CSV")""" """Full URL of service giving Apogee maquette pour une étape (fichier "CSV")"""
maquette_url = context.get_preference("maquette_url") maquette_url = sco_preferences.get_preference(context, "maquette_url")
if not maquette_url: if not maquette_url:
# Default: # Default:
portal_url = self.get_portal_url(context) portal_url = self.get_portal_url(context)
@ -122,7 +122,7 @@ class PortalInterface:
def get_portal_api_version(self, context): def get_portal_api_version(self, context):
"API version of the portal software" "API version of the portal software"
api_ver = context.get_preference("portal_api") api_ver = sco_preferences.get_preference(context, "portal_api")
if not api_ver: if not api_ver:
# Default: # Default:
api_ver = 1 api_ver = 1
@ -151,7 +151,7 @@ def get_inscrits_etape(context, code_etape, anneeapogee=None, ntrials=2):
api_ver = get_portal_api_version(context) api_ver = get_portal_api_version(context)
if not etud_url: if not etud_url:
return [] return []
portal_timeout = context.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
if api_ver > 1: if api_ver > 1:
req = ( req = (
etud_url etud_url
@ -203,7 +203,7 @@ def query_apogee_portal(context, **args):
# Ne fonctionne pas avec l'API 2 sur nom et prenom # Ne fonctionne pas avec l'API 2 sur nom et prenom
# XXX TODO : va poser problème pour la page modif données étudiants : A VOIR # XXX TODO : va poser problème pour la page modif données étudiants : A VOIR
return [] return []
portal_timeout = context.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
req = etud_url + "?" + urllib.urlencode(args.items()) req = etud_url + "?" + urllib.urlencode(args.items())
doc = scu.query_portal(req, timeout=portal_timeout) # sco_utils doc = scu.query_portal(req, timeout=portal_timeout) # sco_utils
return xml_to_list_of_dicts(doc, req=req) return xml_to_list_of_dicts(doc, req=req)
@ -323,7 +323,7 @@ def get_etud_apogee(context, code_nip):
etud_url = get_etud_url(context) etud_url = get_etud_url(context)
if not etud_url: if not etud_url:
return {} return {}
portal_timeout = context.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
req = etud_url + "?" + urllib.urlencode((("nip", code_nip),)) req = etud_url + "?" + urllib.urlencode((("nip", code_nip),))
doc = scu.query_portal(req, timeout=portal_timeout) doc = scu.query_portal(req, timeout=portal_timeout)
d = _normalize_apo_fields(xml_to_list_of_dicts(doc, req=req)) d = _normalize_apo_fields(xml_to_list_of_dicts(doc, req=req))
@ -356,7 +356,7 @@ def _parse_etapes_from_xml(context, doc):
""" """
may raise exception if invalid xml doc may raise exception if invalid xml doc
""" """
xml_etapes_by_dept = context.get_preference("xml_etapes_by_dept") xml_etapes_by_dept = sco_preferences.get_preference(context, "xml_etapes_by_dept")
# parser XML # parser XML
dom = xml.dom.minidom.parseString(doc) dom = xml.dom.minidom.parseString(doc)
infos = {} infos = {}
@ -384,7 +384,7 @@ def get_etapes_apogee(context):
etapes_url = get_etapes_url(context) etapes_url = get_etapes_url(context)
infos = {} infos = {}
if etapes_url: if etapes_url:
portal_timeout = context.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
log( log(
"get_etapes_apogee: requesting '%s' with timeout=%s" "get_etapes_apogee: requesting '%s' with timeout=%s"
% (etapes_url, portal_timeout) % (etapes_url, portal_timeout)
@ -432,9 +432,9 @@ def get_etapes_apogee_dept(context):
Returns [ ( code, intitule) ], ordonnée Returns [ ( code, intitule) ], ordonnée
""" """
xml_etapes_by_dept = context.get_preference("xml_etapes_by_dept") xml_etapes_by_dept = sco_preferences.get_preference(context, "xml_etapes_by_dept")
if xml_etapes_by_dept: if xml_etapes_by_dept:
portal_dept_name = context.get_preference("portal_dept_name") portal_dept_name = sco_preferences.get_preference(context, "portal_dept_name")
log('get_etapes_apogee_dept: portal_dept_name="%s"' % portal_dept_name) log('get_etapes_apogee_dept: portal_dept_name="%s"' % portal_dept_name)
else: else:
portal_dept_name = "" portal_dept_name = ""
@ -558,7 +558,7 @@ def get_maquette_apogee(context, etape="", annee_scolaire=""):
maquette_url = get_maquette_url(context) maquette_url = get_maquette_url(context)
if not maquette_url: if not maquette_url:
return None return None
portal_timeout = context.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
req = ( req = (
maquette_url maquette_url
+ "?" + "?"

View File

@ -203,7 +203,7 @@ def formsemestre_poursuite_report(
html_sortable=True, html_sortable=True,
html_class="table_leftalign table_listegroupe", html_class="table_leftalign table_listegroupe",
pdf_link=False, # pas d'export pdf pdf_link=False, # pas d'export pdf
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
tab.filename = scu.make_filename("poursuite " + sem["titreannee"]) tab.filename = scu.make_filename("poursuite " + sem["titreannee"])

View File

@ -79,18 +79,18 @@ des tuples (name, value, formsemestre_id).
Si formsemestre_id est NULL, la valeur concerne tous les semestres, Si formsemestre_id est NULL, la valeur concerne tous les semestres,
sinon, elle ne concerne que le semestre indiqué. sinon, elle ne concerne que le semestre indiqué.
* Utilisation dans ScoDoc * Utilisation dans ScoDoc7
- lire une valeur: - lire une valeur:
context.get_preference(name, formsemestre_id) get_preference(context, name, formsemestre_id)
nb: les valeurs sont des chaines, sauf: nb: les valeurs sont des chaines, sauf:
. si le type est spécfié (float ou int) . si le type est spécfié (float ou int)
. les boolcheckbox qui sont des entiers 0 ou 1 . les boolcheckbox qui sont des entiers 0 ou 1
- avoir un mapping (read only) de toutes les valeurs: - avoir un mapping (read only) de toutes les valeurs:
context.get_preferences(formsemestre_id) sco_preferences.SemPreferences(context,formsemestre_id)
- editer les preferences globales: - editer les preferences globales:
sco_preferences.get_base_preferences(self).edit(REQUEST=REQUEST) sco_preferences.get_base_preferences(self).edit(REQUEST=REQUEST)
- editer les preferences d'un semestre: - editer les preferences d'un semestre:
sem_preferences(context,formsemestre_id).edit() SemPreferences(context,formsemestre_id).edit()
* Implémentation: sco_preferences.py * Implémentation: sco_preferences.py
@ -109,7 +109,7 @@ Une instance unique par site (département, repéré par URL).
.deleteformsemestre_id, name) .deleteformsemestre_id, name)
.edit() (HTML dialog) .edit() (HTML dialog)
class sem_preferences(context,formsemestre_id) class SemPreferences(context,formsemestre_id)
Une instance par semestre, et une instance pour prefs globales. Une instance par semestre, et une instance pour prefs globales.
L'attribut .base_prefs point sur sco_base_preferences. L'attribut .base_prefs point sur sco_base_preferences.
.__getitem__ [name] .__getitem__ [name]
@ -1956,7 +1956,9 @@ class sco_base_preferences:
submitlabel="Enregistrer les modifications", submitlabel="Enregistrer les modifications",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + self.html_sco_header.sco_footer(context, REQUEST) return (
"\n".join(H) + tf[1] + self.html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(self.context.ScoURL()) # cancel return REQUEST.RESPONSE.redirect(self.context.ScoURL()) # cancel
else: else:
@ -1979,7 +1981,7 @@ def get_base_preferences(context):
return _SCO_BASE_PREFERENCES[u] return _SCO_BASE_PREFERENCES[u]
class sem_preferences: class SemPreferences:
def __init__(self, context, formsemestre_id=None): def __init__(self, context, formsemestre_id=None):
self.context = context self.context = context
self.formsemestre_id = formsemestre_id self.formsemestre_id = formsemestre_id
@ -2065,7 +2067,9 @@ function set_global_pref(el, pref_name) {
+ "/formsemestre_status?formsemestre_id=%s" % self.formsemestre_id + "/formsemestre_status?formsemestre_id=%s" % self.formsemestre_id
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + self.html_sco_header.sco_footer(context, REQUEST) return (
"\n".join(H) + tf[1] + self.html_sco_header.sco_footer(context, REQUEST)
)
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é"
@ -2183,6 +2187,13 @@ def _build_form(self, categories=[], global_edit=False):
return form return form
def get_preference(context, name, formsemestre_id=None):
"""Returns value of named preference.
All preferences have a sensible default value, so this function always returns a usable value for all defined preferences names.
"""
return get_base_preferences(context).get(formsemestre_id, name)
# #
def doc_preferences(context): def doc_preferences(context):
""" Liste les preferences en MarkDown, pour la documentation""" """ Liste les preferences en MarkDown, pour la documentation"""

View File

@ -161,9 +161,9 @@ def feuille_preparation_jury(context, formsemestre_id, REQUEST):
L.append([]) # empty line L.append([]) # empty line
titles = ["Rang"] titles = ["Rang"]
if context.get_preference("prepa_jury_nip"): if sco_preferences.get_preference(context, "prepa_jury_nip"):
titles.append("NIP") titles.append("NIP")
if context.get_preference("prepa_jury_ine"): if sco_preferences.get_preference(context, "prepa_jury_ine"):
titles.append("INE") titles.append("INE")
titles += [ titles += [
"etudid", "etudid",
@ -223,9 +223,9 @@ def feuille_preparation_jury(context, formsemestre_id, REQUEST):
for etudid in etudids: for etudid in etudids:
etud = nt.identdict[etudid] etud = nt.identdict[etudid]
l = [str(i)] l = [str(i)]
if context.get_preference("prepa_jury_nip"): if sco_preferences.get_preference(context, "prepa_jury_nip"):
l.append(etud["code_nip"]) l.append(etud["code_nip"])
if context.get_preference("prepa_jury_ine"): if sco_preferences.get_preference(context, "prepa_jury_ine"):
l.append(etud["code_ine"]) l.append(etud["code_ine"])
l += [ l += [
etudid, etudid,

View File

@ -412,10 +412,10 @@ def pvjury_table(
columns_ids += ["prev_decision"] columns_ids += ["prev_decision"]
columns_ids += ["decision"] columns_ids += ["decision"]
if context.get_preference("bul_show_mention", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_mention", formsemestre_id):
columns_ids += ["mention"] columns_ids += ["mention"]
columns_ids += ["ue_cap"] columns_ids += ["ue_cap"]
if context.get_preference("bul_show_ects", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_ects", formsemestre_id):
columns_ids += ["ects"] columns_ids += ["ects"]
# XXX if not dpv["semestre_non_terminal"]: # XXX if not dpv["semestre_non_terminal"]:
@ -448,11 +448,11 @@ def pvjury_table(
} }
if with_paragraph_nom: if with_paragraph_nom:
cell_style = styles.ParagraphStyle({}) cell_style = styles.ParagraphStyle({})
cell_style.fontSize = context.get_preference( cell_style.fontSize = sco_preferences.get_preference(context,
"SCOLAR_FONT_SIZE", formsemestre_id "SCOLAR_FONT_SIZE", formsemestre_id
) )
cell_style.fontName = context.get_preference("PV_FONTNAME", formsemestre_id) cell_style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id)
cell_style.leading = 1.0 * context.get_preference( cell_style.leading = 1.0 * sco_preferences.get_preference(context,
"SCOLAR_FONT_SIZE", formsemestre_id "SCOLAR_FONT_SIZE", formsemestre_id
) # vertical space ) # vertical space
i = e["identite"] i = e["identite"]
@ -528,7 +528,7 @@ def formsemestre_pvjury(
caption="Décisions jury pour " + sem["titreannee"], caption="Décisions jury pour " + sem["titreannee"],
html_class="table_leftalign", html_class="table_leftalign",
html_sortable=True, html_sortable=True,
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
if format != "html": if format != "html":
return tab.make_page( return tab.make_page(
@ -540,7 +540,8 @@ def formsemestre_pvjury(
) )
tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Décisions du jury pour le semestre", "Décisions du jury pour le semestre",
sem, sem,
@ -589,7 +590,7 @@ def formsemestre_pvjury(
columns_ids=("code", "count", "expl"), columns_ids=("code", "count", "expl"),
html_class="table_leftalign", html_class="table_leftalign",
html_sortable=True, html_sortable=True,
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
).html() ).html()
) )
H.append("<p></p>") # force space at bottom H.append("<p></p>") # force space at bottom
@ -629,7 +630,8 @@ def formsemestre_pvjury_pdf(
etudids = [m["etudid"] for m in groups_infos.members] etudids = [m["etudid"] for m in groups_infos.members]
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Edition du PV de jury %s" % etuddescr, "Edition du PV de jury %s" % etuddescr,
sem=sem, sem=sem,
@ -811,7 +813,8 @@ def formsemestre_lettres_individuelles(
etudids = [m["etudid"] for m in groups_infos.members] etudids = [m["etudid"] for m in groups_infos.members]
H = [ H = [
html_sco_header.html_sem_header(context, html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Edition des lettres individuelles", "Edition des lettres individuelles",
sem=sem, sem=sem,

View File

@ -348,7 +348,7 @@ def pdf_lettres_individuelles(
context.fillEtudsInfo(etuds) context.fillEtudsInfo(etuds)
# #
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
prefs = context.get_preferences(formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id)
params = { params = {
"date_jury": date_jury, "date_jury": date_jury,
"date_commission": date_commission, "date_commission": date_commission,
@ -358,7 +358,7 @@ def pdf_lettres_individuelles(
} }
# copie preferences # copie preferences
for name in sco_preferences.PREFS_NAMES: for name in sco_preferences.PREFS_NAMES:
params[name] = context.get_preference(name, sem["formsemestre_id"]) params[name] = sco_preferences.get_preference(context, name, sem["formsemestre_id"])
bookmarks = {} bookmarks = {}
objects = [] # list of PLATYPUS objects objects = [] # list of PLATYPUS objects
@ -429,7 +429,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
objects = [] objects = []
style = reportlab.lib.styles.ParagraphStyle({}) style = reportlab.lib.styles.ParagraphStyle({})
style.fontSize = 14 style.fontSize = 14
style.fontName = context.get_preference("PV_FONTNAME", formsemestre_id) style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id)
style.leading = 18 style.leading = 18
style.alignment = TA_JUSTIFY style.alignment = TA_JUSTIFY
@ -443,7 +443,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
else: else:
params["decisions_ue_descr_plural"] = "" params["decisions_ue_descr_plural"] = ""
params["INSTITUTION_CITY"] = context.get_preference( params["INSTITUTION_CITY"] = sco_preferences.get_preference(context,
"INSTITUTION_CITY", formsemestre_id "INSTITUTION_CITY", formsemestre_id
) )
if decision["prev_decision_sem"]: if decision["prev_decision_sem"]:
@ -512,7 +512,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
# Corps de la lettre: # Corps de la lettre:
objects += sco_bulletins_pdf.process_field( objects += sco_bulletins_pdf.process_field(
context, context,
context.get_preference("PV_LETTER_TEMPLATE", sem["formsemestre_id"]), sco_preferences.get_preference(context, "PV_LETTER_TEMPLATE", sem["formsemestre_id"]),
params, params,
style, style,
suppress_empty_pars=True, suppress_empty_pars=True,
@ -523,7 +523,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
# chef de département. # chef de département.
if Se.semestre_non_terminal: if Se.semestre_non_terminal:
sig = ( sig = (
context.get_preference("PV_LETTER_PASSAGE_SIGNATURE", formsemestre_id) sco_preferences.get_preference(context, "PV_LETTER_PASSAGE_SIGNATURE", formsemestre_id)
% params % params
) )
sig = _simulate_br(sig, '<para leftindent="%(htab1)s">') sig = _simulate_br(sig, '<para leftindent="%(htab1)s">')
@ -538,7 +538,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
) )
else: else:
sig = ( sig = (
context.get_preference("PV_LETTER_DIPLOMA_SIGNATURE", formsemestre_id) sco_preferences.get_preference(context, "PV_LETTER_DIPLOMA_SIGNATURE", formsemestre_id)
% params % params
) )
sig = _simulate_br(sig, '<para leftindent="%(htab1)s">') sig = _simulate_br(sig, '<para leftindent="%(htab1)s">')
@ -580,12 +580,12 @@ def _make_signature_image(signature, leftindent, formsemestre_id, context=None):
im = PILImage.open(f) im = PILImage.open(f)
width, height = im.size width, height = im.size
pdfheight = ( pdfheight = (
1.0 * context.get_preference("pv_sig_image_height", formsemestre_id) * mm 1.0 * sco_preferences.get_preference(context, "pv_sig_image_height", formsemestre_id) * mm
) )
f.seek(0, 0) f.seek(0, 0)
style = styles.ParagraphStyle({}) style = styles.ParagraphStyle({})
style.leading = 1.0 * context.get_preference( style.leading = 1.0 * sco_preferences.get_preference(context,
"SCOLAR_FONT_SIZE", formsemestre_id "SCOLAR_FONT_SIZE", formsemestre_id
) # vertical space ) # vertical space
style.leftIndent = leftindent style.leftIndent = leftindent
@ -666,7 +666,7 @@ def pvjury_pdf(
author="%s %s (E. Viennet)" % (VERSION.SCONAME, VERSION.SCOVERSION), author="%s %s (E. Viennet)" % (VERSION.SCONAME, VERSION.SCOVERSION),
title=SU("PV du jury de %s" % sem["titre_num"]), title=SU("PV du jury de %s" % sem["titre_num"]),
subject="PV jury", subject="PV jury",
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
) )
@ -702,14 +702,14 @@ def _pvjury_pdf_type(
style = reportlab.lib.styles.ParagraphStyle({}) style = reportlab.lib.styles.ParagraphStyle({})
style.fontSize = 12 style.fontSize = 12
style.fontName = context.get_preference("PV_FONTNAME", formsemestre_id) style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id)
style.leading = 18 style.leading = 18
style.alignment = TA_JUSTIFY style.alignment = TA_JUSTIFY
indent = 1 * cm indent = 1 * cm
bulletStyle = reportlab.lib.styles.ParagraphStyle({}) bulletStyle = reportlab.lib.styles.ParagraphStyle({})
bulletStyle.fontSize = 12 bulletStyle.fontSize = 12
bulletStyle.fontName = context.get_preference("PV_FONTNAME", formsemestre_id) bulletStyle.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id)
bulletStyle.leading = 12 bulletStyle.leading = 12
bulletStyle.alignment = TA_JUSTIFY bulletStyle.alignment = TA_JUSTIFY
bulletStyle.firstLineIndent = 0 bulletStyle.firstLineIndent = 0
@ -727,7 +727,7 @@ def _pvjury_pdf_type(
""" """
% ( % (
titre_jury, titre_jury,
context.get_preference("DeptName", formsemestre_id), sco_preferences.get_preference(context, "DeptName", formsemestre_id),
sem["anneescolaire"], sem["anneescolaire"],
), ),
style, style,
@ -745,7 +745,7 @@ def _pvjury_pdf_type(
objects += sco_pdf.makeParas( objects += sco_pdf.makeParas(
"""<para align="center"><b>Semestre: %s</b></para>""" % sem["titre"], style """<para align="center"><b>Semestre: %s</b></para>""" % sem["titre"], style
) )
if context.get_preference("PV_TITLE_WITH_VDI", formsemestre_id): if sco_preferences.get_preference(context, "PV_TITLE_WITH_VDI", formsemestre_id):
objects += sco_pdf.makeParas( objects += sco_pdf.makeParas(
"""<para align="center">VDI et Code: %s</para>""" % (VDICode or ""), style """<para align="center">VDI et Code: %s</para>""" % (VDICode or ""), style
) )
@ -757,11 +757,11 @@ def _pvjury_pdf_type(
objects += sco_pdf.makeParas( objects += sco_pdf.makeParas(
"<para>" "<para>"
+ context.get_preference("PV_INTRO", formsemestre_id) + sco_preferences.get_preference(context, "PV_INTRO", formsemestre_id)
% { % {
"Decnum": numeroArrete, "Decnum": numeroArrete,
"VDICode": VDICode, "VDICode": VDICode,
"UnivName": context.get_preference("UnivName", formsemestre_id), "UnivName": sco_preferences.get_preference(context, "UnivName", formsemestre_id),
"Type": titre_jury, "Type": titre_jury,
"Date": date_commission, # deprecated "Date": date_commission, # deprecated
"date_commission": date_commission, "date_commission": date_commission,
@ -787,9 +787,9 @@ def _pvjury_pdf_type(
titles = [titles.get(x, "") for x in columns_ids] titles = [titles.get(x, "") for x in columns_ids]
# Make a new cell style and put all cells in paragraphs # Make a new cell style and put all cells in paragraphs
cell_style = styles.ParagraphStyle({}) cell_style = styles.ParagraphStyle({})
cell_style.fontSize = context.get_preference("SCOLAR_FONT_SIZE", formsemestre_id) cell_style.fontSize = sco_preferences.get_preference(context, "SCOLAR_FONT_SIZE", formsemestre_id)
cell_style.fontName = context.get_preference("PV_FONTNAME", formsemestre_id) cell_style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id)
cell_style.leading = 1.0 * context.get_preference( cell_style.leading = 1.0 * sco_preferences.get_preference(context,
"SCOLAR_FONT_SIZE", formsemestre_id "SCOLAR_FONT_SIZE", formsemestre_id
) # vertical space ) # vertical space
LINEWIDTH = 0.5 LINEWIDTH = 0.5
@ -798,7 +798,7 @@ def _pvjury_pdf_type(
"FONTNAME", "FONTNAME",
(0, 0), (0, 0),
(-1, 0), (-1, 0),
context.get_preference("PV_FONTNAME", formsemestre_id), sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id),
), ),
("LINEBELOW", (0, 0), (-1, 0), LINEWIDTH, Color(0, 0, 0)), ("LINEBELOW", (0, 0), (-1, 0), LINEWIDTH, Color(0, 0, 0)),
("GRID", (0, 0), (-1, -1), LINEWIDTH, Color(0, 0, 0)), ("GRID", (0, 0), (-1, -1), LINEWIDTH, Color(0, 0, 0)),
@ -817,7 +817,7 @@ def _pvjury_pdf_type(
widths = [6 * cm, 2.8 * cm, 2.8 * cm, None, None, None, None] widths = [6 * cm, 2.8 * cm, 2.8 * cm, None, None, None, None]
if dpv["has_prev"]: if dpv["has_prev"]:
widths[2:2] = [2.8 * cm] widths[2:2] = [2.8 * cm]
if context.get_preference("bul_show_mention", formsemestre_id): if sco_preferences.get_preference(context, "bul_show_mention", formsemestre_id):
widths += [None] widths += [None]
objects.append(Table(Pt, repeatRows=1, colWidths=widths, style=table_style)) objects.append(Table(Pt, repeatRows=1, colWidths=widths, style=table_style))
@ -826,8 +826,8 @@ def _pvjury_pdf_type(
"""<para spaceBefore="10mm" align="right"> """<para spaceBefore="10mm" align="right">
%s, %s</para>""" %s, %s</para>"""
% ( % (
context.get_preference("DirectorName", formsemestre_id) or "", sco_preferences.get_preference(context, "DirectorName", formsemestre_id) or "",
context.get_preference("DirectorTitle", formsemestre_id) or "", sco_preferences.get_preference(context, "DirectorTitle", formsemestre_id) or "",
), ),
style, style,
) )
@ -848,7 +848,7 @@ def _pvjury_pdf_type(
"FONTNAME", "FONTNAME",
(0, 0), (0, 0),
(-1, 0), (-1, 0),
context.get_preference("PV_FONTNAME", formsemestre_id), sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id),
), ),
("LINEBELOW", (0, 0), (-1, -1), LINEWIDTH, Color(0, 0, 0)), ("LINEBELOW", (0, 0), (-1, -1), LINEWIDTH, Color(0, 0, 0)),
("LINEABOVE", (0, 0), (-1, -1), LINEWIDTH, Color(0, 0, 0)), ("LINEABOVE", (0, 0), (-1, -1), LINEWIDTH, Color(0, 0, 0)),

View File

@ -75,7 +75,7 @@ def formsemestre_recapcomplet(
) # cache les colonnes des modules ) # cache les colonnes des modules
pref_override = int(pref_override) pref_override = int(pref_override)
if pref_override: if pref_override:
hidebac = int(context.get_preference("recap_hidebac", formsemestre_id)) hidebac = int(sco_preferences.get_preference(context, "recap_hidebac", formsemestre_id))
else: else:
hidebac = int(hidebac) hidebac = int(hidebac)
xml_with_decisions = int(xml_with_decisions) xml_with_decisions = int(xml_with_decisions)
@ -177,7 +177,7 @@ def formsemestre_recapcomplet(
% formsemestre_id % formsemestre_id
) )
H.append("</p>") H.append("</p>")
if context.get_preference("use_ue_coefs", formsemestre_id): if sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id):
H.append( H.append(
""" """
<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>
@ -486,7 +486,7 @@ def make_formsemestre_recapcomplet(
if key == "nb_valid_evals": if key == "nb_valid_evals":
l.append("") l.append("")
elif key == "coef": elif key == "coef":
if context.get_preference("use_ue_coefs", formsemestre_id): if sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id):
l.append("%2.3f" % ue["coefficient"]) l.append("%2.3f" % ue["coefficient"])
else: else:
l.append("") l.append("")

View File

@ -192,7 +192,7 @@ def _results_by_category(
bottom_titles=bottom_titles, bottom_titles=bottom_titles,
html_col_width="4em", html_col_width="4em",
html_sortable=True, html_sortable=True,
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
@ -643,7 +643,7 @@ def table_suivi_cohorte(
caption="Suivi cohorte " + pp + sem["titreannee"] + dbac, caption="Suivi cohorte " + pp + sem["titreannee"] + dbac,
page_title="Suivi cohorte " + sem["titreannee"], page_title="Suivi cohorte " + sem["titreannee"],
html_class="table_cohorte", html_class="table_cohorte",
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
# Explication: liste des semestres associés à chaque date # Explication: liste des semestres associés à chaque date
if not P: if not P:
@ -1155,7 +1155,7 @@ def table_suivi_parcours(
"nb": len(etuds), "nb": len(etuds),
"codeparcours": len(etuds), "codeparcours": len(etuds),
}, },
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
return tab return tab
@ -1215,7 +1215,8 @@ def formsemestre_suivi_parcours(
] ]
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title=tab.page_title, page_title=tab.page_title,
init_qtip=True, init_qtip=True,
@ -1543,7 +1544,8 @@ def formsemestre_graph_parcours(
) )
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title="Parcours étudiants de %(titreannee)s" % sem, page_title="Parcours étudiants de %(titreannee)s" % sem,
no_side_bar=True, no_side_bar=True,

View File

@ -459,14 +459,17 @@ def semset_page(context, format="html", REQUEST=None):
html_sortable=True, html_sortable=True,
html_class="table_leftalign", html_class="table_leftalign",
filename="semsets", filename="semsets",
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
if format != "html": if format != "html":
return tab.make_page(context, format=format, REQUEST=REQUEST) return tab.make_page(context, format=format, REQUEST=REQUEST)
page_title = "Ensembles de semestres" page_title = "Ensembles de semestres"
H = [ H = [
html_sco_header.sco_header(context, html_sco_header.sco_header(
context,
REQUEST, REQUEST,
page_title=page_title, page_title=page_title,
init_qtip=True, init_qtip=True,

View File

@ -242,7 +242,9 @@ def trombino_copy_photos(context, group_ids=[], REQUEST=None, dialog_confirmed=F
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
portal_url = sco_portal_apogee.get_portal_url(context) portal_url = sco_portal_apogee.get_portal_url(context)
header = html_sco_header.sco_header(context, REQUEST, page_title="Chargement des photos") header = html_sco_header.sco_header(
context, REQUEST, page_title="Chargement des photos"
)
footer = html_sco_header.sco_footer(context, REQUEST) footer = html_sco_header.sco_footer(context, REQUEST)
if not portal_url: if not portal_url:
return ( return (
@ -374,7 +376,7 @@ def _trombino_pdf(context, groups_infos, REQUEST):
sco_pdf.ScolarsPageTemplate( sco_pdf.ScolarsPageTemplate(
document, document,
context=context, context=context,
preferences=context.get_preferences(sem["formsemestre_id"]), preferences=sco_preferences.SemPreferences(context, sem["formsemestre_id"]),
) )
) )
document.build(objects) document.build(objects)
@ -451,7 +453,7 @@ def _listeappel_photos_pdf(context, groups_infos, REQUEST):
sco_pdf.ScolarsPageTemplate( sco_pdf.ScolarsPageTemplate(
document, document,
context, context,
preferences=context.get_preferences(sem["formsemestre_id"]), preferences=sco_preferences.SemPreferences(context, sem["formsemestre_id"]),
) )
) )
document.build(objects) document.build(objects)
@ -490,7 +492,9 @@ def photos_import_files_form(context, group_ids=[], REQUEST=None):
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title="Import des photos des étudiants"), html_sco_header.sco_header(
context, REQUEST, page_title="Import des photos des étudiants"
),
"""<h2 class="formsemestre">Téléchargement des photos des étudiants</h2> """<h2 class="formsemestre">Téléchargement des photos des étudiants</h2>
<p><b>Vous pouvez aussi charger les photos individuellement via la fiche de chaque étudiant (menu "Etudiant" / "Changer la photo").</b></p> <p><b>Vous pouvez aussi charger les photos individuellement via la fiche de chaque étudiant (menu "Etudiant" / "Changer la photo").</b></p>
<p class="help">Cette page permet de charger en une seule fois les photos de plusieurs étudiants.<br/> <p class="help">Cette page permet de charger en une seule fois les photos de plusieurs étudiants.<br/>

View File

@ -72,10 +72,10 @@ def pdf_trombino_tours(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
) )
DeptName = context.get_preference("DeptName") DeptName = sco_preferences.get_preference(context, "DeptName")
DeptFullName = context.get_preference("DeptFullName") DeptFullName = sco_preferences.get_preference(context, "DeptFullName")
UnivName = context.get_preference("UnivName") UnivName = sco_preferences.get_preference(context, "UnivName")
InstituteName = context.get_preference("InstituteName") InstituteName = sco_preferences.get_preference(context, "InstituteName")
# Generate PDF page # Generate PDF page
StyleSheet = styles.getSampleStyleSheet() StyleSheet = styles.getSampleStyleSheet()
objects = [] objects = []
@ -277,7 +277,11 @@ def pdf_trombino_tours(
document = BaseDocTemplate(report) document = BaseDocTemplate(report)
document.addPageTemplates( document.addPageTemplates(
ScolarsPageTemplate( ScolarsPageTemplate(
document, context=context, preferences=context.get_preferences() document,
context=context,
preferences=sco_preferences.SemPreferences(
context,
),
) )
) )
document.build(objects) document.build(objects)
@ -297,10 +301,10 @@ def pdf_feuille_releve_absences(
): ):
"""Generation de la feuille d'absence en fichier PDF, avec photos""" """Generation de la feuille d'absence en fichier PDF, avec photos"""
NB_CELL_AM = context.get_preference("feuille_releve_abs_AM") NB_CELL_AM = sco_preferences.get_preference(context, "feuille_releve_abs_AM")
NB_CELL_PM = context.get_preference("feuille_releve_abs_PM") NB_CELL_PM = sco_preferences.get_preference(context, "feuille_releve_abs_PM")
COLWIDTH = 0.85 * cm COLWIDTH = 0.85 * cm
if context.get_preference("feuille_releve_abs_samedi"): if sco_preferences.get_preference(context, "feuille_releve_abs_samedi"):
days = sco_abs.DAYNAMES[:6] # Lundi, ..., Samedi days = sco_abs.DAYNAMES[:6] # Lundi, ..., Samedi
else: else:
days = sco_abs.DAYNAMES[:5] # Lundi, ..., Vendredi days = sco_abs.DAYNAMES[:5] # Lundi, ..., Vendredi
@ -311,10 +315,10 @@ def pdf_feuille_releve_absences(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
) )
DeptName = context.get_preference("DeptName") DeptName = sco_preferences.get_preference(context, "DeptName")
DeptFullName = context.get_preference("DeptFullName") DeptFullName = sco_preferences.get_preference(context, "DeptFullName")
UnivName = context.get_preference("UnivName") UnivName = sco_preferences.get_preference(context, "UnivName")
InstituteName = context.get_preference("InstituteName") InstituteName = sco_preferences.get_preference(context, "InstituteName")
# Generate PDF page # Generate PDF page
StyleSheet = styles.getSampleStyleSheet() StyleSheet = styles.getSampleStyleSheet()
objects = [ objects = [
@ -461,17 +465,21 @@ def pdf_feuille_releve_absences(
# Build document # Build document
report = StringIO() # in-memory document, no disk file report = StringIO() # in-memory document, no disk file
filename = "absences-%s-%s.pdf" % (DeptName, groups_infos.groups_filename) filename = "absences-%s-%s.pdf" % (DeptName, groups_infos.groups_filename)
if context.get_preference("feuille_releve_abs_taille") == "A3": if sco_preferences.get_preference(context, "feuille_releve_abs_taille") == "A3":
taille = A3 taille = A3
elif context.get_preference("feuille_releve_abs_taille") == "A4": elif sco_preferences.get_preference(context, "feuille_releve_abs_taille") == "A4":
taille = A4 taille = A4
if context.get_preference("feuille_releve_abs_format") == "Paysage": if sco_preferences.get_preference(context, "feuille_releve_abs_format") == "Paysage":
document = BaseDocTemplate(report, pagesize=landscape(taille)) document = BaseDocTemplate(report, pagesize=landscape(taille))
else: else:
document = BaseDocTemplate(report, pagesize=taille) document = BaseDocTemplate(report, pagesize=taille)
document.addPageTemplates( document.addPageTemplates(
ScolarsPageTemplate( ScolarsPageTemplate(
document, context=context, preferences=context.get_preferences() document,
context=context,
preferences=sco_preferences.SemPreferences(
context,
),
) )
) )
document.build(objects) document.build(objects)

View File

@ -157,7 +157,7 @@ def evaluation_list_operations(context, REQUEST, evaluation_id):
html_sortable=False, html_sortable=False,
html_title="<h2>Opérations sur l'évaluation %s du %s</h2>" html_title="<h2>Opérations sur l'évaluation %s du %s</h2>"
% (E["description"], E["jour"]), % (E["description"], E["jour"]),
preferences=context.get_preferences(M["formsemestre_id"]), preferences=sco_preferences.SemPreferences(context, M["formsemestre_id"]),
) )
return tab.make_page(context, REQUEST=REQUEST) return tab.make_page(context, REQUEST=REQUEST)
@ -200,7 +200,7 @@ def formsemestre_list_saisies_notes(
html_class="table_leftalign table_coldate", html_class="table_leftalign table_coldate",
html_sortable=True, html_sortable=True,
caption="Saisies de notes dans %s" % sem["titreannee"], caption="Saisies de notes dans %s" % sem["titreannee"],
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id), base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id),
origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "", origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "",
) )

View File

@ -936,6 +936,10 @@ def confirm_dialog(
if helpmsg: if helpmsg:
H.append('<p class="help">' + helpmsg + "</p>") H.append('<p class="help">' + helpmsg + "</p>")
if add_headers and REQUEST: if add_headers and REQUEST:
return html_sco_header.sco_header(context, REQUEST) + "\n".join(H) + html_sco_header.sco_footer(context, REQUEST) return (
html_sco_header.sco_header(context, REQUEST)
+ "\n".join(H)
+ html_sco_header.sco_footer(context, REQUEST)
)
else: else:
return "\n".join(H) return "\n".join(H)

View File

@ -385,7 +385,7 @@ def identite_edit(cnx, args, context=None, REQUEST=None):
notify_to = None notify_to = None
if context: if context:
try: try:
notify_to = context.get_preference("notify_etud_changes_to") notify_to = sco_preferences.get_preference(context, "notify_etud_changes_to")
except: except:
pass pass
@ -452,7 +452,7 @@ def notify_etud_change(context, email_addr, etud, before, after, subject):
msg = MIMEMultipart() msg = MIMEMultipart()
subj = Header("[ScoDoc] " + subject, SCO_ENCODING) subj = Header("[ScoDoc] " + subject, SCO_ENCODING)
msg["Subject"] = subj msg["Subject"] = subj
msg["From"] = context.get_preference("email_from_addr") msg["From"] = sco_preferences.get_preference(context, "email_from_addr")
msg["To"] = email_addr msg["To"] = email_addr
mime_txt = MIMEText(txt, "plain", SCO_ENCODING) mime_txt = MIMEText(txt, "plain", SCO_ENCODING)
msg.attach(mime_txt) msg.attach(mime_txt)
@ -498,7 +498,7 @@ def adresse_edit(cnx, args, context=None):
notify_to = None notify_to = None
if context: if context:
try: try:
notify_to = context.get_preference("notify_etud_changes_to") notify_to = sco_preferences.get_preference(context, "notify_etud_changes_to")
except: except:
pass pass
if notify_to: if notify_to:

View File

@ -718,7 +718,7 @@ def SignaleAbsenceGrHebdo(
) )
formsemestre_id = groups_infos.formsemestre_id formsemestre_id = groups_infos.formsemestre_id
require_module = context.get_preference("abs_require_module", formsemestre_id) require_module = sco_preferences.get_preference(context, "abs_require_module", formsemestre_id)
etuds = [ etuds = [
context.getEtudInfo(etudid=m["etudid"], filled=True)[0] context.getEtudInfo(etudid=m["etudid"], filled=True)[0]
for m in groups_infos.members for m in groups_infos.members
@ -880,7 +880,7 @@ def SignaleAbsenceGrSemestre(
+ context.sco_footer(REQUEST) + context.sco_footer(REQUEST)
) )
formsemestre_id = groups_infos.formsemestre_id formsemestre_id = groups_infos.formsemestre_id
require_module = context.get_preference("abs_require_module", formsemestre_id) require_module = sco_preferences.get_preference(context, "abs_require_module", formsemestre_id)
etuds = [ etuds = [
context.getEtudInfo(etudid=m["etudid"], filled=True)[0] context.getEtudInfo(etudid=m["etudid"], filled=True)[0]
for m in groups_infos.members for m in groups_infos.members
@ -1444,7 +1444,7 @@ def EtatAbsencesGr(
tab = GenTable( tab = GenTable(
columns_ids=columns_ids, columns_ids=columns_ids,
rows=T, rows=T,
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
titles={ titles={
"etatincursem": "Etat", "etatincursem": "Etat",
"nomprenom": "Nom", "nomprenom": "Nom",
@ -1745,7 +1745,9 @@ def _tableBillets(context, billets, etud=None, title=""):
columns_ids=columns_ids, columns_ids=columns_ids,
page_title=title, page_title=title,
html_title="<h2>%s</h2>" % title, html_title="<h2>%s</h2>" % title,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
rows=billets, rows=billets,
html_sortable=True, html_sortable=True,
) )
@ -1773,7 +1775,7 @@ def listeBilletsEtud(context, etudid=False, REQUEST=None, format="html"):
@scodoc7func(context) @scodoc7func(context)
def XMLgetBilletsEtud(context, etudid=False, REQUEST=None): def XMLgetBilletsEtud(context, etudid=False, REQUEST=None):
"""Liste billets pour un etudiant""" """Liste billets pour un etudiant"""
if not context.get_preference("handle_billets_abs"): if not sco_preferences.get_preference(context, "handle_billets_abs"):
return "" return ""
t0 = time.time() t0 = time.time()
r = context.listeBilletsEtud(etudid, REQUEST=REQUEST, format="xml") r = context.listeBilletsEtud(etudid, REQUEST=REQUEST, format="xml")

View File

@ -1574,7 +1574,9 @@ def view_module_abs(context, REQUEST, moduleimpl_id, format="html"):
base_url="%s?moduleimpl_id=%s" % (REQUEST.URL0, moduleimpl_id), base_url="%s?moduleimpl_id=%s" % (REQUEST.URL0, moduleimpl_id),
filename="absmodule_" + scu.make_filename(M["module"]["titre"]), filename="absmodule_" + scu.make_filename(M["module"]["titre"]),
caption="Absences dans le module %s" % M["module"]["titre"], caption="Absences dans le module %s" % M["module"]["titre"],
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
if format != "html": if format != "html":
@ -1732,7 +1734,7 @@ def formsemestre_enseignants_list(context, REQUEST, formsemestre_id, format="htm
), ),
base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id), base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id),
caption="Tous les enseignants (responsables ou associés aux modules de ce semestre) apparaissent. Le nombre de saisies d'absences est le nombre d'opérations d'ajout effectuées sur ce semestre, sans tenir compte des annulations ou double saisies.", caption="Tous les enseignants (responsables ou associés aux modules de ce semestre) apparaissent. Le nombre de saisies d'absences est le nombre d'opérations d'ajout effectuées sur ce semestre, sans tenir compte des annulations ou double saisies.",
preferences=context.get_preferences(formsemestre_id), preferences=sco_preferences.SemPreferences(context, formsemestre_id),
) )
return T.make_page( return T.make_page(
context, page_title=title, title=title, REQUEST=REQUEST, format=format context, page_title=title, title=title, REQUEST=REQUEST, format=format

View File

@ -235,9 +235,9 @@ def formsemestre_edit_preferences(context, formsemestre_id, REQUEST):
or ((str(authuser) in sem["responsables"]) and sem["resp_can_edit"]) or ((str(authuser) in sem["responsables"]) and sem["resp_can_edit"])
) and (sem["etat"] == "1") ) and (sem["etat"] == "1")
if ok: if ok:
return context.get_preferences(formsemestre_id=formsemestre_id).edit( return sco_preferences.SemPreferences(
REQUEST=REQUEST context, formsemestre_id=formsemestre_id
) ).edit(REQUEST=REQUEST)
else: else:
raise AccessDenied("Modification impossible pour %s" % authuser) raise AccessDenied("Modification impossible pour %s" % authuser)
@ -285,7 +285,9 @@ def showEtudLog(context, etudid, format="html", REQUEST=None):
filename="log_" + scu.make_filename(etud["nomprenom"]), filename="log_" + scu.make_filename(etud["nomprenom"]),
html_next_section='<ul><li><a href="ficheEtud?etudid=%(etudid)s">fiche de %(nomprenom)s</a></li></ul>' html_next_section='<ul><li><a href="ficheEtud?etudid=%(etudid)s">fiche de %(nomprenom)s</a></li></ul>'
% etud, % etud,
preferences=context.get_preferences(), preferences=sco_preferences.SemPreferences(
context,
),
) )
return tab.make_page(context, format=format, REQUEST=REQUEST) return tab.make_page(context, format=format, REQUEST=REQUEST)
@ -302,7 +304,7 @@ def rssnews(context, REQUEST=None):
"rss feed" "rss feed"
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE) REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
return sco_news.scolar_news_summary_rss( return sco_news.scolar_news_summary_rss(
context, "Nouvelles de " + context.get_preference("DeptName"), context.ScoURL() context, "Nouvelles de " + sco_preferences.get_preference(context, "DeptName"), context.ScoURL()
) )
@ -1181,7 +1183,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
else: else:
A = """<div class="infoapogee"><p>Pas d'informations d'Apogée</p></div>""" A = """<div class="infoapogee"><p>Pas d'informations d'Apogée</p></div>"""
require_ine = context.get_preference("always_require_ine") require_ine = sco_preferences.get_preference(context, "always_require_ine")
descr += [ descr += [
("adm_id", {"input_type": "hidden"}), ("adm_id", {"input_type": "hidden"}),

View File

@ -25,7 +25,9 @@ for sem in sems:
formsemestre_id = sem["formsemestre_id"] formsemestre_id = sem["formsemestre_id"]
nt = context.Notes._getNotesCache().get_NotesTable(context.Notes, formsemestre_id) nt = context.Notes._getNotesCache().get_NotesTable(context.Notes, formsemestre_id)
etudids = nt.get_etudids() etudids = nt.get_etudids()
use_ue_coef = context.get_preference("use_ue_coefs", formsemestre_id) use_ue_coef = sco_preferences.get_preference(
context, "use_ue_coefs", formsemestre_id
)
n += 1 n += 1
print("%d %s (%d) use_ue_coef=%s" % (n, formsemestre_id, len(etudids), use_ue_coef)) print("%d %s (%d) use_ue_coef=%s" % (n, formsemestre_id, len(etudids), use_ue_coef))
for etudid in etudids: for etudid in etudids: