refactoring

This commit is contained in:
Emmanuel Viennet 2021-08-20 10:51:42 +02:00
parent bfad156ac2
commit e61af69f6d
34 changed files with 167 additions and 237 deletions

View File

@ -192,9 +192,13 @@ Charger les données ScoDoc 7: en tant qu'utilisateur "`scodoc`"
(adaptez l'argument si les données ont été copiées ailleurs) (adaptez l'argument si les données ont été copiées ailleurs)
Note: le message Note: les messages d'erreur comme
`pg_restore: warning: restoring tables WITH OIDS is not supported anymore`
est normal et anodin. pg_restore: warning: restoring tables WITH OIDS is not supported anymore
pg_restore: error: could not execute query: ERROR: schema "public" already exists
pg_restore: error: could not execute query: ERROR: must be owner of extension plpgsql
sont normaux et a priori anodins.
A ce stade, vous avez rechargé les bases ScoDoc 7 mais il faut encore A ce stade, vous avez rechargé les bases ScoDoc 7 mais il faut encore
les convertir vers la nouvelle structure ScoDoc 9. les convertir vers la nouvelle structure ScoDoc 9.

View File

@ -339,7 +339,6 @@ def sco_footer():
def html_sem_header( def html_sem_header(
context,
REQUEST, REQUEST,
title, title,
sem=None, sem=None,

View File

@ -90,7 +90,7 @@ class BaseArchiver(object):
finally: finally:
scu.GSL.release() scu.GSL.release()
def get_obj_dir(self, context, oid): def get_obj_dir(self, oid):
""" """
:return: path to directory of archives for this object (eg formsemestre_id or etudid). :return: path to directory of archives for this object (eg formsemestre_id or etudid).
If directory does not yet exist, create it. If directory does not yet exist, create it.
@ -117,11 +117,11 @@ class BaseArchiver(object):
dirs = glob.glob(base + "*") dirs = glob.glob(base + "*")
return [os.path.split(x)[1] for x in dirs] return [os.path.split(x)[1] for x in dirs]
def list_obj_archives(self, context, oid): def list_obj_archives(self, oid):
"""Returns """Returns
:return: list of archive identifiers for this object (paths to non empty dirs) :return: list of archive identifiers for this object (paths to non empty dirs)
""" """
base = self.get_obj_dir(context, oid) + os.path.sep base = self.get_obj_dir(oid) + os.path.sep
dirs = glob.glob( dirs = glob.glob(
base base
+ "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]" + "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]-[0-9][0-9]"
@ -164,11 +164,11 @@ class BaseArchiver(object):
"^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}$", archive_name "^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}$", archive_name
) )
def get_id_from_name(self, context, oid, archive_name): def get_id_from_name(self, oid, archive_name):
"""returns archive id (check that name is valid)""" """returns archive id (check that name is valid)"""
if not self.is_valid_archive_name(archive_name): if not self.is_valid_archive_name(archive_name):
raise ValueError("invalid archive name") raise ValueError("invalid archive name")
archive_id = os.path.join(self.get_obj_dir(context, oid), archive_name) archive_id = os.path.join(self.get_obj_dir(oid), archive_name)
if not os.path.isdir(archive_id): if not os.path.isdir(archive_id):
log( log(
"invalid archive name: %s, oid=%s, archive_id=%s" "invalid archive name: %s, oid=%s, archive_id=%s"
@ -181,10 +181,10 @@ class BaseArchiver(object):
"""Return description of archive""" """Return description of archive"""
return open(os.path.join(archive_id, "_description.txt")).read() return open(os.path.join(archive_id, "_description.txt")).read()
def create_obj_archive(self, context, oid: int, description: str): def create_obj_archive(self, oid: int, description: str):
"""Creates a new archive for this object and returns its id.""" """Creates a new archive for this object and returns its id."""
archive_id = ( archive_id = (
self.get_obj_dir(context, oid) self.get_obj_dir(oid)
+ os.path.sep + os.path.sep
+ "-".join(["%02d" % x for x in time.localtime()[:6]]) + "-".join(["%02d" % x for x in time.localtime()[:6]])
) )
@ -223,10 +223,10 @@ class BaseArchiver(object):
log("reading archive file %s" % fname) log("reading archive file %s" % fname)
return open(fname, "rb").read() return open(fname, "rb").read()
def get_archived_file(self, context, REQUEST, oid, archive_name, filename): def get_archived_file(self, REQUEST, oid, archive_name, filename):
"""Recupere donnees du fichier indiqué et envoie au client""" """Recupere donnees du fichier indiqué et envoie au client"""
# XXX très incomplet: devrait inférer et assigner un type MIME # XXX très incomplet: devrait inférer et assigner un type MIME
archive_id = self.get_id_from_name(context, oid, archive_name) archive_id = self.get_id_from_name(oid, archive_name)
data = self.get(archive_id, filename) data = self.get(archive_id, filename)
ext = os.path.splitext(scu.strlower(filename))[1] ext = os.path.splitext(scu.strlower(filename))[1]
if ext == ".html" or ext == ".htm": if ext == ".html" or ext == ".htm":
@ -284,14 +284,14 @@ def do_formsemestre_archive(
""" """
from app.scodoc.sco_recapcomplet import make_formsemestre_recapcomplet from app.scodoc.sco_recapcomplet import make_formsemestre_recapcomplet
archive_id = PVArchive.create_obj_archive(context, formsemestre_id, description) archive_id = PVArchive.create_obj_archive(formsemestre_id, description)
date = PVArchive.get_archive_date(archive_id).strftime("%d/%m/%Y à %H:%M") date = PVArchive.get_archive_date(archive_id).strftime("%d/%m/%Y à %H:%M")
if not group_ids: if not group_ids:
# tous les inscrits du semestre # tous les inscrits du semestre
group_ids = [sco_groups.get_default_group(formsemestre_id)] group_ids = [sco_groups.get_default_group(formsemestre_id)]
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
) )
groups_filename = "-" + groups_infos.groups_filename groups_filename = "-" + groups_infos.groups_filename
etudids = [m["etudid"] for m in groups_infos.members] etudids = [m["etudid"] for m in groups_infos.members]
@ -386,12 +386,11 @@ def formsemestre_archive(context, REQUEST, formsemestre_id, group_ids=[]):
# tous les inscrits du semestre # tous les inscrits du semestre
group_ids = [sco_groups.get_default_group(formsemestre_id)] group_ids = [sco_groups.get_default_group(formsemestre_id)]
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
) )
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Archiver les PV et résultats du semestre", "Archiver les PV et résultats du semestre",
sem=sem, sem=sem,
@ -420,7 +419,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
), ),
("sep", {"input_type": "separator", "title": "Informations sur PV de jury"}), ("sep", {"input_type": "separator", "title": "Informations sur PV de jury"}),
] ]
descr += sco_pvjury.descrform_pvjury(context, sem) descr += sco_pvjury.descrform_pvjury(sem)
descr += [ descr += [
( (
"signature", "signature",
@ -447,7 +446,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
] ]
menu_choix_groupe = ( menu_choix_groupe = (
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """ """<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """
+ sco_groups_view.menu_groups_choice(context, groups_infos) + sco_groups_view.menu_groups_choice(groups_infos)
+ """(pour les PV et lettres)</div>""" + """(pour les PV et lettres)</div>"""
) )
@ -500,10 +499,10 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
) )
def formsemestre_list_archives(context, REQUEST, formsemestre_id): def formsemestre_list_archives(REQUEST, formsemestre_id):
"""Page listing archives""" """Page listing archives"""
L = [] L = []
for archive_id in PVArchive.list_obj_archives(context, formsemestre_id): for archive_id in PVArchive.list_obj_archives(formsemestre_id):
a = { a = {
"archive_id": archive_id, "archive_id": archive_id,
"description": PVArchive.get_archive_description(archive_id), "description": PVArchive.get_archive_description(archive_id),
@ -513,11 +512,7 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id):
L.append(a) L.append(a)
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [ H = [html_sco_header.html_sem_header(REQUEST, "Archive des PV et résultats ", sem)]
html_sco_header.html_sem_header(
context, REQUEST, "Archive des PV et résultats ", sem
)
]
if not L: if not L:
H.append("<p>aucune archive enregistrée</p>") H.append("<p>aucune archive enregistrée</p>")
else: else:
@ -546,17 +541,13 @@ def formsemestre_list_archives(context, REQUEST, formsemestre_id):
return "\n".join(H) + html_sco_header.sco_footer() return "\n".join(H) + html_sco_header.sco_footer()
def formsemestre_get_archived_file( def formsemestre_get_archived_file(REQUEST, formsemestre_id, archive_name, filename):
context, REQUEST, formsemestre_id, archive_name, filename
):
"""Send file to client.""" """Send file to client."""
return PVArchive.get_archived_file( return PVArchive.get_archived_file(REQUEST, formsemestre_id, archive_name, filename)
context, REQUEST, formsemestre_id, archive_name, filename
)
def formsemestre_delete_archive( def formsemestre_delete_archive(
context, REQUEST, formsemestre_id, archive_name, dialog_confirmed=False REQUEST, formsemestre_id, archive_name, dialog_confirmed=False
): ):
"""Delete an archive""" """Delete an archive"""
if not sco_permissions_check.can_edit_pv(formsemestre_id): if not sco_permissions_check.can_edit_pv(formsemestre_id):
@ -564,7 +555,7 @@ def formsemestre_delete_archive(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER) "opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
) )
_ = sco_formsemestre.get_formsemestre(formsemestre_id) # check formsemestre_id _ = sco_formsemestre.get_formsemestre(formsemestre_id) # check formsemestre_id
archive_id = PVArchive.get_id_from_name(context, formsemestre_id, archive_name) archive_id = PVArchive.get_id_from_name(formsemestre_id, archive_name)
dest_url = "formsemestre_list_archives?formsemestre_id=%s" % (formsemestre_id) dest_url = "formsemestre_list_archives?formsemestre_id=%s" % (formsemestre_id)

View File

@ -53,16 +53,16 @@ class EtudsArchiver(sco_archives.BaseArchiver):
EtudsArchive = EtudsArchiver() EtudsArchive = EtudsArchiver()
def can_edit_etud_archive(context, authuser): def can_edit_etud_archive(authuser):
"""True si l'utilisateur peut modifier les archives etudiantes""" """True si l'utilisateur peut modifier les archives etudiantes"""
return authuser.has_permission(Permission.ScoEtudAddAnnotations) return authuser.has_permission(Permission.ScoEtudAddAnnotations)
def etud_list_archives_html(context, REQUEST, etudid): def etud_list_archives_html(REQUEST, etudid):
"""HTML snippet listing archives""" """HTML snippet listing archives"""
can_edit = can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER) can_edit = can_edit_etud_archive(REQUEST.AUTHENTICATED_USER)
L = [] L = []
for archive_id in EtudsArchive.list_obj_archives(context, etudid): for archive_id in EtudsArchive.list_obj_archives(etudid):
a = { a = {
"archive_id": archive_id, "archive_id": archive_id,
"description": EtudsArchive.get_archive_description(archive_id), "description": EtudsArchive.get_archive_description(archive_id),
@ -107,13 +107,13 @@ def etud_list_archives_html(context, REQUEST, etudid):
return "".join(H) return "".join(H)
def add_archives_info_to_etud_list(context, etuds): def add_archives_info_to_etud_list(etuds):
"""Add key 'etudarchive' describing archive of etuds """Add key 'etudarchive' describing archive of etuds
(used to list all archives of a group) (used to list all archives of a group)
""" """
for etud in etuds: for etud in etuds:
l = [] l = []
for archive_id in EtudsArchive.list_obj_archives(context, etud["etudid"]): for archive_id in EtudsArchive.list_obj_archives(etud["etudid"]):
l.append( l.append(
"%s (%s)" "%s (%s)"
% ( % (
@ -124,10 +124,10 @@ def add_archives_info_to_etud_list(context, etuds):
etud["etudarchive"] = ", ".join(l) etud["etudarchive"] = ", ".join(l)
def etud_upload_file_form(context, REQUEST, etudid): def etud_upload_file_form(REQUEST, etudid):
"""Page with a form to choose and upload a file, with a description.""" """Page with a form to choose and upload a file, with a description."""
# check permission # check permission
if not can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER): if not can_edit_etud_archive(REQUEST.AUTHENTICATED_USER):
raise AccessDenied( raise AccessDenied(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER) "opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
) )
@ -172,34 +172,30 @@ def etud_upload_file_form(context, REQUEST, etudid):
data = tf[2]["datafile"].read() data = tf[2]["datafile"].read()
descr = tf[2]["description"] descr = tf[2]["description"]
filename = tf[2]["datafile"].filename filename = tf[2]["datafile"].filename
_store_etud_file_to_new_archive( _store_etud_file_to_new_archive(etudid, data, filename, description=descr)
context, REQUEST, etudid, data, filename, description=descr
)
return flask.redirect( return flask.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid) url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
) )
def _store_etud_file_to_new_archive( def _store_etud_file_to_new_archive(etudid, data, filename, description=""):
context, REQUEST, etudid, data, filename, description=""
):
"""Store data to new archive.""" """Store data to new archive."""
filesize = len(data) filesize = len(data)
if filesize < 10 or filesize > scu.CONFIG.ETUD_MAX_FILE_SIZE: if filesize < 10 or filesize > scu.CONFIG.ETUD_MAX_FILE_SIZE:
return 0, "Fichier image de taille invalide ! (%d)" % filesize return 0, "Fichier image de taille invalide ! (%d)" % filesize
archive_id = EtudsArchive.create_obj_archive(context, etudid, description) archive_id = EtudsArchive.create_obj_archive(etudid, description)
EtudsArchive.store(archive_id, filename, data) EtudsArchive.store(archive_id, filename, data)
def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed=False): def etud_delete_archive(REQUEST, etudid, archive_name, dialog_confirmed=False):
"""Delete an archive""" """Delete an archive"""
# check permission # check permission
if not can_edit_etud_archive(context, REQUEST.AUTHENTICATED_USER): if not can_edit_etud_archive(REQUEST.AUTHENTICATED_USER):
raise AccessDenied( raise AccessDenied(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER) "opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
) )
etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0] etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0]
archive_id = EtudsArchive.get_id_from_name(context, etudid, archive_name) archive_id = EtudsArchive.get_id_from_name(etudid, archive_name)
if not dialog_confirmed: if not dialog_confirmed:
return scu.confirm_dialog( return scu.confirm_dialog(
"""<h2>Confirmer la suppression des fichiers ?</h2> """<h2>Confirmer la suppression des fichiers ?</h2>
@ -230,11 +226,9 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
) )
def etud_get_archived_file(context, REQUEST, etudid, archive_name, filename): def etud_get_archived_file(REQUEST, etudid, archive_name, filename):
"""Send file to client.""" """Send file to client."""
return EtudsArchive.get_archived_file( return EtudsArchive.get_archived_file(REQUEST, etudid, archive_name, filename)
context, REQUEST, etudid, archive_name, filename
)
# --- Upload d'un ensemble de fichiers (pour un groupe d'étudiants) # --- Upload d'un ensemble de fichiers (pour un groupe d'étudiants)
@ -335,9 +329,7 @@ def etudarchive_import_files(
context, group_id=None, xlsfile=None, zipfile=None, REQUEST=None, description="" context, group_id=None, xlsfile=None, zipfile=None, REQUEST=None, description=""
): ):
def callback(context, etud, data, filename, REQUEST): def callback(context, etud, data, filename, REQUEST):
_store_etud_file_to_new_archive( _store_etud_file_to_new_archive(etud["etudid"], data, filename, description)
context, REQUEST, etud["etudid"], data, filename, description
)
filename_title = "fichier_a_charger" filename_title = "fichier_a_charger"
page_title = "Téléchargement de fichiers associés aux étudiants" page_title = "Téléchargement de fichiers associés aux étudiants"

View File

@ -841,7 +841,7 @@ def formsemestre_bulletinetud(
return "".join(H) return "".join(H)
def can_send_bulletin_by_mail(context, formsemestre_id): def can_send_bulletin_by_mail(formsemestre_id):
"""True if current user is allowed to send a bulletin by mail""" """True if current user is allowed to send a bulletin by mail"""
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
return ( return (
@ -924,7 +924,7 @@ def do_formsemestre_bulletinetud(
elif format == "pdfmail": elif format == "pdfmail":
# format pdfmail: envoie le pdf par mail a l'etud, et affiche le html # format pdfmail: envoie le pdf par mail a l'etud, et affiche le html
# check permission # check permission
if not can_send_bulletin_by_mail(context, formsemestre_id): if not can_send_bulletin_by_mail(formsemestre_id):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
if nohtml: if nohtml:
@ -1114,10 +1114,8 @@ def _formsemestre_bulletinetud_header_html(
"version": version, "version": version,
"format": "pdfmail", "format": "pdfmail",
}, },
"enabled": etud["email"] # possible slt si on a un mail...
and can_send_bulletin_by_mail( "enabled": etud["email"] and can_send_bulletin_by_mail(formsemestre_id),
context, formsemestre_id
), # possible slt si on a un mail...
}, },
{ {
"title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"], "title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"],
@ -1129,10 +1127,9 @@ def _formsemestre_bulletinetud_header_html(
"format": "pdfmail", "format": "pdfmail",
"prefer_mail_perso": 1, "prefer_mail_perso": 1,
}, },
# possible slt si on a un mail...
"enabled": etud["emailperso"] "enabled": etud["emailperso"]
and can_send_bulletin_by_mail( and can_send_bulletin_by_mail(formsemestre_id),
context, formsemestre_id
), # possible slt si on a un mail...
}, },
{ {
"title": "Version XML", "title": "Version XML",

View File

@ -129,7 +129,7 @@ def apo_csv_store(context, csv_data, annee_scolaire, sem_id):
oid = "%d-%d" % (annee_scolaire, sem_id) oid = "%d-%d" % (annee_scolaire, sem_id)
description = "%s;%s;%s" % (str(apo_data.etape), annee_scolaire, sem_id) description = "%s;%s;%s" % (str(apo_data.etape), annee_scolaire, sem_id)
archive_id = ApoCSVArchive.create_obj_archive(context, oid, description) archive_id = ApoCSVArchive.create_obj_archive(oid, description)
ApoCSVArchive.store(archive_id, filename, csv_data) ApoCSVArchive.store(archive_id, filename, csv_data)
return apo_data.etape return apo_data.etape
@ -153,7 +153,7 @@ def apo_csv_list_stored_archives(
infos = [] # liste d'infos infos = [] # liste d'infos
for oid in oids: for oid in oids:
archive_ids = ApoCSVArchive.list_obj_archives(context, oid) archive_ids = ApoCSVArchive.list_obj_archives(oid)
for archive_id in archive_ids: for archive_id in archive_ids:
description = ApoCSVArchive.get_archive_description(archive_id) description = ApoCSVArchive.get_archive_description(archive_id)
fs = tuple(description.split(";")) fs = tuple(description.split(";"))
@ -387,7 +387,7 @@ apo_csv_store(context, csv_data, annee_scolaire, sem_id)
groups_infos = sco_groups_view.DisplayedGroupsInfos(context, [sco_groups.get_default_group(formsemestre_id)], formsemestre_id=formsemestre_id) groups_infos = sco_groups_view.DisplayedGroupsInfos( [sco_groups.get_default_group(formsemestre_id)], formsemestre_id=formsemestre_id)
nt = sco_cache.NotesTableCache.get( formsemestre_id) nt = sco_cache.NotesTableCache.get( formsemestre_id)
@ -410,7 +410,7 @@ col_id='apoL_c0129'
# -- # --
from app.scodoc import sco_portal_apogee from app.scodoc import sco_portal_apogee
context = go_dept(app, 'GEA').Notes context = go_dept(app, 'GEA').Notes
#csv_data = sco_portal_apogee.get_maquette_apogee(context, etape='V1GE', annee_scolaire=2015) #csv_data = sco_portal_apogee.get_maquette_apogee(etape='V1GE', annee_scolaire=2015)
csv_data = open('/tmp/V1GE.txt').read() csv_data = open('/tmp/V1GE.txt').read()
apo_data = sco_apogee_csv.ApoData(csv_data, periode=1) apo_data = sco_apogee_csv.ApoData(csv_data, periode=1)

View File

@ -140,7 +140,7 @@ def apo_semset_maq_status(
% (semset_id,) % (semset_id,)
) )
# Récupération sur portail: # Récupération sur portail:
maquette_url = sco_portal_apogee.get_maquette_url(context) maquette_url = sco_portal_apogee.get_maquette_url()
if maquette_url: # portail configuré if maquette_url: # portail configuré
menu_etapes = """<option value=""></option>""" menu_etapes = """<option value=""></option>"""
menu_etapes += "".join( menu_etapes += "".join(
@ -650,7 +650,7 @@ def view_apo_csv_download_and_store(context, etape_apo="", semset_id="", REQUEST
semset = sco_semset.SemSet(context, semset_id=semset_id) semset = sco_semset.SemSet(context, semset_id=semset_id)
data = sco_portal_apogee.get_maquette_apogee( data = sco_portal_apogee.get_maquette_apogee(
context, etape=etape_apo, annee_scolaire=semset["annee_scolaire"] etape=etape_apo, annee_scolaire=semset["annee_scolaire"]
) )
# here, data is utf8 # here, data is utf8
# but we store and generate latin1 files, to ease further import in Apogée # but we store and generate latin1 files, to ease further import in Apogée

View File

@ -786,7 +786,6 @@ def formsemestre_evaluations_cal(formsemestre_id, REQUEST=None):
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Evaluations du semestre", "Evaluations du semestre",
sem, sem,

View File

@ -85,7 +85,7 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
) )
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context, REQUEST, "Modification du menu du semestre ", sem REQUEST, "Modification du menu du semestre ", sem
), ),
"""<p class="help">Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.</p> """<p class="help">Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.</p>
<p class="help">Procédez en plusieurs fois si vous voulez ajouter plusieurs items.</p>""", <p class="help">Procédez en plusieurs fois si vous voulez ajouter plusieurs items.</p>""",

View File

@ -91,7 +91,6 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Modification du semestre", "Modification du semestre",
sem, sem,
@ -329,7 +328,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
}, },
), ),
] ]
etapes = sco_portal_apogee.get_etapes_apogee_dept(context) etapes = sco_portal_apogee.get_etapes_apogee_dept()
# Propose les etapes renvoyées par le portail # Propose les etapes renvoyées par le portail
# et ajoute les étapes du semestre qui ne sont pas dans la liste (soit la liste a changé, soit l'étape a été ajoutée manuellement) # et ajoute les étapes du semestre qui ne sont pas dans la liste (soit la liste a changé, soit l'étape a été ajoutée manuellement)
etapes_set = {et[0] for et in etapes} etapes_set = {et[0] for et in etapes}
@ -885,7 +884,6 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None):
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Copie du semestre", "Copie du semestre",
sem, sem,
@ -1238,9 +1236,7 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None):
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0] F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0]
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(REQUEST, "Suppression du semestre", sem),
context, REQUEST, "Suppression du semestre", sem
),
"""<div class="ue_warning"><span>Attention !</span> """<div class="ue_warning"><span>Attention !</span>
<p class="help">A n'utiliser qu'en cas d'erreur lors de la saisie d'une formation. Normalement, <p class="help">A n'utiliser qu'en cas d'erreur lors de la saisie d'une formation. Normalement,
<b>un semestre ne doit jamais être supprimé</b> (on perd la mémoire des notes et de tous les événements liés à ce semestre !).</p> <b>un semestre ne doit jamais être supprimé</b> (on perd la mémoire des notes et de tous les événements liés à ce semestre !).</p>
@ -1548,7 +1544,7 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
""" """
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context, REQUEST, "Coefficients des UE du semestre", sem REQUEST, "Coefficients des UE du semestre", sem
), ),
help, help,
] ]
@ -1662,7 +1658,7 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
) # > modif coef UE cap (modifs notes de _certains_ etudiants) ) # > modif coef UE cap (modifs notes de _certains_ etudiants)
header = html_sco_header.html_sem_header( header = html_sco_header.html_sem_header(
context, REQUEST, "Coefficients des UE du semestre", sem REQUEST, "Coefficients des UE du semestre", sem
) )
return ( return (
header header

View File

@ -336,7 +336,6 @@ def formsemestre_inscription_with_modules(
etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0] etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0]
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Inscription de %s dans ce semestre" % etud["nomprenom"], "Inscription de %s dans ce semestre" % etud["nomprenom"],
sem, sem,
@ -762,7 +761,6 @@ def formsemestre_inscrits_ailleurs(context, formsemestre_id, REQUEST=None):
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Inscriptions multiples parmi les étudiants du semestre ", "Inscriptions multiples parmi les étudiants du semestre ",
sem, sem,

View File

@ -376,9 +376,7 @@ def formsemestre_status_menubar(context, sem):
"title": "Envoyer à chaque étudiant son bulletin par e-mail", "title": "Envoyer à chaque étudiant son bulletin par e-mail",
"endpoint": "notes.formsemestre_bulletins_mailetuds_choice", "endpoint": "notes.formsemestre_bulletins_mailetuds_choice",
"args": {"formsemestre_id": formsemestre_id}, "args": {"formsemestre_id": formsemestre_id},
"enabled": sco_bulletins.can_send_bulletin_by_mail( "enabled": sco_bulletins.can_send_bulletin_by_mail(formsemestre_id),
context, formsemestre_id
),
}, },
{ {
"title": "Calendrier des évaluations", "title": "Calendrier des évaluations",
@ -424,9 +422,7 @@ def formsemestre_status_menubar(context, sem):
"title": "Documents archivés", "title": "Documents archivés",
"endpoint": "notes.formsemestre_list_archives", "endpoint": "notes.formsemestre_list_archives",
"args": {"formsemestre_id": formsemestre_id}, "args": {"formsemestre_id": formsemestre_id},
"enabled": sco_archives.PVArchive.list_obj_archives( "enabled": sco_archives.PVArchive.list_obj_archives(formsemestre_id),
context, formsemestre_id
),
}, },
] ]
@ -713,7 +709,7 @@ def formsemestre_description_table(
% (REQUEST.URL0, formsemestre_id, with_evals), % (REQUEST.URL0, formsemestre_id, with_evals),
page_title=title, page_title=title,
html_title=html_sco_header.html_sem_header( html_title=html_sco_header.html_sem_header(
context, REQUEST, "Description du semestre", sem, with_page_header=False REQUEST, "Description du semestre", sem, with_page_header=False
), ),
pdf_title=title, pdf_title=title,
preferences=sco_preferences.SemPreferences(formsemestre_id), preferences=sco_preferences.SemPreferences(formsemestre_id),
@ -927,7 +923,7 @@ def formsemestre_status_head(
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context, REQUEST, page_title, sem, with_page_header=False, with_h2=False REQUEST, page_title, sem, with_page_header=False, with_h2=False
), ),
"""<table> """<table>
<tr><td class="fichetitre2">Formation: </td><td> <tr><td class="fichetitre2">Formation: </td><td>

View File

@ -830,7 +830,7 @@ def formsemestre_validation_auto(context, formsemestre_id, REQUEST):
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context, REQUEST, "Saisie automatique des décisions du semestre", sem REQUEST, "Saisie automatique des décisions du semestre", sem
), ),
""" """
<ul> <ul>

View File

@ -84,7 +84,6 @@ def groups_view(
""" """
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = DisplayedGroupsInfos( groups_infos = DisplayedGroupsInfos(
context,
group_ids, group_ids,
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
etat=etat, etat=etat,
@ -181,9 +180,7 @@ def form_groups_choice(
% (groups_infos.formsemestre_id, default_group_id) % (groups_infos.formsemestre_id, default_group_id)
] ]
H.append( H.append(menu_groups_choice(groups_infos, submit_on_change=submit_on_change))
menu_groups_choice(context, groups_infos, submit_on_change=submit_on_change)
)
if with_selectall_butt: if with_selectall_butt:
H.append( H.append(
@ -194,7 +191,7 @@ def form_groups_choice(
return "\n".join(H) return "\n".join(H)
def menu_groups_choice(context, groups_infos, submit_on_change=False): def menu_groups_choice(groups_infos, submit_on_change=False):
"""menu pour selection groupes """menu pour selection groupes
group_ids est la liste des groupes actuellement sélectionnés group_ids est la liste des groupes actuellement sélectionnés
et doit comporter au moins un élément, sauf si formsemestre_id est spécifié. et doit comporter au moins un élément, sauf si formsemestre_id est spécifié.
@ -304,7 +301,6 @@ class DisplayedGroupsInfos(object):
def __init__( def __init__(
self, self,
context,
group_ids=[], # groupes specifies dans l'URL, ou un seul int group_ids=[], # groupes specifies dans l'URL, ou un seul int
formsemestre_id=None, formsemestre_id=None,
etat=None, etat=None,
@ -312,7 +308,6 @@ class DisplayedGroupsInfos(object):
moduleimpl_id=None, # used to find formsemestre when unspecified moduleimpl_id=None, # used to find formsemestre when unspecified
REQUEST=None, REQUEST=None,
): ):
# log('DisplayedGroupsInfos %s' % group_ids)
if isinstance(group_ids, int): if isinstance(group_ids, int):
if group_ids: if group_ids:
group_ids = [group_ids] # cas ou un seul parametre, pas de liste group_ids = [group_ids] # cas ou un seul parametre, pas de liste
@ -504,11 +499,11 @@ def groups_table(
if with_paiement: if with_paiement:
columns_ids += ["datefinalisationinscription_str", "paiementinscription_str"] columns_ids += ["datefinalisationinscription_str", "paiementinscription_str"]
if with_paiement or with_codes: if with_paiement or with_codes:
sco_portal_apogee.check_paiement_etuds(context, groups_infos.members) sco_portal_apogee.check_paiement_etuds(groups_infos.members)
if with_archives: if with_archives:
from app.scodoc import sco_archives_etud from app.scodoc import sco_archives_etud
sco_archives_etud.add_archives_info_to_etud_list(context, groups_infos.members) sco_archives_etud.add_archives_info_to_etud_list(groups_infos.members)
columns_ids += ["etudarchive"] columns_ids += ["etudarchive"]
if with_annotations: if with_annotations:
sco_etud.add_annotations_to_etud_list(context, groups_infos.members) sco_etud.add_annotations_to_etud_list(context, groups_infos.members)

View File

@ -189,9 +189,7 @@ def sco_import_generate_excel_sample(
titles += extra_cols titles += extra_cols
titlesStyles += [style] * len(extra_cols) titlesStyles += [style] * len(extra_cols)
if group_ids and context: if group_ids and context:
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
context, group_ids, REQUEST=REQUEST
)
members = groups_infos.members members = groups_infos.members
log( log(
"sco_import_generate_excel_sample: group_ids=%s %d members" "sco_import_generate_excel_sample: group_ids=%s %d members"

View File

@ -415,7 +415,7 @@ def build_page(
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context, REQUEST, "Passages dans le semestre", sem, with_page_header=False REQUEST, "Passages dans le semestre", sem, with_page_header=False
), ),
"""<form method="post" action="%s">""" % REQUEST.URL0, """<form method="post" action="%s">""" % REQUEST.URL0,
"""<input type="hidden" name="formsemestre_id" value="%(formsemestre_id)s"/> """<input type="hidden" name="formsemestre_id" value="%(formsemestre_id)s"/>

View File

@ -787,7 +787,7 @@ def evaluation_check_absences_html(
if with_header: if with_header:
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context, REQUEST, "Vérification absences à l'évaluation" REQUEST, "Vérification absences à l'évaluation"
), ),
sco_evaluations.evaluation_describe( sco_evaluations.evaluation_describe(
evaluation_id=evaluation_id, REQUEST=REQUEST evaluation_id=evaluation_id, REQUEST=REQUEST
@ -876,7 +876,6 @@ def formsemestre_check_absences_html(context, formsemestre_id, REQUEST=None):
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Vérification absences aux évaluations de ce semestre", "Vérification absences aux évaluations de ce semestre",
sem, sem,

View File

@ -287,9 +287,7 @@ def moduleimpl_inscriptions_stats(context, formsemestre_id, REQUEST=None):
options.append(mod) options.append(mod)
# Page HTML: # Page HTML:
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(REQUEST, "Inscriptions aux modules du semestre")
context, REQUEST, "Inscriptions aux modules du semestre"
)
] ]
H.append("<h3>Inscrits au semestre: %d étudiants</h3>" % len(inscrits)) H.append("<h3>Inscrits au semestre: %d étudiants</h3>" % len(inscrits))

View File

@ -348,7 +348,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
# Fichiers archivés: # Fichiers archivés:
info["fichiers_archive_htm"] = ( info["fichiers_archive_htm"] = (
'<div class="fichetitre">Fichiers associés</div>' '<div class="fichetitre">Fichiers associés</div>'
+ sco_archives_etud.etud_list_archives_html(context, REQUEST, etudid) + sco_archives_etud.etud_list_archives_html(REQUEST, etudid)
) )
# Devenir de l'étudiant: # Devenir de l'étudiant:

View File

@ -81,7 +81,7 @@ H90 = ".h90" # suffix for reduced size images
def photo_portal_url(context, etud): def photo_portal_url(context, etud):
"""Returns external URL to retreive photo on portal, """Returns external URL to retreive photo on portal,
or None if no portal configured""" or None if no portal configured"""
photo_url = sco_portal_apogee.get_photo_url(context) photo_url = sco_portal_apogee.get_photo_url()
if photo_url and etud["code_nip"]: if photo_url and etud["code_nip"]:
return photo_url + "?nip=" + etud["code_nip"] return photo_url + "?nip=" + etud["code_nip"]
else: else:
@ -98,7 +98,7 @@ def etud_photo_url(context, etud, size="small", fast=False, REQUEST=None):
) )
if fast: if fast:
return photo_url return photo_url
path = photo_pathname(context, etud, size=size) path = photo_pathname(etud, size=size)
if not path: if not path:
# Portail ? # Portail ?
ext_url = photo_portal_url(context, etud) ext_url = photo_portal_url(context, etud)
@ -126,7 +126,7 @@ def get_photo_image(context, etudid=None, size="small", REQUEST=None):
filename = UNKNOWN_IMAGE_PATH filename = UNKNOWN_IMAGE_PATH
else: else:
etud = sco_etud.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0] etud = sco_etud.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
filename = photo_pathname(context, etud, size=size) filename = photo_pathname(etud, size=size)
if not filename: if not filename:
filename = UNKNOWN_IMAGE_PATH filename = UNKNOWN_IMAGE_PATH
return _http_jpeg_file(context, filename, REQUEST=REQUEST) return _http_jpeg_file(context, filename, REQUEST=REQUEST)
@ -169,7 +169,7 @@ def _http_jpeg_file(context, filename, REQUEST=None):
def etud_photo_is_local(context, etud, size="small"): def etud_photo_is_local(context, etud, size="small"):
return photo_pathname(context, etud, size=size) return photo_pathname(etud, size=size)
def etud_photo_html( def etud_photo_html(
@ -216,7 +216,7 @@ def etud_photo_orig_html(context, etud=None, etudid=None, title=None, REQUEST=No
) )
def photo_pathname(context, etud, size="orig"): def photo_pathname(etud, size="orig"):
"""Returns full path of image file if etud has a photo (in the filesystem), or False. """Returns full path of image file if etud has a photo (in the filesystem), or False.
Do not distinguish the cases: no photo, or file missing. Do not distinguish the cases: no photo, or file missing.
""" """
@ -265,7 +265,7 @@ def store_photo(context, etud, data, REQUEST=None):
def suppress_photo(context, etud, REQUEST=None): def suppress_photo(context, etud, REQUEST=None):
"""Suppress a photo""" """Suppress a photo"""
log("suppress_photo etudid=%s" % etud["etudid"]) log("suppress_photo etudid=%s" % etud["etudid"])
rel_path = photo_pathname(context, etud) rel_path = photo_pathname(etud)
# 1- remove ref. from database # 1- remove ref. from database
etud["photo_filename"] = None etud["photo_filename"] = None
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
@ -297,7 +297,7 @@ def save_image(context, etudid, data):
data_file.write(data) data_file.write(data)
data_file.seek(0) data_file.seek(0)
img = PILImage.open(data_file) img = PILImage.open(data_file)
filename = get_new_filename(context, etudid) filename = get_new_filename(etudid)
path = os.path.join(PHOTO_DIR, filename) path = os.path.join(PHOTO_DIR, filename)
log("saving %dx%d jpeg to %s" % (img.size[0], img.size[1], path)) log("saving %dx%d jpeg to %s" % (img.size[0], img.size[1], path))
img.save(path + IMAGE_EXT, format="JPEG", quality=92) img.save(path + IMAGE_EXT, format="JPEG", quality=92)
@ -316,7 +316,7 @@ def scale_height(img, W=None, H=REDUCED_HEIGHT):
return img return img
def get_new_filename(context, etudid): def get_new_filename(etudid):
"""Constructs a random filename to store a new image. """Constructs a random filename to store a new image.
The path is constructed as: Fxx/etudid The path is constructed as: Fxx/etudid
""" """
@ -372,6 +372,6 @@ def copy_portal_photo_to_fs(context, etud, REQUEST=None):
log("copy_portal_photo_to_fs: failure (exception in store_photo)!") log("copy_portal_photo_to_fs: failure (exception in store_photo)!")
if status == 1: if status == 1:
log("copy_portal_photo_to_fs: copied %s" % url) log("copy_portal_photo_to_fs: copied %s" % url)
return photo_pathname(context, etud), "%s: photo chargée" % etud["nomprenom"] return photo_pathname(etud), "%s: photo chargée" % etud["nomprenom"]
else: else:
return None, "%s: <b>%s</b>" % (etud["nomprenom"], diag) return None, "%s: <b>%s</b>" % (etud["nomprenom"], diag)

View File

@ -45,16 +45,16 @@ from six.moves import range
SCO_CACHE_ETAPE_FILENAME = os.path.join(scu.SCO_TMP_DIR, "last_etapes.xml") SCO_CACHE_ETAPE_FILENAME = os.path.join(scu.SCO_TMP_DIR, "last_etapes.xml")
def has_portal(context): def has_portal():
"True if we are connected to a portal" "True if we are connected to a portal"
return get_portal_url(context) return get_portal_url()
class PortalInterface(object): class PortalInterface(object):
def __init__(self): def __init__(self):
self.warning = False self.warning = False
def get_portal_url(self, context): def get_portal_url(self):
"URL of portal" "URL of portal"
portal_url = sco_preferences.get_preference("portal_url") portal_url = sco_preferences.get_preference("portal_url")
if not self.warning: if not self.warning:
@ -65,63 +65,63 @@ class PortalInterface(object):
self.warning = True self.warning = True
return portal_url return portal_url
def get_etapes_url(self, context): def get_etapes_url(self):
"Full URL of service giving list of etapes (in XML)" "Full URL of service giving list of etapes (in XML)"
etapes_url = sco_preferences.get_preference("etapes_url") etapes_url = sco_preferences.get_preference("etapes_url")
if not etapes_url: if not etapes_url:
# Default: # Default:
portal_url = self.get_portal_url(context) portal_url = self.get_portal_url()
if not portal_url: if not portal_url:
return None return None
api_ver = self.get_portal_api_version(context) api_ver = self.get_portal_api_version()
if api_ver > 1: if api_ver > 1:
etapes_url = portal_url + "scodocEtapes.php" etapes_url = portal_url + "scodocEtapes.php"
else: else:
etapes_url = portal_url + "getEtapes.php" etapes_url = portal_url + "getEtapes.php"
return etapes_url return etapes_url
def get_etud_url(self, context): def get_etud_url(self):
"Full URL of service giving list of students (in XML)" "Full URL of service giving list of students (in XML)"
etud_url = sco_preferences.get_preference("etud_url") etud_url = sco_preferences.get_preference("etud_url")
if not etud_url: if not etud_url:
# Default: # Default:
portal_url = self.get_portal_url(context) portal_url = self.get_portal_url()
if not portal_url: if not portal_url:
return None return None
api_ver = self.get_portal_api_version(context) api_ver = self.get_portal_api_version()
if api_ver > 1: if api_ver > 1:
etud_url = portal_url + "scodocEtudiant.php" etud_url = portal_url + "scodocEtudiant.php"
else: else:
etud_url = portal_url + "getEtud.php" etud_url = portal_url + "getEtud.php"
return etud_url return etud_url
def get_photo_url(self, context): def get_photo_url(self):
"Full URL of service giving photo of student" "Full URL of service giving photo of student"
photo_url = sco_preferences.get_preference("photo_url") photo_url = sco_preferences.get_preference("photo_url")
if not photo_url: if not photo_url:
# Default: # Default:
portal_url = self.get_portal_url(context) portal_url = self.get_portal_url()
if not portal_url: if not portal_url:
return None return None
api_ver = self.get_portal_api_version(context) api_ver = self.get_portal_api_version()
if api_ver > 1: if api_ver > 1:
photo_url = portal_url + "scodocPhoto.php" photo_url = portal_url + "scodocPhoto.php"
else: else:
photo_url = portal_url + "getPhoto.php" photo_url = portal_url + "getPhoto.php"
return photo_url return photo_url
def get_maquette_url(self, context): def get_maquette_url(self):
"""Full URL of service giving Apogee maquette pour une étape (fichier "CSV")""" """Full URL of service giving Apogee maquette pour une étape (fichier "CSV")"""
maquette_url = sco_preferences.get_preference("maquette_url") maquette_url = sco_preferences.get_preference("maquette_url")
if not maquette_url: if not maquette_url:
# Default: # Default:
portal_url = self.get_portal_url(context) portal_url = self.get_portal_url()
if not portal_url: if not portal_url:
return None return None
maquette_url = portal_url + "scodocMaquette.php" maquette_url = portal_url + "scodocMaquette.php"
return maquette_url return maquette_url
def get_portal_api_version(self, context): def get_portal_api_version(self):
"API version of the portal software" "API version of the portal software"
api_ver = sco_preferences.get_preference("portal_api") api_ver = sco_preferences.get_preference("portal_api")
if not api_ver: if not api_ver:
@ -139,7 +139,7 @@ get_maquette_url = _PI.get_maquette_url
get_portal_api_version = _PI.get_portal_api_version get_portal_api_version = _PI.get_portal_api_version
def get_inscrits_etape(context, code_etape, anneeapogee=None, ntrials=2): def get_inscrits_etape(code_etape, anneeapogee=None, ntrials=2):
"""Liste des inscrits à une étape Apogée """Liste des inscrits à une étape Apogée
Result = list of dicts Result = list of dicts
ntrials: try several time the same request, useful for some bad web services ntrials: try several time the same request, useful for some bad web services
@ -148,8 +148,8 @@ def get_inscrits_etape(context, code_etape, anneeapogee=None, ntrials=2):
if anneeapogee is None: if anneeapogee is None:
anneeapogee = str(time.localtime()[0]) anneeapogee = str(time.localtime()[0])
etud_url = get_etud_url(context) etud_url = get_etud_url()
api_ver = get_portal_api_version(context) api_ver = get_portal_api_version()
if not etud_url: if not etud_url:
return [] return []
portal_timeout = sco_preferences.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference("portal_timeout")
@ -194,13 +194,13 @@ def get_inscrits_etape(context, code_etape, anneeapogee=None, ntrials=2):
return etuds return etuds
def query_apogee_portal(context, **args): def query_apogee_portal(**args):
"""Recupere les infos sur les etudiants nommés """Recupere les infos sur les etudiants nommés
args: nom, prenom, code_nip args: nom, prenom, code_nip
(nom et prenom matchent des parties de noms) (nom et prenom matchent des parties de noms)
""" """
etud_url = get_etud_url(context) etud_url = get_etud_url()
api_ver = get_portal_api_version(context) api_ver = get_portal_api_version()
if not etud_url: if not etud_url:
return [] return []
if api_ver > 1: if api_ver > 1:
@ -264,7 +264,7 @@ def xml_to_list_of_dicts(doc, req=None):
return infos return infos
def get_infos_apogee_allaccents(context, nom, prenom): def get_infos_apogee_allaccents(nom, prenom):
"essai recup infos avec differents codages des accents" "essai recup infos avec differents codages des accents"
if nom: if nom:
nom_noaccents = scu.suppress_accents(nom) nom_noaccents = scu.suppress_accents(nom)
@ -277,25 +277,23 @@ def get_infos_apogee_allaccents(context, nom, prenom):
prenom_noaccents = prenom prenom_noaccents = prenom
# avec accents # avec accents
infos = query_apogee_portal(context, nom=nom, prenom=prenom) infos = query_apogee_portal(nom=nom, prenom=prenom)
# sans accents # sans accents
if nom != nom_noaccents or prenom != prenom_noaccents: if nom != nom_noaccents or prenom != prenom_noaccents:
infos += query_apogee_portal( infos += query_apogee_portal(nom=nom_noaccents, prenom=prenom_noaccents)
context, nom=nom_noaccents, prenom=prenom_noaccents
)
return infos return infos
def get_infos_apogee(context, nom, prenom): def get_infos_apogee(nom, prenom):
"""recupere les codes Apogee en utilisant le web service CRIT""" """recupere les codes Apogee en utilisant le web service CRIT"""
if (not nom) and (not prenom): if (not nom) and (not prenom):
return [] return []
# essaie plusieurs codages: tirets, accents # essaie plusieurs codages: tirets, accents
infos = get_infos_apogee_allaccents(context, nom, prenom) infos = get_infos_apogee_allaccents(nom, prenom)
nom_st = nom.replace("-", " ") nom_st = nom.replace("-", " ")
prenom_st = prenom.replace("-", " ") prenom_st = prenom.replace("-", " ")
if nom_st != nom or prenom_st != prenom: if nom_st != nom or prenom_st != prenom:
infos += get_infos_apogee_allaccents(context, nom_st, prenom_st) infos += get_infos_apogee_allaccents(nom_st, prenom_st)
# si pas de match et nom ou prenom composé, essaie en coupant # si pas de match et nom ou prenom composé, essaie en coupant
if not infos: if not infos:
if nom: if nom:
@ -307,18 +305,18 @@ def get_infos_apogee(context, nom, prenom):
else: else:
prenom1 = prenom prenom1 = prenom
if nom != nom1 or prenom != prenom1: if nom != nom1 or prenom != prenom1:
infos += get_infos_apogee_allaccents(context, nom1, prenom1) infos += get_infos_apogee_allaccents(nom1, prenom1)
return infos return infos
def get_etud_apogee(context, code_nip): def get_etud_apogee(code_nip):
"""Informations à partir du code NIP. """Informations à partir du code NIP.
None si pas d'infos sur cet etudiant. None si pas d'infos sur cet etudiant.
Exception si reponse invalide. Exception si reponse invalide.
""" """
if not code_nip: if not code_nip:
return {} return {}
etud_url = get_etud_url(context) etud_url = get_etud_url()
if not etud_url: if not etud_url:
return {} return {}
portal_timeout = sco_preferences.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference("portal_timeout")
@ -332,7 +330,7 @@ def get_etud_apogee(context, code_nip):
return d[0] return d[0]
def get_default_etapes(context): def get_default_etapes():
"""Liste par défaut, lue du fichier de config""" """Liste par défaut, lue du fichier de config"""
filename = scu.SCO_TOOLS_DIR + "/default-etapes.txt" filename = scu.SCO_TOOLS_DIR + "/default-etapes.txt"
log("get_default_etapes: reading %s" % filename) log("get_default_etapes: reading %s" % filename)
@ -350,7 +348,7 @@ def get_default_etapes(context):
return etapes return etapes
def _parse_etapes_from_xml(context, doc): def _parse_etapes_from_xml(doc):
""" """
may raise exception if invalid xml doc may raise exception if invalid xml doc
""" """
@ -373,13 +371,13 @@ def _parse_etapes_from_xml(context, doc):
return infos return infos
def get_etapes_apogee(context): def get_etapes_apogee():
"""Liste des etapes apogee """Liste des etapes apogee
{ departement : { code_etape : intitule } } { departement : { code_etape : intitule } }
Demande la liste au portail, ou si échec utilise liste Demande la liste au portail, ou si échec utilise liste
par défaut par défaut
""" """
etapes_url = get_etapes_url(context) etapes_url = get_etapes_url()
infos = {} infos = {}
if etapes_url: if etapes_url:
portal_timeout = sco_preferences.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference("portal_timeout")
@ -389,7 +387,7 @@ def get_etapes_apogee(context):
) )
doc = scu.query_portal(etapes_url, timeout=portal_timeout) doc = scu.query_portal(etapes_url, timeout=portal_timeout)
try: try:
infos = _parse_etapes_from_xml(context, doc) infos = _parse_etapes_from_xml(doc)
# cache le resultat (utile si le portail repond de façon intermitente) # cache le resultat (utile si le portail repond de façon intermitente)
if infos: if infos:
log("get_etapes_apogee: caching result") log("get_etapes_apogee: caching result")
@ -399,14 +397,14 @@ def get_etapes_apogee(context):
# Avons nous la copie d'une réponse récente ? # Avons nous la copie d'une réponse récente ?
try: try:
doc = open(SCO_CACHE_ETAPE_FILENAME).read() doc = open(SCO_CACHE_ETAPE_FILENAME).read()
infos = _parse_etapes_from_xml(context, doc) infos = _parse_etapes_from_xml(doc)
log("using last saved version from " + SCO_CACHE_ETAPE_FILENAME) log("using last saved version from " + SCO_CACHE_ETAPE_FILENAME)
except: except:
infos = {} infos = {}
else: else:
# Pas de portail: utilise étapes par défaut livrées avec ScoDoc # Pas de portail: utilise étapes par défaut livrées avec ScoDoc
log("get_etapes_apogee: no configured URL (using default file)") log("get_etapes_apogee: no configured URL (using default file)")
infos = get_default_etapes(context) infos = get_default_etapes()
return infos return infos
@ -421,7 +419,7 @@ def _xml_list_codes(target_dict, dept, nodes):
target_dict[dept] = {code: intitule} target_dict[dept] = {code: intitule}
def get_etapes_apogee_dept(context): def get_etapes_apogee_dept():
"""Liste des etapes apogee pour ce departement. """Liste des etapes apogee pour ce departement.
Utilise la propriete 'portal_dept_name' pour identifier le departement. Utilise la propriete 'portal_dept_name' pour identifier le departement.
@ -438,7 +436,7 @@ def get_etapes_apogee_dept(context):
portal_dept_name = "" portal_dept_name = ""
log("get_etapes_apogee_dept: pas de sections par departement") log("get_etapes_apogee_dept: pas de sections par departement")
infos = get_etapes_apogee(context) infos = get_etapes_apogee()
if portal_dept_name and portal_dept_name not in infos: if portal_dept_name and portal_dept_name not in infos:
log( log(
"get_etapes_apogee_dept: pas de section '%s' dans la reponse portail" "get_etapes_apogee_dept: pas de section '%s' dans la reponse portail"
@ -512,7 +510,7 @@ def _normalize_apo_fields(infolist):
return infolist return infolist
def check_paiement_etuds(context, etuds): def check_paiement_etuds(etuds):
"""Interroge le portail pour vérifier l'état de "paiement" et l'étape d'inscription. """Interroge le portail pour vérifier l'état de "paiement" et l'étape d'inscription.
Seuls les etudiants avec code NIP sont renseignés. Seuls les etudiants avec code NIP sont renseignés.
@ -534,7 +532,7 @@ def check_paiement_etuds(context, etuds):
etud["etape"] = None etud["etape"] = None
else: else:
# Modifie certains champs de l'étudiant: # Modifie certains champs de l'étudiant:
infos = get_etud_apogee(context, etud["code_nip"]) infos = get_etud_apogee(etud["code_nip"])
if infos: if infos:
for k in ( for k in (
"paiementinscription", "paiementinscription",
@ -551,9 +549,9 @@ def check_paiement_etuds(context, etuds):
etud["paiementinscription_str"] = "(pb cnx Apogée)" etud["paiementinscription_str"] = "(pb cnx Apogée)"
def get_maquette_apogee(context, etape="", annee_scolaire=""): def get_maquette_apogee(etape="", annee_scolaire=""):
"""Maquette CSV Apogee pour une étape et une annee scolaire""" """Maquette CSV Apogee pour une étape et une annee scolaire"""
maquette_url = get_maquette_url(context) maquette_url = get_maquette_url()
if not maquette_url: if not maquette_url:
return None return None
portal_timeout = sco_preferences.get_preference("portal_timeout") portal_timeout = sco_preferences.get_preference("portal_timeout")

View File

@ -2125,9 +2125,7 @@ class SemPreferences(object):
context = None # XXX TO REMOVE context = None # XXX TO REMOVE
sem = sco_formsemestre.get_formsemestre(self.formsemestre_id) sem = sco_formsemestre.get_formsemestre(self.formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(REQUEST, "Préférences du semestre", sem),
context, REQUEST, "Préférences du semestre", sem
),
""" """
<p class="help">Les paramètres définis ici ne s'appliqueront qu'à ce semestre.</p> <p class="help">Les paramètres définis ici ne s'appliqueront qu'à ce semestre.</p>
<p class="msg">Attention: cliquez sur "Enregistrer les modifications" en bas de page pour appliquer vos changements !</p> <p class="msg">Attention: cliquez sur "Enregistrer les modifications" en bas de page pour appliquer vos changements !</p>

View File

@ -551,7 +551,6 @@ def formsemestre_pvjury(
tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id) tab.base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Décisions du jury pour le semestre", "Décisions du jury pour le semestre",
sem, sem,
@ -635,13 +634,12 @@ def formsemestre_pvjury_pdf(
group_ids = [sco_groups.get_default_group(formsemestre_id)] group_ids = [sco_groups.get_default_group(formsemestre_id)]
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
) )
etudids = [m["etudid"] for m in groups_infos.members] etudids = [m["etudid"] for m in groups_infos.members]
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Edition du PV de jury %s" % etuddescr, "Edition du PV de jury %s" % etuddescr,
sem=sem, sem=sem,
@ -659,14 +657,14 @@ def formsemestre_pvjury_pdf(
</p>""", </p>""",
html_sco_header.sco_footer(), html_sco_header.sco_footer(),
] ]
descr = descrform_pvjury(context, sem) descr = descrform_pvjury(sem)
if etudid: if etudid:
descr.append(("etudid", {"input_type": "hidden"})) descr.append(("etudid", {"input_type": "hidden"}))
if groups_infos: if groups_infos:
menu_choix_groupe = ( menu_choix_groupe = (
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister sur le PV: """ """<div class="group_ids_sel_menu">Groupes d'étudiants à lister sur le PV: """
+ sco_groups_view.menu_groups_choice(context, groups_infos) + sco_groups_view.menu_groups_choice(groups_infos)
+ """</div>""" + """</div>"""
) )
else: else:
@ -726,7 +724,7 @@ def formsemestre_pvjury_pdf(
return scu.sendPDFFile(REQUEST, pdfdoc, filename) return scu.sendPDFFile(REQUEST, pdfdoc, filename)
def descrform_pvjury(context, sem): def descrform_pvjury(sem):
"""Définition de formulaire pour PV jury PDF""" """Définition de formulaire pour PV jury PDF"""
F = sco_formations.formation_list(formation_id=sem["formation_id"])[0] F = sco_formations.formation_list(formation_id=sem["formation_id"])[0]
return [ return [
@ -818,13 +816,12 @@ def formsemestre_lettres_individuelles(
# tous les inscrits du semestre # tous les inscrits du semestre
group_ids = [sco_groups.get_default_group(formsemestre_id)] group_ids = [sco_groups.get_default_group(formsemestre_id)]
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
) )
etudids = [m["etudid"] for m in groups_infos.members] etudids = [m["etudid"] for m in groups_infos.members]
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Edition des lettres individuelles", "Edition des lettres individuelles",
sem=sem, sem=sem,
@ -841,7 +838,7 @@ def formsemestre_lettres_individuelles(
descr = descrform_lettres_individuelles() descr = descrform_lettres_individuelles()
menu_choix_groupe = ( menu_choix_groupe = (
"""<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """ """<div class="group_ids_sel_menu">Groupes d'étudiants à lister: """
+ sco_groups_view.menu_groups_choice(context, groups_infos) + sco_groups_view.menu_groups_choice(groups_infos)
+ """</div>""" + """</div>"""
) )

View File

@ -603,7 +603,6 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context,
group_ids=group_ids, group_ids=group_ids,
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
select_all_when_unspecified=True, select_all_when_unspecified=True,
@ -779,7 +778,6 @@ def feuille_saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
) )
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context,
group_ids=group_ids, group_ids=group_ids,
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
select_all_when_unspecified=True, select_all_when_unspecified=True,
@ -878,7 +876,6 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context,
group_ids=group_ids, group_ids=group_ids,
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
select_all_when_unspecified=True, select_all_when_unspecified=True,

View File

@ -339,7 +339,7 @@ class SemSet(dict):
"""Affichage de la partie Effectifs et Liste des étudiants """Affichage de la partie Effectifs et Liste des étudiants
(actif seulement si un portail est configuré) (actif seulement si un portail est configuré)
""" """
if sco_portal_apogee.has_portal(self.context): if sco_portal_apogee.has_portal():
return self.bilan.html_diagnostic() return self.bilan.html_diagnostic()
else: else:
return "" return ""

View File

@ -375,7 +375,7 @@ def list_synch(context, sem, anneeapogee=None):
for etape in etapes: for etape in etapes:
if etape: if etape:
etudsapo = sco_portal_apogee.get_inscrits_etape( etudsapo = sco_portal_apogee.get_inscrits_etape(
context, etape, anneeapogee=anneeapogee etape, anneeapogee=anneeapogee
) )
etudsapo_set = etudsapo_set.union(set([x[EKEY_APO] for x in etudsapo])) etudsapo_set = etudsapo_set.union(set([x[EKEY_APO] for x in etudsapo]))
for e in etudsapo: for e in etudsapo:
@ -803,9 +803,7 @@ def formsemestre_import_etud_admission(
) )
apo_etuds = {} # nip : etud apo apo_etuds = {} # nip : etud apo
for etape in sem["etapes"]: for etape in sem["etapes"]:
etudsapo = sco_portal_apogee.get_inscrits_etape( etudsapo = sco_portal_apogee.get_inscrits_etape(etape, anneeapogee=anneeapogee)
context, etape, anneeapogee=anneeapogee
)
apo_etuds.update({e["nip"]: e for e in etudsapo}) apo_etuds.update({e["nip"]: e for e in etudsapo})
for i in ins: for i in ins:
@ -818,7 +816,7 @@ def formsemestre_import_etud_admission(
etud = apo_etuds.get(code_nip) etud = apo_etuds.get(code_nip)
if not etud: if not etud:
# pas vu dans les etudiants de l'étape, tente en individuel # pas vu dans les etudiants de l'étape, tente en individuel
etud = sco_portal_apogee.get_etud_apogee(context, code_nip) etud = sco_portal_apogee.get_etud_apogee(code_nip)
if etud: if etud:
update_etape_formsemestre_inscription(context, i, etud) update_etape_formsemestre_inscription(context, i, etud)
do_import_etud_admission( do_import_etud_admission(

View File

@ -79,7 +79,7 @@ def trombino(
etat = None # may be passed as '' etat = None # may be passed as ''
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, etat=etat, REQUEST=REQUEST group_ids, formsemestre_id=formsemestre_id, etat=etat, REQUEST=REQUEST
) )
# #
@ -225,7 +225,7 @@ def _trombino_zip(context, groups_infos, REQUEST):
# assume we have the photos (or the user acknowledged the fact) # assume we have the photos (or the user acknowledged the fact)
# Archive originals (not reduced) images, in JPEG # Archive originals (not reduced) images, in JPEG
for t in groups_infos.members: for t in groups_infos.members:
im_path = sco_photos.photo_pathname(context, t, size="orig") im_path = sco_photos.photo_pathname(t, size="orig")
if not im_path: if not im_path:
continue continue
img = open(im_path, "rb").read() img = open(im_path, "rb").read()
@ -250,12 +250,10 @@ def _trombino_zip(context, groups_infos, REQUEST):
# Copy photos from portal to ScoDoc # Copy photos from portal to ScoDoc
def trombino_copy_photos(context, group_ids=[], REQUEST=None, dialog_confirmed=False): def trombino_copy_photos(context, group_ids=[], REQUEST=None, dialog_confirmed=False):
"Copy photos from portal to ScoDoc (overwriting local copy)" "Copy photos from portal to ScoDoc (overwriting local copy)"
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
context, group_ids, REQUEST=REQUEST
)
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
portal_url = sco_portal_apogee.get_portal_url(context) portal_url = sco_portal_apogee.get_portal_url()
header = html_sco_header.sco_header(page_title="Chargement des photos") header = html_sco_header.sco_header(page_title="Chargement des photos")
footer = html_sco_header.sco_footer() footer = html_sco_header.sco_footer()
if not portal_url: if not portal_url:
@ -300,7 +298,7 @@ def trombino_copy_photos(context, group_ids=[], REQUEST=None, dialog_confirmed=F
def _get_etud_platypus_image(context, t, image_width=2 * cm): def _get_etud_platypus_image(context, t, image_width=2 * cm):
"""Returns aplatypus object for the photo of student t""" """Returns aplatypus object for the photo of student t"""
try: try:
path = sco_photos.photo_pathname(context, t, size="small") path = sco_photos.photo_pathname(t, size="small")
if not path: if not path:
# log('> unknown') # log('> unknown')
path = sco_photos.UNKNOWN_IMAGE_PATH path = sco_photos.UNKNOWN_IMAGE_PATH
@ -494,9 +492,7 @@ def photos_generate_excel_sample(context, group_ids=[], REQUEST=None):
def photos_import_files_form(context, group_ids=[], REQUEST=None): def photos_import_files_form(context, group_ids=[], REQUEST=None):
"""Formulaire pour importation photos""" """Formulaire pour importation photos"""
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
context, group_ids, REQUEST=REQUEST
)
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
H = [ H = [
@ -548,9 +544,7 @@ def photos_import_files(
context, group_ids=[], xlsfile=None, zipfile=None, REQUEST=None context, group_ids=[], xlsfile=None, zipfile=None, REQUEST=None
): ):
"""Importation des photos""" """Importation des photos"""
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
context, group_ids, REQUEST=REQUEST
)
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
filename_title = "fichier_photo" filename_title = "fichier_photo"
page_title = "Téléchargement des photos des étudiants" page_title = "Téléchargement des photos des étudiants"

View File

@ -62,7 +62,7 @@ def pdf_trombino_tours(
"""Generation du trombinoscope en fichier PDF""" """Generation du trombinoscope en fichier PDF"""
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
) )
DeptName = sco_preferences.get_preference("DeptName") DeptName = sco_preferences.get_preference("DeptName")
@ -300,7 +300,7 @@ def pdf_feuille_releve_absences(
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
) )
DeptName = sco_preferences.get_preference("DeptName") DeptName = sco_preferences.get_preference("DeptName")

View File

@ -225,7 +225,6 @@ def external_ue_create_form(context, formsemestre_id, etudid, REQUEST=None):
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Ajout d'une UE externe pour %(nomprenom)s" % etud, "Ajout d'une UE externe pour %(nomprenom)s" % etud,
sem, sem,

View File

@ -86,7 +86,7 @@ def index_html(context, REQUEST, all_depts=False, with_inactives=False, format="
all_depts = int(all_depts) all_depts = int(all_depts)
with_inactives = int(with_inactives) with_inactives = int(with_inactives)
H = [html_sco_header.html_sem_header(context, REQUEST, "Gestion des utilisateurs")] H = [html_sco_header.html_sem_header(REQUEST, "Gestion des utilisateurs")]
if current_user.has_permission(Permission.ScoUsersAdmin, g.scodoc_dept): if current_user.has_permission(Permission.ScoUsersAdmin, g.scodoc_dept):
H.append( H.append(

View File

@ -324,7 +324,7 @@ def SignaleAbsenceGrHebdo(
moduleimpl_id = None moduleimpl_id = None
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(
context, group_ids, moduleimpl_id=moduleimpl_id, REQUEST=REQUEST group_ids, moduleimpl_id=moduleimpl_id, REQUEST=REQUEST
) )
if not groups_infos.members: if not groups_infos.members:
return ( return (
@ -415,9 +415,7 @@ def SignaleAbsenceGrHebdo(
datelundi, datelundi,
destination, destination,
moduleimpl_id or "", moduleimpl_id or "",
sco_groups_view.menu_groups_choice( sco_groups_view.menu_groups_choice(groups_infos, submit_on_change=True),
context, groups_infos, submit_on_change=True
),
), ),
] ]
# #
@ -489,9 +487,7 @@ def SignaleAbsenceGrSemestre(
REQUEST=None, REQUEST=None,
): ):
"""Saisie des absences sur une journée sur un semestre (ou intervalle de dates) entier""" """Saisie des absences sur une journée sur un semestre (ou intervalle de dates) entier"""
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
context, group_ids, REQUEST=REQUEST
)
if not groups_infos.members: if not groups_infos.members:
return ( return (
html_sco_header.sco_header(page_title="Saisie des absences") html_sco_header.sco_header(page_title="Saisie des absences")
@ -865,9 +861,7 @@ def EtatAbsencesGr(
datedebut = ndb.DateDMYtoISO(debut) datedebut = ndb.DateDMYtoISO(debut)
datefin = ndb.DateDMYtoISO(fin) datefin = ndb.DateDMYtoISO(fin)
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
context, group_ids, REQUEST=REQUEST
)
formsemestre_id = groups_infos.formsemestre_id formsemestre_id = groups_infos.formsemestre_id
sem = groups_infos.formsemestre sem = groups_infos.formsemestre
@ -956,7 +950,7 @@ def EtatAbsencesGr(
javascripts=["js/etud_info.js"], javascripts=["js/etud_info.js"],
), ),
html_title=html_sco_header.html_sem_header( html_title=html_sco_header.html_sem_header(
context, REQUEST, "%s" % title, sem, with_page_header=False REQUEST, "%s" % title, sem, with_page_header=False
) )
+ "<p>Période du %s au %s (nombre de <b>demi-journées</b>)<br/>" % (debut, fin), + "<p>Période du %s au %s (nombre de <b>demi-journées</b>)<br/>" % (debut, fin),
base_url="%s&formsemestre_id=%s&debut=%s&fin=%s" base_url="%s&formsemestre_id=%s&debut=%s&fin=%s"
@ -997,9 +991,7 @@ def EtatAbsencesDate(
# ported from dtml # ported from dtml
"""Etat des absences pour un groupe à une date donnée""" """Etat des absences pour un groupe à une date donnée"""
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = sco_groups_view.DisplayedGroupsInfos( groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids, REQUEST=REQUEST)
context, group_ids, REQUEST=REQUEST
)
H = [html_sco_header.sco_header(page_title="Etat des absences")] H = [html_sco_header.sco_header(page_title="Etat des absences")]
if date: if date:
dateiso = ndb.DateDMYtoISO(date) dateiso = ndb.DateDMYtoISO(date)

View File

@ -684,7 +684,6 @@ def edit_enseignants_form(context, REQUEST, moduleimpl_id):
M, sem = sco_moduleimpl.can_change_ens(REQUEST, moduleimpl_id) M, sem = sco_moduleimpl.can_change_ens(REQUEST, moduleimpl_id)
# -- # --
header = html_sco_header.html_sem_header( header = html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
'Enseignants du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>' 'Enseignants du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
% (moduleimpl_id, M["module"]["titre"]), % (moduleimpl_id, M["module"]["titre"]),
@ -797,7 +796,6 @@ def edit_moduleimpl_resp(context, REQUEST, moduleimpl_id):
M, sem = sco_moduleimpl.can_change_module_resp(REQUEST, moduleimpl_id) M, sem = sco_moduleimpl.can_change_module_resp(REQUEST, moduleimpl_id)
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
'Modification du responsable du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>' 'Modification du responsable du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
% (moduleimpl_id, M["module"]["titre"]), % (moduleimpl_id, M["module"]["titre"]),
@ -904,7 +902,6 @@ def edit_moduleimpl_expr(context, REQUEST, moduleimpl_id):
M, sem = sco_moduleimpl.can_change_ens(REQUEST, moduleimpl_id) M, sem = sco_moduleimpl.can_change_ens(REQUEST, moduleimpl_id)
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
'Modification règle de calcul du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>' 'Modification règle de calcul du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
% (moduleimpl_id, M["module"]["titre"]), % (moduleimpl_id, M["module"]["titre"]),
@ -1003,7 +1000,6 @@ def view_module_abs(context, REQUEST, moduleimpl_id, format="html"):
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
'Absences du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>' 'Absences du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
% (moduleimpl_id, M["module"]["titre"]), % (moduleimpl_id, M["module"]["titre"]),
@ -1055,7 +1051,6 @@ def edit_ue_expr(context, REQUEST, formsemestre_id, ue_id):
ue = sco_edit_ue.do_ue_list({"ue_id": ue_id})[0] ue = sco_edit_ue.do_ue_list({"ue_id": ue_id})[0]
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Modification règle de calcul de l'UE %s (%s)" "Modification règle de calcul de l'UE %s (%s)"
% (ue["acronyme"], ue["titre"]), % (ue["acronyme"], ue["titre"]),
@ -1197,15 +1192,13 @@ def formsemestre_enseignants_list(context, REQUEST, formsemestre_id, format="htm
html_class="table_leftalign", html_class="table_leftalign",
filename=scu.make_filename("Enseignants-" + sem["titreannee"]), filename=scu.make_filename("Enseignants-" + sem["titreannee"]),
html_title=html_sco_header.html_sem_header( html_title=html_sco_header.html_sem_header(
context, REQUEST, "Enseignants du semestre", sem, with_page_header=False REQUEST, "Enseignants du semestre", sem, with_page_header=False
), ),
base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id), base_url="%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id),
caption="Tous les enseignants (responsables ou associés aux modules de ce semestre) apparaissent. Le nombre de saisies d'absences est le nombre d'opérations d'ajout effectuées sur ce semestre, sans tenir compte des annulations ou double saisies.", caption="Tous les enseignants (responsables ou associés aux modules de ce semestre) apparaissent. Le nombre de saisies d'absences est le nombre d'opérations d'ajout effectuées sur ce semestre, sans tenir compte des annulations ou double saisies.",
preferences=sco_preferences.SemPreferences(formsemestre_id), preferences=sco_preferences.SemPreferences(formsemestre_id),
) )
return T.make_page( return T.make_page(page_title=title, title=title, REQUEST=REQUEST, format=format)
page_title=title, title=title, REQUEST=REQUEST, format=format
)
@bp.route("/edit_enseignants_form_delete", methods=["GET", "POST"]) @bp.route("/edit_enseignants_form_delete", methods=["GET", "POST"])
@ -1453,7 +1446,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
tit = "Suppression de l'évaluation %(description)s (%(jour)s)" % E tit = "Suppression de l'évaluation %(description)s (%(jour)s)" % E
etat = sco_evaluations.do_evaluation_etat(evaluation_id) etat = sco_evaluations.do_evaluation_etat(evaluation_id)
H = [ H = [
html_sco_header.html_sem_header(context, REQUEST, tit, with_h2=False), html_sco_header.html_sem_header(REQUEST, tit, with_h2=False),
"""<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod, """<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod,
"""<h3>%s</h3>""" % tit, """<h3>%s</h3>""" % tit,
"""<p class="help">Opération <span class="redboldtext">irréversible</span>. Si vous supprimez l'évaluation, vous ne pourrez pas retrouver les notes associées.</p>""", """<p class="help">Opération <span class="redboldtext">irréversible</span>. Si vous supprimez l'évaluation, vous ne pourrez pas retrouver les notes associées.</p>""",
@ -1716,7 +1709,7 @@ def formsemestre_bulletins_choice(
"""Choix d'une version de bulletin""" """Choix d'une version de bulletin"""
sem = sco_formsemestre.get_formsemestre(formsemestre_id) sem = sco_formsemestre.get_formsemestre(formsemestre_id)
H = [ H = [
html_sco_header.html_sem_header(context, REQUEST, title, sem), html_sco_header.html_sem_header(REQUEST, title, sem),
""" """
<form name="f" method="GET" action="%s"> <form name="f" method="GET" action="%s">
<input type="hidden" name="formsemestre_id" value="%s"></input> <input type="hidden" name="formsemestre_id" value="%s"></input>
@ -1759,7 +1752,7 @@ def formsemestre_bulletins_mailetuds(
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etudids nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etudids
etudids = nt.get_etudids() etudids = nt.get_etudids()
# #
if not sco_bulletins.can_send_bulletin_by_mail(context, formsemestre_id): if not sco_bulletins.can_send_bulletin_by_mail(formsemestre_id):
raise AccessDenied("vous n'avez pas le droit d'envoyer les bulletins") raise AccessDenied("vous n'avez pas le droit d'envoyer les bulletins")
# Confirmation dialog # Confirmation dialog
if not dialog_confirmed: if not dialog_confirmed:

View File

@ -1178,7 +1178,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
# code_nip = initvalues.get("code_nip", "") # code_nip = initvalues.get("code_nip", "")
# if code_nip: # if code_nip:
# try: # try:
# infos = sco_portal_apogee.get_etud_apogee(context, code_nip) # infos = sco_portal_apogee.get_etud_apogee(code_nip)
# except ValueError: # except ValueError:
# infos = None # infos = None
# pass # XXX a terminer # pass # XXX a terminer
@ -1191,7 +1191,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
prenom = REQUEST.form.get("prenom", "") prenom = REQUEST.form.get("prenom", "")
if REQUEST.form.get("tf_submitted", False) and not prenom: if REQUEST.form.get("tf_submitted", False) and not prenom:
prenom = initvalues.get("prenom", "") prenom = initvalues.get("prenom", "")
infos = sco_portal_apogee.get_infos_apogee(context, nom, prenom) infos = sco_portal_apogee.get_infos_apogee(nom, prenom)
if infos: if infos:
formatted_infos = [ formatted_infos = [
@ -1626,7 +1626,6 @@ def check_group_apogee(
cnx = ndb.GetDBConnexion() cnx = ndb.GetDBConnexion()
H = [ H = [
html_sco_header.html_sem_header( html_sco_header.html_sem_header(
context,
REQUEST, REQUEST,
"Etudiants du %s" % (group["group_name"] or "semestre"), "Etudiants du %s" % (group["group_name"] or "semestre"),
sem, sem,
@ -1646,7 +1645,7 @@ def check_group_apogee(
t["email"], t["email"],
t["code_nip"], t["code_nip"],
) )
infos = sco_portal_apogee.get_infos_apogee(context, nom, prenom) infos = sco_portal_apogee.get_infos_apogee(nom, prenom)
if not infos: if not infos:
info_apogee = ( info_apogee = (
'<b>Pas d\'information</b> (<a href="etudident_edit_form?etudid=%s">Modifier identité</a>)' '<b>Pas d\'information</b> (<a href="etudident_edit_form?etudid=%s">Modifier identité</a>)'
@ -2069,7 +2068,7 @@ def formsemestre_import_etud_admission(
context, formsemestre_id, import_identite=True, import_email=import_email context, formsemestre_id, import_identite=True, import_email=import_email
) )
H = [ H = [
html_sco_header.html_sem_header(context, REQUEST, "Reimport données admission"), html_sco_header.html_sem_header(REQUEST, "Reimport données admission"),
"<h3>Opération effectuée</h3>", "<h3>Opération effectuée</h3>",
] ]
if no_nip: if no_nip:

View File

@ -99,4 +99,7 @@ do
# fi # fi
done done
echo
echo "Terminé. (vous pouvez ignorer les éventuels avertissements de pg_restore ci-dessus !)"
echo
# #