WIP refactoring: preferences
This commit is contained in:
parent
d586359e3d
commit
09a65b48ef
17
README.md
17
README.md
@ -55,20 +55,9 @@ Installer le bon vieux `pyExcelerator` dans l'environnement:
|
||||
## Migration ZScolar
|
||||
|
||||
### 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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -240,7 +240,9 @@ def students_import_excel(
|
||||
dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
||||
else:
|
||||
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>")
|
||||
for d in diag:
|
||||
H.append("<li>%s</li>" % d)
|
||||
@ -266,7 +268,7 @@ def scolars_import_excel_file(
|
||||
cnx = context.GetDBConnexion(autocommit=False)
|
||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||
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()
|
||||
if not exceldata:
|
||||
raise ScoValueError("Ficher excel vide ou invalide")
|
||||
@ -789,6 +791,8 @@ def adm_table_description_format(context):
|
||||
rows=Fmt.values(),
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
return tab
|
||||
|
@ -129,7 +129,7 @@ def sidebar(context, REQUEST=None):
|
||||
"""
|
||||
% params
|
||||
)
|
||||
if context.get_preference("handle_billets_abs"):
|
||||
if sco_preferences.get_preference(context, "handle_billets_abs"):
|
||||
H.append(
|
||||
"""<li> <a href="%(ScoURL)s/Absences/listeBilletsEtud?etudid=%(etudid)s">Billets</a></li>"""
|
||||
% params
|
||||
@ -166,9 +166,9 @@ def sidebar_dept(context, REQUEST=None):
|
||||
"""Partie supérieure de la marge de gauche"""
|
||||
infos = {
|
||||
"BASE0": REQUEST.BASE0,
|
||||
"DeptIntranetTitle": context.get_preference("DeptIntranetTitle"),
|
||||
"DeptIntranetURL": context.get_preference("DeptIntranetURL"),
|
||||
"DeptName": context.get_preference("DeptName"),
|
||||
"DeptIntranetTitle": sco_preferences.get_preference(context, "DeptIntranetTitle"),
|
||||
"DeptIntranetURL": sco_preferences.get_preference(context, "DeptIntranetURL"),
|
||||
"DeptName": sco_preferences.get_preference(context, "DeptName"),
|
||||
"ScoURL": context.ScoURL(),
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ def sendAlarm(context, subj, txt):
|
||||
msg = MIMEMultipart()
|
||||
subj = Header(subj, sco_utils.SCO_ENCODING)
|
||||
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.epilogue = ""
|
||||
txt = MIMEText(txt, "plain", sco_utils.SCO_ENCODING)
|
||||
|
@ -173,7 +173,7 @@ class NotesTable:
|
||||
self.moduleimpl_stats = {} # { moduleimpl_id : {stats} }
|
||||
self._uecoef = {} # { ue_id : coef } cache coef manuels ue cap
|
||||
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
|
||||
self.inscrlist = context.do_formsemestre_inscription_list(
|
||||
args={"formsemestre_id": formsemestre_id}
|
||||
|
@ -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
|
||||
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:
|
||||
if template_latex:
|
||||
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):
|
||||
"""Renvoie l'annotation PE dans la liste de ces annotations ;
|
||||
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
|
||||
"""
|
||||
|
@ -54,7 +54,9 @@ import pe_avislatex
|
||||
|
||||
def _pe_view_sem_recap_form(context, formsemestre_id, REQUEST=None):
|
||||
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>
|
||||
<p class="help">
|
||||
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":
|
||||
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)
|
||||
|
||||
|
@ -45,7 +45,7 @@ import sco_compute_moy
|
||||
|
||||
def is_work_saturday(context):
|
||||
"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):
|
||||
|
@ -71,7 +71,9 @@ def do_abs_notify(context, sem, etudid, date, nbabs, nbabsjust):
|
||||
formsemestre_id = sem["formsemestre_id"]
|
||||
else:
|
||||
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(
|
||||
context, sem, prefs, etudid, date, nbabs, nbabsjust
|
||||
@ -81,7 +83,7 @@ def do_abs_notify(context, sem, etudid, date, nbabs, nbabsjust):
|
||||
return # abort
|
||||
|
||||
# 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 = []
|
||||
for email_addr in destinations:
|
||||
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 - 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_increment = context.get_preference(
|
||||
abs_notify_abs_increment = sco_preferences.get_preference(context,
|
||||
"abs_notify_abs_increment", formsemestre_id
|
||||
)
|
||||
nbabs_last_notified = etud_nbabs_last_notified(context, etudid, formsemestre_id)
|
||||
|
@ -116,8 +116,10 @@ def doSignaleAbsence(
|
||||
if modimpl["moduleimpl_id"] == moduleimpl_id:
|
||||
M = "dans le module %s" % modimpl["module"]["code"]
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
REQUEST, page_title="Signalement d'une absence pour %(nomprenom)s" % etud
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Signalement d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<h2>Signalement d'absences</h2>""",
|
||||
]
|
||||
@ -151,7 +153,7 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
|
||||
etudid = etud["etudid"]
|
||||
disabled = False
|
||||
if not etud["cursem"]:
|
||||
require_module = context.get_preference(
|
||||
require_module = sco_preferences.get_preference(context,
|
||||
"abs_require_module"
|
||||
) # on utilise la pref globale car pas de sem courant
|
||||
if require_module:
|
||||
@ -162,7 +164,7 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
|
||||
menu_module = ""
|
||||
else:
|
||||
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(
|
||||
context.Notes, formsemestre_id
|
||||
)
|
||||
@ -203,8 +205,10 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
|
||||
menu_module += """</select></p>"""
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
REQUEST, page_title="Signalement d'une absence pour %(nomprenom)s" % etud
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Signalement d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<table><tr><td>
|
||||
<h2>Signalement d'une absence pour %(nomprenom)s</h2>
|
||||
@ -316,8 +320,10 @@ def doJustifAbsence(
|
||||
nbadded += 1
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
REQUEST, page_title="Justification d'une absence pour %(nomprenom)s" % etud
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Justification d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<h2>Justification d'absences</h2>""",
|
||||
]
|
||||
@ -352,8 +358,10 @@ def JustifAbsenceEtud(context, REQUEST=None): # etudid implied
|
||||
etud = context.getEtudInfo(filled=1, REQUEST=REQUEST)[0]
|
||||
etudid = etud["etudid"]
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
REQUEST, page_title="Justification d'une absence pour %(nomprenom)s" % etud
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Justification d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<table><tr><td>
|
||||
<h2>Justification d'une absence pour %(nomprenom)s</h2>
|
||||
@ -421,8 +429,10 @@ def doAnnuleAbsence(
|
||||
nbadded += 1
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
REQUEST, page_title="Annulation d'une absence pour %(nomprenom)s" % etud
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Annulation d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<h2>Annulation d'absences pour %(nomprenom)s</h2>""" % etud,
|
||||
]
|
||||
@ -458,8 +468,10 @@ def AnnuleAbsenceEtud(context, REQUEST=None): # etudid implied
|
||||
etudid = etud["etudid"]
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
REQUEST, page_title="Annulation d'une absence pour %(nomprenom)s" % etud
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Annulation d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<table><tr><td>
|
||||
<h2><font color="#FF0000">Annulation</font> d'une absence pour %(nomprenom)s</h2>
|
||||
@ -557,7 +569,8 @@ def doAnnuleJustif(
|
||||
nbadded += 1
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Annulation d'une justification pour %(nomprenom)s" % etud,
|
||||
),
|
||||
@ -672,7 +685,8 @@ def CalAbs(context, REQUEST=None): # etud implied
|
||||
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Calendrier des absences de %(nomprenom)s" % etud,
|
||||
cssstyles=["css/calabs.css"],
|
||||
@ -752,7 +766,9 @@ def ListeAbsEtud(
|
||||
base_url=base_url_nj,
|
||||
filename="abs_" + scu.make_filename(etud["nomprenom"]),
|
||||
caption="Absences non justifiées de %(nomprenom)s" % etud,
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
tab_absjust = GenTable(
|
||||
titles=titles,
|
||||
@ -763,7 +779,9 @@ def ListeAbsEtud(
|
||||
base_url=base_url_j,
|
||||
filename="absjust_" + scu.make_filename(etud["nomprenom"]),
|
||||
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:
|
||||
@ -777,7 +795,9 @@ def ListeAbsEtud(
|
||||
# Mise en forme HTML:
|
||||
H = []
|
||||
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(
|
||||
"""<h2>Absences de %s (à partir du %s)</h2>"""
|
||||
@ -828,7 +848,8 @@ def absences_index_html(context, REQUEST=None):
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Gestion des absences",
|
||||
cssstyles=["css/calabs.css"],
|
||||
@ -844,7 +865,7 @@ def absences_index_html(context, REQUEST=None):
|
||||
H.append(
|
||||
"""<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(
|
||||
"""<li><a href="listeBillets">Traitement des billets d'absence en attente</a></li>"""
|
||||
)
|
||||
|
@ -65,7 +65,9 @@ _help_txt = """
|
||||
def apo_compare_csv_form(context, REQUEST=None):
|
||||
"""Form: submit 2 CSV files to compare them."""
|
||||
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>
|
||||
<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)
|
||||
|
||||
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>",
|
||||
_help_txt,
|
||||
'<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"),
|
||||
html_class="table_leftalign",
|
||||
html_with_td_classes=True,
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
return T
|
||||
|
||||
|
@ -85,7 +85,7 @@ def make_context_dict(context, sem, etud):
|
||||
C.update(etud)
|
||||
# copie preferences
|
||||
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, ...
|
||||
sco_groups.etud_add_group_infos(context, etud, sem)
|
||||
@ -116,7 +116,7 @@ def formsemestre_bulletinetud_dict(
|
||||
if not version in ("short", "long", "selectedevals"):
|
||||
raise ValueError("invalid version code !")
|
||||
|
||||
prefs = context.get_preferences(formsemestre_id)
|
||||
prefs = sco_preferences.SemPreferences(context, formsemestre_id)
|
||||
nt = context._getNotesCache().get_NotesTable(
|
||||
context, formsemestre_id
|
||||
) # > toutes notes
|
||||
@ -403,8 +403,8 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
|
||||
(ajoute les informations aux modimpls)
|
||||
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_abs_modules = context.get_preference(
|
||||
bul_show_mod_rangs = sco_preferences.get_preference(context, "bul_show_mod_rangs", formsemestre_id)
|
||||
bul_show_abs_modules = sco_preferences.get_preference(context,
|
||||
"bul_show_abs_modules", formsemestre_id
|
||||
)
|
||||
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">'
|
||||
% (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_html"] = link_mod + mod["code"] + "</a>"
|
||||
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">'
|
||||
% (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_html"] = link_mod + mod["code_txt"] + "</a>"
|
||||
else:
|
||||
@ -558,7 +558,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
|
||||
|
||||
# Evaluations incomplètes ou futures:
|
||||
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])
|
||||
all_evals = context.do_evaluation_list(
|
||||
args={"moduleimpl_id": modimpl["moduleimpl_id"]}
|
||||
@ -842,7 +842,7 @@ def can_send_bulletin_by_mail(context, formsemestre_id, REQUEST):
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
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 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).
|
||||
"""
|
||||
etud = I["etud"]
|
||||
webmaster = context.get_preference("bul_mail_contact_addr", formsemestre_id)
|
||||
dept = scu.unescape_html(context.get_preference("DeptName", formsemestre_id))
|
||||
copy_addr = context.get_preference("email_copy_bulletins", formsemestre_id)
|
||||
intro_mail = context.get_preference("bul_intro_mail", formsemestre_id)
|
||||
webmaster = sco_preferences.get_preference(context, "bul_mail_contact_addr", formsemestre_id)
|
||||
dept = scu.unescape_html(sco_preferences.get_preference(context, "DeptName", formsemestre_id))
|
||||
copy_addr = sco_preferences.get_preference(context, "email_copy_bulletins", formsemestre_id)
|
||||
intro_mail = sco_preferences.get_preference(context, "bul_intro_mail", formsemestre_id)
|
||||
|
||||
if intro_mail:
|
||||
hea = intro_mail % {
|
||||
@ -985,7 +985,7 @@ def mail_bulletin(context, formsemestre_id, I, pdfdata, filename, recipient_addr
|
||||
else:
|
||||
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(
|
||||
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)
|
||||
recipients = [recipient_addr]
|
||||
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)
|
||||
if copy_addr:
|
||||
msg["Bcc"] = copy_addr.strip()
|
||||
@ -1027,7 +1027,8 @@ def _formsemestre_bulletinetud_header_html(
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
uid = str(authuser)
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
page_title="Bulletin de %(nomprenom)s" % etud,
|
||||
REQUEST=REQUEST,
|
||||
javascripts=[
|
||||
|
@ -87,7 +87,7 @@ def bulletin_get_class(class_name):
|
||||
|
||||
def bulletin_get_class_name_displayed(context, formsemestre_id):
|
||||
"""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:
|
||||
gen_class = bulletin_get_class(bul_class_name)
|
||||
return gen_class.description
|
||||
@ -121,7 +121,7 @@ class BulletinGenerator:
|
||||
self.server_name = server_name
|
||||
# Store preferences for convenience:
|
||||
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
|
||||
# Common PDF styles:
|
||||
# - Pour tous les champs du bulletin sauf les cellules de table:
|
||||
@ -223,7 +223,9 @@ class BulletinGenerator:
|
||||
margins=self.margins,
|
||||
server_name=self.server_name,
|
||||
filigranne=self.filigranne,
|
||||
preferences=self.context.get_preferences(formsemestre_id),
|
||||
preferences=self.sco_preferences.SemPreferences(
|
||||
context, formsemestre_id
|
||||
),
|
||||
)
|
||||
)
|
||||
document.build(objects)
|
||||
@ -273,7 +275,7 @@ def make_formsemestre_bulletinetud(
|
||||
raise ValueError("invalid version code !")
|
||||
|
||||
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:
|
||||
gen_class = bulletin_get_class(bul_class_name)
|
||||
except:
|
||||
|
@ -156,7 +156,7 @@ def formsemestre_bulletinetud_published_dict(
|
||||
mg = scu.fmt_note(nt.get_etud_moy_gen(etudid))
|
||||
if (
|
||||
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
|
||||
# notes en attente dans ce semestre
|
||||
@ -249,7 +249,7 @@ def formsemestre_bulletinetud_published_dict(
|
||||
m["note"][k] = scu.fmt_note(m["note"][k])
|
||||
|
||||
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(
|
||||
value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid]
|
||||
)
|
||||
@ -283,7 +283,7 @@ def formsemestre_bulletinetud_published_dict(
|
||||
)
|
||||
# Evaluations incomplètes ou futures:
|
||||
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(
|
||||
args={"moduleimpl_id": modimpl["moduleimpl_id"]}
|
||||
)
|
||||
@ -327,7 +327,7 @@ def formsemestre_bulletinetud_published_dict(
|
||||
)
|
||||
|
||||
# --- 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)
|
||||
nbabs = AbsEtudSem.CountAbs()
|
||||
nbabsjust = AbsEtudSem.CountAbsJust()
|
||||
@ -336,7 +336,7 @@ def formsemestre_bulletinetud_published_dict(
|
||||
|
||||
# --- Decision Jury
|
||||
if (
|
||||
context.get_preference("bul_show_decision", formsemestre_id)
|
||||
sco_preferences.get_preference(context, "bul_show_decision", formsemestre_id)
|
||||
or xml_with_decisions
|
||||
):
|
||||
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
|
||||
@ -344,7 +344,7 @@ def formsemestre_bulletinetud_published_dict(
|
||||
etudid,
|
||||
formsemestre_id,
|
||||
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"])
|
||||
if dpv:
|
||||
@ -367,7 +367,7 @@ def formsemestre_bulletinetud_published_dict(
|
||||
d["decision_ue"] = []
|
||||
if decision[
|
||||
"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():
|
||||
ue = context.do_ue_list({"ue_id": ue_id})[0]
|
||||
d["decision_ue"].append(
|
||||
|
@ -90,7 +90,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
||||
formsemestre_id = self.infos["formsemestre_id"]
|
||||
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
|
||||
)
|
||||
|
||||
@ -106,7 +106,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
||||
|
||||
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 = (
|
||||
'<span class="bul_minmax" title="[min, max] promo">[%s, %s]</span>'
|
||||
% (I["moy_min"], I["moy_max"])
|
||||
@ -131,7 +131,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
||||
if mod["mod_moy_txt"] == "NI":
|
||||
continue # saute les modules où on n'est pas inscrit
|
||||
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>' % (
|
||||
mod["mod_rang_txt"],
|
||||
scu.fmt_note(mod["stats"]["min"]),
|
||||
@ -178,7 +178,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
||||
rowstyle = ""
|
||||
plusminus = minuslink #
|
||||
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
|
||||
hide = ""
|
||||
else:
|
||||
@ -208,7 +208,7 @@ class BulletinGeneratorLegacy(sco_bulletins_generator.BulletinGenerator):
|
||||
)
|
||||
|
||||
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 = (
|
||||
'%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()
|
||||
P = [] # elems pour gen. pdf
|
||||
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
|
||||
)
|
||||
|
||||
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"])
|
||||
else:
|
||||
minmax = ""
|
||||
@ -470,7 +470,7 @@ def _bulletin_pdf_table_legacy(context, I, version="long"):
|
||||
if mod["mod_moy_txt"] == "NI":
|
||||
continue # saute les modules où on n'est pas inscrit
|
||||
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>' % (
|
||||
mod["mod_rang_txt"],
|
||||
scu.fmt_note(mod["stats"]["min"]),
|
||||
@ -510,11 +510,11 @@ def _bulletin_pdf_table_legacy(context, I, version="long"):
|
||||
coef_ue = ""
|
||||
ue_descr = "(en cours, non prise en compte)"
|
||||
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"])
|
||||
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>' % (
|
||||
ue["cur_moy_ue_txt"],
|
||||
ue["min"],
|
||||
|
@ -83,10 +83,10 @@ def pdfassemblebulletins(
|
||||
return ""
|
||||
# Paramètres de mise en page
|
||||
margins = (
|
||||
context.get_preference("left_margin", formsemestre_id),
|
||||
context.get_preference("top_margin", formsemestre_id),
|
||||
context.get_preference("right_margin", formsemestre_id),
|
||||
context.get_preference("bottom_margin", formsemestre_id),
|
||||
sco_preferences.get_preference(context, "left_margin", formsemestre_id),
|
||||
sco_preferences.get_preference(context, "top_margin", formsemestre_id),
|
||||
sco_preferences.get_preference(context, "right_margin", formsemestre_id),
|
||||
sco_preferences.get_preference(context, "bottom_margin", formsemestre_id),
|
||||
)
|
||||
|
||||
report = cStringIO.StringIO() # in-memory document, no disk file
|
||||
@ -102,7 +102,7 @@ def pdfassemblebulletins(
|
||||
margins=margins,
|
||||
pagesbookmarks=pagesbookmarks,
|
||||
filigranne=filigranne,
|
||||
preferences=context.get_preferences(formsemestre_id),
|
||||
preferences=sco_preferences.SemPreferences(context, formsemestre_id),
|
||||
)
|
||||
)
|
||||
document.build(objects)
|
||||
@ -191,7 +191,7 @@ def get_formsemestre_bulletins_pdf(
|
||||
bookmarks[i] = scu.suppress_accents(nt.get_sexnom(etudid))
|
||||
i = i + 1
|
||||
#
|
||||
infos = {"DeptName": context.get_preference("DeptName", formsemestre_id)}
|
||||
infos = {"DeptName": sco_preferences.get_preference(context, "DeptName", formsemestre_id)}
|
||||
if REQUEST:
|
||||
server_name = REQUEST.BASE0
|
||||
else:
|
||||
@ -241,7 +241,7 @@ def get_etud_bulletins_pdf(context, etudid, REQUEST, version="selectedevals"):
|
||||
filigrannes[i] = filigranne
|
||||
bookmarks[i] = sem["session_id"] # eg RT-DUT-FI-S1-2015
|
||||
i = i + 1
|
||||
infos = {"DeptName": context.get_preference("DeptName")}
|
||||
infos = {"DeptName": sco_preferences.get_preference(context, "DeptName")}
|
||||
if REQUEST:
|
||||
server_name = REQUEST.BASE0
|
||||
else:
|
||||
|
@ -105,7 +105,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
|
||||
columns_ids=colkeys,
|
||||
pdf_table_style=pdf_style,
|
||||
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_ignore_default=True,
|
||||
html_with_td_classes=True,
|
||||
@ -286,7 +286,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
|
||||
context = self.context
|
||||
P = [] # elems pour générer table avec gen_table (liste de dicts)
|
||||
formsemestre_id = I["formsemestre_id"]
|
||||
prefs = context.get_preferences(formsemestre_id)
|
||||
prefs = sco_preferences.SemPreferences(context, formsemestre_id)
|
||||
|
||||
# Colonnes à afficher:
|
||||
with_col_abs = prefs["bul_show_abs_modules"]
|
||||
|
@ -76,7 +76,7 @@ class BulletinGeneratorUCAC(sco_bulletins_standard.BulletinGeneratorStandard):
|
||||
I = self.infos
|
||||
context = self.context
|
||||
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)
|
||||
|
||||
@ -195,7 +195,7 @@ class BulletinGeneratorUCAC(sco_bulletins_standard.BulletinGeneratorStandard):
|
||||
ue_type = None
|
||||
# --- UE capitalisée:
|
||||
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"])
|
||||
hidden = False
|
||||
cssstyle = ""
|
||||
|
@ -139,7 +139,7 @@ def make_xml_formsemestre_bulletinetud(
|
||||
mg = scu.fmt_note(nt.get_etud_moy_gen(etudid))
|
||||
if (
|
||||
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
|
||||
# notes en attente dans ce semestre
|
||||
@ -247,7 +247,7 @@ def make_xml_formsemestre_bulletinetud(
|
||||
moy=scu.fmt_note(modstat["moy"]),
|
||||
)
|
||||
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.rang(value=nt.mod_rangs[modimpl["moduleimpl_id"]][0][etudid])
|
||||
doc._pop()
|
||||
@ -283,7 +283,7 @@ def make_xml_formsemestre_bulletinetud(
|
||||
doc._pop()
|
||||
# Evaluations incomplètes ou futures:
|
||||
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(
|
||||
args={"moduleimpl_id": modimpl["moduleimpl_id"]}
|
||||
)
|
||||
@ -336,7 +336,7 @@ def make_xml_formsemestre_bulletinetud(
|
||||
doc._pop()
|
||||
doc._pop()
|
||||
# --- 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)
|
||||
nbabs = AbsEtudSem.CountAbs()
|
||||
nbabsjust = AbsEtudSem.CountAbsJust()
|
||||
@ -345,7 +345,7 @@ def make_xml_formsemestre_bulletinetud(
|
||||
doc._pop()
|
||||
# --- Decision Jury
|
||||
if (
|
||||
context.get_preference("bul_show_decision", formsemestre_id)
|
||||
sco_preferences.get_preference(context, "bul_show_decision", formsemestre_id)
|
||||
or xml_with_decisions
|
||||
):
|
||||
infos, dpv = sco_bulletins.etud_descr_situation_semestre(
|
||||
@ -353,7 +353,7 @@ def make_xml_formsemestre_bulletinetud(
|
||||
etudid,
|
||||
formsemestre_id,
|
||||
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"]))
|
||||
if dpv:
|
||||
@ -383,7 +383,7 @@ def make_xml_formsemestre_bulletinetud(
|
||||
|
||||
if decision[
|
||||
"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():
|
||||
ue = context.do_ue_list({"ue_id": ue_id})[0]
|
||||
doc._push()
|
||||
|
@ -124,7 +124,7 @@ def formsemestre_table_estim_cost(
|
||||
),
|
||||
rows=T,
|
||||
html_sortable=True,
|
||||
preferences=context.get_preferences(formsemestre_id),
|
||||
preferences=sco_preferences.SemPreferences(context, formsemestre_id),
|
||||
html_class="table_leftalign table_listegroupe",
|
||||
xls_before_table=[
|
||||
["%(titre)s %(num_sem)s %(modalitestr)s" % sem],
|
||||
@ -193,9 +193,12 @@ def formsemestre_estim_cost(
|
||||
coef_tp,
|
||||
)
|
||||
tab.html_before_table = h
|
||||
tab.base_url = (
|
||||
"%s?formsemestre_id=%s&n_group_td=%s&n_group_tp=%s&coef_tp=%s"
|
||||
% (REQUEST.URL0, formsemestre_id, n_group_td, n_group_tp, coef_tp)
|
||||
tab.base_url = "%s?formsemestre_id=%s&n_group_td=%s&n_group_tp=%s&coef_tp=%s" % (
|
||||
REQUEST.URL0,
|
||||
formsemestre_id,
|
||||
n_group_td,
|
||||
n_group_tp,
|
||||
coef_tp,
|
||||
)
|
||||
|
||||
return tab.make_page(context, format=format, REQUEST=REQUEST)
|
||||
|
@ -183,7 +183,9 @@ def table_debouche_etudids(context, etudids, keep_numeric=True):
|
||||
# html_col_width='4em',
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign table_listegroupe",
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
return tab
|
||||
|
||||
|
@ -118,7 +118,7 @@ def index_html(context, REQUEST=None, showcodes=0, showsemtable=0):
|
||||
"""<hr/>
|
||||
<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("</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):
|
||||
@ -239,7 +243,9 @@ def _sem_table_gt(context, sems, showcodes=False):
|
||||
html_sortable=True,
|
||||
# base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id),
|
||||
# caption='Maquettes enregistrées',
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
|
||||
return tab
|
||||
|
@ -188,7 +188,7 @@ def _send_db(context, REQUEST, ano_db_name):
|
||||
scu.SCO_DUMP_UP_URL,
|
||||
files=files,
|
||||
data={
|
||||
"dept_name": context.get_preference("DeptName"),
|
||||
"dept_name": sco_preferences.get_preference(context, "DeptName"),
|
||||
"serial": _get_scodoc_serial(context),
|
||||
"sco_user": str(REQUEST.AUTHENTICATED_USER),
|
||||
"sent_by": context.Users.user_info(str(REQUEST.AUTHENTICATED_USER))[
|
||||
|
@ -40,7 +40,9 @@ def matiere_create(context, ue_id=None, REQUEST=None):
|
||||
"""Creation d'une matiere"""
|
||||
UE = context.do_ue_list(args={"ue_id": ue_id})[0]
|
||||
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,
|
||||
"""<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
|
||||
@ -100,7 +102,9 @@ def matiere_delete(context, matiere_id=None, REQUEST=None):
|
||||
M = context.do_matiere_list(args={"matiere_id": matiere_id})[0]
|
||||
UE = context.do_ue_list(args={"ue_id": M["ue_id"]})[0]
|
||||
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,
|
||||
" 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_ids = [u["ue_id"] for u in ues]
|
||||
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,
|
||||
"""(formation %(acronyme)s, version %(version)s)</h2>""" % Fo,
|
||||
]
|
||||
@ -182,7 +188,9 @@ associé.
|
||||
dest_url = context.NotesURL() + "/ue_list?formation_id=" + U["formation_id"]
|
||||
|
||||
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:
|
||||
return REQUEST.RESPONSE.redirect(dest_url)
|
||||
else:
|
||||
@ -210,3 +218,18 @@ associé.
|
||||
context.do_matiere_edit(tf[2])
|
||||
|
||||
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
|
@ -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"])
|
||||
|
||||
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,
|
||||
" (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é)"
|
||||
)
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"],
|
||||
javascripts=[
|
||||
@ -479,21 +482,25 @@ Si vous souhaitez modifier cette formation (par exemple pour y ajouter un module
|
||||
for Mat in Matlist:
|
||||
if not parcours.UE_IS_MODULE:
|
||||
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(
|
||||
'<a class="stdlink" href="matiere_edit?matiere_id=%(matiere_id)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('<ul class="notes_module_list">')
|
||||
Modlist = context.do_module_list(args={"matiere_id": Mat["matiere_id"]})
|
||||
im = 0
|
||||
for Mod in Modlist:
|
||||
Mod["nb_moduleimpls"] = sco_edit_module.module_count_moduleimpls(context,
|
||||
Mod["module_id"]
|
||||
Mod["nb_moduleimpls"] = sco_edit_module.module_count_moduleimpls(
|
||||
context, Mod["module_id"]
|
||||
)
|
||||
klass = "notes_module_list"
|
||||
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("</span>")
|
||||
|
||||
mod_editable = (
|
||||
editable # and not sco_edit_module.module_is_locked(context, Mod['module_id'])
|
||||
)
|
||||
mod_editable = editable # and not sco_edit_module.module_is_locked(context, Mod['module_id'])
|
||||
if mod_editable:
|
||||
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">'
|
||||
@ -812,8 +817,8 @@ def formation_table_recap(context, formation_id, format="html", REQUEST=None):
|
||||
for Mat in Matlist:
|
||||
Modlist = context.do_module_list(args={"matiere_id": Mat["matiere_id"]})
|
||||
for Mod in Modlist:
|
||||
Mod["nb_moduleimpls"] = sco_edit_module.module_count_moduleimpls(context,
|
||||
Mod["module_id"]
|
||||
Mod["nb_moduleimpls"] = sco_edit_module.module_count_moduleimpls(
|
||||
context, Mod["module_id"]
|
||||
)
|
||||
#
|
||||
T.append(
|
||||
@ -876,7 +881,9 @@ def formation_table_recap(context, formation_id, format="html", REQUEST=None):
|
||||
page_title=title,
|
||||
html_title="<h2>" + title + "</h2>",
|
||||
pdf_title=title,
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
return tab.make_page(context, format=format, REQUEST=REQUEST)
|
||||
|
||||
|
@ -52,7 +52,7 @@ def formsemestre_get_ics_url(context, sem):
|
||||
Par exemple:
|
||||
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:
|
||||
return None
|
||||
try:
|
||||
@ -98,7 +98,7 @@ def get_edt_transcodage_groups(context, formsemestre_id):
|
||||
edt2sco = {}
|
||||
sco2edt = {}
|
||||
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:
|
||||
return edt2sco, sco2edt, msg
|
||||
|
||||
|
@ -76,7 +76,9 @@ def apo_semset_maq_status(
|
||||
block_export_res_modules = int(block_export_res_modules)
|
||||
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)
|
||||
|
||||
@ -98,7 +100,8 @@ def apo_semset_maq_status(
|
||||
ok_for_export &= semset["jury_ok"]
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Export Apogée",
|
||||
javascripts=["js/apo_semset_maq_status.js"],
|
||||
@ -474,7 +477,9 @@ def table_apo_csv_list(context, semset, REQUEST=None):
|
||||
html_sortable=True,
|
||||
# base_url = '%s?formsemestre_id=%s' % (REQUEST.URL0, formsemestre_id),
|
||||
# caption='Maquettes enregistrées',
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
|
||||
return tab
|
||||
@ -559,8 +564,12 @@ def _view_etuds_page(
|
||||
etuds.sort(key=lambda x: (x["nom"], x["prenom"]))
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
REQUEST, page_title=title, init_qtip=True, javascripts=["js/etud_info.js"]
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=title,
|
||||
init_qtip=True,
|
||||
javascripts=["js/etud_info.js"],
|
||||
),
|
||||
"<h2>%s</h2>" % title,
|
||||
]
|
||||
@ -579,7 +588,9 @@ def _view_etuds_page(
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
filename="students_apo",
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
if format != "html":
|
||||
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)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Maquette Apogée enregistrée pour %s" % etape_apo,
|
||||
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
|
||||
etuds = apo_data.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
|
||||
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),
|
||||
filename="students_" + etape_apo,
|
||||
caption="Etudiants Apogée en " + etape_apo,
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
|
||||
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
|
||||
# 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
|
||||
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_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)
|
||||
@ -835,7 +855,7 @@ def apo_csv_export_results(
|
||||
)
|
||||
|
||||
basename = (
|
||||
context.get_preference("DeptName")
|
||||
sco_preferences.get_preference(context, "DeptName")
|
||||
+ str(annee_scolaire)
|
||||
+ "-%s-" % periode
|
||||
+ "-".join(etapes_apo)
|
||||
|
@ -494,8 +494,12 @@ def formsemestre_evaluations_cal(context, formsemestre_id, REQUEST=None):
|
||||
)
|
||||
|
||||
H = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
REQUEST, "Evaluations du semestre", sem, cssstyles=["css/calabs.css"]
|
||||
html_sco_header.html_sem_header(
|
||||
context,
|
||||
REQUEST,
|
||||
"Evaluations du semestre",
|
||||
sem,
|
||||
cssstyles=["css/calabs.css"],
|
||||
),
|
||||
'<div class="cal_evaluations">',
|
||||
CalHTML,
|
||||
@ -622,7 +626,7 @@ def formsemestre_evaluations_delai_correction(
|
||||
html_sortable=True,
|
||||
html_title="<h2>Correction des évaluations du semestre</h2>",
|
||||
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),
|
||||
origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "",
|
||||
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"]
|
||||
if tf[0] == 0:
|
||||
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:
|
||||
return REQUEST.RESPONSE.redirect(dest_url)
|
||||
else:
|
||||
|
@ -571,7 +571,7 @@ def Excel_feuille_listeappel(
|
||||
(
|
||||
"%s %s (%s - %s)"
|
||||
% (
|
||||
context.get_preference("DeptName", formsemestre_id),
|
||||
sco_preferences.get_preference(context, "DeptName", formsemestre_id),
|
||||
notesdb.unquote(sem["titre_num"]),
|
||||
sem["date_debut"],
|
||||
sem["date_fin"],
|
||||
|
@ -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() + "",
|
||||
html_class="table_leftalign",
|
||||
html_sortable=True,
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
return tab, semlist
|
||||
|
||||
@ -279,7 +281,8 @@ def scodoc_table_results(
|
||||
info_sems.append("</ul>")
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Export résultats",
|
||||
init_qtip=True,
|
||||
|
@ -88,7 +88,9 @@ def form_search_etud(
|
||||
|
||||
if add_headers:
|
||||
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)
|
||||
+ 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)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
page_title="Recherche d'un étudiant",
|
||||
no_side_bar=True,
|
||||
init_qtip=True,
|
||||
@ -158,7 +161,9 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
|
||||
rows=etuds,
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
H.append(tab.html())
|
||||
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>")
|
||||
|
||||
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)
|
||||
+ html_sco_header.standard_html_footer()
|
||||
)
|
||||
|
@ -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),
|
||||
page_title=title,
|
||||
pdf_title=title,
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
|
@ -543,9 +543,13 @@ def table_formsemestres(
|
||||
"etapes_apo_str": "Apo.",
|
||||
}
|
||||
if sems:
|
||||
preferences = context.get_preferences(sems[0]["formsemestre_id"])
|
||||
preferences = sco_preferences.SemPreferences(
|
||||
context, sems[0]["formsemestre_id"]
|
||||
)
|
||||
else:
|
||||
preferences = context.get_preferences()
|
||||
preferences = sco_preferences.SemPreferences(
|
||||
context,
|
||||
)
|
||||
tab = GenTable(
|
||||
columns_ids=columns_ids,
|
||||
rows=sems,
|
||||
|
@ -75,7 +75,8 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
|
||||
# portage from dtml
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
H = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
html_sco_header.html_sem_header(
|
||||
context,
|
||||
REQUEST,
|
||||
"Modification du semestre",
|
||||
sem,
|
||||
@ -383,7 +384,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
||||
"size": 32,
|
||||
"title": "Element(s) Apogée:",
|
||||
"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"
|
||||
),
|
||||
},
|
||||
@ -396,7 +397,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
||||
"size": 32,
|
||||
"title": "Element(s) Apogée:",
|
||||
"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"
|
||||
),
|
||||
},
|
||||
@ -642,7 +643,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
||||
# check dates
|
||||
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>'
|
||||
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)]
|
||||
):
|
||||
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 = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
html_sco_header.html_sem_header(
|
||||
context,
|
||||
REQUEST,
|
||||
"Copie du semestre",
|
||||
sem,
|
||||
@ -1035,7 +1037,7 @@ def do_formsemestre_clone(
|
||||
# NB: don't copy notes_formsemestre_custommenu (usually specific)
|
||||
|
||||
# 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:
|
||||
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)
|
||||
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
|
||||
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>
|
||||
<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>
|
||||
@ -1404,7 +1408,7 @@ def formsemestre_edit_options(context, formsemestre_id, target_url=None, REQUEST
|
||||
ok, err = context._check_access_diretud(formsemestre_id, REQUEST)
|
||||
if not ok:
|
||||
return err
|
||||
return context.get_preferences(formsemestre_id).edit(
|
||||
return sco_preferences.SemPreferences(context, formsemestre_id).edit(
|
||||
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>
|
||||
"""
|
||||
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)
|
||||
for ue in ues:
|
||||
@ -1633,8 +1642,8 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
|
||||
formsemestre_id=formsemestre_id
|
||||
) # > modif coef UE cap (modifs notes de _certains_ etudiants)
|
||||
|
||||
header = html_sco_header.html_sem_header(context,
|
||||
REQUEST, "Coefficients des UE du semestre", sem
|
||||
header = html_sco_header.html_sem_header(
|
||||
context, REQUEST, "Coefficients des UE du semestre", sem
|
||||
)
|
||||
return (
|
||||
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]
|
||||
# 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:
|
||||
ImputationDept = context.get_preference("DeptName")
|
||||
ImputationDept = sco_preferences.get_preference(context, "DeptName")
|
||||
ImputationDept = ImputationDept.upper()
|
||||
parcours_type = parcours.NAME
|
||||
modalite = sem["modalite"]
|
||||
|
@ -261,7 +261,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"title": "Synchroniser avec étape Apogée",
|
||||
"url": "formsemestre_synchro_etuds?formsemestre_id=" + formsemestre_id,
|
||||
"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"),
|
||||
},
|
||||
{
|
||||
@ -288,7 +288,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"url": "formsemestre_import_etud_admission?formsemestre_id="
|
||||
+ formsemestre_id,
|
||||
"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",
|
||||
@ -518,7 +518,7 @@ def fill_formsemestre(context, sem, REQUEST=None):
|
||||
)
|
||||
else:
|
||||
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":
|
||||
eyeicon = scu.icontag("hide_img", border="0", title="Bulletins NON publiés")
|
||||
else:
|
||||
@ -568,7 +568,7 @@ def formsemestre_description_table(
|
||||
nt = context._getNotesCache().get_NotesTable(
|
||||
context, formsemestre_id
|
||||
) # > 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]
|
||||
parcours = sco_codes_parcours.get_parcours_from_code(F["type_parcours"])
|
||||
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}
|
||||
R.append(sums)
|
||||
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 += ["Inscrits", "Responsable", "Enseignants"]
|
||||
if with_evals:
|
||||
@ -687,11 +687,11 @@ def formsemestre_description_table(
|
||||
base_url="%s?formsemestre_id=%s&with_evals=%s"
|
||||
% (REQUEST.URL0, formsemestre_id, with_evals),
|
||||
page_title=title,
|
||||
html_title=html_sco_header.html_sem_header(context,
|
||||
REQUEST, "Description du semestre", sem, with_page_header=False
|
||||
html_title=html_sco_header.html_sem_header(
|
||||
context, REQUEST, "Description du semestre", sem, with_page_header=False
|
||||
),
|
||||
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 "
|
||||
|
||||
H = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
REQUEST, page_title, sem, with_page_header=False, with_h2=False
|
||||
html_sco_header.html_sem_header(
|
||||
context, REQUEST, page_title, sem, with_page_header=False, with_h2=False
|
||||
),
|
||||
"""<table>
|
||||
<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(
|
||||
'<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>')
|
||||
|
||||
return "".join(H)
|
||||
@ -1007,7 +1007,7 @@ def formsemestre_status(context, formsemestre_id=None, REQUEST=None):
|
||||
prev_ue_id = ue["ue_id"]
|
||||
acronyme = ue["acronyme"]
|
||||
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)
|
||||
H.append(
|
||||
"""<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("</table></p>")
|
||||
if context.get_preference("use_ue_coefs", formsemestre_id):
|
||||
if sco_preferences.get_preference(context, "use_ue_coefs", formsemestre_id):
|
||||
H.append(
|
||||
"""
|
||||
<p class="infop">utilise les coefficients d'UE pour calculer la moyenne générale.</p>
|
||||
|
@ -656,7 +656,7 @@ def formsemestre_recap_parcours_table(
|
||||
H.append("</tr>")
|
||||
# 3eme ligne: ECTS
|
||||
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
|
||||
):
|
||||
etud_moy_infos = nt.get_etud_moy_infos(etudid)
|
||||
|
@ -102,8 +102,12 @@ def groups_view(
|
||||
)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
REQUEST, javascripts=JAVASCRIPTS, cssstyles=CSSSTYLES, init_qtip=True
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
javascripts=JAVASCRIPTS,
|
||||
cssstyles=CSSSTYLES,
|
||||
init_qtip=True,
|
||||
)
|
||||
]
|
||||
# Menu choix groupe
|
||||
@ -578,7 +582,7 @@ def groups_table(
|
||||
else:
|
||||
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(
|
||||
rows=groups_infos.members,
|
||||
columns_ids=columns_ids,
|
||||
@ -979,7 +983,7 @@ def export_groups_as_moodle_csv(context, formsemestre_id=None, REQUEST=None):
|
||||
elts.append(group_name)
|
||||
T.append({"email": etud["email"], "semestre_groupe": "-".join(elts)})
|
||||
# Make table
|
||||
prefs = context.get_preferences(formsemestre_id)
|
||||
prefs = sco_preferences.SemPreferences(context, formsemestre_id)
|
||||
tab = GenTable(
|
||||
rows=T,
|
||||
columns_ids=("email", "semestre_groupe"),
|
||||
|
@ -227,7 +227,7 @@ Pour plus d'informations sur ce logiciel, voir %s
|
||||
msg["Subject"] = Header("Mot de passe ScoDoc", scu.SCO_ENCODING)
|
||||
else:
|
||||
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.epilogue = ""
|
||||
txt = MIMEText(txt, "plain", scu.SCO_ENCODING)
|
||||
|
@ -278,7 +278,9 @@ def formsemestre_inscr_passage(
|
||||
# -- check lock
|
||||
if sem["etat"] != "1":
|
||||
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)
|
||||
H = [header]
|
||||
if type(etuds) == type(""):
|
||||
@ -412,8 +414,8 @@ def build_page(
|
||||
inscrit_groupes_checked = ""
|
||||
|
||||
H = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
REQUEST, "Passages dans le semestre", sem, with_page_header=False
|
||||
html_sco_header.html_sem_header(
|
||||
context, REQUEST, "Passages dans le semestre", sem, with_page_header=False
|
||||
),
|
||||
"""<form method="post" action="%s">""" % REQUEST.URL0,
|
||||
"""<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,
|
||||
rows=etuds,
|
||||
caption="%(title)s. %(help)s" % src_cat["infos"],
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
return tab.excel()
|
||||
|
@ -301,9 +301,9 @@ def _make_table_notes(
|
||||
grc = inscr["etat"]
|
||||
|
||||
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"]
|
||||
elif context.get_preference("anonymous_lst_code") == "NIP":
|
||||
elif sco_preferences.get_preference(context, "anonymous_lst_code") == "NIP":
|
||||
code = etud["code_nip"]
|
||||
if not code: # laisser le code vide n'aurait aucun sens, prenons l'etudid
|
||||
code = etudid
|
||||
@ -472,7 +472,7 @@ def _make_table_notes(
|
||||
html_title=html_title,
|
||||
pdf_title=pdf_title,
|
||||
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
|
||||
)
|
||||
|
||||
@ -775,7 +775,9 @@ def evaluation_check_absences_html(
|
||||
|
||||
if with_header:
|
||||
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(
|
||||
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 !"""
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
H = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
REQUEST, "Vérification absences aux évaluations de ce semestre", sem
|
||||
html_sco_header.html_sem_header(
|
||||
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.
|
||||
Sont listés tous les modules avec des évaluations.<br/>Aucune action n'est effectuée:
|
||||
|
@ -54,7 +54,11 @@ def formsemestre_table_etuds_lycees(
|
||||
primostr = "du "
|
||||
title = "Lycées des étudiants %ssemestre " % primostr + sem["titreannee"]
|
||||
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,
|
||||
False,
|
||||
"Lycées de TOUS les étudiants",
|
||||
context.get_preferences(),
|
||||
sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
no_links=True,
|
||||
)
|
||||
tab.base_url = REQUEST.URL0
|
||||
@ -78,7 +84,8 @@ def scodoc_table_etuds_lycees(context, format="html", REQUEST=None):
|
||||
if format != "html":
|
||||
return t
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=tab.page_title,
|
||||
init_google_maps=True,
|
||||
@ -194,7 +201,8 @@ def formsemestre_etuds_lycees(
|
||||
)
|
||||
]
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=tab.page_title,
|
||||
init_google_maps=True,
|
||||
|
@ -254,7 +254,7 @@ def _send_news_by_mail(context, n):
|
||||
"""Notify by email"""
|
||||
infos = _get_formsemestre_infos_from_news(context, n)
|
||||
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 = [x.strip() for x in destinations.split(",")]
|
||||
destinations = [x for x in destinations if x]
|
||||
|
@ -344,7 +344,7 @@ def copy_portal_photo_to_fs(context, etud, REQUEST=None):
|
||||
url = photo_portal_url(context, etud)
|
||||
if not url:
|
||||
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
|
||||
try:
|
||||
log("copy_portal_photo_to_fs: getting %s" % url)
|
||||
|
@ -309,7 +309,7 @@ def do_placement(context, REQUEST):
|
||||
listetud.append((nom, prenom))
|
||||
random.shuffle(listetud)
|
||||
|
||||
sem_preferences = context.get_preferences()
|
||||
sem_preferences = sco_preferences.SemPreferences(context)
|
||||
space = sem_preferences.get("feuille_placement_emargement")
|
||||
maxlines = sem_preferences.get("feuille_placement_positions")
|
||||
|
||||
@ -386,7 +386,7 @@ def do_placement(context, REQUEST):
|
||||
+ "",
|
||||
pdf_title=pdf_title,
|
||||
# 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
|
||||
)
|
||||
t = tab.make_page(
|
||||
|
@ -55,7 +55,7 @@ class PortalInterface:
|
||||
|
||||
def get_portal_url(self, context):
|
||||
"URL of portal"
|
||||
portal_url = context.get_preference("portal_url")
|
||||
portal_url = sco_preferences.get_preference(context, "portal_url")
|
||||
if not self.warning:
|
||||
if portal_url:
|
||||
log("Portal URL=%s" % portal_url)
|
||||
@ -66,7 +66,7 @@ class PortalInterface:
|
||||
|
||||
def get_etapes_url(self, context):
|
||||
"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:
|
||||
# Default:
|
||||
portal_url = self.get_portal_url(context)
|
||||
@ -81,7 +81,7 @@ class PortalInterface:
|
||||
|
||||
def get_etud_url(self, context):
|
||||
"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:
|
||||
# Default:
|
||||
portal_url = self.get_portal_url(context)
|
||||
@ -96,7 +96,7 @@ class PortalInterface:
|
||||
|
||||
def get_photo_url(self, context):
|
||||
"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:
|
||||
# Default:
|
||||
portal_url = self.get_portal_url(context)
|
||||
@ -111,7 +111,7 @@ class PortalInterface:
|
||||
|
||||
def get_maquette_url(self, context):
|
||||
"""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:
|
||||
# Default:
|
||||
portal_url = self.get_portal_url(context)
|
||||
@ -122,7 +122,7 @@ class PortalInterface:
|
||||
|
||||
def get_portal_api_version(self, context):
|
||||
"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:
|
||||
# Default:
|
||||
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)
|
||||
if not etud_url:
|
||||
return []
|
||||
portal_timeout = context.get_preference("portal_timeout")
|
||||
portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
|
||||
if api_ver > 1:
|
||||
req = (
|
||||
etud_url
|
||||
@ -203,7 +203,7 @@ def query_apogee_portal(context, **args):
|
||||
# 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
|
||||
return []
|
||||
portal_timeout = context.get_preference("portal_timeout")
|
||||
portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
|
||||
req = etud_url + "?" + urllib.urlencode(args.items())
|
||||
doc = scu.query_portal(req, timeout=portal_timeout) # sco_utils
|
||||
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)
|
||||
if not etud_url:
|
||||
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),))
|
||||
doc = scu.query_portal(req, timeout=portal_timeout)
|
||||
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
|
||||
"""
|
||||
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
|
||||
dom = xml.dom.minidom.parseString(doc)
|
||||
infos = {}
|
||||
@ -384,7 +384,7 @@ def get_etapes_apogee(context):
|
||||
etapes_url = get_etapes_url(context)
|
||||
infos = {}
|
||||
if etapes_url:
|
||||
portal_timeout = context.get_preference("portal_timeout")
|
||||
portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
|
||||
log(
|
||||
"get_etapes_apogee: requesting '%s' with timeout=%s"
|
||||
% (etapes_url, portal_timeout)
|
||||
@ -432,9 +432,9 @@ def get_etapes_apogee_dept(context):
|
||||
|
||||
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:
|
||||
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)
|
||||
else:
|
||||
portal_dept_name = ""
|
||||
@ -558,7 +558,7 @@ def get_maquette_apogee(context, etape="", annee_scolaire=""):
|
||||
maquette_url = get_maquette_url(context)
|
||||
if not maquette_url:
|
||||
return None
|
||||
portal_timeout = context.get_preference("portal_timeout")
|
||||
portal_timeout = sco_preferences.get_preference(context, "portal_timeout")
|
||||
req = (
|
||||
maquette_url
|
||||
+ "?"
|
||||
|
@ -203,7 +203,7 @@ def formsemestre_poursuite_report(
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign table_listegroupe",
|
||||
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"])
|
||||
|
||||
|
@ -79,18 +79,18 @@ des tuples (name, value, formsemestre_id).
|
||||
Si formsemestre_id est NULL, la valeur concerne tous les semestres,
|
||||
sinon, elle ne concerne que le semestre indiqué.
|
||||
|
||||
* Utilisation dans ScoDoc
|
||||
* Utilisation dans ScoDoc7
|
||||
- lire une valeur:
|
||||
context.get_preference(name, formsemestre_id)
|
||||
get_preference(context, name, formsemestre_id)
|
||||
nb: les valeurs sont des chaines, sauf:
|
||||
. si le type est spécfié (float ou int)
|
||||
. les boolcheckbox qui sont des entiers 0 ou 1
|
||||
- avoir un mapping (read only) de toutes les valeurs:
|
||||
context.get_preferences(formsemestre_id)
|
||||
sco_preferences.SemPreferences(context,formsemestre_id)
|
||||
- editer les preferences globales:
|
||||
sco_preferences.get_base_preferences(self).edit(REQUEST=REQUEST)
|
||||
- editer les preferences d'un semestre:
|
||||
sem_preferences(context,formsemestre_id).edit()
|
||||
SemPreferences(context,formsemestre_id).edit()
|
||||
|
||||
* Implémentation: sco_preferences.py
|
||||
|
||||
@ -109,7 +109,7 @@ Une instance unique par site (département, repéré par URL).
|
||||
.deleteformsemestre_id, name)
|
||||
.edit() (HTML dialog)
|
||||
|
||||
class sem_preferences(context,formsemestre_id)
|
||||
class SemPreferences(context,formsemestre_id)
|
||||
Une instance par semestre, et une instance pour prefs globales.
|
||||
L'attribut .base_prefs point sur sco_base_preferences.
|
||||
.__getitem__ [name]
|
||||
@ -1956,7 +1956,9 @@ class sco_base_preferences:
|
||||
submitlabel="Enregistrer les modifications",
|
||||
)
|
||||
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:
|
||||
return REQUEST.RESPONSE.redirect(self.context.ScoURL()) # cancel
|
||||
else:
|
||||
@ -1979,7 +1981,7 @@ def get_base_preferences(context):
|
||||
return _SCO_BASE_PREFERENCES[u]
|
||||
|
||||
|
||||
class sem_preferences:
|
||||
class SemPreferences:
|
||||
def __init__(self, context, formsemestre_id=None):
|
||||
self.context = context
|
||||
self.formsemestre_id = formsemestre_id
|
||||
@ -2065,7 +2067,9 @@ function set_global_pref(el, pref_name) {
|
||||
+ "/formsemestre_status?formsemestre_id=%s" % self.formsemestre_id
|
||||
)
|
||||
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:
|
||||
return REQUEST.RESPONSE.redirect(
|
||||
dest_url + "&head_message=Annulé"
|
||||
@ -2183,6 +2187,13 @@ def _build_form(self, categories=[], global_edit=False):
|
||||
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):
|
||||
""" Liste les preferences en MarkDown, pour la documentation"""
|
||||
|
@ -161,9 +161,9 @@ def feuille_preparation_jury(context, formsemestre_id, REQUEST):
|
||||
L.append([]) # empty line
|
||||
|
||||
titles = ["Rang"]
|
||||
if context.get_preference("prepa_jury_nip"):
|
||||
if sco_preferences.get_preference(context, "prepa_jury_nip"):
|
||||
titles.append("NIP")
|
||||
if context.get_preference("prepa_jury_ine"):
|
||||
if sco_preferences.get_preference(context, "prepa_jury_ine"):
|
||||
titles.append("INE")
|
||||
titles += [
|
||||
"etudid",
|
||||
@ -223,9 +223,9 @@ def feuille_preparation_jury(context, formsemestre_id, REQUEST):
|
||||
for etudid in etudids:
|
||||
etud = nt.identdict[etudid]
|
||||
l = [str(i)]
|
||||
if context.get_preference("prepa_jury_nip"):
|
||||
if sco_preferences.get_preference(context, "prepa_jury_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 += [
|
||||
etudid,
|
||||
|
@ -412,10 +412,10 @@ def pvjury_table(
|
||||
columns_ids += ["prev_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 += ["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"]
|
||||
|
||||
# XXX if not dpv["semestre_non_terminal"]:
|
||||
@ -448,11 +448,11 @@ def pvjury_table(
|
||||
}
|
||||
if with_paragraph_nom:
|
||||
cell_style = styles.ParagraphStyle({})
|
||||
cell_style.fontSize = context.get_preference(
|
||||
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.leading = 1.0 * context.get_preference(
|
||||
cell_style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id)
|
||||
cell_style.leading = 1.0 * sco_preferences.get_preference(context,
|
||||
"SCOLAR_FONT_SIZE", formsemestre_id
|
||||
) # vertical space
|
||||
i = e["identite"]
|
||||
@ -528,7 +528,7 @@ def formsemestre_pvjury(
|
||||
caption="Décisions jury pour " + sem["titreannee"],
|
||||
html_class="table_leftalign",
|
||||
html_sortable=True,
|
||||
preferences=context.get_preferences(formsemestre_id),
|
||||
preferences=sco_preferences.SemPreferences(context, formsemestre_id),
|
||||
)
|
||||
if format != "html":
|
||||
return tab.make_page(
|
||||
@ -540,7 +540,8 @@ def formsemestre_pvjury(
|
||||
)
|
||||
tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id)
|
||||
H = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
html_sco_header.html_sem_header(
|
||||
context,
|
||||
REQUEST,
|
||||
"Décisions du jury pour le semestre",
|
||||
sem,
|
||||
@ -589,7 +590,7 @@ def formsemestre_pvjury(
|
||||
columns_ids=("code", "count", "expl"),
|
||||
html_class="table_leftalign",
|
||||
html_sortable=True,
|
||||
preferences=context.get_preferences(formsemestre_id),
|
||||
preferences=sco_preferences.SemPreferences(context, formsemestre_id),
|
||||
).html()
|
||||
)
|
||||
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]
|
||||
|
||||
H = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
html_sco_header.html_sem_header(
|
||||
context,
|
||||
REQUEST,
|
||||
"Edition du PV de jury %s" % etuddescr,
|
||||
sem=sem,
|
||||
@ -811,7 +813,8 @@ def formsemestre_lettres_individuelles(
|
||||
etudids = [m["etudid"] for m in groups_infos.members]
|
||||
|
||||
H = [
|
||||
html_sco_header.html_sem_header(context,
|
||||
html_sco_header.html_sem_header(
|
||||
context,
|
||||
REQUEST,
|
||||
"Edition des lettres individuelles",
|
||||
sem=sem,
|
||||
|
@ -348,7 +348,7 @@ def pdf_lettres_individuelles(
|
||||
context.fillEtudsInfo(etuds)
|
||||
#
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
prefs = context.get_preferences(formsemestre_id)
|
||||
prefs = sco_preferences.SemPreferences(context, formsemestre_id)
|
||||
params = {
|
||||
"date_jury": date_jury,
|
||||
"date_commission": date_commission,
|
||||
@ -358,7 +358,7 @@ def pdf_lettres_individuelles(
|
||||
}
|
||||
# copie preferences
|
||||
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 = {}
|
||||
objects = [] # list of PLATYPUS objects
|
||||
@ -429,7 +429,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
|
||||
objects = []
|
||||
style = reportlab.lib.styles.ParagraphStyle({})
|
||||
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.alignment = TA_JUSTIFY
|
||||
|
||||
@ -443,7 +443,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
|
||||
else:
|
||||
params["decisions_ue_descr_plural"] = ""
|
||||
|
||||
params["INSTITUTION_CITY"] = context.get_preference(
|
||||
params["INSTITUTION_CITY"] = sco_preferences.get_preference(context,
|
||||
"INSTITUTION_CITY", formsemestre_id
|
||||
)
|
||||
if decision["prev_decision_sem"]:
|
||||
@ -512,7 +512,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
|
||||
# Corps de la lettre:
|
||||
objects += sco_bulletins_pdf.process_field(
|
||||
context,
|
||||
context.get_preference("PV_LETTER_TEMPLATE", sem["formsemestre_id"]),
|
||||
sco_preferences.get_preference(context, "PV_LETTER_TEMPLATE", sem["formsemestre_id"]),
|
||||
params,
|
||||
style,
|
||||
suppress_empty_pars=True,
|
||||
@ -523,7 +523,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
|
||||
# chef de département.
|
||||
if Se.semestre_non_terminal:
|
||||
sig = (
|
||||
context.get_preference("PV_LETTER_PASSAGE_SIGNATURE", formsemestre_id)
|
||||
sco_preferences.get_preference(context, "PV_LETTER_PASSAGE_SIGNATURE", formsemestre_id)
|
||||
% params
|
||||
)
|
||||
sig = _simulate_br(sig, '<para leftindent="%(htab1)s">')
|
||||
@ -538,7 +538,7 @@ def pdf_lettre_individuelle(sem, decision, etud, params, signature=None, context
|
||||
)
|
||||
else:
|
||||
sig = (
|
||||
context.get_preference("PV_LETTER_DIPLOMA_SIGNATURE", formsemestre_id)
|
||||
sco_preferences.get_preference(context, "PV_LETTER_DIPLOMA_SIGNATURE", formsemestre_id)
|
||||
% params
|
||||
)
|
||||
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)
|
||||
width, height = im.size
|
||||
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)
|
||||
|
||||
style = styles.ParagraphStyle({})
|
||||
style.leading = 1.0 * context.get_preference(
|
||||
style.leading = 1.0 * sco_preferences.get_preference(context,
|
||||
"SCOLAR_FONT_SIZE", formsemestre_id
|
||||
) # vertical space
|
||||
style.leftIndent = leftindent
|
||||
@ -666,7 +666,7 @@ def pvjury_pdf(
|
||||
author="%s %s (E. Viennet)" % (VERSION.SCONAME, VERSION.SCOVERSION),
|
||||
title=SU("PV du jury de %s" % sem["titre_num"]),
|
||||
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.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.alignment = TA_JUSTIFY
|
||||
|
||||
indent = 1 * cm
|
||||
bulletStyle = reportlab.lib.styles.ParagraphStyle({})
|
||||
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.alignment = TA_JUSTIFY
|
||||
bulletStyle.firstLineIndent = 0
|
||||
@ -727,7 +727,7 @@ def _pvjury_pdf_type(
|
||||
"""
|
||||
% (
|
||||
titre_jury,
|
||||
context.get_preference("DeptName", formsemestre_id),
|
||||
sco_preferences.get_preference(context, "DeptName", formsemestre_id),
|
||||
sem["anneescolaire"],
|
||||
),
|
||||
style,
|
||||
@ -745,7 +745,7 @@ def _pvjury_pdf_type(
|
||||
objects += sco_pdf.makeParas(
|
||||
"""<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(
|
||||
"""<para align="center">VDI et Code: %s</para>""" % (VDICode or ""), style
|
||||
)
|
||||
@ -757,11 +757,11 @@ def _pvjury_pdf_type(
|
||||
|
||||
objects += sco_pdf.makeParas(
|
||||
"<para>"
|
||||
+ context.get_preference("PV_INTRO", formsemestre_id)
|
||||
+ sco_preferences.get_preference(context, "PV_INTRO", formsemestre_id)
|
||||
% {
|
||||
"Decnum": numeroArrete,
|
||||
"VDICode": VDICode,
|
||||
"UnivName": context.get_preference("UnivName", formsemestre_id),
|
||||
"UnivName": sco_preferences.get_preference(context, "UnivName", formsemestre_id),
|
||||
"Type": titre_jury,
|
||||
"Date": date_commission, # deprecated
|
||||
"date_commission": date_commission,
|
||||
@ -787,9 +787,9 @@ def _pvjury_pdf_type(
|
||||
titles = [titles.get(x, "") for x in columns_ids]
|
||||
# Make a new cell style and put all cells in paragraphs
|
||||
cell_style = styles.ParagraphStyle({})
|
||||
cell_style.fontSize = context.get_preference("SCOLAR_FONT_SIZE", formsemestre_id)
|
||||
cell_style.fontName = context.get_preference("PV_FONTNAME", formsemestre_id)
|
||||
cell_style.leading = 1.0 * context.get_preference(
|
||||
cell_style.fontSize = sco_preferences.get_preference(context, "SCOLAR_FONT_SIZE", formsemestre_id)
|
||||
cell_style.fontName = sco_preferences.get_preference(context, "PV_FONTNAME", formsemestre_id)
|
||||
cell_style.leading = 1.0 * sco_preferences.get_preference(context,
|
||||
"SCOLAR_FONT_SIZE", formsemestre_id
|
||||
) # vertical space
|
||||
LINEWIDTH = 0.5
|
||||
@ -798,7 +798,7 @@ def _pvjury_pdf_type(
|
||||
"FONTNAME",
|
||||
(0, 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)),
|
||||
("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]
|
||||
if dpv["has_prev"]:
|
||||
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]
|
||||
objects.append(Table(Pt, repeatRows=1, colWidths=widths, style=table_style))
|
||||
|
||||
@ -826,8 +826,8 @@ def _pvjury_pdf_type(
|
||||
"""<para spaceBefore="10mm" align="right">
|
||||
%s, %s</para>"""
|
||||
% (
|
||||
context.get_preference("DirectorName", formsemestre_id) or "",
|
||||
context.get_preference("DirectorTitle", formsemestre_id) or "",
|
||||
sco_preferences.get_preference(context, "DirectorName", formsemestre_id) or "",
|
||||
sco_preferences.get_preference(context, "DirectorTitle", formsemestre_id) or "",
|
||||
),
|
||||
style,
|
||||
)
|
||||
@ -848,7 +848,7 @@ def _pvjury_pdf_type(
|
||||
"FONTNAME",
|
||||
(0, 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)),
|
||||
("LINEABOVE", (0, 0), (-1, -1), LINEWIDTH, Color(0, 0, 0)),
|
||||
|
@ -75,7 +75,7 @@ def formsemestre_recapcomplet(
|
||||
) # cache les colonnes des modules
|
||||
pref_override = int(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:
|
||||
hidebac = int(hidebac)
|
||||
xml_with_decisions = int(xml_with_decisions)
|
||||
@ -177,7 +177,7 @@ def formsemestre_recapcomplet(
|
||||
% formsemestre_id
|
||||
)
|
||||
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(
|
||||
"""
|
||||
<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":
|
||||
l.append("")
|
||||
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"])
|
||||
else:
|
||||
l.append("")
|
||||
|
@ -192,7 +192,7 @@ def _results_by_category(
|
||||
bottom_titles=bottom_titles,
|
||||
html_col_width="4em",
|
||||
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,
|
||||
page_title="Suivi cohorte " + sem["titreannee"],
|
||||
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
|
||||
if not P:
|
||||
@ -1155,7 +1155,7 @@ def table_suivi_parcours(
|
||||
"nb": len(etuds),
|
||||
"codeparcours": len(etuds),
|
||||
},
|
||||
preferences=context.get_preferences(formsemestre_id),
|
||||
preferences=sco_preferences.SemPreferences(context, formsemestre_id),
|
||||
)
|
||||
return tab
|
||||
|
||||
@ -1215,7 +1215,8 @@ def formsemestre_suivi_parcours(
|
||||
]
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=tab.page_title,
|
||||
init_qtip=True,
|
||||
@ -1543,7 +1544,8 @@ def formsemestre_graph_parcours(
|
||||
)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Parcours étudiants de %(titreannee)s" % sem,
|
||||
no_side_bar=True,
|
||||
|
@ -459,14 +459,17 @@ def semset_page(context, format="html", REQUEST=None):
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
filename="semsets",
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
if format != "html":
|
||||
return tab.make_page(context, format=format, REQUEST=REQUEST)
|
||||
|
||||
page_title = "Ensembles de semestres"
|
||||
H = [
|
||||
html_sco_header.sco_header(context,
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=page_title,
|
||||
init_qtip=True,
|
||||
|
@ -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
|
||||
|
||||
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)
|
||||
if not portal_url:
|
||||
return (
|
||||
@ -374,7 +376,7 @@ def _trombino_pdf(context, groups_infos, REQUEST):
|
||||
sco_pdf.ScolarsPageTemplate(
|
||||
document,
|
||||
context=context,
|
||||
preferences=context.get_preferences(sem["formsemestre_id"]),
|
||||
preferences=sco_preferences.SemPreferences(context, sem["formsemestre_id"]),
|
||||
)
|
||||
)
|
||||
document.build(objects)
|
||||
@ -451,7 +453,7 @@ def _listeappel_photos_pdf(context, groups_infos, REQUEST):
|
||||
sco_pdf.ScolarsPageTemplate(
|
||||
document,
|
||||
context,
|
||||
preferences=context.get_preferences(sem["formsemestre_id"]),
|
||||
preferences=sco_preferences.SemPreferences(context, sem["formsemestre_id"]),
|
||||
)
|
||||
)
|
||||
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
|
||||
|
||||
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>
|
||||
<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/>
|
||||
|
@ -72,10 +72,10 @@ def pdf_trombino_tours(
|
||||
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
|
||||
)
|
||||
|
||||
DeptName = context.get_preference("DeptName")
|
||||
DeptFullName = context.get_preference("DeptFullName")
|
||||
UnivName = context.get_preference("UnivName")
|
||||
InstituteName = context.get_preference("InstituteName")
|
||||
DeptName = sco_preferences.get_preference(context, "DeptName")
|
||||
DeptFullName = sco_preferences.get_preference(context, "DeptFullName")
|
||||
UnivName = sco_preferences.get_preference(context, "UnivName")
|
||||
InstituteName = sco_preferences.get_preference(context, "InstituteName")
|
||||
# Generate PDF page
|
||||
StyleSheet = styles.getSampleStyleSheet()
|
||||
objects = []
|
||||
@ -277,7 +277,11 @@ def pdf_trombino_tours(
|
||||
document = BaseDocTemplate(report)
|
||||
document.addPageTemplates(
|
||||
ScolarsPageTemplate(
|
||||
document, context=context, preferences=context.get_preferences()
|
||||
document,
|
||||
context=context,
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
)
|
||||
document.build(objects)
|
||||
@ -297,10 +301,10 @@ def pdf_feuille_releve_absences(
|
||||
):
|
||||
"""Generation de la feuille d'absence en fichier PDF, avec photos"""
|
||||
|
||||
NB_CELL_AM = context.get_preference("feuille_releve_abs_AM")
|
||||
NB_CELL_PM = context.get_preference("feuille_releve_abs_PM")
|
||||
NB_CELL_AM = sco_preferences.get_preference(context, "feuille_releve_abs_AM")
|
||||
NB_CELL_PM = sco_preferences.get_preference(context, "feuille_releve_abs_PM")
|
||||
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
|
||||
else:
|
||||
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
|
||||
)
|
||||
|
||||
DeptName = context.get_preference("DeptName")
|
||||
DeptFullName = context.get_preference("DeptFullName")
|
||||
UnivName = context.get_preference("UnivName")
|
||||
InstituteName = context.get_preference("InstituteName")
|
||||
DeptName = sco_preferences.get_preference(context, "DeptName")
|
||||
DeptFullName = sco_preferences.get_preference(context, "DeptFullName")
|
||||
UnivName = sco_preferences.get_preference(context, "UnivName")
|
||||
InstituteName = sco_preferences.get_preference(context, "InstituteName")
|
||||
# Generate PDF page
|
||||
StyleSheet = styles.getSampleStyleSheet()
|
||||
objects = [
|
||||
@ -461,17 +465,21 @@ def pdf_feuille_releve_absences(
|
||||
# Build document
|
||||
report = StringIO() # in-memory document, no disk file
|
||||
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
|
||||
elif context.get_preference("feuille_releve_abs_taille") == "A4":
|
||||
elif sco_preferences.get_preference(context, "feuille_releve_abs_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))
|
||||
else:
|
||||
document = BaseDocTemplate(report, pagesize=taille)
|
||||
document.addPageTemplates(
|
||||
ScolarsPageTemplate(
|
||||
document, context=context, preferences=context.get_preferences()
|
||||
document,
|
||||
context=context,
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
)
|
||||
document.build(objects)
|
||||
|
@ -157,7 +157,7 @@ def evaluation_list_operations(context, REQUEST, evaluation_id):
|
||||
html_sortable=False,
|
||||
html_title="<h2>Opérations sur l'évaluation %s du %s</h2>"
|
||||
% (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)
|
||||
|
||||
@ -200,7 +200,7 @@ def formsemestre_list_saisies_notes(
|
||||
html_class="table_leftalign table_coldate",
|
||||
html_sortable=True,
|
||||
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),
|
||||
origin="Généré par %s le " % VERSION.SCONAME + scu.timedate_human_repr() + "",
|
||||
)
|
||||
|
@ -936,6 +936,10 @@ def confirm_dialog(
|
||||
if helpmsg:
|
||||
H.append('<p class="help">' + helpmsg + "</p>")
|
||||
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:
|
||||
return "\n".join(H)
|
||||
|
@ -385,7 +385,7 @@ def identite_edit(cnx, args, context=None, REQUEST=None):
|
||||
notify_to = None
|
||||
if context:
|
||||
try:
|
||||
notify_to = context.get_preference("notify_etud_changes_to")
|
||||
notify_to = sco_preferences.get_preference(context, "notify_etud_changes_to")
|
||||
except:
|
||||
pass
|
||||
|
||||
@ -452,7 +452,7 @@ def notify_etud_change(context, email_addr, etud, before, after, subject):
|
||||
msg = MIMEMultipart()
|
||||
subj = Header("[ScoDoc] " + subject, SCO_ENCODING)
|
||||
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
|
||||
mime_txt = MIMEText(txt, "plain", SCO_ENCODING)
|
||||
msg.attach(mime_txt)
|
||||
@ -498,7 +498,7 @@ def adresse_edit(cnx, args, context=None):
|
||||
notify_to = None
|
||||
if context:
|
||||
try:
|
||||
notify_to = context.get_preference("notify_etud_changes_to")
|
||||
notify_to = sco_preferences.get_preference(context, "notify_etud_changes_to")
|
||||
except:
|
||||
pass
|
||||
if notify_to:
|
||||
|
@ -718,7 +718,7 @@ def SignaleAbsenceGrHebdo(
|
||||
)
|
||||
|
||||
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 = [
|
||||
context.getEtudInfo(etudid=m["etudid"], filled=True)[0]
|
||||
for m in groups_infos.members
|
||||
@ -880,7 +880,7 @@ def SignaleAbsenceGrSemestre(
|
||||
+ context.sco_footer(REQUEST)
|
||||
)
|
||||
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 = [
|
||||
context.getEtudInfo(etudid=m["etudid"], filled=True)[0]
|
||||
for m in groups_infos.members
|
||||
@ -1444,7 +1444,7 @@ def EtatAbsencesGr(
|
||||
tab = GenTable(
|
||||
columns_ids=columns_ids,
|
||||
rows=T,
|
||||
preferences=context.get_preferences(formsemestre_id),
|
||||
preferences=sco_preferences.SemPreferences(context, formsemestre_id),
|
||||
titles={
|
||||
"etatincursem": "Etat",
|
||||
"nomprenom": "Nom",
|
||||
@ -1745,7 +1745,9 @@ def _tableBillets(context, billets, etud=None, title=""):
|
||||
columns_ids=columns_ids,
|
||||
page_title=title,
|
||||
html_title="<h2>%s</h2>" % title,
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
rows=billets,
|
||||
html_sortable=True,
|
||||
)
|
||||
@ -1773,7 +1775,7 @@ def listeBilletsEtud(context, etudid=False, REQUEST=None, format="html"):
|
||||
@scodoc7func(context)
|
||||
def XMLgetBilletsEtud(context, etudid=False, REQUEST=None):
|
||||
"""Liste billets pour un etudiant"""
|
||||
if not context.get_preference("handle_billets_abs"):
|
||||
if not sco_preferences.get_preference(context, "handle_billets_abs"):
|
||||
return ""
|
||||
t0 = time.time()
|
||||
r = context.listeBilletsEtud(etudid, REQUEST=REQUEST, format="xml")
|
||||
|
@ -1574,7 +1574,9 @@ def view_module_abs(context, REQUEST, moduleimpl_id, format="html"):
|
||||
base_url="%s?moduleimpl_id=%s" % (REQUEST.URL0, moduleimpl_id),
|
||||
filename="absmodule_" + scu.make_filename(M["module"]["titre"]),
|
||||
caption="Absences dans le module %s" % M["module"]["titre"],
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
|
||||
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),
|
||||
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(
|
||||
context, page_title=title, title=title, REQUEST=REQUEST, format=format
|
||||
|
@ -235,9 +235,9 @@ def formsemestre_edit_preferences(context, formsemestre_id, REQUEST):
|
||||
or ((str(authuser) in sem["responsables"]) and sem["resp_can_edit"])
|
||||
) and (sem["etat"] == "1")
|
||||
if ok:
|
||||
return context.get_preferences(formsemestre_id=formsemestre_id).edit(
|
||||
REQUEST=REQUEST
|
||||
)
|
||||
return sco_preferences.SemPreferences(
|
||||
context, formsemestre_id=formsemestre_id
|
||||
).edit(REQUEST=REQUEST)
|
||||
else:
|
||||
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"]),
|
||||
html_next_section='<ul><li><a href="ficheEtud?etudid=%(etudid)s">fiche de %(nomprenom)s</a></li></ul>'
|
||||
% etud,
|
||||
preferences=context.get_preferences(),
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
context,
|
||||
),
|
||||
)
|
||||
|
||||
return tab.make_page(context, format=format, REQUEST=REQUEST)
|
||||
@ -302,7 +304,7 @@ def rssnews(context, REQUEST=None):
|
||||
"rss feed"
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||
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:
|
||||
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 += [
|
||||
("adm_id", {"input_type": "hidden"}),
|
||||
|
@ -25,7 +25,9 @@ for sem in sems:
|
||||
formsemestre_id = sem["formsemestre_id"]
|
||||
nt = context.Notes._getNotesCache().get_NotesTable(context.Notes, formsemestre_id)
|
||||
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
|
||||
print("%d %s (%d) use_ue_coef=%s" % (n, formsemestre_id, len(etudids), use_ue_coef))
|
||||
for etudid in etudids:
|
||||
|
Loading…
Reference in New Issue
Block a user