forked from ScoDoc/ScoDoc
refactoring: removing useless args for Flask
This commit is contained in:
parent
243a9b6fd9
commit
8fedde52e7
@ -628,8 +628,6 @@ class GenTable(object):
|
||||
H.append(
|
||||
self.html_header
|
||||
or html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=page_title,
|
||||
javascripts=javascripts,
|
||||
init_qtip=init_qtip,
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
import html
|
||||
|
||||
from flask import g
|
||||
from flask import request
|
||||
from flask_login import current_user
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
@ -136,10 +138,7 @@ def scodoc_top_html_header(page_title="ScoDoc: bienvenue"):
|
||||
|
||||
# Header:
|
||||
def sco_header(
|
||||
context,
|
||||
REQUEST=None,
|
||||
# optional args
|
||||
container=None, # objet qui a lancé la demande
|
||||
page_title="", # page title
|
||||
no_side_bar=False, # hide sidebar
|
||||
cssstyles=[], # additionals CSS sheets
|
||||
@ -159,15 +158,13 @@ def sco_header(
|
||||
from app.scodoc.sco_formsemestre_status import formsemestre_page_title
|
||||
|
||||
context = None # XXX TODO à enlever #context
|
||||
# context est une instance de ZScolar. container est une instance qui "acquiert" ZScolar
|
||||
|
||||
# Add a HTTP header (can be used by Apache to log requests)
|
||||
if REQUEST.AUTHENTICATED_USER:
|
||||
REQUEST.RESPONSE.setHeader("X-ScoDoc-User", str(REQUEST.AUTHENTICATED_USER))
|
||||
|
||||
# Get more parameters from REQUEST
|
||||
if not head_message and "head_message" in REQUEST.form:
|
||||
head_message = REQUEST.form["head_message"]
|
||||
# Get head message from http request:
|
||||
if not head_message:
|
||||
if request.method == "POST":
|
||||
head_message = request.form.get("head_message", "")
|
||||
elif request.method == "GET":
|
||||
head_message = request.args.get("head_message", "")
|
||||
|
||||
params = {
|
||||
"page_title": page_title or VERSION.SCONAME,
|
||||
@ -175,7 +172,7 @@ def sco_header(
|
||||
"ScoURL": scu.ScoURL(),
|
||||
"encoding": scu.SCO_ENCODING,
|
||||
"titrebandeau_mkup": "<td>" + titrebandeau + "</td>",
|
||||
"authuser": str(REQUEST.AUTHENTICATED_USER),
|
||||
"authuser": current_user.user_name,
|
||||
}
|
||||
if bodyOnLoad:
|
||||
params["bodyOnLoad_mkup"] = """onload="%s" """ % bodyOnLoad
|
||||
@ -307,11 +304,11 @@ def sco_header(
|
||||
H.append(scu.CUSTOM_HTML_HEADER)
|
||||
#
|
||||
if not no_side_bar:
|
||||
H.append(html_sidebar.sidebar(REQUEST))
|
||||
H.append(html_sidebar.sidebar())
|
||||
H.append("""<div class="gtrcontent" id="gtrcontent">""")
|
||||
#
|
||||
# Barre menu semestre:
|
||||
H.append(formsemestre_page_title(context, REQUEST))
|
||||
H.append(formsemestre_page_title(context))
|
||||
|
||||
# Avertissement si mot de passe à changer
|
||||
if user_check:
|
||||
@ -354,9 +351,7 @@ def html_sem_header(
|
||||
"Titre d'une page semestre avec lien vers tableau de bord"
|
||||
# sem now unused and thus optional...
|
||||
if with_page_header:
|
||||
h = sco_header(
|
||||
context, REQUEST, page_title="%s" % (page_title or title), **args
|
||||
)
|
||||
h = sco_header(page_title="%s" % (page_title or title), **args)
|
||||
else:
|
||||
h = ""
|
||||
if with_h2:
|
||||
|
@ -28,30 +28,32 @@
|
||||
"""
|
||||
Génération de la "sidebar" (marge gauche des pages HTML)
|
||||
"""
|
||||
from flask import url_for, g
|
||||
from flask import url_for
|
||||
from flask import g
|
||||
from flask import request
|
||||
from flask_login import current_user
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
|
||||
|
||||
def sidebar_common(REQUEST=None):
|
||||
def sidebar_common():
|
||||
"partie commune à toutes les sidebar"
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
params = {
|
||||
"ScoURL": scu.ScoURL(),
|
||||
"UsersURL": scu.UsersURL(),
|
||||
"NotesURL": scu.NotesURL(),
|
||||
"AbsencesURL": scu.AbsencesURL(),
|
||||
"LogoutURL": url_for("auth.logout"),
|
||||
"authuser": str(authuser),
|
||||
"authuser": current_user.user_name,
|
||||
}
|
||||
H = [
|
||||
'<a class="scodoc_title" href="about">ScoDoc 8</a>',
|
||||
'<div id="authuser"><a id="authuserlink" href="%(ScoURL)s/Users/user_info_page">%(authuser)s</a><br/><a id="deconnectlink" href="%(LogoutURL)s">déconnexion</a></div>'
|
||||
% params,
|
||||
sidebar_dept(REQUEST),
|
||||
"""<h2 class="insidebar">Scolarité</h2>
|
||||
sidebar_dept(),
|
||||
"""<h2 class="insidebar">Scolarité</h2>
|
||||
<a href="%(ScoURL)s" class="sidebar">Semestres</a> <br/>
|
||||
<a href="%(NotesURL)s" class="sidebar">Programmes</a> <br/>
|
||||
<a href="%(AbsencesURL)s" class="sidebar">Absences</a> <br/>
|
||||
@ -59,14 +61,14 @@ def sidebar_common(REQUEST=None):
|
||||
% params,
|
||||
]
|
||||
|
||||
if authuser.has_permission(Permission.ScoUsersAdmin) or authuser.has_permission(
|
||||
Permission.ScoUsersView
|
||||
):
|
||||
if current_user.has_permission(
|
||||
Permission.ScoUsersAdmin
|
||||
) or current_user.has_permission(Permission.ScoUsersView):
|
||||
H.append(
|
||||
"""<a href="%(UsersURL)s" class="sidebar">Utilisateurs</a> <br/>""" % params
|
||||
)
|
||||
|
||||
if authuser.has_permission(Permission.ScoChangePreferences):
|
||||
if current_user.has_permission(Permission.ScoChangePreferences):
|
||||
H.append(
|
||||
"""<a href="%(ScoURL)s/edit_preferences" class="sidebar">Paramétrage</a> <br/>"""
|
||||
% params
|
||||
@ -75,7 +77,7 @@ def sidebar_common(REQUEST=None):
|
||||
return "".join(H)
|
||||
|
||||
|
||||
def sidebar(REQUEST=None):
|
||||
def sidebar():
|
||||
"Main HTML page sidebar"
|
||||
# rewritten from legacy DTML code
|
||||
from app.scodoc import sco_abs
|
||||
@ -86,7 +88,7 @@ def sidebar(REQUEST=None):
|
||||
"SCO_USER_MANUAL": scu.SCO_USER_MANUAL,
|
||||
}
|
||||
|
||||
H = ['<div class="sidebar">', sidebar_common(REQUEST)]
|
||||
H = ['<div class="sidebar">', sidebar_common()]
|
||||
|
||||
H.append(
|
||||
"""<div class="box-chercheetud">Chercher étudiant:<br/>
|
||||
@ -97,9 +99,14 @@ def sidebar(REQUEST=None):
|
||||
"""
|
||||
% params
|
||||
)
|
||||
# ---- s'il y a un etudiant selectionné:
|
||||
if "etudid" in REQUEST.form:
|
||||
etudid = REQUEST.form["etudid"]
|
||||
# ---- Il y-a-t-il un etudiant selectionné ?
|
||||
etudid = None
|
||||
if request.method == "GET":
|
||||
etudid = request.args.get("etudid", None)
|
||||
elif request.method == "POST":
|
||||
etudid = request.form.get("etudid", None)
|
||||
|
||||
if etudid:
|
||||
etud = sco_etud.get_etud_info(filled=1, etudid=etudid)[0]
|
||||
params.update(etud)
|
||||
params["fiche_url"] = url_for(
|
||||
@ -126,7 +133,7 @@ def sidebar(REQUEST=None):
|
||||
)
|
||||
|
||||
H.append("<ul>")
|
||||
if REQUEST.AUTHENTICATED_USER.has_permission(Permission.ScoAbsChange):
|
||||
if current_user.has_permission(Permission.ScoAbsChange):
|
||||
H.append(
|
||||
"""
|
||||
<li> <a href="%(ScoURL)s/Absences/SignaleAbsenceEtud?etudid=%(etudid)s">Ajouter</a></li>
|
||||
@ -168,25 +175,17 @@ def sidebar(REQUEST=None):
|
||||
return "".join(H)
|
||||
|
||||
|
||||
def sidebar_dept(REQUEST=None):
|
||||
def sidebar_dept():
|
||||
"""Partie supérieure de la marge de gauche"""
|
||||
infos = {
|
||||
"BASE0": REQUEST.BASE0,
|
||||
"DeptIntranetTitle": sco_preferences.get_preference("DeptIntranetTitle"),
|
||||
"DeptIntranetURL": sco_preferences.get_preference("DeptIntranetURL"),
|
||||
"DeptName": sco_preferences.get_preference("DeptName"),
|
||||
"ScoURL": scu.ScoURL(),
|
||||
}
|
||||
|
||||
H = [
|
||||
"""<h2 class="insidebar">Dépt. %(DeptName)s</h2>
|
||||
<a href="%(BASE0)s" class="sidebar">Accueil</a> <br/> """
|
||||
% infos
|
||||
f"""<h2 class="insidebar">Dépt. {sco_preferences.get_preference("DeptName")}</h2>
|
||||
<a href="{url_for("scodoc.index")}" class="sidebar">Accueil</a> <br/> """
|
||||
]
|
||||
if infos["DeptIntranetURL"]:
|
||||
dept_intranet_url = sco_preferences.get_preference("DeptIntranetURL")
|
||||
if dept_intranet_url:
|
||||
H.append(
|
||||
'<a href="%(DeptIntranetURL)s" class="sidebar">%(DeptIntranetTitle)s</a> <br/>'
|
||||
% infos
|
||||
f"""<a href="{dept_intranet_url}" class="sidebar">{
|
||||
sco_preferences.get_preference("DeptIntranetTitle")}</a> <br/>"""
|
||||
)
|
||||
# Entreprises pas encore supporté en ScoDoc8
|
||||
# H.append(
|
||||
|
@ -48,9 +48,7 @@ from app.scodoc 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(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.
|
||||
|
@ -132,8 +132,6 @@ def doSignaleAbsence(
|
||||
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,
|
||||
),
|
||||
"""<h2>Signalement d'absences</h2>""",
|
||||
@ -221,8 +219,6 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Signalement d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<table><tr><td>
|
||||
@ -340,8 +336,6 @@ def doJustifAbsence(
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Justification d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<h2>Justification d'absences</h2>""",
|
||||
@ -378,8 +372,6 @@ def JustifAbsenceEtud(context, REQUEST=None): # etudid implied
|
||||
etudid = etud["etudid"]
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Justification d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<table><tr><td>
|
||||
@ -450,8 +442,6 @@ def doAnnuleAbsence(
|
||||
#
|
||||
H = [
|
||||
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,
|
||||
@ -489,8 +479,6 @@ def AnnuleAbsenceEtud(context, REQUEST=None): # etudid implied
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Annulation d'une absence pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<table><tr><td>
|
||||
@ -591,8 +579,6 @@ def doAnnuleJustif(
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Annulation d'une justification pour %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<h2>Annulation de justifications pour %(nomprenom)s</h2>""" % etud,
|
||||
@ -679,7 +665,7 @@ def EtatAbsences(context, REQUEST=None):
|
||||
"""Etat des absences: choix du groupe"""
|
||||
# crude portage from 1999 DTML
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title="Etat des absences"),
|
||||
html_sco_header.sco_header(page_title="Etat des absences"),
|
||||
"""<h2>Etat des absences pour un groupe</h2>
|
||||
<form action="EtatAbsencesGr" method="GET">""",
|
||||
formChoixSemestreGroupe(context),
|
||||
@ -760,8 +746,6 @@ def CalAbs(context, REQUEST=None): # etud implied
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Calendrier des absences de %(nomprenom)s" % etud,
|
||||
cssstyles=["css/calabs.css"],
|
||||
),
|
||||
@ -864,9 +848,7 @@ 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(page_title="Absences de %s" % etud["nomprenom"])
|
||||
)
|
||||
H.append(
|
||||
"""<h2>Absences de %s (à partir du %s)</h2>"""
|
||||
|
@ -64,9 +64,7 @@ _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(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">
|
||||
""",
|
||||
@ -96,9 +94,7 @@ 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(page_title="Comparaison de fichiers Apogée"),
|
||||
"<h2>Comparaison de fichiers Apogée</h2>",
|
||||
_help_txt,
|
||||
'<div class="apo_compare_csv">',
|
||||
|
@ -283,7 +283,7 @@ def do_formsemestre_archive(
|
||||
|
||||
if not group_ids:
|
||||
# tous les inscrits du semestre
|
||||
group_ids = [sco_groups.get_default_group(context, formsemestre_id)]
|
||||
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
||||
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
|
||||
)
|
||||
@ -304,8 +304,6 @@ def do_formsemestre_archive(
|
||||
data = "\n".join(
|
||||
[
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Moyennes archivées le %s" % date,
|
||||
head_message="Moyennes archivées le %s" % date,
|
||||
no_side_bar=True,
|
||||
@ -372,7 +370,7 @@ def formsemestre_archive(context, REQUEST, formsemestre_id, group_ids=[]):
|
||||
"""Make and store new archive for this formsemestre.
|
||||
(all students or only selected groups)
|
||||
"""
|
||||
if not sco_permissions_check.can_edit_pv(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_edit_pv(formsemestre_id):
|
||||
raise AccessDenied(
|
||||
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
|
||||
)
|
||||
@ -380,7 +378,7 @@ def formsemestre_archive(context, REQUEST, formsemestre_id, group_ids=[]):
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
if not group_ids:
|
||||
# tous les inscrits du semestre
|
||||
group_ids = [sco_groups.get_default_group(context, formsemestre_id)]
|
||||
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
||||
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
|
||||
)
|
||||
@ -555,7 +553,7 @@ def formsemestre_delete_archive(
|
||||
context, REQUEST, formsemestre_id, archive_name, dialog_confirmed=False
|
||||
):
|
||||
"""Delete an archive"""
|
||||
if not sco_permissions_check.can_edit_pv(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_edit_pv(formsemestre_id):
|
||||
raise AccessDenied(
|
||||
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
|
||||
)
|
||||
|
@ -133,8 +133,6 @@ def etud_upload_file_form(context, REQUEST, etudid):
|
||||
etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0]
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Chargement d'un document associé à %(nomprenom)s" % etud,
|
||||
),
|
||||
"""<h2>Chargement d'un document associé à %(nomprenom)s</h2>
|
||||
@ -266,7 +264,7 @@ def etudarchive_import_files_form(context, group_id, REQUEST=None):
|
||||
"""Formulaire pour importation fichiers d'un groupe"""
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Import de fichiers associés aux étudiants"
|
||||
page_title="Import de fichiers associés aux étudiants"
|
||||
),
|
||||
"""<h2 class="formsemestre">Téléchargement de fichier associés aux étudiants</h2>
|
||||
<p>Les fichiers associés (dossiers d'admission, certificats, ...), de types quelconques (pdf, doc, images)
|
||||
|
@ -38,7 +38,10 @@ from email.header import Header
|
||||
|
||||
from reportlab.lib.colors import Color
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
from flask import g, url_for
|
||||
|
||||
from flask import g
|
||||
from flask import url_for
|
||||
from flask_login import current_user
|
||||
|
||||
from app.scodoc import sco_emails
|
||||
import app.scodoc.sco_utils as scu
|
||||
@ -837,14 +840,13 @@ def formsemestre_bulletinetud(
|
||||
return "".join(H)
|
||||
|
||||
|
||||
def can_send_bulletin_by_mail(context, formsemestre_id, REQUEST):
|
||||
def can_send_bulletin_by_mail(context, formsemestre_id):
|
||||
"""True if current user is allowed to send a bulletin by mail"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
return (
|
||||
sco_preferences.get_preference("bul_mail_allowed_for_all", formsemestre_id)
|
||||
or authuser.has_permission(Permission.ScoImplement)
|
||||
or str(authuser) in sem["responsables"]
|
||||
or current_user.has_permission(Permission.ScoImplement)
|
||||
or current_user.user_name in sem["responsables"]
|
||||
)
|
||||
|
||||
|
||||
@ -921,7 +923,7 @@ def do_formsemestre_bulletinetud(
|
||||
elif format == "pdfmail":
|
||||
# format pdfmail: envoie le pdf par mail a l'etud, et affiche le html
|
||||
# check permission
|
||||
if not can_send_bulletin_by_mail(context, formsemestre_id, REQUEST):
|
||||
if not can_send_bulletin_by_mail(context, formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
|
||||
if nohtml:
|
||||
@ -1112,7 +1114,7 @@ def _formsemestre_bulletinetud_header_html(
|
||||
},
|
||||
"enabled": etud["email"]
|
||||
and can_send_bulletin_by_mail(
|
||||
context, formsemestre_id, REQUEST
|
||||
context, formsemestre_id
|
||||
), # possible slt si on a un mail...
|
||||
},
|
||||
{
|
||||
@ -1127,7 +1129,7 @@ def _formsemestre_bulletinetud_header_html(
|
||||
},
|
||||
"enabled": etud["emailperso"]
|
||||
and can_send_bulletin_by_mail(
|
||||
context, formsemestre_id, REQUEST
|
||||
context, formsemestre_id
|
||||
), # possible slt si on a un mail...
|
||||
},
|
||||
{
|
||||
@ -1168,9 +1170,7 @@ def _formsemestre_bulletinetud_header_html(
|
||||
"formsemestre_id": formsemestre_id,
|
||||
"etudid": etudid,
|
||||
},
|
||||
"enabled": sco_permissions_check.can_validate_sem(
|
||||
context, REQUEST, formsemestre_id
|
||||
),
|
||||
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
|
||||
},
|
||||
{
|
||||
"title": "Enregistrer note d'une UE externe",
|
||||
@ -1179,9 +1179,7 @@ def _formsemestre_bulletinetud_header_html(
|
||||
"formsemestre_id": formsemestre_id,
|
||||
"etudid": etudid,
|
||||
},
|
||||
"enabled": sco_permissions_check.can_validate_sem(
|
||||
context, REQUEST, formsemestre_id
|
||||
),
|
||||
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
|
||||
},
|
||||
{
|
||||
"title": "Entrer décisions jury",
|
||||
@ -1190,9 +1188,7 @@ def _formsemestre_bulletinetud_header_html(
|
||||
"formsemestre_id": formsemestre_id,
|
||||
"etudid": etudid,
|
||||
},
|
||||
"enabled": sco_permissions_check.can_validate_sem(
|
||||
context, REQUEST, formsemestre_id
|
||||
),
|
||||
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
|
||||
},
|
||||
{
|
||||
"title": "Editer PV jury",
|
||||
|
@ -58,7 +58,7 @@ def formsemestre_table_estim_cost(
|
||||
(dans ce cas, retoucher le tableau excel exporté).
|
||||
"""
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
sco_formsemestre_status.fill_formsemestre(context, sem, REQUEST=REQUEST)
|
||||
sco_formsemestre_status.fill_formsemestre(sem)
|
||||
Mlist = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
||||
context, formsemestre_id=formsemestre_id
|
||||
)
|
||||
|
@ -196,7 +196,7 @@ def table_debouche_etudids(context, etudids, keep_numeric=True):
|
||||
def report_debouche_ask_date(context, REQUEST=None):
|
||||
"""Formulaire demande date départ"""
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ """<form method="GET">
|
||||
Date de départ de la recherche: <input type="text" name="start_year" value="" size=10/>
|
||||
</form>"""
|
||||
@ -210,22 +210,6 @@ def report_debouche_ask_date(context, REQUEST=None):
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# OBSOLETE (this field has been copied to itemsuivi)
|
||||
# def debouche_set(context, object, value, REQUEST=None):
|
||||
# """Set debouche (field in admission table, may be deprecated ?)
|
||||
# """
|
||||
# if not sco_permissions_check.can_edit_suivi(context, REQUEST):
|
||||
# raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
# adm_id = object
|
||||
# debouche = value.strip('-_ \t')
|
||||
# cnx = ndb.GetDBConnexion()
|
||||
# adms = sco_etud.admission_list(cnx, {'etudid' : etudid})
|
||||
# if not adms:
|
||||
# raise ValueError('no admission info for %s !' % etudid)
|
||||
# adm = adms[0]
|
||||
# adm['debouche'] = debouche
|
||||
# admission_edit(cnx, adm)
|
||||
|
||||
|
||||
_itemsuiviEditor = ndb.EditableTable(
|
||||
"itemsuivi",
|
||||
@ -266,7 +250,7 @@ def itemsuivi_get(cnx, itemsuivi_id, ignore_errors=False):
|
||||
|
||||
def itemsuivi_suppress(context, itemsuivi_id, REQUEST=None):
|
||||
"""Suppression d'un item"""
|
||||
if not sco_permissions_check.can_edit_suivi(context, REQUEST):
|
||||
if not sco_permissions_check.can_edit_suivi():
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
cnx = ndb.GetDBConnexion()
|
||||
item = itemsuivi_get(cnx, itemsuivi_id, ignore_errors=True)
|
||||
@ -280,7 +264,7 @@ def itemsuivi_create(
|
||||
context, etudid, item_date=None, situation="", REQUEST=None, format=None
|
||||
):
|
||||
"""Creation d'un item"""
|
||||
if not sco_permissions_check.can_edit_suivi(context, REQUEST):
|
||||
if not sco_permissions_check.can_edit_suivi():
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
cnx = ndb.GetDBConnexion()
|
||||
itemsuivi_id = _itemsuivi_create(
|
||||
@ -298,7 +282,7 @@ def itemsuivi_set_date(context, itemsuivi_id, item_date, REQUEST=None):
|
||||
"""set item date
|
||||
item_date is a string dd/mm/yyyy
|
||||
"""
|
||||
if not sco_permissions_check.can_edit_suivi(context, REQUEST):
|
||||
if not sco_permissions_check.can_edit_suivi():
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
# log('itemsuivi_set_date %s : %s' % (itemsuivi_id, item_date))
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -309,7 +293,7 @@ def itemsuivi_set_date(context, itemsuivi_id, item_date, REQUEST=None):
|
||||
|
||||
def itemsuivi_set_situation(context, object, value, REQUEST=None):
|
||||
"""set situation"""
|
||||
if not sco_permissions_check.can_edit_suivi(context, REQUEST):
|
||||
if not sco_permissions_check.can_edit_suivi():
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
itemsuivi_id = object
|
||||
situation = value.strip("-_ \t")
|
||||
@ -365,7 +349,7 @@ def itemsuivi_tag_set(context, itemsuivi_id="", taglist=[], REQUEST=None):
|
||||
a string with tag names separated by commas ("un;deux")
|
||||
or a list of strings (["un", "deux"])
|
||||
"""
|
||||
if not sco_permissions_check.can_edit_suivi(context, REQUEST):
|
||||
if not sco_permissions_check.can_edit_suivi():
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
if not taglist:
|
||||
taglist = []
|
||||
|
@ -29,6 +29,7 @@
|
||||
"""
|
||||
|
||||
from flask import g
|
||||
from flask_login import current_user
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
@ -144,8 +145,7 @@ Chercher étape courante: <input name="etape_apo" type="text" size="8" spellchec
|
||||
% scu.NotesURL()
|
||||
)
|
||||
#
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
if authuser.has_permission(Permission.ScoEtudInscrit):
|
||||
if current_user.has_permission(Permission.ScoEtudInscrit):
|
||||
H.append(
|
||||
"""<hr>
|
||||
<h3>Gestion des étudiants</h3>
|
||||
@ -158,7 +158,7 @@ Chercher étape courante: <input name="etape_apo" type="text" size="8" spellchec
|
||||
"""
|
||||
)
|
||||
#
|
||||
if authuser.has_permission(Permission.ScoEditApo):
|
||||
if current_user.has_permission(Permission.ScoEditApo):
|
||||
H.append(
|
||||
"""<hr>
|
||||
<h3>Exports Apogée</h3>
|
||||
@ -178,11 +178,7 @@ 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()
|
||||
)
|
||||
return html_sco_header.sco_header() + "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def _sem_table(context, sems):
|
||||
|
@ -66,9 +66,7 @@ SCO_DUMP_LOCK = "/tmp/scodump.lock"
|
||||
|
||||
def sco_dump_and_send_db(context, REQUEST=None):
|
||||
"""Dump base de données du département courant et l'envoie anonymisée pour debug"""
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title="Assistance technique")
|
||||
]
|
||||
H = [html_sco_header.sco_header(page_title="Assistance technique")]
|
||||
# get currect (dept) DB name:
|
||||
cursor = ndb.SimpleQuery("SELECT current_database()", {})
|
||||
db_name = cursor.fetchone()[0]
|
||||
|
@ -52,9 +52,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
|
||||
F = F[0]
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Suppression d'une formation"
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Suppression d'une formation"),
|
||||
"""<h2>Suppression de la formation %(titre)s (%(acronyme)s)</h2>""" % F,
|
||||
]
|
||||
|
||||
@ -130,9 +128,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
|
||||
"""Edit or create a formation"""
|
||||
if create:
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Création d'une formation"
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Création d'une formation"),
|
||||
"""<h2>Création d'une formation</h2>
|
||||
|
||||
<p class="help">Une "formation" décrit une filière, comme un DUT ou une Licence. La formation se subdivise en unités pédagogiques (UE, matières, modules). Elle peut se diviser en plusieurs semestres (ou sessions), qui seront mis en place séparément.
|
||||
@ -154,9 +150,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
|
||||
is_locked = sco_formations.formation_has_locked_sems(context, formation_id)
|
||||
submitlabel = "Modifier les valeurs"
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Modification d'une formation"
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Modification d'une formation"),
|
||||
"""<h2>Modification de la formation %(acronyme)s</h2>""" % initvalues,
|
||||
]
|
||||
if is_locked:
|
||||
|
@ -98,9 +98,7 @@ def matiere_create(context, ue_id=None, REQUEST=None):
|
||||
|
||||
UE = sco_edit_ue.do_ue_list(context, 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(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
|
||||
@ -197,9 +195,7 @@ def matiere_delete(context, matiere_id=None, REQUEST=None):
|
||||
M = do_matiere_list(context, args={"matiere_id": matiere_id})[0]
|
||||
UE = sco_edit_ue.do_ue_list(context, 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(page_title="Suppression d'une matière"),
|
||||
"<h2>Suppression de la matière %(titre)s" % M,
|
||||
" dans l'UE (%(acronyme)s))</h2>" % UE,
|
||||
]
|
||||
@ -242,9 +238,7 @@ 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(page_title="Modification d'une matière"),
|
||||
"""<h2>Modification de la matière %(titre)s""" % F,
|
||||
"""(formation %(acronyme)s, version %(version)s)</h2>""" % Fo,
|
||||
]
|
||||
|
@ -131,7 +131,7 @@ def module_create(context, matiere_id=None, REQUEST=None):
|
||||
parcours = sco_codes_parcours.get_parcours_from_code(Fo["type_parcours"])
|
||||
semestres_indices = list(range(1, parcours.NB_SEM + 1))
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title="Création d'un module"),
|
||||
html_sco_header.sco_header(page_title="Création d'un module"),
|
||||
"""<h2>Création d'un module dans la matière %(titre)s""" % M,
|
||||
""" (UE %(acronyme)s)</h2>""" % UE,
|
||||
_MODULE_HELP,
|
||||
@ -287,9 +287,7 @@ def module_delete(context, module_id=None, REQUEST=None):
|
||||
raise ScoValueError("Module inexistant !")
|
||||
Mod = Mods[0]
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Suppression d'un module"
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Suppression d'un module"),
|
||||
"""<h2>Suppression du module %(titre)s (%(code)s)</h2>""" % Mod,
|
||||
]
|
||||
|
||||
@ -368,8 +366,6 @@ def module_edit(context, module_id=None, REQUEST=None):
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Modification du module %(titre)s" % Mod,
|
||||
cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"],
|
||||
javascripts=[
|
||||
@ -539,9 +535,7 @@ def module_list(context, formation_id, REQUEST=None):
|
||||
raise ScoValueError("invalid formation !")
|
||||
F = sco_formations.formation_list(context, args={"formation_id": formation_id})[0]
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Liste des modules de %(titre)s" % F
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Liste des modules de %(titre)s" % F),
|
||||
"""<h2>Listes des modules dans la formation %(titre)s (%(acronyme)s)</h2>"""
|
||||
% F,
|
||||
'<ul class="notes_module_list">',
|
||||
|
@ -211,9 +211,7 @@ 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(page_title=title, javascripts=["js/edit_ue.js"]),
|
||||
"<h2>" + title,
|
||||
" (formation %(acronyme)s, version %(version)s)</h2>" % Fo,
|
||||
"""
|
||||
@ -470,8 +468,6 @@ def ue_list(context, formation_id=None, msg="", REQUEST=None):
|
||||
)
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"],
|
||||
javascripts=[
|
||||
"libjs/jinplace-1.2.1.min.js",
|
||||
|
@ -166,8 +166,6 @@ def experimental_calendar(context, group_id=None, formsemestre_id=None, REQUEST=
|
||||
return "\n".join(
|
||||
[
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
javascripts=[
|
||||
"libjs/purl.js",
|
||||
"libjs/moment.min.js",
|
||||
|
@ -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(context, formsemestre_id)], formsemestre_id=formsemestre_id, REQUEST=REQUEST)
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(context, [sco_groups.get_default_group(formsemestre_id)], formsemestre_id=formsemestre_id)
|
||||
|
||||
nt = sco_cache.NotesTableCache.get( formsemestre_id)
|
||||
|
||||
|
@ -69,7 +69,7 @@ def apo_semset_maq_status(
|
||||
if not semset_id:
|
||||
raise ValueError("invalid null semset_id")
|
||||
semset = sco_semset.SemSet(context, semset_id=semset_id)
|
||||
semset.fill_formsemestres(REQUEST)
|
||||
semset.fill_formsemestres()
|
||||
# autorise export meme si etudiants Apo manquants:
|
||||
allow_missing_apo = int(allow_missing_apo)
|
||||
# autorise export meme s'il manque des décisions de jury:
|
||||
@ -105,8 +105,6 @@ def apo_semset_maq_status(
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Export Apogée",
|
||||
javascripts=["js/apo_semset_maq_status.js"],
|
||||
),
|
||||
@ -570,8 +568,6 @@ def _view_etuds_page(
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=title,
|
||||
init_qtip=True,
|
||||
javascripts=["js/etud_info.js"],
|
||||
@ -719,8 +715,6 @@ def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=Non
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Maquette Apogée enregistrée pour %s" % etape_apo,
|
||||
init_qtip=True,
|
||||
javascripts=["js/etud_info.js"],
|
||||
|
@ -253,7 +253,7 @@ def do_evaluation_create(
|
||||
evaluation_type=None,
|
||||
numero=None,
|
||||
REQUEST=None,
|
||||
**kw # ceci pour absorber les arguments excedentaires de tf #sco8
|
||||
**kw, # ceci pour absorber les arguments excedentaires de tf #sco8
|
||||
):
|
||||
"""Create an evaluation"""
|
||||
context = None # #context
|
||||
@ -623,10 +623,10 @@ def do_evaluation_get_all_notes(
|
||||
"""Toutes les notes pour une evaluation: { etudid : { 'value' : value, 'date' : date ... }}
|
||||
Attention: inclut aussi les notes des étudiants qui ne sont plus inscrits au module.
|
||||
"""
|
||||
# log('do_evaluation_get_all_notes( e=%s fs=%s )' % (evaluation_id, filter_suppressed))
|
||||
do_cache = (
|
||||
filter_suppressed and table == "notes_notes" and (by_uid is None)
|
||||
) # pas de cache pour (rares) appels via undo_notes ou specifiant un enseignant
|
||||
log(f"do_evaluation_get_all_notes: {evaluation_id} (do_cache={do_cache})")
|
||||
if do_cache:
|
||||
r = sco_cache.EvaluationCache.get(evaluation_id)
|
||||
if r != None:
|
||||
@ -651,7 +651,8 @@ def do_evaluation_get_all_notes(
|
||||
for x in res:
|
||||
d[x["etudid"]] = x
|
||||
if do_cache:
|
||||
sco_cache.EvaluationCache.set(evaluation_id, d)
|
||||
status = sco_cache.EvaluationCache.set(evaluation_id, d)
|
||||
log(f"EvaluationCache.set: {evaluation_id}\t{status}")
|
||||
return d
|
||||
|
||||
|
||||
@ -1082,7 +1083,7 @@ def evaluation_describe(evaluation_id="", edit_in_place=True, REQUEST=None):
|
||||
% (jour, E["heure_debut"], E["heure_fin"])
|
||||
)
|
||||
if E["jour"]:
|
||||
group_id = sco_groups.get_default_group(context, formsemestre_id)
|
||||
group_id = sco_groups.get_default_group(formsemestre_id)
|
||||
H.append(
|
||||
'<span class="noprint"><a href="%s/Absences/EtatAbsencesDate?group_ids=%s&date=%s">(absences ce jour)</a></span>'
|
||||
% (
|
||||
@ -1129,7 +1130,7 @@ def evaluation_create_form(
|
||||
if not readonly:
|
||||
if not sco_permissions_check.can_edit_evaluation(moduleimpl_id=moduleimpl_id):
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>Opération non autorisée</h2><p>"
|
||||
+ "Modification évaluation impossible pour %s"
|
||||
% current_user.get_nomplogin()
|
||||
@ -1359,7 +1360,7 @@ 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)
|
||||
head = html_sco_header.sco_header(page_title=page_title)
|
||||
return head + "\n".join(H) + "\n" + tf[1] + help + html_sco_header.sco_footer()
|
||||
elif tf[0] == -1:
|
||||
return REQUEST.RESPONSE.redirect(dest_url)
|
||||
|
@ -278,8 +278,6 @@ def scodoc_table_results(
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Export résultats",
|
||||
init_qtip=True,
|
||||
javascripts=html_sco_header.BOOTSTRAP_MULTISELECT_JS
|
||||
|
@ -86,9 +86,7 @@ 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(page_title="Choix d'un étudiant")
|
||||
+ "\n".join(H)
|
||||
+ html_sco_header.sco_footer()
|
||||
)
|
||||
|
@ -219,8 +219,9 @@ def etapes_apo_str(etapes):
|
||||
return ", ".join([str(x) for x in etapes])
|
||||
|
||||
|
||||
def do_formsemestre_create(context, args, REQUEST, silent=False):
|
||||
def do_formsemestre_create(args, silent=False):
|
||||
"create a formsemestre"
|
||||
context = None # XXX #context
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_news
|
||||
|
||||
@ -235,11 +236,12 @@ def do_formsemestre_create(context, args, REQUEST, silent=False):
|
||||
|
||||
# create default partition
|
||||
partition_id = sco_groups.partition_create(
|
||||
context, formsemestre_id, default=True, redirect=0, REQUEST=REQUEST
|
||||
)
|
||||
_group_id = sco_groups.createGroup(
|
||||
context, partition_id, default=True, REQUEST=REQUEST
|
||||
context,
|
||||
formsemestre_id,
|
||||
default=True,
|
||||
redirect=0,
|
||||
)
|
||||
_group_id = sco_groups.createGroup(context, partition_id, default=True)
|
||||
|
||||
# news
|
||||
if "titre" not in args:
|
||||
|
@ -68,8 +68,6 @@ def formsemestre_createwithmodules(context, REQUEST=None):
|
||||
"""Page création d'un semestre"""
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Création d'un semestre",
|
||||
javascripts=["libjs/AutoSuggest.js"],
|
||||
cssstyles=["css/autosuggest_inquisitor.css"],
|
||||
@ -552,9 +550,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
||||
else:
|
||||
disabled = ""
|
||||
fcg = '<select name="%s" %s>' % (select_name, disabled)
|
||||
default_group_id = sco_groups.get_default_group(
|
||||
context, formsemestre_id
|
||||
)
|
||||
default_group_id = sco_groups.get_default_group(formsemestre_id)
|
||||
fcg += '<option value="%s" %s>Tous</option>' % (
|
||||
default_group_id,
|
||||
opt_selected(default_group_id),
|
||||
@ -736,9 +732,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
|
||||
)
|
||||
if not edit:
|
||||
# creation du semestre
|
||||
formsemestre_id = sco_formsemestre.do_formsemestre_create(
|
||||
context, tf[2], REQUEST
|
||||
)
|
||||
formsemestre_id = sco_formsemestre.do_formsemestre_create(tf[2])
|
||||
# creation des modules
|
||||
for module_id in tf[2]["tf-checked"]:
|
||||
modargs = {
|
||||
@ -1038,7 +1032,7 @@ def do_formsemestre_clone(
|
||||
args["date_debut"] = date_debut
|
||||
args["date_fin"] = date_fin
|
||||
args["etat"] = 1 # non verrouillé
|
||||
formsemestre_id = sco_formsemestre.do_formsemestre_create(context, args, REQUEST)
|
||||
formsemestre_id = sco_formsemestre.do_formsemestre_create(args)
|
||||
log("created formsemestre %s" % formsemestre_id)
|
||||
# 2- create moduleimpls
|
||||
mods_orig = sco_moduleimpl.do_moduleimpl_list(
|
||||
@ -1114,7 +1108,6 @@ def do_formsemestre_clone(
|
||||
context,
|
||||
formsemestre_id,
|
||||
partition_name=partname,
|
||||
REQUEST=REQUEST,
|
||||
redirect=0,
|
||||
)
|
||||
for g in sco_groups.get_partition_groups(context, part):
|
||||
@ -1130,7 +1123,7 @@ def do_formsemestre_clone(
|
||||
part_id = g[0]
|
||||
for group_name in g[1]:
|
||||
_ = sco_groups.createGroup(
|
||||
context, part_id, group_name=group_name, REQUEST=REQUEST
|
||||
context, part_id, group_name=group_name
|
||||
)
|
||||
|
||||
return formsemestre_id
|
||||
|
@ -65,9 +65,7 @@ def formsemestre_ext_create(context, etudid, sem_params, REQUEST=None):
|
||||
sem_params["modalite"] = "EXT"
|
||||
sem_params["etapes"] = None
|
||||
sem_params["responsables"] = [str(REQUEST.AUTHENTICATED_USER)]
|
||||
formsemestre_id = sco_formsemestre.do_formsemestre_create(
|
||||
context, sem_params, REQUEST, silent=True
|
||||
)
|
||||
formsemestre_id = sco_formsemestre.do_formsemestre_create(sem_params, silent=True)
|
||||
# nota: le semestre est créé vide: pas de modules
|
||||
|
||||
# Inscription au semestre
|
||||
@ -85,7 +83,7 @@ def formsemestre_ext_create_form(context, etudid, formsemestre_id, REQUEST=None)
|
||||
"""Formulaire creation/inscription à un semestre extérieur"""
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0]
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST),
|
||||
html_sco_header.sco_header(),
|
||||
"""<h2>Enregistrement d'une inscription antérieure dans un autre établissement</h2>
|
||||
<p class="help">
|
||||
Cette opération créé un semestre extérieur ("ancien") et y inscrit juste cet étudiant.
|
||||
@ -271,8 +269,6 @@ def _make_page(context, etud, sem, tf, message="", REQUEST=None):
|
||||
moy_gen = nt.get_etud_moy_gen(etud["etudid"])
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Validation des UE d'un semestre extérieur",
|
||||
javascripts=["js/formsemestre_ext_edit_ue_validations.js"],
|
||||
),
|
||||
|
@ -226,7 +226,7 @@ def do_formsemestre_inscription_with_modules(
|
||||
)
|
||||
# inscriptions aux groupes
|
||||
# 1- inscrit au groupe 'tous'
|
||||
group_id = sco_groups.get_default_group(context, formsemestre_id)
|
||||
group_id = sco_groups.get_default_group(formsemestre_id)
|
||||
sco_groups.set_group(context, etudid, group_id)
|
||||
gdone = {group_id: 1} # empeche doublons
|
||||
|
||||
@ -279,7 +279,7 @@ def formsemestre_inscription_with_modules_form(
|
||||
"""
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=1)[0]
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST),
|
||||
html_sco_header.sco_header(),
|
||||
"<h2>Inscription de %s" % etud["nomprenom"],
|
||||
]
|
||||
if only_ext:
|
||||
@ -455,7 +455,7 @@ def formsemestre_inscription_option(context, etudid, formsemestre_id, REQUEST=No
|
||||
|
||||
F = html_sco_header.sco_footer()
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>Inscription de %s aux modules de %s (%s - %s)</h2>"
|
||||
% (etud["nomprenom"], sem["titre_num"], sem["date_debut"], sem["date_fin"])
|
||||
]
|
||||
@ -725,7 +725,7 @@ def do_moduleimpl_incription_options(
|
||||
|
||||
if REQUEST:
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST),
|
||||
html_sco_header.sco_header(),
|
||||
"""<h3>Modifications effectuées</h3>
|
||||
<p><a class="stdlink" href="%s">
|
||||
Retour à la fiche étudiant</a></p>
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
from flask import current_app
|
||||
from flask import g
|
||||
from flask import request
|
||||
from flask import url_for
|
||||
from flask_login import current_user
|
||||
|
||||
from app.scodoc.notes_log import log
|
||||
import app.scodoc.sco_utils as scu
|
||||
@ -61,22 +63,6 @@ from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc.sco_formsemestre_custommenu import formsemestre_custommenu_html
|
||||
|
||||
|
||||
# H = [ """<span class="barrenav"><ul class="nav">
|
||||
# <li onmouseover="MenuDisplay(this)" onmouseout="MenuHide(this)"><a href="#" class="menu %s">%s</a><ul>""" % (cssclass, title)
|
||||
# ]
|
||||
# for item in items:
|
||||
# if item.get('enabled', True):
|
||||
# if base_url:
|
||||
# item['urlq'] = urllib.quote(item['url'])
|
||||
# else:
|
||||
# item['urlq'] = item['url']
|
||||
# H.append('<li><a href="' + base_url + '%(urlq)s">%(title)s</a></li>' % item)
|
||||
# else:
|
||||
# H.append('<li><span class="disabled_menu_item">%(title)s</span></li>' % item)
|
||||
# H.append('</ul></li></ul></%s>' % elem)
|
||||
# return ''.join(H)
|
||||
|
||||
|
||||
def defMenuStats(context, formsemestre_id):
|
||||
"Définition du menu 'Statistiques' "
|
||||
return [
|
||||
@ -135,10 +121,9 @@ def defMenuStats(context, formsemestre_id):
|
||||
]
|
||||
|
||||
|
||||
def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
def formsemestre_status_menubar(context, sem):
|
||||
"""HTML to render menubar"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
uid = str(authuser)
|
||||
uid = current_user.user_name
|
||||
formsemestre_id = sem["formsemestre_id"]
|
||||
if int(sem["etat"]):
|
||||
change_lock_msg = "Verrouiller"
|
||||
@ -172,9 +157,9 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"formsemestre_id": formsemestre_id,
|
||||
},
|
||||
"enabled": (
|
||||
authuser.has_permission(Permission.ScoImplement)
|
||||
current_user.has_permission(Permission.ScoImplement)
|
||||
or (
|
||||
str(REQUEST.AUTHENTICATED_USER) in sem["responsables"]
|
||||
current_user.user_name in sem["responsables"]
|
||||
and sem["resp_can_edit"]
|
||||
)
|
||||
)
|
||||
@ -186,9 +171,9 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"endpoint": "scolar.formsemestre_edit_preferences",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": (
|
||||
authuser.has_permission(Permission.ScoImplement)
|
||||
current_user.has_permission(Permission.ScoImplement)
|
||||
or (
|
||||
str(REQUEST.AUTHENTICATED_USER) in sem["responsables"]
|
||||
current_user.user_name in sem["responsables"]
|
||||
and sem["resp_can_edit"]
|
||||
)
|
||||
)
|
||||
@ -200,7 +185,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"endpoint": "notes.formsemestre_edit_options",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": (uid in sem["responsables"])
|
||||
or authuser.has_permission(Permission.ScoImplement),
|
||||
or current_user.has_permission(Permission.ScoImplement),
|
||||
"helpmsg": "Change les options",
|
||||
},
|
||||
{
|
||||
@ -208,7 +193,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"endpoint": "notes.formsemestre_change_lock",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": (uid in sem["responsables"])
|
||||
or authuser.has_permission(Permission.ScoImplement),
|
||||
or current_user.has_permission(Permission.ScoImplement),
|
||||
"helpmsg": "",
|
||||
},
|
||||
{
|
||||
@ -236,14 +221,14 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"title": "Cloner ce semestre",
|
||||
"endpoint": "notes.formsemestre_clone",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoImplement),
|
||||
"enabled": current_user.has_permission(Permission.ScoImplement),
|
||||
"helpmsg": "",
|
||||
},
|
||||
{
|
||||
"title": "Associer à une nouvelle version du programme",
|
||||
"endpoint": "notes.formsemestre_associate_new_version",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoChangeFormation)
|
||||
"enabled": current_user.has_permission(Permission.ScoChangeFormation)
|
||||
and (sem["etat"] == "1"),
|
||||
"helpmsg": "",
|
||||
},
|
||||
@ -251,7 +236,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"title": "Supprimer ce semestre",
|
||||
"endpoint": "notes.formsemestre_delete",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoImplement),
|
||||
"enabled": current_user.has_permission(Permission.ScoImplement),
|
||||
"helpmsg": "",
|
||||
},
|
||||
]
|
||||
@ -278,14 +263,14 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"title": "Passage des étudiants depuis d'autres semestres",
|
||||
"endpoint": "notes.formsemestre_inscr_passage",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoEtudInscrit)
|
||||
"enabled": current_user.has_permission(Permission.ScoEtudInscrit)
|
||||
and (sem["etat"] == "1"),
|
||||
},
|
||||
{
|
||||
"title": "Synchroniser avec étape Apogée",
|
||||
"endpoint": "notes.formsemestre_synchro_etuds",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoView)
|
||||
"enabled": current_user.has_permission(Permission.ScoView)
|
||||
and sco_preferences.get_preference("portal_url")
|
||||
and (sem["etat"] == "1"),
|
||||
},
|
||||
@ -293,27 +278,27 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"title": "Inscrire un étudiant",
|
||||
"endpoint": "notes.formsemestre_inscription_with_modules_etud",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoEtudInscrit)
|
||||
"enabled": current_user.has_permission(Permission.ScoEtudInscrit)
|
||||
and (sem["etat"] == "1"),
|
||||
},
|
||||
{
|
||||
"title": "Importer des étudiants dans ce semestre (table Excel)",
|
||||
"endpoint": "scolar.form_students_import_excel",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoEtudInscrit)
|
||||
"enabled": current_user.has_permission(Permission.ScoEtudInscrit)
|
||||
and (sem["etat"] == "1"),
|
||||
},
|
||||
{
|
||||
"title": "Import/export des données admission",
|
||||
"endpoint": "scolar.form_students_import_infos_admissions",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoView),
|
||||
"enabled": current_user.has_permission(Permission.ScoView),
|
||||
},
|
||||
{
|
||||
"title": "Resynchroniser données identité",
|
||||
"endpoint": "scolar.formsemestre_import_etud_admission",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": authuser.has_permission(Permission.ScoEtudChangeAdr)
|
||||
"enabled": current_user.has_permission(Permission.ScoEtudChangeAdr)
|
||||
and sco_preferences.get_preference("portal_url"),
|
||||
},
|
||||
{
|
||||
@ -322,7 +307,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"args": {
|
||||
"format": "allxls",
|
||||
"group_ids": sco_groups.get_default_group(
|
||||
context, formsemestre_id, fix_if_missing=True, REQUEST=REQUEST
|
||||
formsemestre_id, fix_if_missing=True
|
||||
),
|
||||
},
|
||||
},
|
||||
@ -346,7 +331,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"endpoint": "scolar.editPartitionForm",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": sco_groups.sco_permissions_check.can_change_groups(
|
||||
context, REQUEST, formsemestre_id
|
||||
formsemestre_id
|
||||
),
|
||||
},
|
||||
]
|
||||
@ -356,9 +341,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
)
|
||||
submenu = []
|
||||
enabled = (
|
||||
sco_groups.sco_permissions_check.can_change_groups(
|
||||
context, REQUEST, formsemestre_id
|
||||
)
|
||||
sco_groups.sco_permissions_check.can_change_groups(formsemestre_id)
|
||||
and partitions
|
||||
)
|
||||
for partition in partitions:
|
||||
@ -398,7 +381,7 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"endpoint": "notes.formsemestre_bulletins_mailetuds_choice",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": sco_bulletins.can_send_bulletin_by_mail(
|
||||
context, formsemestre_id, REQUEST
|
||||
context, formsemestre_id
|
||||
),
|
||||
},
|
||||
{
|
||||
@ -433,17 +416,13 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
"hidebac": 1,
|
||||
"pref_override": 0,
|
||||
},
|
||||
"enabled": sco_permissions_check.can_validate_sem(
|
||||
context, REQUEST, formsemestre_id
|
||||
),
|
||||
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
|
||||
},
|
||||
{
|
||||
"title": "Editer les PV et archiver les résultats",
|
||||
"endpoint": "notes.formsemestre_archive",
|
||||
"args": {"formsemestre_id": formsemestre_id},
|
||||
"enabled": sco_permissions_check.can_edit_pv(
|
||||
context, REQUEST, formsemestre_id
|
||||
),
|
||||
"enabled": sco_permissions_check.can_edit_pv(formsemestre_id),
|
||||
},
|
||||
{
|
||||
"title": "Documents archivés",
|
||||
@ -472,27 +451,32 @@ def formsemestre_status_menubar(context, sem, REQUEST):
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def retreive_formsemestre_from_request(context, REQUEST):
|
||||
def retreive_formsemestre_from_request():
|
||||
"""Cherche si on a de quoi déduire le semestre affiché à partir des
|
||||
arguments de la requête:
|
||||
formsemestre_id ou moduleimpl ou evaluation ou group_id ou partition_id
|
||||
"""
|
||||
context = None # XXX #context
|
||||
if request.method == "GET":
|
||||
args = request.args
|
||||
elif request.method == "POST":
|
||||
args = request.form
|
||||
else:
|
||||
return None
|
||||
# Search formsemestre
|
||||
group_ids = REQUEST.form.get("group_ids", [])
|
||||
if "formsemestre_id" in REQUEST.form:
|
||||
formsemestre_id = REQUEST.form["formsemestre_id"]
|
||||
elif "moduleimpl_id" in REQUEST.form:
|
||||
group_ids = args.get("group_ids", [])
|
||||
if "formsemestre_id" in args:
|
||||
formsemestre_id = args["formsemestre_id"]
|
||||
elif "moduleimpl_id" in args:
|
||||
modimpl = sco_moduleimpl.do_moduleimpl_list(
|
||||
context, moduleimpl_id=REQUEST.form["moduleimpl_id"]
|
||||
context, moduleimpl_id=args["moduleimpl_id"]
|
||||
)
|
||||
if not modimpl:
|
||||
return None # suppressed ?
|
||||
modimpl = modimpl[0]
|
||||
formsemestre_id = modimpl["formsemestre_id"]
|
||||
elif "evaluation_id" in REQUEST.form:
|
||||
E = sco_evaluations.do_evaluation_list(
|
||||
{"evaluation_id": REQUEST.form["evaluation_id"]}
|
||||
)
|
||||
elif "evaluation_id" in args:
|
||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": args["evaluation_id"]})
|
||||
if not E:
|
||||
return None # evaluation suppressed ?
|
||||
E = E[0]
|
||||
@ -500,8 +484,8 @@ def retreive_formsemestre_from_request(context, REQUEST):
|
||||
context, moduleimpl_id=E["moduleimpl_id"]
|
||||
)[0]
|
||||
formsemestre_id = modimpl["formsemestre_id"]
|
||||
elif "group_id" in REQUEST.form:
|
||||
group = sco_groups.get_group(context, REQUEST.form["group_id"])
|
||||
elif "group_id" in args:
|
||||
group = sco_groups.get_group(context, args["group_id"])
|
||||
formsemestre_id = group["formsemestre_id"]
|
||||
elif group_ids:
|
||||
if group_ids:
|
||||
@ -512,8 +496,8 @@ def retreive_formsemestre_from_request(context, REQUEST):
|
||||
group_id = group_ids[0]
|
||||
group = sco_groups.get_group(context, group_id)
|
||||
formsemestre_id = group["formsemestre_id"]
|
||||
elif "partition_id" in REQUEST.form:
|
||||
partition = sco_groups.get_partition(context, REQUEST.form["partition_id"])
|
||||
elif "partition_id" in args:
|
||||
partition = sco_groups.get_partition(context, args["partition_id"])
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
else:
|
||||
return None # no current formsemestre
|
||||
@ -522,11 +506,11 @@ def retreive_formsemestre_from_request(context, REQUEST):
|
||||
|
||||
|
||||
# Element HTML decrivant un semestre (barre de menu et infos)
|
||||
def formsemestre_page_title(context, REQUEST):
|
||||
def formsemestre_page_title(context):
|
||||
"""Element HTML decrivant un semestre (barre de menu et infos)
|
||||
Cherche dans REQUEST si un semestre est défini (formsemestre_id ou moduleimpl ou evaluation ou group)
|
||||
"""
|
||||
formsemestre_id = retreive_formsemestre_from_request(context, REQUEST)
|
||||
formsemestre_id = retreive_formsemestre_from_request()
|
||||
#
|
||||
if not formsemestre_id:
|
||||
return ""
|
||||
@ -536,21 +520,22 @@ def formsemestre_page_title(context, REQUEST):
|
||||
log("can't find formsemestre_id %s" % formsemestre_id)
|
||||
return ""
|
||||
|
||||
fill_formsemestre(context, sem, REQUEST=REQUEST)
|
||||
fill_formsemestre(sem)
|
||||
|
||||
H = [
|
||||
"""<div class="formsemestre_page_title">""",
|
||||
"""<div class="infos">
|
||||
<span class="semtitle"><a class="stdlink" title="%(session_id)s" href="%(notes_url)s/formsemestre_status?formsemestre_id=%(formsemestre_id)s">%(titre)s</a><a title="%(etape_apo_str)s">%(num_sem)s</a>%(modalitestr)s</span><span class="dates"><a title="du %(date_debut)s au %(date_fin)s ">%(mois_debut)s - %(mois_fin)s</a></span><span class="resp"><a title="%(nomcomplet)s">%(resp)s</a></span><span class="nbinscrits"><a class="discretelink" href="%(notes_url)s/formsemestre_lists?formsemestre_id=%(formsemestre_id)s">%(nbinscrits)d inscrits</a></span><span class="lock">%(locklink)s</span><span class="eye">%(eyelink)s</span></div>"""
|
||||
% sem,
|
||||
formsemestre_status_menubar(context, sem, REQUEST),
|
||||
formsemestre_status_menubar(context, sem),
|
||||
"""</div>""",
|
||||
]
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def fill_formsemestre(context, sem, REQUEST=None):
|
||||
def fill_formsemestre(sem):
|
||||
"""Add some useful fields to help display formsemestres"""
|
||||
context = None # XXX #context
|
||||
notes_url = scu.NotesURL()
|
||||
sem["notes_url"] = notes_url
|
||||
formsemestre_id = sem["formsemestre_id"]
|
||||
@ -765,7 +750,6 @@ def formsemestre_description(
|
||||
# genere liste html pour accès aux groupes de ce semestre
|
||||
def _make_listes_sem(context, sem, REQUEST=None, with_absences=True):
|
||||
context = context
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
# construit l'URL "destination"
|
||||
# (a laquelle on revient apres saisie absences)
|
||||
destination = url_for(
|
||||
@ -776,7 +760,7 @@ def _make_listes_sem(context, sem, REQUEST=None, with_absences=True):
|
||||
#
|
||||
H = []
|
||||
# pas de menu absences si pas autorise:
|
||||
if with_absences and not authuser.has_permission(Permission.ScoAbsChange):
|
||||
if with_absences and not current_user.has_permission(Permission.ScoAbsChange):
|
||||
with_absences = False
|
||||
|
||||
#
|
||||
@ -878,17 +862,13 @@ def _make_listes_sem(context, sem, REQUEST=None, with_absences=True):
|
||||
H.append("</table>")
|
||||
else:
|
||||
H.append('<p class="help indent">Aucun groupe dans cette partition')
|
||||
if sco_groups.sco_permissions_check.can_change_groups(
|
||||
context, REQUEST, formsemestre_id
|
||||
):
|
||||
if sco_groups.sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
H.append(
|
||||
' (<a href="affectGroups?partition_id=%s" class="stdlink">créer</a>)'
|
||||
% partition["partition_id"]
|
||||
)
|
||||
H.append("</p>")
|
||||
if sco_groups.sco_permissions_check.can_change_groups(
|
||||
context, REQUEST, formsemestre_id
|
||||
):
|
||||
if sco_groups.sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
H.append(
|
||||
f"""<h4><a
|
||||
href="{
|
||||
@ -1021,9 +1001,7 @@ def formsemestre_status(context, formsemestre_id=None, REQUEST=None):
|
||||
)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Semestre %s" % sem["titreannee"]
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Semestre %s" % sem["titreannee"]),
|
||||
'<div class="formsemestre_status">',
|
||||
formsemestre_status_head(
|
||||
context, formsemestre_id=formsemestre_id, page_title="Tableau de bord"
|
||||
|
@ -106,8 +106,6 @@ def formsemestre_validation_etud_form(
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Parcours %(nomprenom)s" % etud,
|
||||
javascripts=["js/recap_parcours.js"],
|
||||
)
|
||||
@ -921,7 +919,7 @@ def do_formsemestre_validation_auto(context, formsemestre_id, REQUEST):
|
||||
"do_formsemestre_validation_auto: %d validations, %d conflicts"
|
||||
% (nb_valid, len(conflicts))
|
||||
)
|
||||
H = [html_sco_header.sco_header(context, REQUEST, page_title="Saisie automatique")]
|
||||
H = [html_sco_header.sco_header(page_title="Saisie automatique")]
|
||||
H.append(
|
||||
"""<h2>Saisie automatique des décisions du semestre %s</h2>
|
||||
<p>Opération effectuée.</p>
|
||||
@ -992,8 +990,6 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Validation UE",
|
||||
javascripts=["js/validate_previous_ue.js"],
|
||||
),
|
||||
|
@ -33,15 +33,18 @@ Optimisation possible:
|
||||
et éviter ainsi l'appel ulterieur à get_etud_groups() dans _make_table_notes
|
||||
|
||||
"""
|
||||
import time
|
||||
import collections
|
||||
import re
|
||||
import operator
|
||||
import re
|
||||
import time
|
||||
|
||||
import xml.dom.minidom
|
||||
from xml.etree import ElementTree
|
||||
from xml.etree.ElementTree import Element
|
||||
|
||||
import flask
|
||||
from flask import g
|
||||
from flask import url_for
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app.scodoc.notes_log import log
|
||||
@ -171,8 +174,9 @@ def get_partition_groups(context, partition):
|
||||
)
|
||||
|
||||
|
||||
def get_default_group(context, formsemestre_id, fix_if_missing=False, REQUEST=None):
|
||||
def get_default_group(formsemestre_id, fix_if_missing=False):
|
||||
"""Returns group_id for default ('tous') group"""
|
||||
context = None # #context
|
||||
r = ndb.SimpleDictFetch(
|
||||
"SELECT gd.group_id FROM group_descr gd, partition p WHERE p.formsemestre_id=%(formsemestre_id)s AND p.partition_name is NULL AND p.partition_id = gd.partition_id",
|
||||
{"formsemestre_id": formsemestre_id},
|
||||
@ -190,10 +194,8 @@ def get_default_group(context, formsemestre_id, fix_if_missing=False, REQUEST=No
|
||||
]
|
||||
except ScoException:
|
||||
log("creating default partition for %s" % formsemestre_id)
|
||||
partition_id = partition_create(
|
||||
context, formsemestre_id, default=True, REQUEST=REQUEST
|
||||
)
|
||||
group_id = createGroup(context, partition_id, default=True, REQUEST=REQUEST)
|
||||
partition_id = partition_create(context, formsemestre_id, default=True)
|
||||
group_id = createGroup(context, partition_id, default=True)
|
||||
return group_id
|
||||
# debug check
|
||||
if len(r) != 1:
|
||||
@ -330,7 +332,7 @@ def get_etud_main_group(context, etudid, sem):
|
||||
if groups:
|
||||
return groups[0]
|
||||
else:
|
||||
return get_group(context, get_default_group(context, sem["formsemestre_id"]))
|
||||
return get_group(context, get_default_group(sem["formsemestre_id"]))
|
||||
|
||||
|
||||
def formsemestre_get_main_partition(context, formsemestre_id):
|
||||
@ -600,7 +602,7 @@ def setGroups(
|
||||
|
||||
partition = get_partition(context, partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
log("***setGroups: partition_id=%s" % partition_id)
|
||||
log("groupsLists=%s" % groupsLists)
|
||||
@ -669,7 +671,7 @@ def setGroups(
|
||||
# group_name = six.text_type(group_name, "utf-8").encode(
|
||||
# scu.SCO_ENCODING
|
||||
# ) # #py3 #sco8
|
||||
group_id = createGroup(context, partition_id, group_name, REQUEST=REQUEST)
|
||||
group_id = createGroup(context, partition_id, group_name)
|
||||
# Place dans ce groupe les etudiants indiqués:
|
||||
for etudid in fs[1:-1]:
|
||||
change_etud_group_in_partition(
|
||||
@ -682,15 +684,11 @@ def setGroups(
|
||||
)
|
||||
|
||||
|
||||
def createGroup(context, partition_id, group_name="", default=False, REQUEST=None):
|
||||
"""Create a new group in this partition
|
||||
(called from JS)
|
||||
"""
|
||||
def createGroup(context, partition_id, group_name="", default=False):
|
||||
"""Create a new group in this partition"""
|
||||
partition = get_partition(context, partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
if REQUEST and not sco_permissions_check.can_change_groups(
|
||||
context, REQUEST, formsemestre_id
|
||||
):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
#
|
||||
if group_name:
|
||||
@ -727,9 +725,7 @@ def suppressGroup(context, group_id, partition_id=None, REQUEST=None):
|
||||
else:
|
||||
partition_id = group["partition_id"]
|
||||
partition = get_partition(context, partition_id)
|
||||
if not sco_permissions_check.can_change_groups(
|
||||
context, REQUEST, partition["formsemestre_id"]
|
||||
):
|
||||
if not sco_permissions_check.can_change_groups(partition["formsemestre_id"]):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
log(
|
||||
"suppressGroup: group_id=%s group_name=%s partition_name=%s"
|
||||
@ -744,13 +740,10 @@ def partition_create(
|
||||
partition_name="",
|
||||
default=False,
|
||||
numero=None,
|
||||
REQUEST=None,
|
||||
redirect=1,
|
||||
):
|
||||
"""Create a new partition"""
|
||||
if REQUEST and not sco_permissions_check.can_change_groups(
|
||||
context, REQUEST, formsemestre_id
|
||||
):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
if partition_name:
|
||||
partition_name = partition_name.strip()
|
||||
@ -774,8 +767,12 @@ def partition_create(
|
||||
log("createPartition: created partition_id=%s" % partition_id)
|
||||
#
|
||||
if redirect:
|
||||
return REQUEST.RESPONSE.redirect(
|
||||
"editPartitionForm?formsemestre_id=" + formsemestre_id
|
||||
return flask.redirect(
|
||||
url_for(
|
||||
"scolar.editPartitionForm",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=formsemestre_id,
|
||||
)
|
||||
)
|
||||
else:
|
||||
return partition_id
|
||||
@ -794,7 +791,7 @@ def getArrowIconsTags(context, REQUEST):
|
||||
def editPartitionForm(context, formsemestre_id=None, REQUEST=None):
|
||||
"""Form to create/suppress partitions"""
|
||||
# ad-hoc form
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
partitions = get_partitions_list(context, formsemestre_id)
|
||||
arrow_up, arrow_down, arrow_none = getArrowIconsTags(context, REQUEST)
|
||||
@ -804,8 +801,6 @@ def editPartitionForm(context, formsemestre_id=None, REQUEST=None):
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Partitions...",
|
||||
javascripts=["js/editPartitionForm.js"],
|
||||
),
|
||||
@ -924,7 +919,7 @@ def partition_set_attr(context, partition_id, attr, value, REQUEST=None):
|
||||
|
||||
partition = get_partition(context, partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
|
||||
log("partition_set_attr(%s, %s, %s)" % (partition_id, attr, value))
|
||||
@ -947,7 +942,7 @@ def partition_delete(
|
||||
default partition cannot be suppressed (unless force)"""
|
||||
partition = get_partition(context, partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
|
||||
if not partition["partition_name"] and not force:
|
||||
@ -991,7 +986,7 @@ def partition_move(context, partition_id, after=0, REQUEST=None, redirect=1):
|
||||
"""Move before/after previous one (decrement/increment numero)"""
|
||||
partition = get_partition(context, partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
#
|
||||
redirect = int(redirect)
|
||||
@ -1026,7 +1021,7 @@ def partition_rename(context, partition_id, REQUEST=None):
|
||||
"""Form to rename a partition"""
|
||||
partition = get_partition(context, partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
H = ["<h2>Renommer une partition</h2>"]
|
||||
tf = TrivialFormulator(
|
||||
@ -1049,7 +1044,7 @@ def partition_rename(context, partition_id, REQUEST=None):
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ "\n".join(H)
|
||||
+ "\n"
|
||||
+ tf[1]
|
||||
@ -1086,7 +1081,7 @@ def partition_set_name(context, partition_id, partition_name, REQUEST=None, redi
|
||||
"Partition %s déjà existante dans ce semestre !" % partition_name
|
||||
)
|
||||
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
redirect = int(redirect)
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -1111,7 +1106,7 @@ def group_set_name(context, group_id, group_name, REQUEST=None, redirect=1):
|
||||
if group["group_name"] is None:
|
||||
raise ValueError("can't set a name to default group")
|
||||
formsemestre_id = group["formsemestre_id"]
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
redirect = int(redirect)
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -1128,7 +1123,7 @@ def group_rename(context, group_id, REQUEST=None):
|
||||
"""Form to rename a group"""
|
||||
group = get_group(context, group_id)
|
||||
formsemestre_id = group["formsemestre_id"]
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
H = ["<h2>Renommer un groupe de %s</h2>" % group["partition_name"]]
|
||||
tf = TrivialFormulator(
|
||||
@ -1151,7 +1146,7 @@ def group_rename(context, group_id, REQUEST=None):
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ "\n".join(H)
|
||||
+ "\n"
|
||||
+ tf[1]
|
||||
@ -1178,7 +1173,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
# renvoie sur page édition groupes
|
||||
dest_url = "affectGroups?partition_id=%s" % partition_id
|
||||
if not sco_permissions_check.can_change_groups(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
|
||||
@ -1196,9 +1191,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
|
||||
]
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Répartition des groupes"
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Répartition des groupes"),
|
||||
"<h2>Répartition des groupes de %s</h2>" % partition["partition_name"],
|
||||
"<p>Semestre %s</p>" % sem["titreannee"],
|
||||
"""<p class="help">Les groupes existants seront <b>effacés</b> et remplacés par
|
||||
@ -1240,9 +1233,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
|
||||
# except:
|
||||
# H.append('<p class="warning">Nom de groupe invalide: %s</p>'%group_name)
|
||||
# return '\n'.join(H) + tf[1] + html_sco_header.sco_footer( REQUEST)
|
||||
group_ids.append(
|
||||
createGroup(context, partition_id, group_name, REQUEST=REQUEST)
|
||||
)
|
||||
group_ids.append(createGroup(context, partition_id, group_name))
|
||||
#
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > identdict
|
||||
identdict = nt.identdict
|
||||
|
@ -40,15 +40,11 @@ def affectGroups(context, partition_id, REQUEST=None):
|
||||
# Ported from DTML and adapted to new group management (nov 2009)
|
||||
partition = sco_groups.get_partition(context, partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
if not sco_groups.sco_permissions_check.can_change_groups(
|
||||
context, REQUEST, formsemestre_id
|
||||
):
|
||||
if not sco_groups.sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
raise AccessDenied("vous n'avez pas la permission d'effectuer cette opération")
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Affectation aux groupes",
|
||||
javascripts=["js/groupmgr.js"],
|
||||
cssstyles=["css/groups.css"],
|
||||
|
@ -105,8 +105,6 @@ def groups_view(
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
javascripts=JAVASCRIPTS,
|
||||
cssstyles=CSSSTYLES,
|
||||
init_qtip=True,
|
||||
@ -170,9 +168,7 @@ def form_groups_choice(
|
||||
|
||||
Si submit_on_change, ajoute une classe "submit_on_change" qui est utilisee en JS
|
||||
"""
|
||||
default_group_id = sco_groups.get_default_group(
|
||||
context, groups_infos.formsemestre_id
|
||||
)
|
||||
default_group_id = sco_groups.get_default_group(groups_infos.formsemestre_id)
|
||||
|
||||
H = [
|
||||
"""<form id="group_selector" method="get">
|
||||
@ -202,9 +198,7 @@ def menu_groups_choice(context, groups_infos, submit_on_change=False):
|
||||
et doit comporter au moins un élément, sauf si formsemestre_id est spécifié.
|
||||
(utilisé pour retrouver le semestre et proposer la liste des autres groupes)
|
||||
"""
|
||||
default_group_id = sco_groups.get_default_group(
|
||||
context, groups_infos.formsemestre_id
|
||||
)
|
||||
default_group_id = sco_groups.get_default_group(groups_infos.formsemestre_id)
|
||||
|
||||
if submit_on_change:
|
||||
klass = "submit_on_change"
|
||||
@ -334,7 +328,7 @@ class DisplayedGroupsInfos(object):
|
||||
if not formsemestre_id:
|
||||
raise Exception("missing parameter formsemestre_id or group_ids")
|
||||
if select_all_when_unspecified:
|
||||
group_ids = [sco_groups.get_default_group(context, formsemestre_id)]
|
||||
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
||||
else:
|
||||
# selectionne le premier groupe trouvé, s'il y en a un
|
||||
partition = sco_groups.get_partitions_list(
|
||||
@ -344,7 +338,7 @@ class DisplayedGroupsInfos(object):
|
||||
if groups:
|
||||
group_ids = [groups[0]["group_id"]]
|
||||
else:
|
||||
group_ids = [sco_groups.get_default_group(context, formsemestre_id)]
|
||||
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
||||
|
||||
gq = []
|
||||
for group_id in group_ids:
|
||||
@ -861,7 +855,7 @@ def tab_absences_html(context, groups_infos, etat=None, REQUEST=None):
|
||||
H.append('<h3>Opérations diverses</h3><ul class="ul_misc">')
|
||||
# Lien pour verif codes INE/NIP
|
||||
# (pour tous les etudiants du semestre)
|
||||
group_id = sco_groups.get_default_group(context, groups_infos.formsemestre_id)
|
||||
group_id = sco_groups.get_default_group(groups_infos.formsemestre_id)
|
||||
if authuser.has_permission(Permission.ScoEtudInscrit):
|
||||
H.append(
|
||||
'<li><a class="stdlink" href="check_group_apogee?group_id=%s&etat=%s">Vérifier codes Apogée</a> (de tous les groupes)</li>'
|
||||
|
@ -241,9 +241,7 @@ def students_import_excel(
|
||||
dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
||||
else:
|
||||
dest = scu.NotesURL()
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title="Import etudiants")
|
||||
]
|
||||
H = [html_sco_header.sco_header(page_title="Import etudiants")]
|
||||
H.append("<ul>")
|
||||
for d in diag:
|
||||
H.append("<li>%s</li>" % d)
|
||||
@ -503,11 +501,7 @@ def students_import_admission(
|
||||
type_admission=type_admission,
|
||||
)
|
||||
if REQUEST:
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Import données admissions"
|
||||
)
|
||||
]
|
||||
H = [html_sco_header.sco_header(page_title="Import données admissions")]
|
||||
H.append("<p>Import terminé !</p>")
|
||||
H.append(
|
||||
'<p><a class="stdlink" href="%s">Continuer</a></p>'
|
||||
@ -618,7 +612,7 @@ def scolars_import_admission(
|
||||
|
||||
log("scolars_import_admission: formsemestre_id=%s" % formsemestre_id)
|
||||
members = sco_groups.get_group_members(
|
||||
context, sco_groups.get_default_group(context, formsemestre_id)
|
||||
context, sco_groups.get_default_group(formsemestre_id)
|
||||
)
|
||||
etuds_by_nomprenom = {} # { nomprenom : etud }
|
||||
diag = []
|
||||
|
@ -287,9 +287,7 @@ 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(page_title="Passage des étudiants")
|
||||
footer = html_sco_header.sco_footer()
|
||||
H = [header]
|
||||
if type(etuds) == type(""):
|
||||
|
@ -246,7 +246,7 @@ def _make_table_notes(
|
||||
keep_numeric = False
|
||||
# Si pas de groupe, affiche tout
|
||||
if not group_ids:
|
||||
group_ids = [sco_groups.get_default_group(context, M["formsemestre_id"])]
|
||||
group_ids = [sco_groups.get_default_group(M["formsemestre_id"])]
|
||||
groups = sco_groups.listgroups(context, group_ids)
|
||||
|
||||
gr_title = sco_groups.listgroups_abbrev(groups)
|
||||
|
@ -84,8 +84,6 @@ def scodoc_table_etuds_lycees(context, format="html", REQUEST=None):
|
||||
return t
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=tab.page_title,
|
||||
init_google_maps=True,
|
||||
init_qtip=True,
|
||||
@ -199,8 +197,6 @@ def formsemestre_etuds_lycees(
|
||||
]
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=tab.page_title,
|
||||
init_google_maps=True,
|
||||
init_qtip=True,
|
||||
|
@ -71,8 +71,6 @@ def moduleimpl_inscriptions_edit(
|
||||
if sem["etat"] != "1":
|
||||
raise ScoValueError("opération impossible: semestre verrouille")
|
||||
header = html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Inscription au module",
|
||||
init_qtip=True,
|
||||
javascripts=["js/etud_info.js"],
|
||||
|
@ -60,7 +60,7 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
|
||||
context, moduleimpl_id=E["moduleimpl_id"]
|
||||
)[0]
|
||||
|
||||
group_id = sco_groups.get_default_group(context, modimpl["formsemestre_id"])
|
||||
group_id = sco_groups.get_default_group(modimpl["formsemestre_id"])
|
||||
|
||||
if (
|
||||
sco_permissions_check.can_edit_notes(
|
||||
@ -185,9 +185,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
|
||||
arrow_up, arrow_down, arrow_none = sco_groups.getArrowIconsTags(context, REQUEST)
|
||||
#
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Module %(titre)s" % Mod
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Module %(titre)s" % Mod),
|
||||
"""<h2 class="formsemestre">Module <tt>%(code)s</tt> %(titre)s</h2>""" % Mod,
|
||||
# XXX """caneditevals=%s caneditnotes=%s""" % (caneditevals,caneditnotes),
|
||||
"""<div class="moduleimpl_tableaubord">
|
||||
@ -285,7 +283,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
|
||||
Permission.ScoAbsChange
|
||||
) and sco_formsemestre.sem_est_courant(context, sem):
|
||||
datelundi = sco_abs.ddmmyyyy(time.strftime("%d/%m/%Y")).prev_monday()
|
||||
group_id = sco_groups.get_default_group(context, formsemestre_id)
|
||||
group_id = sco_groups.get_default_group(formsemestre_id)
|
||||
H.append(
|
||||
f"""
|
||||
<span class="moduleimpl_abs_link"><a class="stdlink"
|
||||
|
@ -279,7 +279,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
|
||||
alist = []
|
||||
annos = sco_etud.etud_annotations_list(cnx, args={"etudid": etudid})
|
||||
for a in annos:
|
||||
if not sco_permissions_check.can_suppress_annotation(context, a["id"], REQUEST):
|
||||
if not sco_permissions_check.can_suppress_annotation(a["id"]):
|
||||
a["dellink"] = ""
|
||||
else:
|
||||
a[
|
||||
@ -355,7 +355,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
|
||||
|
||||
# Devenir de l'étudiant:
|
||||
has_debouche = True # info['debouche']
|
||||
if sco_permissions_check.can_edit_suivi(context, REQUEST):
|
||||
if sco_permissions_check.can_edit_suivi():
|
||||
suivi_readonly = "0"
|
||||
link_add_suivi = """<li class="adddebouche">
|
||||
<a id="adddebouchelink" class="stdlink" href="#">ajouter une ligne</a>
|
||||
@ -478,8 +478,6 @@ def ficheEtud(context, etudid=None, REQUEST=None):
|
||||
</div>
|
||||
"""
|
||||
header = html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Fiche étudiant %(prenom)s %(nom)s" % info,
|
||||
cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"],
|
||||
javascripts=[
|
||||
@ -547,12 +545,7 @@ def etud_info_html(context, etudid, with_photo="1", REQUEST=None, debug=False):
|
||||
context = context
|
||||
except:
|
||||
pass
|
||||
# log('etud_info_html: %s' % REQUEST.QUERY_STRING)
|
||||
formsemestre_id = sco_formsemestre_status.retreive_formsemestre_from_request(
|
||||
context, REQUEST
|
||||
)
|
||||
# log('etud_info_html: formsemestre_id=%s' % formsemestre_id)
|
||||
|
||||
formsemestre_id = sco_formsemestre_status.retreive_formsemestre_from_request()
|
||||
with_photo = int(with_photo)
|
||||
etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0]
|
||||
photo_html = sco_photos.etud_photo_html(
|
||||
|
@ -62,7 +62,6 @@ def can_edit_evaluation(moduleimpl_id=None):
|
||||
# was _evaluation_check_write_access
|
||||
# AccessDenied("Modification évaluation impossible pour %s" % (uid,))
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_moduleimpl
|
||||
|
||||
# acces pour resp. moduleimpl et resp. form semestre (dir etud)
|
||||
if moduleimpl_id is None:
|
||||
@ -85,7 +84,7 @@ def can_edit_evaluation(moduleimpl_id=None):
|
||||
return False
|
||||
|
||||
|
||||
def can_suppress_annotation(context, annotation_id, REQUEST):
|
||||
def can_suppress_annotation(annotation_id):
|
||||
"""True if current user can suppress this annotation
|
||||
Seuls l'auteur de l'annotation et le chef de dept peuvent supprimer
|
||||
une annotation.
|
||||
@ -95,51 +94,48 @@ def can_suppress_annotation(context, annotation_id, REQUEST):
|
||||
if len(annos) != 1:
|
||||
raise sco_exceptions.ScoValueError("annotation inexistante !")
|
||||
anno = annos[0]
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
return (
|
||||
str(authuser) == anno["zope_authenticated_user"]
|
||||
) or authuser.has_permission(Permission.ScoEtudAddAnnotations)
|
||||
current_user.user_name == anno["zope_authenticated_user"]
|
||||
) or current_user.has_permission(Permission.ScoEtudAddAnnotations)
|
||||
|
||||
|
||||
def can_edit_suivi(context, REQUEST=None):
|
||||
def can_edit_suivi():
|
||||
"""Vrai si l'utilisateur peut modifier les informations de suivi sur la page etud" """
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
return authuser.has_permission(Permission.ScoEtudChangeAdr)
|
||||
return current_user.has_permission(Permission.ScoEtudChangeAdr)
|
||||
|
||||
|
||||
def can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
def can_validate_sem(formsemestre_id):
|
||||
"Vrai si utilisateur peut saisir decision de jury dans ce semestre"
|
||||
from app.scodoc import sco_formsemestre
|
||||
|
||||
context = None # XXX #context
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
if sem["etat"] != "1":
|
||||
return False # semestre verrouillé
|
||||
|
||||
return is_chef_or_diretud(context, REQUEST, sem)
|
||||
return is_chef_or_diretud(sem)
|
||||
|
||||
|
||||
def can_edit_pv(context, REQUEST, formsemestre_id):
|
||||
def can_edit_pv(formsemestre_id):
|
||||
"Vrai si utilisateur peut editer un PV de jury de ce semestre"
|
||||
from app.scodoc import sco_formsemestre
|
||||
|
||||
context = None # XXX #context
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
if is_chef_or_diretud(context, REQUEST, sem):
|
||||
if is_chef_or_diretud(sem):
|
||||
return True
|
||||
# Autorise les secrétariats, repérés via la permission ScoEtudChangeAdr
|
||||
# (ceci nous évite d'ajouter une permission Zope aux installations existantes)
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
return authuser.has_permission(Permission.ScoEtudChangeAdr)
|
||||
return current_user.has_permission(Permission.ScoEtudChangeAdr)
|
||||
|
||||
|
||||
def is_chef_or_diretud(context, REQUEST, sem):
|
||||
def is_chef_or_diretud(sem):
|
||||
"Vrai si utilisateur est admin, chef dept ou responsable du semestre"
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
if authuser.has_permission(Permission.ScoImplement):
|
||||
return True # admin, chef dept
|
||||
uid = str(authuser)
|
||||
if uid in sem["responsables"]:
|
||||
if (
|
||||
current_user.has_permission(Permission.ScoImplement)
|
||||
or current_user.user_name in sem["responsables"]
|
||||
):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@ -151,21 +147,20 @@ def check_access_diretud(
|
||||
"""
|
||||
from app.scodoc import sco_formsemestre
|
||||
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
header = html_sco_header.sco_header(
|
||||
context, page_title="Accès interdit", REQUEST=REQUEST
|
||||
)
|
||||
footer = html_sco_header.sco_footer()
|
||||
if (str(authuser) not in sem["responsables"]) and not authuser.has_permission(
|
||||
required_permission
|
||||
):
|
||||
if (
|
||||
current_user.user_name not in sem["responsables"]
|
||||
) and not current_user.has_permission(required_permission):
|
||||
return (
|
||||
False,
|
||||
"\n".join(
|
||||
[
|
||||
header,
|
||||
"<h2>Opération non autorisée pour %s</h2>" % authuser,
|
||||
"<h2>Opération non autorisée pour %s</h2>" % current_user,
|
||||
"<p>Responsable de ce semestre : <b>%s</b></p>"
|
||||
% ", ".join(sem["responsables"]),
|
||||
footer,
|
||||
@ -176,18 +171,17 @@ def check_access_diretud(
|
||||
return True, ""
|
||||
|
||||
|
||||
def can_change_groups(context, REQUEST, formsemestre_id):
|
||||
def can_change_groups(formsemestre_id):
|
||||
"Vrai si l'utilisateur peut changer les groupes dans ce semestre"
|
||||
from app.scodoc import sco_formsemestre
|
||||
|
||||
context = None # XXX #context
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
if sem["etat"] != "1":
|
||||
return False # semestre verrouillé
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
if authuser.has_permission(Permission.ScoEtudChangeGroups):
|
||||
if current_user.has_permission(Permission.ScoEtudChangeGroups):
|
||||
return True # admin, chef dept
|
||||
uid = str(authuser)
|
||||
if uid in sem["responsables"]:
|
||||
if current_user.user_name in sem["responsables"]:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -412,7 +412,7 @@ def placement_eval_selectetuds(context, evaluation_id, REQUEST=None):
|
||||
page_title = 'Placement "%s"' % theeval["description"]
|
||||
else:
|
||||
page_title = "Placement des étudiants"
|
||||
H = [html_sco_header.sco_header(context, REQUEST, page_title=page_title)]
|
||||
H = [html_sco_header.sco_header(page_title=page_title)]
|
||||
|
||||
formid = "placementfile"
|
||||
if not REQUEST.form.get("%s-submitted" % formid, False):
|
||||
|
@ -170,7 +170,7 @@ def formsemestre_poursuite_report(
|
||||
"""Table avec informations "poursuite" """
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
etuds = _getEtudInfoGroupes(
|
||||
context, [sco_groups.get_default_group(context, formsemestre_id)]
|
||||
context, [sco_groups.get_default_group(formsemestre_id)]
|
||||
)
|
||||
|
||||
infos = []
|
||||
|
@ -1958,7 +1958,7 @@ class BasePreferences(object):
|
||||
|
||||
context = None # XXX TO REMOVE #context
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title="Préférences"),
|
||||
html_sco_header.sco_header(page_title="Préférences"),
|
||||
"<h2>Préférences globales pour %s</h2>" % scu.ScoURL(),
|
||||
"""<p class="help">Ces paramètres s'appliquent par défaut à tous les semestres, sauf si ceux-ci définissent des valeurs spécifiques.</p>
|
||||
<p class="msg">Attention: cliquez sur "Enregistrer les modifications" en bas de page pour appliquer vos changements !</p>
|
||||
|
@ -516,7 +516,7 @@ def formsemestre_pvjury(
|
||||
if not dpv:
|
||||
if format == "html":
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>Aucune information disponible !</h2>"
|
||||
+ footer
|
||||
)
|
||||
@ -634,7 +634,7 @@ def formsemestre_pvjury_pdf(
|
||||
etuddescr = ""
|
||||
if not group_ids:
|
||||
# tous les inscrits du semestre
|
||||
group_ids = [sco_groups.get_default_group(context, formsemestre_id)]
|
||||
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
||||
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
||||
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
|
||||
@ -818,7 +818,7 @@ def formsemestre_lettres_individuelles(
|
||||
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
|
||||
if not group_ids:
|
||||
# tous les inscrits du semestre
|
||||
group_ids = [sco_groups.get_default_group(context, formsemestre_id)]
|
||||
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
||||
context, group_ids, formsemestre_id=formsemestre_id, REQUEST=REQUEST
|
||||
)
|
||||
|
@ -95,8 +95,6 @@ def formsemestre_recapcomplet(
|
||||
if not isFile:
|
||||
H += [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Récapitulatif",
|
||||
no_side_bar=True,
|
||||
init_qtip=True,
|
||||
@ -173,7 +171,7 @@ def formsemestre_recapcomplet(
|
||||
"""<p><a class="stdlink" href="formsemestre_pvjury?formsemestre_id=%s">Voir les décisions du jury</a></p>"""
|
||||
% formsemestre_id
|
||||
)
|
||||
if sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
H.append("<p>")
|
||||
if modejury:
|
||||
H.append(
|
||||
|
@ -365,7 +365,7 @@ def formsemestre_report_counts(
|
||||
if format != "html":
|
||||
return t
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title=title),
|
||||
html_sco_header.sco_header(page_title=title),
|
||||
t,
|
||||
"\n".join(F),
|
||||
"""<p class="help">Le tableau affiche le nombre d'étudiants de ce semestre dans chacun
|
||||
@ -756,7 +756,7 @@ def formsemestre_suivi_cohorte(
|
||||
)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title=tab.page_title),
|
||||
html_sco_header.sco_header(page_title=tab.page_title),
|
||||
"""<h2 class="formsemestre">Suivi cohorte: devenir des étudiants de ce semestre</h2>""",
|
||||
_gen_form_selectetuds(
|
||||
formsemestre_id,
|
||||
@ -1229,8 +1229,6 @@ def formsemestre_suivi_parcours(
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=tab.page_title,
|
||||
init_qtip=True,
|
||||
javascripts=["js/etud_info.js"],
|
||||
@ -1559,8 +1557,6 @@ def formsemestre_graph_parcours(
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Parcours étudiants de %(titreannee)s" % sem,
|
||||
no_side_bar=True,
|
||||
),
|
||||
|
@ -311,7 +311,7 @@ def do_evaluation_set_missing(
|
||||
diag = "Valeur %s invalide" % value
|
||||
if diag:
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ '<h2>%s</h2><p><a href="saisie_notes?evaluation_id=%s">Recommencer</a>'
|
||||
% (diag, evaluation_id)
|
||||
+ html_sco_header.sco_footer()
|
||||
@ -348,7 +348,7 @@ def do_evaluation_set_missing(
|
||||
url=mod["url"],
|
||||
)
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ """<h2>%d notes changées</h2>
|
||||
<ul>
|
||||
<li><a class="stdlink" href="saisie_notes?evaluation_id=%s">
|
||||
@ -429,11 +429,7 @@ def evaluation_suppress_alln(context, evaluation_id, REQUEST, dialog_confirmed=F
|
||||
url=mod["url"],
|
||||
)
|
||||
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
+ "\n".join(H)
|
||||
+ html_sco_header.sco_footer()
|
||||
)
|
||||
return html_sco_header.sco_header() + "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def _notes_add(context, uid, evaluation_id, notes, comment=None, do_it=True):
|
||||
@ -578,7 +574,7 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
|
||||
formsemestre_id = M["formsemestre_id"]
|
||||
if not sco_permissions_check.can_edit_notes(context, authuser, E["moduleimpl_id"]):
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>Modification des notes impossible pour %s</h2>" % authusername
|
||||
+ """<p>(vérifiez que le semestre n'est pas verrouillé et que vous
|
||||
avez l'autorisation d'effectuer cette opération)</p>
|
||||
@ -605,8 +601,6 @@ def saisie_notes_tableur(context, evaluation_id, group_ids=[], REQUEST=None):
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=page_title,
|
||||
javascripts=sco_groups_view.JAVASCRIPTS,
|
||||
cssstyles=sco_groups_view.CSSSTYLES,
|
||||
@ -859,7 +853,7 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
|
||||
# (admin, respformation, and responsable_id)
|
||||
if not sco_permissions_check.can_edit_notes(context, authuser, E["moduleimpl_id"]):
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>Modification des notes impossible pour %s</h2>" % authusername
|
||||
+ """<p>(vérifiez que le semestre n'est pas verrouillé et que vous
|
||||
avez l'autorisation d'effectuer cette opération)</p>
|
||||
@ -887,8 +881,6 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
|
||||
# HTML page:
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=page_title,
|
||||
javascripts=sco_groups_view.JAVASCRIPTS + ["js/saisie_notes.js"],
|
||||
cssstyles=sco_groups_view.CSSSTYLES,
|
||||
|
@ -135,9 +135,9 @@ class SemSet(dict):
|
||||
self["semlinks"] = [(pattern % sem) for sem in self.sems]
|
||||
self["semtitles_str"] = "<br/>".join(self["semlinks"])
|
||||
|
||||
def fill_formsemestres(self, REQUEST):
|
||||
def fill_formsemestres(self):
|
||||
for sem in self.sems:
|
||||
sco_formsemestre_status.fill_formsemestre(self.context, sem, REQUEST)
|
||||
sco_formsemestre_status.fill_formsemestre(sem)
|
||||
ets = sco_etape_apogee.apo_get_sem_etapes(self.context, sem)
|
||||
sem["etapes_apo_str"] = sco_formsemestre.etapes_apo_str(sorted(list(ets)))
|
||||
|
||||
@ -467,8 +467,6 @@ def semset_page(context, format="html", REQUEST=None):
|
||||
page_title = "Ensembles de semestres"
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=page_title,
|
||||
init_qtip=True,
|
||||
javascripts=["libjs/jinplace-1.2.1.min.js"],
|
||||
|
@ -107,9 +107,7 @@ def formsemestre_synchro_etuds(
|
||||
"""
|
||||
% sem
|
||||
)
|
||||
header = html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Synchronisation étudiants"
|
||||
)
|
||||
header = html_sco_header.sco_header(page_title="Synchronisation étudiants")
|
||||
footer = html_sco_header.sco_footer()
|
||||
base_url = "%s?formsemestre_id=%s" % (REQUEST.URL0, formsemestre_id)
|
||||
if anneeapogee:
|
||||
@ -522,9 +520,7 @@ def list_all(context, etudsapo_set):
|
||||
|
||||
|
||||
def formsemestre_synchro_etuds_help(context, sem):
|
||||
sem["default_group_id"] = sco_groups.get_default_group(
|
||||
context, sem["formsemestre_id"]
|
||||
)
|
||||
sem["default_group_id"] = sco_groups.get_default_group(sem["formsemestre_id"])
|
||||
return (
|
||||
"""<div class="pas_help pas_help_left"><h3><a name="help">Explications</a></h3>
|
||||
<p>Cette page permet d'importer dans le semestre destination
|
||||
|
@ -101,7 +101,7 @@ def trombino(
|
||||
|
||||
|
||||
def _trombino_html_header(context, REQUEST):
|
||||
return html_sco_header.sco_header(context, REQUEST, javascripts=["js/trombino.js"])
|
||||
return html_sco_header.sco_header(javascripts=["js/trombino.js"])
|
||||
|
||||
|
||||
def trombino_html(context, groups_infos, REQUEST=None):
|
||||
@ -257,9 +257,7 @@ 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(page_title="Chargement des photos")
|
||||
footer = html_sco_header.sco_footer()
|
||||
if not portal_url:
|
||||
return (
|
||||
@ -507,9 +505,7 @@ 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(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/>
|
||||
|
@ -298,8 +298,6 @@ def user_info_page(context, user_name=None, REQUEST=None):
|
||||
raise ScoValueError("invalid user_name")
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Utilisateur %s" % user.user_name,
|
||||
)
|
||||
]
|
||||
|
@ -868,9 +868,7 @@ def confirm_dialog(
|
||||
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()
|
||||
html_sco_header.sco_header() + "\n".join(H) + html_sco_header.sco_footer()
|
||||
)
|
||||
else:
|
||||
return "\n".join(H)
|
||||
|
@ -136,8 +136,6 @@ def index_html(context, REQUEST=None):
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Gestion des absences",
|
||||
cssstyles=["css/calabs.css"],
|
||||
javascripts=["js/calabs.js"],
|
||||
@ -956,8 +954,6 @@ def EtatAbsencesGr(
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
html_header=html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title=title,
|
||||
init_qtip=True,
|
||||
javascripts=["js/etud_info.js"],
|
||||
@ -1151,7 +1147,7 @@ def AddBilletAbsenceForm(context, etudid, REQUEST=None):
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Billet d'absence de %s" % etud["nomprenom"]
|
||||
page_title="Billet d'absence de %s" % etud["nomprenom"]
|
||||
)
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
@ -1292,9 +1288,7 @@ def listeBillets(context, REQUEST=None):
|
||||
tab = _tableBillets(context, billets)
|
||||
T = tab.html()
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Billet d'absence non traités"
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Billet d'absence non traités"),
|
||||
"<h2>Billets d'absence en attente de traitement (%d)</h2>" % len(billets),
|
||||
]
|
||||
|
||||
@ -1425,8 +1419,6 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Traitement billet d'absence de %s" % etud["nomprenom"],
|
||||
),
|
||||
'<h2>Traitement du billet %s : <a class="discretelink" href="%s">%s</a></h2>'
|
||||
|
@ -56,8 +56,7 @@ import calendar
|
||||
|
||||
def entreprise_header(context, REQUEST=None, page_title=""):
|
||||
"common header for all Entreprises pages"
|
||||
return html_sco_header.sco_header(
|
||||
context, REQUEST, container=context, page_title=page_title
|
||||
return html_sco_header.sco_header( page_title=page_title
|
||||
)
|
||||
|
||||
|
||||
@ -78,7 +77,7 @@ def sidebar(REQUEST):
|
||||
H = [
|
||||
"""<div id="sidebar-container">
|
||||
<div class="sidebar">""",
|
||||
html_sidebar.sidebar_common(REQUEST),
|
||||
html_sidebar.sidebar_common(),
|
||||
"""<h2 class="insidebar"><a href="%(ScoURL)s/Entreprises" class="sidebar">Entreprises</a></h2>
|
||||
<ul class="insidebar">"""
|
||||
% params,
|
||||
|
@ -237,11 +237,7 @@ sco_publish(
|
||||
sco_formsemestre_status.formsemestre_description,
|
||||
Permission.ScoView,
|
||||
)
|
||||
sco_publish(
|
||||
"/formsemestre_status_menubar",
|
||||
sco_formsemestre_status.formsemestre_status_menubar,
|
||||
Permission.ScoView,
|
||||
)
|
||||
|
||||
sco_publish(
|
||||
"/formation_create",
|
||||
sco_edit_formation.formation_create,
|
||||
@ -384,9 +380,7 @@ def index_html(context, REQUEST=None):
|
||||
editable = REQUEST.AUTHENTICATED_USER.has_permission(Permission.ScoChangeFormation)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Programmes formations"
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Programmes formations"),
|
||||
"""<h2>Programmes pédagogiques</h2>
|
||||
""",
|
||||
]
|
||||
@ -1325,7 +1319,7 @@ def formsemestre_desinscription(
|
||||
)
|
||||
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ '<p>Etudiant désinscrit !</p><p><a class="stdlink" href="%s">retour à la fiche</a>'
|
||||
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||
+ html_sco_header.sco_footer()
|
||||
@ -1527,8 +1521,6 @@ def evaluation_listenotes(context, REQUEST=None):
|
||||
"""Affichage des notes d'une évaluation"""
|
||||
if REQUEST.form.get("format", "html") == "html":
|
||||
H = html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
cssstyles=["css/verticalhisto.css"],
|
||||
javascripts=["js/etud_info.js"],
|
||||
init_qtip=True,
|
||||
@ -1730,7 +1722,7 @@ def formsemestre_bulletins_mailetuds(
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > get_etudids
|
||||
etudids = nt.get_etudids()
|
||||
#
|
||||
if not sco_bulletins.can_send_bulletin_by_mail(context, formsemestre_id, REQUEST):
|
||||
if not sco_bulletins.can_send_bulletin_by_mail(context, formsemestre_id):
|
||||
raise AccessDenied("vous n'avez pas le droit d'envoyer les bulletins")
|
||||
# Confirmation dialog
|
||||
if not dialog_confirmed:
|
||||
@ -1764,7 +1756,7 @@ def formsemestre_bulletins_mailetuds(
|
||||
nb_send += 1
|
||||
#
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ '<p>%d bulletins sur %d envoyés par mail !</p><p><a class="stdlink" href="formsemestre_status?formsemestre_id=%s">continuer</a></p>'
|
||||
% (nb_send, len(etudids), formsemestre_id)
|
||||
+ html_sco_header.sco_footer()
|
||||
@ -1829,7 +1821,7 @@ def appreciation_add_form(
|
||||
else:
|
||||
a = "Ajout"
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>%s d'une appréciation sur %s</h2>" % (a, etud["nomprenom"])
|
||||
]
|
||||
F = html_sco_header.sco_footer()
|
||||
@ -1906,9 +1898,7 @@ def formsemestre_validation_etud_form(
|
||||
REQUEST=None,
|
||||
):
|
||||
"Formulaire choix jury pour un étudiant"
|
||||
readonly = not sco_permissions_check.can_validate_sem(
|
||||
context, REQUEST, formsemestre_id
|
||||
)
|
||||
readonly = not sco_permissions_check.can_validate_sem(formsemestre_id)
|
||||
return sco_formsemestre_validation.formsemestre_validation_etud_form(
|
||||
context,
|
||||
formsemestre_id,
|
||||
@ -1935,7 +1925,7 @@ def formsemestre_validation_etud(
|
||||
REQUEST=None,
|
||||
):
|
||||
"Enregistre choix jury pour un étudiant"
|
||||
if not sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
context,
|
||||
message="<p>Opération non autorisée pour %s</h2>"
|
||||
@ -1971,7 +1961,7 @@ def formsemestre_validation_etud_manu(
|
||||
REQUEST=None,
|
||||
):
|
||||
"Enregistre choix jury pour un étudiant"
|
||||
if not sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
context,
|
||||
message="<p>Opération non autorisée pour %s</h2>"
|
||||
@ -2001,7 +1991,7 @@ def formsemestre_validate_previous_ue(
|
||||
context, formsemestre_id, etudid=None, REQUEST=None
|
||||
):
|
||||
"Form. saisie UE validée hors ScoDoc "
|
||||
if not sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
context,
|
||||
message="<p>Opération non autorisée pour %s</h2>"
|
||||
@ -2029,7 +2019,7 @@ def formsemestre_ext_edit_ue_validations(
|
||||
context, formsemestre_id, etudid=None, REQUEST=None
|
||||
):
|
||||
"Form. edition UE semestre extérieur"
|
||||
if not sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
context,
|
||||
message="<p>Opération non autorisée pour %s</h2>"
|
||||
@ -2054,7 +2044,7 @@ sco_publish(
|
||||
@scodoc7func(context)
|
||||
def etud_ue_suppress_validation(context, etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
"""Suppress a validation (ue_id, etudid) and redirect to formsemestre"""
|
||||
if not sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
context,
|
||||
message="<p>Opération non autorisée pour %s</h2>"
|
||||
@ -2072,7 +2062,7 @@ def etud_ue_suppress_validation(context, etudid, formsemestre_id, ue_id, REQUEST
|
||||
@scodoc7func(context)
|
||||
def formsemestre_validation_auto(context, formsemestre_id, REQUEST):
|
||||
"Formulaire saisie automatisee des decisions d'un semestre"
|
||||
if not sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
context,
|
||||
message="<p>Opération non autorisée pour %s</h2>"
|
||||
@ -2091,7 +2081,7 @@ def formsemestre_validation_auto(context, formsemestre_id, REQUEST):
|
||||
@scodoc7func(context)
|
||||
def do_formsemestre_validation_auto(context, formsemestre_id, REQUEST):
|
||||
"Formulaire saisie automatisee des decisions d'un semestre"
|
||||
if not sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
context,
|
||||
message="<p>Opération non autorisée pour %s</h2>"
|
||||
@ -2112,7 +2102,7 @@ def formsemestre_validation_suppress_etud(
|
||||
context, formsemestre_id, etudid, REQUEST=None, dialog_confirmed=False
|
||||
):
|
||||
"""Suppression des decisions de jury pour un etudiant."""
|
||||
if not sco_permissions_check.can_validate_sem(context, REQUEST, formsemestre_id):
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
context,
|
||||
message="<p>Opération non autorisée pour %s</h2>"
|
||||
|
@ -155,10 +155,7 @@ def about(context, REQUEST):
|
||||
)
|
||||
d = ""
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST)
|
||||
+ "\n".join(H)
|
||||
+ d
|
||||
+ html_sco_header.sco_footer()
|
||||
html_sco_header.sco_header() + "\n".join(H) + d + html_sco_header.sco_footer()
|
||||
)
|
||||
|
||||
|
||||
@ -519,9 +516,7 @@ def doAddAnnotation(context, etudid, comment, REQUEST):
|
||||
@scodoc7func(context)
|
||||
def doSuppressAnnotation(context, etudid, annotation_id, REQUEST):
|
||||
"""Suppression annotation."""
|
||||
if not sco_permissions_check.can_suppress_annotation(
|
||||
context, annotation_id, REQUEST
|
||||
):
|
||||
if not sco_permissions_check.can_suppress_annotation(annotation_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -560,7 +555,7 @@ def formChangeCoordonnees(context, etudid, REQUEST):
|
||||
% etud
|
||||
]
|
||||
header = html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Changement adresse de %(nomprenom)s" % etud
|
||||
page_title="Changement adresse de %(nomprenom)s" % etud
|
||||
)
|
||||
|
||||
tf = TrivialFormulator(
|
||||
@ -722,7 +717,7 @@ def etud_photo_orig_page(context, etudid=None, REQUEST=None):
|
||||
"Page with photo in orig. size"
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=1, REQUEST=REQUEST)[0]
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title=etud["nomprenom"]),
|
||||
html_sco_header.sco_header(page_title=etud["nomprenom"]),
|
||||
"<h2>%s</h2>" % etud["nomprenom"],
|
||||
'<div><a href="%s">'
|
||||
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
|
||||
@ -744,7 +739,7 @@ def formChangePhoto(context, etudid=None, REQUEST=None):
|
||||
else:
|
||||
etud["photoloc"] = "externe"
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title="Changement de photo"),
|
||||
html_sco_header.sco_header(page_title="Changement de photo"),
|
||||
"""<h2>Changement de la photo de %(nomprenom)s</h2>
|
||||
<p>Photo actuelle (%(photoloc)s):
|
||||
"""
|
||||
@ -868,8 +863,6 @@ def _formDem_of_Def(
|
||||
etud["operation_name"] = operation_name
|
||||
#
|
||||
header = html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="%(operation_name)s de %(nomprenom)s (du semestre %(semtitre)s)"
|
||||
% etud,
|
||||
)
|
||||
@ -1101,7 +1094,7 @@ def etudident_edit_form(context, REQUEST=None):
|
||||
|
||||
def _etudident_create_or_edit_form(context, REQUEST, edit):
|
||||
"Le formulaire HTML"
|
||||
H = [html_sco_header.sco_header(context, REQUEST, init_jquery_ui=True)]
|
||||
H = [html_sco_header.sco_header(init_jquery_ui=True)]
|
||||
F = html_sco_header.sco_footer()
|
||||
etudid = REQUEST.form.get("etudid", None)
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -1740,7 +1733,7 @@ def form_students_import_excel(context, REQUEST, formsemestre_id=None):
|
||||
if sem and sem["etat"] != "1":
|
||||
raise ScoValueError("Modification impossible: semestre verrouille")
|
||||
H = [
|
||||
html_sco_header.sco_header(context, REQUEST, page_title="Import etudiants"),
|
||||
html_sco_header.sco_header(page_title="Import etudiants"),
|
||||
"""<h2 class="formsemestre">Téléchargement d\'une nouvelle liste d\'etudiants</h2>
|
||||
<div style="color: red">
|
||||
<p>A utiliser pour importer de <b>nouveaux</b> étudiants (typiquement au
|
||||
@ -1886,9 +1879,7 @@ def import_generate_excel_sample(context, REQUEST, with_codesemestre="1"):
|
||||
@scodoc7func(context)
|
||||
def import_generate_admission_sample(context, REQUEST, formsemestre_id):
|
||||
"une feuille excel pour importation données admissions"
|
||||
group = sco_groups.get_group(
|
||||
context, sco_groups.get_default_group(context, formsemestre_id)
|
||||
)
|
||||
group = sco_groups.get_group(context, sco_groups.get_default_group(formsemestre_id))
|
||||
fmt = sco_import_etuds.sco_import_format()
|
||||
data = sco_import_etuds.sco_import_generate_excel_sample(
|
||||
fmt,
|
||||
@ -1913,8 +1904,6 @@ def form_students_import_infos_admissions(context, REQUEST, formsemestre_id=None
|
||||
# autorise juste l'export
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context,
|
||||
REQUEST,
|
||||
page_title="Export données admissions (Parcoursup ou autre)",
|
||||
),
|
||||
"""<h2 class="formsemestre">Téléchargement des informations sur l'admission des étudiants</h2>
|
||||
@ -1929,9 +1918,7 @@ def form_students_import_infos_admissions(context, REQUEST, formsemestre_id=None
|
||||
|
||||
# On a le droit d'importer:
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
context, REQUEST, page_title="Import données admissions Parcoursup"
|
||||
),
|
||||
html_sco_header.sco_header(page_title="Import données admissions Parcoursup"),
|
||||
"""<h2 class="formsemestre">Téléchargement des informations sur l'admission des étudiants depuis feuilles import Parcoursup</h2>
|
||||
<div style="color: red">
|
||||
<p>A utiliser pour renseigner les informations sur l'origine des étudiants (lycées, bac, etc). Ces informations sont facultatives mais souvent utiles pour mieux connaitre les étudiants et aussi pour effectuer des statistiques (résultats suivant le type de bac...). Les données sont affichées sur les fiches individuelles des étudiants.</p>
|
||||
|
@ -98,7 +98,7 @@ def create_user_form(context, REQUEST, user_name=None, edit=0):
|
||||
auth_dept = current_user.dept
|
||||
initvalues = {}
|
||||
edit = int(edit)
|
||||
H = [html_sco_header.sco_header(context, REQUEST, bodyOnLoad="init_tf_form('')")]
|
||||
H = [html_sco_header.sco_header(bodyOnLoad="init_tf_form('')")]
|
||||
F = html_sco_header.sco_footer()
|
||||
if edit:
|
||||
if not user_name:
|
||||
@ -503,7 +503,7 @@ def form_change_password(REQUEST, user_name=None):
|
||||
u = current_user
|
||||
else:
|
||||
u = User.query.filter_by(user_name=user_name).first()
|
||||
H = [html_sco_header.sco_header(context, REQUEST, user_check=False)]
|
||||
H = [html_sco_header.sco_header(user_check=False)]
|
||||
F = html_sco_header.sco_footer()
|
||||
# check access
|
||||
if not can_handle_passwd(u):
|
||||
@ -586,7 +586,7 @@ def change_password(user_name, password, password2, REQUEST):
|
||||
+ '<a href="%s" class="stdlink">Continuer</a></body></html>'
|
||||
% scu.ScoURL()
|
||||
)
|
||||
return html_sco_header.sco_header(context, REQUEST) + "\n".join(H) + F
|
||||
return html_sco_header.sco_header() + "\n".join(H) + F
|
||||
|
||||
|
||||
@bp.route("/delete_user_form", methods=["GET", "POST"])
|
||||
@ -599,7 +599,7 @@ def delete_user_form(REQUEST, user_name, dialog_confirmed=False):
|
||||
if not can_handle_passwd(u):
|
||||
# access denied (or non existent user)
|
||||
return (
|
||||
html_sco_header.sco_header(context, REQUEST, user_check=False)
|
||||
html_sco_header.sco_header(user_check=False)
|
||||
+ "<p>Vous n'avez pas la permission de supprimer cet utilisateur</p>"
|
||||
+ html_sco_header.sco_footer()
|
||||
)
|
||||
|
@ -233,7 +233,7 @@ class ScoFake(object):
|
||||
etapes=None,
|
||||
responsables=["bach"],
|
||||
):
|
||||
oid = sco_formsemestre.do_formsemestre_create(self.context, locals(), REQUEST)
|
||||
oid = sco_formsemestre.do_formsemestre_create(locals())
|
||||
# oids = self.context.do_formsemestre_list(args={"formsemestre_id": oid})
|
||||
oids = sco_formsemestre.do_formsemestre_list(
|
||||
self.context, args={"formsemestre_id": oid}
|
||||
|
@ -203,9 +203,7 @@ _ = sco_groups.partition_create(
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
li1 = sco_groups.get_partitions_list(context.Scolarite, sem["formsemestre_id"])
|
||||
_ = sco_groups.createGroup(
|
||||
context.Scolarite, li1[0]["partition_id"], "Groupe 1", REQUEST=REQUEST
|
||||
)
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe 1")
|
||||
|
||||
# --- Affectation des élèves dans des groupes
|
||||
|
||||
|
@ -90,9 +90,7 @@ _ = sco_groups.partition_create(
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
li1 = sco_groups.get_partitions_list(context.Scolarite, sem["formsemestre_id"])
|
||||
_ = sco_groups.createGroup(
|
||||
context.Scolarite, li1[0]["partition_id"], "Groupe 1", REQUEST=REQUEST
|
||||
)
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe 1")
|
||||
|
||||
# --- Affectation des élèves dans des groupes
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import sco_formations
|
||||
import json
|
||||
import random
|
||||
|
||||
# La variable context est définie par le script de lancement
|
||||
# l'affecte ainsi pour évietr les warnins pylint:
|
||||
context = context # pylint: disable=undefined-variable
|
||||
@ -21,7 +22,7 @@ file.close()
|
||||
|
||||
f = sco_formations.formation_import_xml(REQUEST=REQUEST, doc=doc, context=context.Notes)
|
||||
|
||||
# --- Création des semestres
|
||||
# --- Création des semestres
|
||||
|
||||
sem1 = G.create_formsemestre(
|
||||
formation_id=f[0],
|
||||
@ -56,26 +57,26 @@ sem4 = G.create_formsemestre(
|
||||
|
||||
li_module = context.Notes.do_module_list()
|
||||
mods_imp = []
|
||||
for mod in li_module :
|
||||
if mod["semestre_id"] == 1 :
|
||||
for mod in li_module:
|
||||
if mod["semestre_id"] == 1:
|
||||
formsemestre_id = sem1["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 2 :
|
||||
elif mod["semestre_id"] == 2:
|
||||
formsemestre_id = sem2["formsemestre_id"]
|
||||
elif mod["semestre_id"] == 3 :
|
||||
elif mod["semestre_id"] == 3:
|
||||
formsemestre_id = sem3["formsemestre_id"]
|
||||
else :
|
||||
else:
|
||||
formsemestre_id = sem4["formsemestre_id"]
|
||||
|
||||
mi = G.create_moduleimpl(
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=formsemestre_id,
|
||||
responsable_id="bach",
|
||||
module_id=mod["module_id"],
|
||||
formsemestre_id=formsemestre_id,
|
||||
responsable_id="bach",
|
||||
)
|
||||
mods_imp.append(mi)
|
||||
|
||||
# --- Création des étudiants
|
||||
|
||||
etuds=[]
|
||||
etuds = []
|
||||
for nom, prenom in [
|
||||
("Semestre11", "EtudiantNumero1"),
|
||||
("Semestre12", "EtudiantNumero2"),
|
||||
@ -84,8 +85,8 @@ for nom, prenom in [
|
||||
("Semestre35", "EtudiantNumero5"),
|
||||
("Semestre36", "EtudiantNumero6"),
|
||||
("Semestre47", "EtudiantNumero7"),
|
||||
("Semestre48", "EtudiantNumero8")
|
||||
] :
|
||||
("Semestre48", "EtudiantNumero8"),
|
||||
]:
|
||||
etud = G.create_etud(
|
||||
nom=nom,
|
||||
prenom=prenom,
|
||||
@ -108,16 +109,24 @@ for etud in etuds[6:]:
|
||||
|
||||
# --- Création d'une évaluation pour chaque UE
|
||||
|
||||
lim_sem1 = sco_moduleimpl.do_moduleimpl_list(context.Notes, formsemestre_id=sem1["formsemestre_id"], REQUEST=REQUEST)
|
||||
lim_sem1 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem1["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem1 = json.loads(lim_sem1)
|
||||
|
||||
lim_sem2 = sco_moduleimpl.do_moduleimpl_list(context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
||||
lim_sem2 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem2 = json.loads(lim_sem2)
|
||||
|
||||
lim_sem3 = sco_moduleimpl.do_moduleimpl_list(context.Notes, formsemestre_id=sem3["formsemestre_id"], REQUEST=REQUEST)
|
||||
lim_sem3 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem3["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem3 = json.loads(lim_sem3)
|
||||
|
||||
lim_sem4 = sco_moduleimpl.do_moduleimpl_list(context.Notes, formsemestre_id=sem4["formsemestre_id"], REQUEST=REQUEST)
|
||||
lim_sem4 = sco_moduleimpl.do_moduleimpl_list(
|
||||
context.Notes, formsemestre_id=sem4["formsemestre_id"], REQUEST=REQUEST
|
||||
)
|
||||
load_lim_sem4 = json.loads(lim_sem4)
|
||||
|
||||
|
||||
@ -132,45 +141,74 @@ for moduleimpl_id, jour, description, coefficient in [
|
||||
(load_lim_sem4[3]["moduleimpl_id"], "03/02/2021", "InterroTestSemestre4", 1.0),
|
||||
(load_lim_sem4[9]["moduleimpl_id"], "04/02/2021", "InterroTestSemestre4", 1.0),
|
||||
(load_lim_sem4[13]["moduleimpl_id"], "05/02/2021", "InterroTestSemestre4", 1.0),
|
||||
] :
|
||||
e = G.create_evaluation(moduleimpl_id=moduleimpl_id, jour=jour, description=description, coefficient=coefficient)
|
||||
]:
|
||||
e = G.create_evaluation(
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
jour=jour,
|
||||
description=description,
|
||||
coefficient=coefficient,
|
||||
)
|
||||
|
||||
|
||||
# --- Saisie des notes des étudiants (un élève a 12, un autre a 7 pour chaque semestre)
|
||||
|
||||
lie1 = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem1["formsemestre_id"])
|
||||
lie2 = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem2["formsemestre_id"])
|
||||
lie3 = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem3["formsemestre_id"])
|
||||
lie4 = context.Notes.do_evaluation_list_in_formsemestre(formsemestre_id=sem4["formsemestre_id"])
|
||||
lie1 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem1["formsemestre_id"]
|
||||
)
|
||||
lie2 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem2["formsemestre_id"]
|
||||
)
|
||||
lie3 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem3["formsemestre_id"]
|
||||
)
|
||||
lie4 = context.Notes.do_evaluation_list_in_formsemestre(
|
||||
formsemestre_id=sem4["formsemestre_id"]
|
||||
)
|
||||
|
||||
for eval in lie1 :
|
||||
for etud in etuds[:2] :
|
||||
if etud == etuds[0] :
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(evaluation=eval, etud=etud, note=12.0)
|
||||
else :
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(evaluation=eval, etud=etud, note=7.0)
|
||||
for eval in lie1:
|
||||
for etud in etuds[:2]:
|
||||
if etud == etuds[0]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
for eval in lie2 :
|
||||
for etud in etuds[2:4] :
|
||||
if etud == etuds[2] :
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(evaluation=eval, etud=etud, note=12.0)
|
||||
else :
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(evaluation=eval, etud=etud, note=7.0)
|
||||
for eval in lie2:
|
||||
for etud in etuds[2:4]:
|
||||
if etud == etuds[2]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
|
||||
for eval in lie3 :
|
||||
for etud in etuds[4:6] :
|
||||
if etud == etuds[4] :
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(evaluation=eval, etud=etud, note=12.0)
|
||||
else :
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(evaluation=eval, etud=etud, note=7.0)
|
||||
for eval in lie3:
|
||||
for etud in etuds[4:6]:
|
||||
if etud == etuds[4]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
for eval in lie4 :
|
||||
for etud in etuds[6:] :
|
||||
if etud == etuds[6] :
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(evaluation=eval, etud=etud, note=12.0)
|
||||
else :
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(evaluation=eval, etud=etud, note=7.0)
|
||||
for eval in lie4:
|
||||
for etud in etuds[6:]:
|
||||
if etud == etuds[6]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=12.0
|
||||
)
|
||||
else:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=eval, etud=etud, note=7.0
|
||||
)
|
||||
|
||||
# --- Département
|
||||
|
||||
@ -184,45 +222,68 @@ load_lif = json.loads(lif)
|
||||
assert len(load_lif) == 1
|
||||
assert load_lif[0]["formation_id"] == f[0]
|
||||
|
||||
exp = sco_formations.formation_export(context.Notes, formation_id=f[0], format="json", REQUEST=REQUEST)
|
||||
exp = sco_formations.formation_export(
|
||||
context.Notes, formation_id=f[0], format="json", REQUEST=REQUEST
|
||||
)
|
||||
load_exp = json.loads(exp)
|
||||
assert load_exp["acronyme"] == "DUT Info"
|
||||
assert load_exp["titre_officiel"] == "DUT Informatique"
|
||||
assert load_exp["formation_code"] == "FCOD2"
|
||||
|
||||
# --- Semestre
|
||||
# --- Semestre
|
||||
|
||||
li_sem = context.Notes.formsemestre_list(formation_id=f[0], format = "json", REQUEST=REQUEST)
|
||||
li_sem = context.Notes.formsemestre_list(
|
||||
formation_id=f[0], format="json", REQUEST=REQUEST
|
||||
)
|
||||
load_li_sem = json.loads(li_sem)
|
||||
assert len(load_li_sem) == 4
|
||||
|
||||
# --- Création des groupes
|
||||
|
||||
_ = sco_groups.partition_create(context.Scolarite, formsemestre_id=sem1["formsemestre_id"], partition_name="Eleve 1ere annee", REQUEST=REQUEST)
|
||||
_ = sco_groups.partition_create(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
partition_name="Eleve 1ere annee",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
li1 = sco_groups.get_partitions_list(context.Scolarite, sem1["formsemestre_id"])
|
||||
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1A", REQUEST=REQUEST)
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1A")
|
||||
|
||||
li_grp1 = sco_groups.get_partition_groups(context.Scolarite, li1[0])
|
||||
|
||||
for etud in etuds[0:2] :
|
||||
for etud in etuds[0:2]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp1[0]["group_id"])
|
||||
|
||||
|
||||
# --- Groupes
|
||||
|
||||
li_part = sco_groups.formsemestre_partition_list(context.Scolarite, formsemestre_id=sem1["formsemestre_id"], format = "json", REQUEST=REQUEST)
|
||||
li_part = sco_groups.formsemestre_partition_list(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_li_part = json.loads(li_part)
|
||||
assert len(load_li_part) == 2 # 2 partition (defaut et eleve 1ere annee)
|
||||
assert len(load_li_part) == 2 # 2 partition (defaut et eleve 1ere annee)
|
||||
assert load_li_part[0]["formsemestre_id"] == sem1["formsemestre_id"]
|
||||
assert len(load_li_part[0]["group"]) == 1 # 2 groupes S1A
|
||||
assert len(load_li_part[0]["group"]) == 1 # 2 groupes S1A
|
||||
assert load_li_part[0]["group"][0]["group_name"] == "Groupe S1A"
|
||||
assert load_li_part[0]["group"][0]["group_id"] == li_grp1[0]["group_id"]
|
||||
assert load_li_part[0]["partition_id"] == load_li_part[0]["group"][0]["partition_id"] == li1[0]["partition_id"]
|
||||
assert (
|
||||
load_li_part[0]["partition_id"]
|
||||
== load_li_part[0]["group"][0]["partition_id"]
|
||||
== li1[0]["partition_id"]
|
||||
)
|
||||
assert load_li_part[0]["partition_name"] == "Eleve 1ere annee"
|
||||
|
||||
vue_g1 = sco_groups_view.groups_view(context.Scolarite, group_ids = [li_grp1[0]["group_id"]], format = "json", REQUEST=REQUEST)
|
||||
vue_g1 = sco_groups_view.groups_view(
|
||||
context.Scolarite,
|
||||
group_ids=[li_grp1[0]["group_id"]],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_vue_g1 = json.loads(vue_g1)
|
||||
assert len(load_vue_g1) == 2
|
||||
assert load_vue_g1[0][li1[0]["partition_id"]] == li_grp1[0]["group_name"]
|
||||
@ -230,32 +291,49 @@ assert load_vue_g1[0][li1[0]["partition_id"]] == li_grp1[0]["group_name"]
|
||||
|
||||
# --- Etudiant
|
||||
|
||||
etudi = context.Scolarite.etud_info(etudid=etuds[0]["etudid"], format="json", REQUEST=REQUEST)
|
||||
etudi = context.Scolarite.etud_info(
|
||||
etudid=etuds[0]["etudid"], format="json", REQUEST=REQUEST
|
||||
)
|
||||
load_etudi = json.loads(etudi)
|
||||
assert load_etudi["prenom"] == "Etudiantnumero1"
|
||||
assert load_etudi["nom"] == "SEMESTRE11"
|
||||
assert load_etudi["etudid"] == etuds[0]["etudid"]
|
||||
|
||||
# --- Absences
|
||||
# --- Absences
|
||||
|
||||
for debut, fin, demijournee in [
|
||||
("18/01/2021", "18/01/2021", 1),
|
||||
("19/01/2021", "19/01/2021", 0),
|
||||
] :
|
||||
sco_abs_views.doSignaleAbsence(context.Absences, datedebut=debut, datefin=fin, demijournee=demijournee, etudid=etuds[0]["etudid"], REQUEST=REQUEST)
|
||||
]:
|
||||
sco_abs_views.doSignaleAbsence(
|
||||
context.Absences,
|
||||
datedebut=debut,
|
||||
datefin=fin,
|
||||
demijournee=demijournee,
|
||||
etudid=etuds[0]["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
nb_abs = context.Absences.CountAbs(etuds[0]["etudid"], debut="09/01/2020", fin="02/01/2021")
|
||||
nb_abs = context.Absences.CountAbs(
|
||||
etuds[0]["etudid"], debut="09/01/2020", fin="02/01/2021"
|
||||
)
|
||||
assert nb_abs == 2
|
||||
|
||||
liste_abs = sco_abs_views.ListeAbsEtud(context.Absences, etuds[0]["etudid"], format='json', REQUEST=REQUEST)
|
||||
liste_abs = sco_abs_views.ListeAbsEtud(
|
||||
context.Absences, etuds[0]["etudid"], format="json", REQUEST=REQUEST
|
||||
)
|
||||
load_liste_abs = json.loads(liste_abs)
|
||||
assert len(load_liste_abs) == 2
|
||||
|
||||
_ = sco_abs_views.doAnnuleAbsence(context.Absences, "15/01/2021", "15/01/2021", 1, etudid=etuds[0]["etudid"], REQUEST=REQUEST)
|
||||
_ = sco_abs_views.doAnnuleAbsence(
|
||||
context.Absences,
|
||||
"15/01/2021",
|
||||
"15/01/2021",
|
||||
1,
|
||||
etudid=etuds[0]["etudid"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# --- Module
|
||||
|
||||
#Voir test dans test_formation.
|
||||
|
||||
|
||||
|
||||
# Voir test dans test_formation.
|
||||
|
@ -71,18 +71,18 @@ assert len(etuds) == 20
|
||||
# --- Création d'une formation
|
||||
|
||||
f = G.create_formation(
|
||||
acronyme="DUTI",
|
||||
titre="DUT Info",
|
||||
titre_officiel="DUT Informatique",
|
||||
)
|
||||
acronyme="DUTI",
|
||||
titre="DUT Info",
|
||||
titre_officiel="DUT Informatique",
|
||||
)
|
||||
|
||||
assert f["acronyme"] == "DUTI"
|
||||
assert f["titre"] == "DUT Info"
|
||||
assert f["titre_officiel"] == "DUT Informatique"
|
||||
|
||||
assert f["acronyme"]=="DUTI"
|
||||
assert f["titre"]=="DUT Info"
|
||||
assert f["titre_officiel"]=="DUT Informatique"
|
||||
|
||||
|
||||
# --- Création d'UE, matière, module pour les premieres années
|
||||
|
||||
|
||||
ue1 = G.create_ue(formation_id=f["formation_id"], acronyme="UE11", titre="UE1S1")
|
||||
|
||||
mat1 = G.create_matiere(ue_id=ue1["ue_id"], titre="mat1")
|
||||
@ -96,16 +96,16 @@ mod1 = G.create_module(
|
||||
)
|
||||
|
||||
assert ue1["formation_id"] == f["formation_id"]
|
||||
assert ue1["acronyme"]=="UE11"
|
||||
assert ue1["titre"]=="UE1S1"
|
||||
assert ue1["acronyme"] == "UE11"
|
||||
assert ue1["titre"] == "UE1S1"
|
||||
|
||||
assert mod1["matiere_id"]==mat1["matiere_id"]
|
||||
assert mod1["code"]=="M1S1"
|
||||
assert mod1["titre"]=="mod1"
|
||||
assert mod1["ue_id"]==ue1["ue_id"]
|
||||
assert mod1["formation_id"]==f["formation_id"]
|
||||
assert mod1["matiere_id"] == mat1["matiere_id"]
|
||||
assert mod1["code"] == "M1S1"
|
||||
assert mod1["titre"] == "mod1"
|
||||
assert mod1["ue_id"] == ue1["ue_id"]
|
||||
assert mod1["formation_id"] == f["formation_id"]
|
||||
|
||||
# --- Création d'UE, matière, module pour les deuxieme années
|
||||
# --- Création d'UE, matière, module pour les deuxieme années
|
||||
|
||||
ue2 = G.create_ue(formation_id=f["formation_id"], acronyme="UE31", titre="UE1S1")
|
||||
|
||||
@ -128,10 +128,10 @@ sem1 = G.create_formsemestre(
|
||||
date_fin="01/02/2021",
|
||||
)
|
||||
|
||||
assert sem1["formation_id"]==f["formation_id"]
|
||||
assert sem1["semestre_id"]==1
|
||||
assert sem1["date_debut"]=="01/09/2020"
|
||||
assert sem1["date_fin"]=="01/02/2021"
|
||||
assert sem1["formation_id"] == f["formation_id"]
|
||||
assert sem1["semestre_id"] == 1
|
||||
assert sem1["date_debut"] == "01/09/2020"
|
||||
assert sem1["date_fin"] == "01/02/2021"
|
||||
|
||||
sem2 = G.create_formsemestre(
|
||||
formation_id=f["formation_id"],
|
||||
@ -147,9 +147,9 @@ mi1 = G.create_moduleimpl(
|
||||
responsable_id="bach",
|
||||
)
|
||||
|
||||
assert mi1["module_id" ]==mod1["module_id"]
|
||||
assert mi1["formsemestre_id"]==sem1["formsemestre_id"]
|
||||
assert mi1["responsable_id"]=="bach"
|
||||
assert mi1["module_id"] == mod1["module_id"]
|
||||
assert mi1["formsemestre_id"] == sem1["formsemestre_id"]
|
||||
assert mi1["responsable_id"] == "bach"
|
||||
|
||||
mi2 = G.create_moduleimpl(
|
||||
module_id=mod2["module_id"],
|
||||
@ -160,16 +160,26 @@ mi2 = G.create_moduleimpl(
|
||||
|
||||
# --- Inscription des étudiants
|
||||
|
||||
for etud in etuds[:10] :
|
||||
for etud in etuds[:10]:
|
||||
G.inscrit_etudiant(sem1, etud)
|
||||
|
||||
for etud in etuds [10:] :
|
||||
|
||||
for etud in etuds[10:]:
|
||||
G.inscrit_etudiant(sem2, etud)
|
||||
|
||||
|
||||
# --- Création de 2 partitions
|
||||
|
||||
_ = sco_groups.partition_create(context.Scolarite, formsemestre_id=sem1["formsemestre_id"], partition_name="Eleve 1ere annee", REQUEST=REQUEST)
|
||||
_ = sco_groups.partition_create(context.Scolarite, formsemestre_id=sem2["formsemestre_id"], partition_name="Eleve 2eme annee", REQUEST=REQUEST)
|
||||
_ = sco_groups.partition_create(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
partition_name="Eleve 1ere annee",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
_ = sco_groups.partition_create(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem2["formsemestre_id"],
|
||||
partition_name="Eleve 2eme annee",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
li1 = sco_groups.get_partitions_list(context.Scolarite, sem1["formsemestre_id"])
|
||||
@ -177,54 +187,64 @@ li2 = sco_groups.get_partitions_list(context.Scolarite, sem2["formsemestre_id"])
|
||||
|
||||
|
||||
# --- Création des groupes
|
||||
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1A", REQUEST=REQUEST)
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1B", REQUEST=REQUEST)
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe S3A", REQUEST=REQUEST)
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe S3B", REQUEST=REQUEST)
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe TEST", REQUEST=REQUEST)
|
||||
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1A")
|
||||
_ = sco_groups.createGroup(context.Scolarite, li1[0]["partition_id"], "Groupe S1B")
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe S3A")
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe S3B")
|
||||
_ = sco_groups.createGroup(context.Scolarite, li2[0]["partition_id"], "Groupe TEST")
|
||||
|
||||
li_grp1 = sco_groups.get_partition_groups(context.Scolarite, li1[0])
|
||||
li_grp2 = sco_groups.get_partition_groups(context.Scolarite, li2[0])
|
||||
li_grp3 = sco_groups.get_partition_groups(context.Scolarite, li1[1]) #liste groupe defaut
|
||||
li_grp3 = sco_groups.get_partition_groups(
|
||||
context.Scolarite, li1[1]
|
||||
) # liste groupe defaut
|
||||
|
||||
assert len(li_grp1) == 2 #test de get_partition_groups # 2
|
||||
assert len(li_grp2) == 3 #test de get_partition_groups # 3
|
||||
assert len(li_grp1) == 2 # test de get_partition_groups # 2
|
||||
assert len(li_grp2) == 3 # test de get_partition_groups # 3
|
||||
assert li_grp1[0]["group_name"] == "Groupe S1A"
|
||||
|
||||
|
||||
# --- Affectation des élèves dans les groupes
|
||||
|
||||
for etud in etuds[:5] :
|
||||
for etud in etuds[:5]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp1[0]["group_id"])
|
||||
|
||||
for etud in etuds[5:10] :
|
||||
|
||||
for etud in etuds[5:10]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp1[1]["group_id"])
|
||||
|
||||
for etud in etuds[10:15] :
|
||||
|
||||
for etud in etuds[10:15]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp2[0]["group_id"])
|
||||
|
||||
for etud in etuds[15:] :
|
||||
for etud in etuds[15:]:
|
||||
sco_groups.set_group(context.Scolarite, etud["etudid"], li_grp2[1]["group_id"])
|
||||
|
||||
|
||||
# --- Vérification si les élèves sont bien dans les bons groupes
|
||||
|
||||
for etud in etuds[:5] :
|
||||
grp = sco_groups.get_etud_groups(context.Scolarite, etud["etudid"], sem1, exclude_default=True)
|
||||
for etud in etuds[:5]:
|
||||
grp = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etud["etudid"], sem1, exclude_default=True
|
||||
)
|
||||
assert grp[0]["group_name"] == "Groupe S1A"
|
||||
|
||||
for etud in etuds[5:10] :
|
||||
grp = sco_groups.get_etud_groups(context.Scolarite, etud["etudid"], sem1, exclude_default=True)
|
||||
assert grp[0]["group_name"] == "Groupe S1B"
|
||||
for etud in etuds[5:10]:
|
||||
grp = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etud["etudid"], sem1, exclude_default=True
|
||||
)
|
||||
assert grp[0]["group_name"] == "Groupe S1B"
|
||||
|
||||
for etud in etuds[10:15] :
|
||||
grp = sco_groups.get_etud_groups(context.Scolarite, etud["etudid"], sem2, exclude_default=True)
|
||||
for etud in etuds[10:15]:
|
||||
grp = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etud["etudid"], sem2, exclude_default=True
|
||||
)
|
||||
assert grp[0]["group_name"] == "Groupe S3A"
|
||||
|
||||
for etud in etuds[15:] :
|
||||
grp = sco_groups.get_etud_groups(context.Scolarite, etud["etudid"], sem2, exclude_default=True)
|
||||
for etud in etuds[15:]:
|
||||
grp = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etud["etudid"], sem2, exclude_default=True
|
||||
)
|
||||
assert grp[0]["group_name"] == "Groupe S3B"
|
||||
|
||||
|
||||
# --- Création d'une évaluation
|
||||
|
||||
e1 = G.create_evaluation(
|
||||
@ -243,132 +263,181 @@ e2 = G.create_evaluation(
|
||||
|
||||
# --- Saisie des notes
|
||||
|
||||
for etud in etuds[10:] :
|
||||
for etud in etuds[10:]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=e1, etud=etud, note=float(random.randint(0, 20))
|
||||
)
|
||||
|
||||
|
||||
for etud in etuds[:10] :
|
||||
|
||||
|
||||
for etud in etuds[:10]:
|
||||
nb_changed, nb_suppress, existing_decisions = G.create_note(
|
||||
evaluation=e2, etud=etud, note=float(random.randint(0, 20))
|
||||
)
|
||||
|
||||
# --- Liste des étudiants inscrits aux evaluations
|
||||
|
||||
lie1 = sco_groups.do_evaluation_listeetuds_groups(context.Scolarite, e1["evaluation_id"], groups = li_grp1)
|
||||
lie2 = sco_groups.do_evaluation_listeetuds_groups(context.Scolarite, e2["evaluation_id"], groups = li_grp2)
|
||||
# --- Liste des étudiants inscrits aux evaluations
|
||||
|
||||
for etud in etuds[:10] :
|
||||
assert etud["etudid"] in lie1 # test de do_evaluation_listeetuds_groups
|
||||
lie1 = sco_groups.do_evaluation_listeetuds_groups(
|
||||
context.Scolarite, e1["evaluation_id"], groups=li_grp1
|
||||
)
|
||||
lie2 = sco_groups.do_evaluation_listeetuds_groups(
|
||||
context.Scolarite, e2["evaluation_id"], groups=li_grp2
|
||||
)
|
||||
|
||||
for etud in etuds[:10]:
|
||||
assert etud["etudid"] in lie1 # test de do_evaluation_listeetuds_groups
|
||||
|
||||
for etud in etuds[10:]:
|
||||
assert etud["etudid"] in lie2 # test de do_evaluation_listeetuds_groups
|
||||
|
||||
for etud in etuds[10:] :
|
||||
assert etud["etudid"] in lie2 # test de do_evaluation_listeetuds_groups
|
||||
|
||||
|
||||
# --- Liste des groupes présents aux évaluation
|
||||
|
||||
lig1 = sco_groups.do_evaluation_listegroupes(context.Scolarite, e1["evaluation_id"], include_default=False)
|
||||
lig2 = sco_groups.do_evaluation_listegroupes(context.Scolarite, e2["evaluation_id"], include_default=False)
|
||||
lig1 = sco_groups.do_evaluation_listegroupes(
|
||||
context.Scolarite, e1["evaluation_id"], include_default=False
|
||||
)
|
||||
lig2 = sco_groups.do_evaluation_listegroupes(
|
||||
context.Scolarite, e2["evaluation_id"], include_default=False
|
||||
)
|
||||
|
||||
|
||||
|
||||
assert len(lig1) == 2
|
||||
assert len(lig2) == 2
|
||||
assert li_grp1[0] and li_grp1[1] in lig1 # test do_evaluation_listegroupes
|
||||
assert li_grp2[0] and li_grp2[1] in lig2 # test do_evaluation_listegroupes
|
||||
|
||||
|
||||
|
||||
# --- Changement de groupe d'un élève
|
||||
|
||||
grp1 = sco_groups.get_etud_groups(context.Scolarite, etuds[0]["etudid"], sem1, exclude_default = True)
|
||||
sco_groups.change_etud_group_in_partition(context.Scolarite, etuds[0]["etudid"], li_grp1[1]["group_id"], li1[0], REQUEST=REQUEST)
|
||||
grp2 = sco_groups.get_etud_groups(context.Scolarite, etuds[0]["etudid"], sem1, exclude_default = True)
|
||||
grp1 = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etuds[0]["etudid"], sem1, exclude_default=True
|
||||
)
|
||||
sco_groups.change_etud_group_in_partition(
|
||||
context.Scolarite,
|
||||
etuds[0]["etudid"],
|
||||
li_grp1[1]["group_id"],
|
||||
li1[0],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
grp2 = sco_groups.get_etud_groups(
|
||||
context.Scolarite, etuds[0]["etudid"], sem1, exclude_default=True
|
||||
)
|
||||
assert grp1 != grp2
|
||||
assert grp1[0] == li_grp1[0] # test get_etud_groups
|
||||
assert grp2[0]["group_name"] == "Groupe S1B" #test du changement de groupe
|
||||
assert grp1[0] == li_grp1[0] # test get_etud_groups
|
||||
assert grp2[0]["group_name"] == "Groupe S1B" # test du changement de groupe
|
||||
|
||||
|
||||
# --- Liste des partitions en format json
|
||||
# --- Liste des partitions en format json
|
||||
|
||||
lijson_s1 = sco_groups.formsemestre_partition_list(context.Scolarite, formsemestre_id=sem1["formsemestre_id"], format = "json", REQUEST=REQUEST)
|
||||
lijson_s1 = sco_groups.formsemestre_partition_list(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_lijson_s1 = json.loads(lijson_s1)
|
||||
|
||||
assert len(load_lijson_s1) == 2 # 2 partition (defaut et eleve 1ere annee)
|
||||
assert len(load_lijson_s1) == 2 # 2 partition (defaut et eleve 1ere annee)
|
||||
assert load_lijson_s1[0]["formsemestre_id"] == sem1["formsemestre_id"]
|
||||
assert len(load_lijson_s1[0]["group"]) == 2 # 2 groupes S1A et S1B
|
||||
assert len(load_lijson_s1[0]["group"]) == 2 # 2 groupes S1A et S1B
|
||||
assert load_lijson_s1[0]["group"][0]["group_name"] == "Groupe S1A"
|
||||
assert load_lijson_s1[0]["group"][0]["group_id"] == li_grp1[0]["group_id"]
|
||||
assert load_lijson_s1[0]["partition_id"] == load_lijson_s1[0]["group"][0]["partition_id"] == li1[0]["partition_id"]
|
||||
assert (
|
||||
load_lijson_s1[0]["partition_id"]
|
||||
== load_lijson_s1[0]["group"][0]["partition_id"]
|
||||
== li1[0]["partition_id"]
|
||||
)
|
||||
assert load_lijson_s1[0]["partition_name"] == "Eleve 1ere annee"
|
||||
|
||||
|
||||
|
||||
# --- Vue d'un groupes (liste d'élève en format json)
|
||||
|
||||
vue_g1 = sco_groups_view.groups_view(context.Scolarite, group_ids = [li_grp1[0]["group_id"]], format = "json", REQUEST=REQUEST)
|
||||
vue_g1 = sco_groups_view.groups_view(
|
||||
context.Scolarite,
|
||||
group_ids=[li_grp1[0]["group_id"]],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_vue_g1 = json.loads(vue_g1)
|
||||
|
||||
assert len(load_vue_g1) == 4
|
||||
assert load_vue_g1[0][li1[0]["partition_id"]] == li_grp1[0]["group_name"]
|
||||
|
||||
vue_sem = sco_groups_view.groups_view(context.Scolarite, formsemestre_id=sem1["formsemestre_id"], format = "json", REQUEST=REQUEST)
|
||||
vue_sem = sco_groups_view.groups_view(
|
||||
context.Scolarite,
|
||||
formsemestre_id=sem1["formsemestre_id"],
|
||||
format="json",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
load_vue_sem = json.loads(vue_sem)
|
||||
|
||||
assert len(load_vue_sem) == 10
|
||||
|
||||
tab=[]
|
||||
val=False
|
||||
for etud in etuds[:10] :
|
||||
for i in range(len(load_vue_sem)) :
|
||||
if etud["prenom"] == load_vue_sem[i]["prenom"] and etud["nom_disp"]==load_vue_sem[i]["nom_disp"] :
|
||||
tab = []
|
||||
val = False
|
||||
for etud in etuds[:10]:
|
||||
for i in range(len(load_vue_sem)):
|
||||
if (
|
||||
etud["prenom"] == load_vue_sem[i]["prenom"]
|
||||
and etud["nom_disp"] == load_vue_sem[i]["nom_disp"]
|
||||
):
|
||||
val = True
|
||||
tab.append(val)
|
||||
|
||||
assert not False in tab #tout mes etudiants sont present dans vue_sem.
|
||||
assert not False in tab # tout mes etudiants sont present dans vue_sem.
|
||||
|
||||
# --- Test des fonctions dans sco_groups
|
||||
|
||||
|
||||
assert li_grp1[0] == sco_groups.get_group(context.Scolarite, li_grp1[0]["group_id"]) #test get_group
|
||||
assert li_grp1[0] == sco_groups.get_group(
|
||||
context.Scolarite, li_grp1[0]["group_id"]
|
||||
) # test get_group
|
||||
|
||||
assert len(li_grp2) == 3
|
||||
sco_groups.group_delete(context.Scolarite, li_grp2[2])
|
||||
#assert len(li_grp2) == 2 #TEST DE group_delete, aucun changement sur la console mais se supprime sur scodoc web
|
||||
# mais pas dans la console comme pour countAbs()
|
||||
|
||||
assert sco_groups.get_partition(context.Scolarite, li1[0]["partition_id"])== li1[0] # test de get_partition
|
||||
assert sco_groups.get_partition(context.Scolarite, li2[0]["partition_id"])== li2[0] # test de get_partition
|
||||
# assert len(li_grp2) == 2 #TEST DE group_delete, aucun changement sur la console mais se supprime sur scodoc web
|
||||
# mais pas dans la console comme pour countAbs()
|
||||
|
||||
assert (
|
||||
sco_groups.get_partition(context.Scolarite, li1[0]["partition_id"]) == li1[0]
|
||||
) # test de get_partition
|
||||
assert (
|
||||
sco_groups.get_partition(context.Scolarite, li2[0]["partition_id"]) == li2[0]
|
||||
) # test de get_partition
|
||||
|
||||
|
||||
li1 = sco_groups.get_partitions_list(context.Scolarite, sem1["formsemestre_id"])
|
||||
#assert p1 in li1 #test de get_partitions_list
|
||||
assert len(li1) == 2 #eleve de 1ere annee + la partition defaut
|
||||
# assert p1 in li1 #test de get_partitions_list
|
||||
assert len(li1) == 2 # eleve de 1ere annee + la partition defaut
|
||||
|
||||
li2 = sco_groups.get_partitions_list(context.Scolarite, sem2["formsemestre_id"])
|
||||
#assert p2 in li2 #test de get_partitions_list
|
||||
assert len(li2) == 2 #eleve de 2eme annee + la partition defaut
|
||||
# assert p2 in li2 #test de get_partitions_list
|
||||
assert len(li2) == 2 # eleve de 2eme annee + la partition defaut
|
||||
|
||||
|
||||
dp1 = sco_groups.get_default_partition(context.Scolarite, sem1["formsemestre_id"])
|
||||
dp2 = sco_groups.get_default_partition(context.Scolarite, sem2["formsemestre_id"])
|
||||
|
||||
assert dp1 in li1 # test si dp1 est bien dans li1 et par consequent teste la fonction get_default_partition
|
||||
assert dp2 in li2 # test si dp2 est bien dans li1 et par consequent teste la fonction get_default_partition
|
||||
assert (
|
||||
dp1 in li1
|
||||
) # test si dp1 est bien dans li1 et par consequent teste la fonction get_default_partition
|
||||
assert (
|
||||
dp2 in li2
|
||||
) # test si dp2 est bien dans li1 et par consequent teste la fonction get_default_partition
|
||||
|
||||
|
||||
dg1 = sco_groups.get_default_group(context.Scolarite, sem1["formsemestre_id"], REQUEST=REQUEST)
|
||||
assert li_grp3[0]["group_id"] == dg1 #test de get_default_group
|
||||
dg1 = sco_groups.get_default_group(sem1["formsemestre_id"])
|
||||
assert li_grp3[0]["group_id"] == dg1 # test de get_default_group
|
||||
|
||||
|
||||
sg = sco_groups.get_sem_groups(context.Scolarite, sem1["formsemestre_id"])
|
||||
assert len(sg) == 3 #test de get_sem_groups
|
||||
assert len(sg) == 3 # test de get_sem_groups
|
||||
assert li_grp1[0] and li_grp1[1] in sg
|
||||
assert li_grp3[0] in sg # test de get_sem_groups
|
||||
assert li_grp3[0] in sg # test de get_sem_groups
|
||||
|
||||
limembre = sco_groups.get_group_members(context.Scolarite, li_grp1[0]["group_id"])
|
||||
assert len(limembre) == 4 # car on a changé de groupe un etudiant de ce groupe donc 5-1=4
|
||||
assert (
|
||||
len(limembre) == 4
|
||||
) # car on a changé de groupe un etudiant de ce groupe donc 5-1=4
|
||||
|
||||
"""
|
||||
Commentaire :
|
||||
@ -377,19 +446,3 @@ Meme probleme que pour les groupes, lorsque l'on supprime un groupe il est toujo
|
||||
mais pas dans scodoc web.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -53,9 +53,10 @@ def test_cache_evaluations(test_client):
|
||||
raise Exception("no evaluations")
|
||||
#
|
||||
evaluation_id = sem_evals[0]["evaluation_id"]
|
||||
sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
|
||||
# should have been be cached:
|
||||
assert sco_cache.EvaluationCache.get(evaluation_id)
|
||||
eval_notes = sco_evaluations.do_evaluation_get_all_notes(evaluation_id)
|
||||
# should have been be cached, except if empty
|
||||
if eval_notes:
|
||||
assert sco_cache.EvaluationCache.get(evaluation_id)
|
||||
sco_cache.invalidate_formsemestre(sem["formsemestre_id"])
|
||||
# should have been erased from cache:
|
||||
assert not sco_cache.EvaluationCache.get(evaluation_id)
|
||||
|
Loading…
Reference in New Issue
Block a user