1
0
forked from ScoDoc/ScoDoc

rewritten all ficheEtud urls using Flask

This commit is contained in:
Emmanuel Viennet 2021-07-11 17:37:12 +02:00
parent edd59ceab3
commit c6f0fa86ea
28 changed files with 381 additions and 146 deletions

View File

@ -28,7 +28,7 @@
""" """
Génération de la "sidebar" (marge gauche des pages HTML) Génération de la "sidebar" (marge gauche des pages HTML)
""" """
from flask import url_for from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
@ -81,7 +81,10 @@ def sidebar(context, REQUEST=None):
from app.scodoc.sco_abs import getAbsSemEtud from app.scodoc.sco_abs import getAbsSemEtud
from app.scodoc import sco_etud from app.scodoc import sco_etud
params = {"ScoURL": scu.ScoURL(), "SCO_USER_MANUAL": scu.SCO_USER_MANUAL} params = {
"ScoURL": scu.ScoURL(),
"SCO_USER_MANUAL": scu.SCO_USER_MANUAL,
}
H = ['<div class="sidebar">', sidebar_common(context, REQUEST)] H = ['<div class="sidebar">', sidebar_common(context, REQUEST)]
@ -99,9 +102,12 @@ def sidebar(context, REQUEST=None):
etudid = REQUEST.form["etudid"] etudid = REQUEST.form["etudid"]
etud = sco_etud.get_etud_info(filled=1, etudid=etudid)[0] etud = sco_etud.get_etud_info(filled=1, etudid=etudid)[0]
params.update(etud) params.update(etud)
params["fiche_url"] = url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
)
# compte les absences du semestre en cours # compte les absences du semestre en cours
H.append( H.append(
"""<h2 id="insidebar-etud"><a href="%(ScoURL)s/ficheEtud?etudid=%(etudid)s" class="sidebar"> """<h2 id="insidebar-etud"><a href="%(fiche_url)s" class="sidebar">
<font color="#FF0000">%(civilite_str)s %(nom_disp)s</font></a> <font color="#FF0000">%(civilite_str)s %(nom_disp)s</font></a>
</h2> </h2>
<b>Absences</b>""" <b>Absences</b>"""

View File

@ -33,6 +33,8 @@ import pdb
import inspect import inspect
from operator import itemgetter from operator import itemgetter
from flask import g, url_for
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
from app.scodoc.notes_log import log, logCallStack from app.scodoc.notes_log import log, logCallStack
@ -1269,16 +1271,23 @@ class NotesTable(object):
% (self.formsemestre_id, etudid, ue, ue_cap) % (self.formsemestre_id, etudid, ue, ue_cap)
) )
raise ScoValueError( raise ScoValueError(
"""<div class="scovalueerror"><p>Coefficient de l'UE capitalisée %s impossible à déterminer pour l'étudiant <a href="ficheEtud?etudid=%s" class="discretelink">%s</a></p> """<div class="scovalueerror"><p>Coefficient de l'UE capitalisée %s impossible à déterminer
<p>Il faut <a href="formsemestre_edit_uecoefs?formsemestre_id=%s&err_ue_id=%s">saisir le coefficient de cette UE avant de continuer</a></p> pour l'étudiant <a href="%s" class="discretelink">%s</a></p>
</div> <p>Il faut <a href="%s">saisir le coefficient de cette UE avant de continuer</a></p>
""" </div>
"""
% ( % (
ue["acronyme"], ue["acronyme"],
etudid, url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
),
self.get_nom_long(etudid), self.get_nom_long(etudid),
self.formsemestre_id, url_for(
ue["ue_id"], "scolar.formsemestre_edit_uecoefs",
scodoc_dept=g.scodoc_dept,
formsemestre_id=self.formsemestre_id,
err_ue_id=ue["ue_id"],
),
) )
) )

View File

@ -37,6 +37,8 @@ from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
from email.header import Header from email.header import Header
from flask import g, url_for
from app.scodoc import sco_emails from app.scodoc import sco_emails
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -250,7 +252,9 @@ def abs_notification_message(context, sem, prefs, etudid, nbabs, nbabsjust):
values["nbabs"] = nbabs values["nbabs"] = nbabs
values["nbabsjust"] = nbabsjust values["nbabsjust"] = nbabsjust
values["nbabsnonjust"] = nbabs - nbabsjust values["nbabsnonjust"] = nbabs - nbabsjust
values["url_ficheetud"] = scu.ScoURL() + "/ficheEtud?etudid=" + etudid values["url_ficheetud"] = url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
)
template = prefs["abs_notification_mail_tmpl"] template = prefs["abs_notification_mail_tmpl"]
if template: if template:

View File

@ -30,8 +30,7 @@
""" """
import datetime import datetime
from stripogram import html2text, html2safehtml from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import notesdb as ndb from app.scodoc import notesdb as ndb
@ -49,7 +48,6 @@ from app.scodoc import sco_photos
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
from app.scodoc.sco_exceptions import ScoValueError from app.scodoc.sco_exceptions import ScoValueError
from app.scodoc.sco_permissions import Permission
def doSignaleAbsence( def doSignaleAbsence(
@ -232,7 +230,8 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
</td><td> </td><td>
""" """
% etud, % etud,
"""<a href="%s/ficheEtud?etudid=%s">""" % (scu.ScoURL(), etud["etudid"]), """<a href="%s">"""
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]),
sco_photos.etud_photo_html( sco_photos.etud_photo_html(
context, context,
etudid=etudid, etudid=etudid,
@ -388,7 +387,8 @@ def JustifAbsenceEtud(context, REQUEST=None): # etudid implied
</td><td> </td><td>
""" """
% etud, % etud,
"""<a href="%s/ficheEtud?etudid=%s">""" % (scu.ScoURL(), etud["etudid"]), """<a href="%s">"""
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
sco_photos.etud_photo_html( sco_photos.etud_photo_html(
context, context,
etudid=etudid, etudid=etudid,
@ -498,7 +498,8 @@ def AnnuleAbsenceEtud(context, REQUEST=None): # etudid implied
</td><td> </td><td>
""" """
% etud, # " % etud, # "
"""<a href="%s/ficheEtud?etudid=%s">""" % (scu.ScoURL(), etud["etudid"]), """<a href="%s">"""
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
sco_photos.etud_photo_html( sco_photos.etud_photo_html(
context, context,
etudid=etudid, etudid=etudid,
@ -776,12 +777,11 @@ def CalAbs(context, REQUEST=None): # etud implied
""" """
% (nbabs, nbabsjust, nbabs - nbabsjust, len(justifs_noabs)), % (nbabs, nbabsjust, nbabs - nbabsjust, len(justifs_noabs)),
"""</td> """</td>
<td><a href="%s/ficheEtud?etudid=%s">%s</a></td> <td><a href="%s">%s</a></td>
</tr> </tr>
</table>""" </table>"""
% ( % (
scu.ScoURL(), url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etudid,
sco_photos.etud_photo_html( sco_photos.etud_photo_html(
context, context,
etudid=etudid, etudid=etudid,

View File

@ -29,6 +29,7 @@
Il s'agit de fichiers quelconques, généralement utilisés pour conserver Il s'agit de fichiers quelconques, généralement utilisés pour conserver
les dossiers d'admission et autres pièces utiles. les dossiers d'admission et autres pièces utiles.
""" """
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import sco_import_etuds from app.scodoc import sco_import_etuds
@ -165,7 +166,9 @@ def etud_upload_file_form(context, REQUEST, etudid):
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST) return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(scu.NotesURL() + "/ficheEtud?etudid=" + etudid) return REQUEST.RESPONSE.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
else: else:
data = tf[2]["datafile"][0].read() data = tf[2]["datafile"][0].read()
descr = tf[2]["description"] descr = tf[2]["description"]
@ -173,7 +176,9 @@ def etud_upload_file_form(context, REQUEST, etudid):
_store_etud_file_to_new_archive( _store_etud_file_to_new_archive(
context, REQUEST, etudid, data, filename, description=descr context, REQUEST, etudid, data, filename, description=descr
) )
return REQUEST.RESPONSE.redirect(scu.ScoURL() + "/ficheEtud?etudid=" + etudid) return REQUEST.RESPONSE.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
def _store_etud_file_to_new_archive( def _store_etud_file_to_new_archive(
@ -196,7 +201,6 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
) )
etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0] etud = sco_etud.get_etud_info(filled=1, REQUEST=REQUEST)[0]
archive_id = EtudsArchive.get_id_from_name(context, etudid, archive_name) archive_id = EtudsArchive.get_id_from_name(context, etudid, archive_name)
dest_url = "ficheEtud?etudid=%s" % etudid
if not dialog_confirmed: if not dialog_confirmed:
return scu.confirm_dialog( return scu.confirm_dialog(
context, context,
@ -209,12 +213,24 @@ def etud_delete_archive(context, REQUEST, etudid, archive_name, dialog_confirmed
), ),
dest_url="", dest_url="",
REQUEST=REQUEST, REQUEST=REQUEST,
cancel_url=dest_url, cancel_url=url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=etudid,
head_message="annulation",
),
parameters={"etudid": etudid, "archive_name": archive_name}, parameters={"etudid": etudid, "archive_name": archive_name},
) )
EtudsArchive.delete_archive(archive_id) EtudsArchive.delete_archive(archive_id)
return REQUEST.RESPONSE.redirect(dest_url + "&head_message=Archive%20supprimée") return REQUEST.RESPONSE.redirect(
url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=etudid,
head_message="Archive%20supprimée",
)
)
def etud_get_archived_file(context, REQUEST, etudid, archive_name, filename): def etud_get_archived_file(context, REQUEST, etudid, archive_name, filename):

View File

@ -31,8 +31,6 @@
import time import time
from types import StringType from types import StringType
import pprint import pprint
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
from app.scodoc import htmlutils
import email import email
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
@ -40,6 +38,8 @@ from email.mime.base import MIMEBase
from email.header import Header from email.header import Header
from reportlab.lib.colors import Color 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 app.scodoc import sco_emails from app.scodoc import sco_emails
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -48,6 +48,7 @@ from app.scodoc.notes_log import log
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_exceptions import AccessDenied from app.scodoc.sco_exceptions import AccessDenied
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
from app.scodoc import htmlutils
from app.scodoc import sco_abs from app.scodoc import sco_abs
from app.scodoc import sco_abs_views from app.scodoc import sco_abs_views
from app.scodoc import sco_bulletins_generator from app.scodoc import sco_bulletins_generator
@ -1077,9 +1078,14 @@ def _formsemestre_bulletinetud_header_html(
cssstyles=["css/radar_bulletin.css"], cssstyles=["css/radar_bulletin.css"],
), ),
"""<table class="bull_head"><tr><td> """<table class="bull_head"><tr><td>
<h2><a class="discretelink" href="ficheEtud?etudid=%(etudid)s">%(nomprenom)s</a></h2> <h2><a class="discretelink" href="%s">%s</a></h2>
""" """
% etud, % (
url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
),
etud["nomprenom"],
),
""" """
<form name="f" method="GET" action="%s">""" <form name="f" method="GET" action="%s">"""
% REQUEST.URL0, % REQUEST.URL0,
@ -1252,12 +1258,10 @@ def _formsemestre_bulletinetud_header_html(
H.append("""</tr></table>""") H.append("""</tr></table>""")
# #
H.append( H.append(
"""</form></span></td><td class="bull_photo"> """</form></span></td><td class="bull_photo"><a href="%s">%s</a>
<a href="%s/ficheEtud?etudid=%s">%s</a> """
"""
% ( % (
scu.ScoURL(), url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etudid,
sco_photos.etud_photo_html( sco_photos.etud_photo_html(
context, etud, title="fiche de " + etud["nom"], REQUEST=REQUEST context, etud, title="fiche de " + etud["nom"], REQUEST=REQUEST
), ),

View File

@ -31,6 +31,8 @@ Rapport (table) avec dernier semestre fréquenté et débouché de chaque étudi
from types import StringType from types import StringType
import safehtml import safehtml
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
@ -121,8 +123,12 @@ def table_debouche_etudids(context, etudids, keep_numeric=True):
"civilite": etud["civilite"], "civilite": etud["civilite"],
"nom": etud["nom"], "nom": etud["nom"],
"prenom": etud["prenom"], "prenom": etud["prenom"],
"_nom_target": "ficheEtud?etudid=" + etud["etudid"], "_nom_target": url_for(
"_prenom_target": "ficheEtud?etudid=" + etud["etudid"], "scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
),
"_prenom_target": url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
),
"_nom_td_attrs": 'id="%s" class="etudinfo"' % (etud["etudid"]), "_nom_td_attrs": 'id="%s" class="etudinfo"' % (etud["etudid"]),
# 'debouche' : etud['debouche'], # 'debouche' : etud['debouche'],
"moy": scu.fmt_note(nt.get_etud_moy_gen(etudid), keep_numeric=keep_numeric), "moy": scu.fmt_note(nt.get_etud_moy_gen(etudid), keep_numeric=keep_numeric),

View File

@ -31,6 +31,8 @@
from cStringIO import StringIO from cStringIO import StringIO
from zipfile import ZipFile from zipfile import ZipFile
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
@ -546,7 +548,7 @@ def view_scodoc_etuds(
raise ValueError("etudid or NIP must be specified") raise ValueError("etudid or NIP must be specified")
for e in etuds: for e in etuds:
tgt = "ficheEtud?etudid=" + e["etudid"] tgt = url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=e["etudid"])
e["_nom_target"] = tgt e["_nom_target"] = tgt
e["_prenom_target"] = tgt e["_prenom_target"] = tgt
e["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"],) e["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"],)
@ -758,7 +760,9 @@ def view_apo_csv(context, etape_apo="", semset_id="", format="html", REQUEST=Non
e["in_scodoc"] = e["nip"] not in nips_no_sco e["in_scodoc"] = e["nip"] not in nips_no_sco
e["in_scodoc_str"] = {True: "oui", False: "non"}[e["in_scodoc"]] e["in_scodoc_str"] = {True: "oui", False: "non"}[e["in_scodoc"]]
if e["in_scodoc"]: if e["in_scodoc"]:
e["_in_scodoc_str_target"] = "ficheEtud?code_nip=" + e["nip"] e["_in_scodoc_str_target"] = url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, code_nip=e["nip"]
)
e.update(sco_etud.get_etud_info(code_nip=e["nip"], filled=True)[0]) e.update(sco_etud.get_etud_info(code_nip=e["nip"], filled=True)[0])
e["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"],) e["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"],)
e["_prenom_td_attrs"] = 'id="pre-%s" class="etudinfo"' % (e["etudid"],) e["_prenom_td_attrs"] = 'id="pre-%s" class="etudinfo"' % (e["etudid"],)

View File

@ -92,6 +92,8 @@ Le filtrage s'effctue sur la date et non plus sur la parité du semestre (1-3/2-
import json import json
from flask import url_for, g
from app.scodoc.sco_portal_apogee import get_inscrits_etape from app.scodoc.sco_portal_apogee import get_inscrits_etape
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
from app.scodoc.sco_utils import annee_scolaire_debut from app.scodoc.sco_utils import annee_scolaire_debut
@ -681,7 +683,10 @@ class EtapeBilan(object):
@staticmethod @staticmethod
def link_etu(etudid, nom): def link_etu(etudid, nom):
return '<a class="stdlink" href="ficheEtud?etudid=%s">%s</a>' % (etudid, nom) return '<a class="stdlink" href="%s">%s</a>' % (
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
nom,
)
def link_semestre(self, semestre, short=False): def link_semestre(self, semestre, short=False):
if short: if short:

View File

@ -32,6 +32,8 @@
import time import time
from flask import url_for, g
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText from email.mime.text import MIMEText
from email.header import Header from email.header import Header
@ -332,8 +334,13 @@ def _check_duplicate_code(cnx, args, code_name, context, edit=True, REQUEST=None
listh = [] # liste des doubles listh = [] # liste des doubles
for e in etuds: for e in etuds:
listh.append( listh.append(
"""Autre étudiant: <a href="ficheEtud?etudid=%(etudid)s">%(nom)s %(prenom)s</a>""" """Autre étudiant: <a href="%s">"""
% e % url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=e["etudid"],
)
+ """%(nom)s %(prenom)s</a>""" % e
) )
if etudid: if etudid:
OK = "retour à la fiche étudiant" OK = "retour à la fiche étudiant"
@ -704,7 +711,7 @@ def create_etud(context, cnx, args={}, REQUEST=None):
) )
etud = etudident_list(cnx, {"etudid": etudid})[0] etud = etudident_list(cnx, {"etudid": etudid})[0]
fill_etuds_info([etud]) fill_etuds_info([etud])
etud["url"] = "ficheEtud?etudid=%(etudid)s" % etud etud["url"] = url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
sco_news.add( sco_news.add(
context, context,
REQUEST, REQUEST,

View File

@ -29,6 +29,8 @@
""" """
from types import ListType from types import ListType
from flask import url_for, g
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
@ -174,7 +176,8 @@ def _build_results_list(context, dpv_by_sem, etuds_infos):
"nom_usuel": etud["nom_usuel"], "nom_usuel": etud["nom_usuel"],
"prenom": etud["prenom"], "prenom": etud["prenom"],
"civilite_str": etud["civilite_str"], "civilite_str": etud["civilite_str"],
"_nom_target": "%s/ficheEtud?etudid=%s" % (scu.ScoURL(), etudid), "_nom_target": "%s"
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
"_nom_td_attrs": 'id="%s" class="etudinfo"' % etudid, "_nom_td_attrs": 'id="%s" class="etudinfo"' % etudid,
"bac": bac.abbrev(), "bac": bac.abbrev(),
"parcours": dec["parcours"], "parcours": dec["parcours"],

View File

@ -27,6 +27,7 @@
"""Recherche d'étudiants """Recherche d'étudiants
""" """
from flask import url_for, g
from scodoc_manager import sco_mgr from scodoc_manager import sco_mgr
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -105,7 +106,6 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
Args: Args:
expnom: string, regexp sur le nom ou un code_nip ou un etudid expnom: string, regexp sur le nom ou un code_nip ou un etudid
""" """
dest_url = "ficheEtud"
if len(expnom) > 1: if len(expnom) > 1:
etuds = sco_etud.get_etud_info(filled=1, etudid=expnom, REQUEST=REQUEST) etuds = sco_etud.get_etud_info(filled=1, etudid=expnom, REQUEST=REQUEST)
if len(etuds) != 1: if len(etuds) != 1:
@ -119,7 +119,9 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
if len(etuds) == 1: if len(etuds) == 1:
# va directement a la fiche # va directement a la fiche
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
scu.NotesURL() + "/ficheEtud?etudid=" + etuds[0]["etudid"] url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etuds[0]["etudid"]
)
) )
H = [ H = [
@ -135,7 +137,9 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
% (len(etuds), expnom), % (len(etuds), expnom),
form_search_etud( form_search_etud(
context, context,
dest_url=dest_url, dest_url=url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept
), # sans l'etudid, post du form
REQUEST=REQUEST, REQUEST=REQUEST,
title="Autre recherche", title="Autre recherche",
), ),
@ -143,7 +147,9 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
if len(etuds) > 0: if len(etuds) > 0:
# Choix dans la liste des résultats: # Choix dans la liste des résultats:
for e in etuds: for e in etuds:
target = dest_url + "?etudid=%s&" % e["etudid"] target = url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=e["etudid"]
)
e["_nomprenom_target"] = target e["_nomprenom_target"] = target
e["inscription_target"] = target e["inscription_target"] = target
e["_nomprenom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"]) e["_nomprenom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"])
@ -169,7 +175,7 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
H.append( H.append(
form_search_etud( form_search_etud(
context, context,
dest_url=dest_url, dest_url=url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept),
REQUEST=REQUEST, REQUEST=REQUEST,
title="Autre recherche", title="Autre recherche",
) )
@ -303,16 +309,16 @@ def table_etud_in_accessible_depts(context, expnom=None, REQUEST=None):
] ]
for etuds in result: for etuds in result:
if etuds: if etuds:
DeptId = etuds[0]["dept"] dept_id = etuds[0]["dept"]
# H.append('<h3>Département %s</h3>' % DeptId) # H.append('<h3>Département %s</h3>' % DeptId)
dest_url = DeptId + "/Scolarite/ficheEtud"
for e in etuds: for e in etuds:
target = dest_url + "?etudid=%s" % e["etudid"] e["_nomprenom_target"] = url_for(
e["_nomprenom_target"] = target "scolar.ficheEtud", scodoc_dept=dept_id, etudid=e["etudid"]
)
e["_nomprenom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"]) e["_nomprenom_td_attrs"] = 'id="%s" class="etudinfo"' % (e["etudid"])
tab = GenTable( tab = GenTable(
titles={"nomprenom": "Etudiants en " + DeptId}, titles={"nomprenom": "Etudiants en " + dept_id},
columns_ids=("nomprenom",), columns_ids=("nomprenom",),
rows=etuds, rows=etuds,
html_sortable=True, html_sortable=True,

View File

@ -33,6 +33,8 @@ Ces semestres n'auront qu'un seul inscrit !
""" """
import time import time
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
from app.scodoc.sco_utils import log from app.scodoc.sco_utils import log
@ -97,8 +99,11 @@ def formsemestre_ext_create_form(context, etudid, formsemestre_id, REQUEST=None)
</p> </p>
""" """
% (etudid,), % (etudid,),
"""<h3><a href="ficheEtud?etudid=%s" class="stdlink">Etudiant %s</a></h3>""" """<h3><a href="%s" class="stdlink">Etudiant %s</a></h3>"""
% (etudid, etud["nomprenom"]), % (
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etud["nomprenom"],
),
] ]
F = html_sco_header.sco_footer(context, REQUEST) F = html_sco_header.sco_footer(context, REQUEST)
orig_sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) orig_sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
@ -204,7 +209,7 @@ def formsemestre_ext_create_form(context, etudid, formsemestre_id, REQUEST=None)
tf[2]["formation_id"] = orig_sem["formation_id"] tf[2]["formation_id"] = orig_sem["formation_id"]
formsemestre_ext_create(context, etudid, tf[2], REQUEST=REQUEST) formsemestre_ext_create(context, etudid, tf[2], REQUEST=REQUEST)
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"%s/ficheEtud?etudid=%s" % (scu.ScoURL(), etudid) url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
) )

View File

@ -29,6 +29,8 @@
""" """
import time import time
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
from app.scodoc.scolog import logdb from app.scodoc.scolog import logdb
@ -315,8 +317,11 @@ def formsemestre_inscription_with_modules_form(
else: else:
H.append("<p>aucune session de formation !</p>") H.append("<p>aucune session de formation !</p>")
H.append( H.append(
'<h3>ou</h3> <a class="stdlink" href="%s/ficheEtud?etudid=%s">retour à la fiche de %s</a>' '<h3>ou</h3> <a class="stdlink" href="%s">retour à la fiche de %s</a>'
% (scu.ScoURL(), etudid, etud["nomprenom"]) % (
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etud["nomprenom"],
)
) )
return "\n".join(H) + F return "\n".join(H) + F
@ -357,9 +362,20 @@ def formsemestre_inscription_with_modules(
% (etud["nomprenom"], sem["titremois"]) % (etud["nomprenom"], sem["titremois"])
) )
H.append( H.append(
"""<ul><li><a href="ficheEtud?etudid=%s">retour à la fiche de %s</a></li> """<ul>
<li><a href="formsemestre_status?formsemestre_id=%s">retour au tableau de bord de %s</a></li></ul>""" <li><a href="%s">retour à la fiche de %s</a></li>
% (etudid, etud["nomprenom"], formsemestre_id, sem["titremois"]) <li><a href="%s">retour au tableau de bord de %s</a></li>
</ul>"""
% (
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etud["nomprenom"],
url_for(
"notes.formsemestre_status",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
),
sem["titremois"],
)
) )
return "\n".join(H) + F return "\n".join(H) + F
# Check 2: déjà inscrit dans un semestre recouvrant les même dates ? # Check 2: déjà inscrit dans un semestre recouvrant les même dates ?
@ -401,7 +417,9 @@ def formsemestre_inscription_with_modules(
REQUEST=REQUEST, REQUEST=REQUEST,
method="formsemestre_inscription_with_modules", method="formsemestre_inscription_with_modules",
) )
return REQUEST.RESPONSE.redirect(scu.ScoURL() + "/ficheEtud?etudid=" + etudid) return REQUEST.RESPONSE.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
else: else:
# formulaire choix groupe # formulaire choix groupe
H.append( H.append(
@ -555,7 +573,7 @@ function chkbx_select(field_id, state) {
return "\n".join(H) + "\n" + tf[1] + F return "\n".join(H) + "\n" + tf[1] + F
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"%s/ficheEtud?etudid=%s" % (scu.ScoURL(), etudid) url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
) )
else: else:
# Inscriptions aux modules choisis # Inscriptions aux modules choisis
@ -591,8 +609,9 @@ function chkbx_select(field_id, state) {
if (not a_inscrire) and (not a_desinscrire): if (not a_inscrire) and (not a_desinscrire):
H.append( H.append(
"""<h3>Aucune modification à effectuer</h3> """<h3>Aucune modification à effectuer</h3>
<p><a class="stdlink" href="%s/ficheEtud?etudid=%s">retour à la fiche étudiant</a></p>""" <p><a class="stdlink" href="%s">retour à la fiche étudiant</a></p>
% (scu.ScoURL(), etudid) """
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
) )
return "\n".join(H) + F return "\n".join(H) + F
@ -643,15 +662,14 @@ function chkbx_select(field_id, state) {
<input type="hidden" name="modulesimpls_ainscrire" value="%s"/> <input type="hidden" name="modulesimpls_ainscrire" value="%s"/>
<input type="hidden" name="modulesimpls_adesinscrire" value="%s"/> <input type="hidden" name="modulesimpls_adesinscrire" value="%s"/>
<input type ="submit" value="Confirmer"/> <input type ="submit" value="Confirmer"/>
<input type ="button" value="Annuler" onclick="document.location='%s/ficheEtud?etudid=%s';"/> <input type ="button" value="Annuler" onclick="document.location='%s';"/>
</form> </form>
""" """
% ( % (
etudid, etudid,
modulesimpls_ainscrire, modulesimpls_ainscrire,
modulesimpls_adesinscrire, modulesimpls_adesinscrire,
scu.ScoURL(), url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etudid,
) )
) )
return "\n".join(H) + F return "\n".join(H) + F
@ -712,10 +730,10 @@ def do_moduleimpl_incription_options(
H = [ H = [
html_sco_header.sco_header(context, REQUEST), html_sco_header.sco_header(context, REQUEST),
"""<h3>Modifications effectuées</h3> """<h3>Modifications effectuées</h3>
<p><a class="stdlink" href="%s/ficheEtud?etudid=%s"> <p><a class="stdlink" href="%s">
Retour à la fiche étudiant</a></p> Retour à la fiche étudiant</a></p>
""" """
% (scu.ScoURL(), etudid), % url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
html_sco_header.sco_footer(context, REQUEST), html_sco_header.sco_footer(context, REQUEST),
] ]
return "\n".join(H) return "\n".join(H)
@ -780,8 +798,15 @@ def formsemestre_inscrits_ailleurs(context, formsemestre_id, REQUEST=None):
H.append("<ul>") H.append("<ul>")
for etud in etudlist: for etud in etudlist:
H.append( H.append(
'<li><a href="ficheEtud?etudid=%(etudid)s" class="discretelink">%(nomprenom)s</a> : ' '<li><a href="%s" class="discretelink">%s</a> : '
% etud % (
url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=etud["etudid"],
),
etud["nomprenom"],
)
) )
l = [] l = []
for s in insd[etud["etudid"]]: for s in insd[etud["etudid"]]:

View File

@ -29,6 +29,8 @@
""" """
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error, time, datetime import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error, time, datetime
from flask import url_for, g
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
@ -146,10 +148,9 @@ def formsemestre_validation_etud_form(
) )
H.append( H.append(
'</td><td style="text-align: right;"><a href="%s/ficheEtud?etudid=%s">%s</a></td></tr></table>' '</td><td style="text-align: right;"><a href="%s">%s</a></td></tr></table>'
% ( % (
scu.ScoURL(), url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etudid,
sco_photos.etud_photo_html( sco_photos.etud_photo_html(
context, etud, title="fiche de %s" % etud["nom"], REQUEST=REQUEST context, etud, title="fiche de %s" % etud["nom"], REQUEST=REQUEST
), ),
@ -164,8 +165,10 @@ def formsemestre_validation_etud_form(
if etud_etat != "I": if etud_etat != "I":
H.append( H.append(
tf_error_message( tf_error_message(
"""Impossible de statuer sur cet étudiant: il est démissionnaire ou défaillant (voir <a href="%s/ficheEtud?etudid=%s">sa fiche</a>)""" """Impossible de statuer sur cet étudiant:
% (scu.ScoURL(), etudid) il est démissionnaire ou défaillant (voir <a href="%s">sa fiche</a>)
"""
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
) )
) )
return "\n".join(H + Footer) return "\n".join(H + Footer)
@ -1096,10 +1099,9 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
"""<h2 class="formsemestre">%s: validation d'une UE antérieure</h2>""" """<h2 class="formsemestre">%s: validation d'une UE antérieure</h2>"""
% etud["nomprenom"], % etud["nomprenom"],
( (
'</td><td style="text-align: right;"><a href="%s/ficheEtud?etudid=%s">%s</a></td></tr></table>' '</td><td style="text-align: right;"><a href="%s">%s</a></td></tr></table>'
% ( % (
scu.ScoURL(), url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etudid,
sco_photos.etud_photo_html( sco_photos.etud_photo_html(
context, etud, title="fiche de %s" % etud["nom"], REQUEST=REQUEST context, etud, title="fiche de %s" % etud["nom"], REQUEST=REQUEST
), ),

View File

@ -37,6 +37,8 @@ import time
import collections import collections
import operator import operator
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
from app.scodoc import sco_abs from app.scodoc import sco_abs
@ -535,8 +537,11 @@ def groups_table(
etud["_emailperso_target"] = "mailto:" + etud["emailperso"] etud["_emailperso_target"] = "mailto:" + etud["emailperso"]
else: else:
etud["_emailperso_target"] = "" etud["_emailperso_target"] = ""
etud["_nom_disp_target"] = "ficheEtud?etudid=" + etud["etudid"] fiche_url = url_for(
etud["_prenom_target"] = "ficheEtud?etudid=" + etud["etudid"] "scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
)
etud["_nom_disp_target"] = fiche_url
etud["_prenom_target"] = fiche_url
etud["_nom_disp_td_attrs"] = 'id="%s" class="etudinfo"' % (etud["etudid"]) etud["_nom_disp_td_attrs"] = 'id="%s" class="etudinfo"' % (etud["etudid"])
@ -937,7 +942,10 @@ def form_choix_saisie_semaine(context, groups_infos, REQUEST=None):
moduleimpl_id = query_args.get("moduleimpl_id", [""])[0] moduleimpl_id = query_args.get("moduleimpl_id", [""])[0]
if "head_message" in query_args: if "head_message" in query_args:
del query_args["head_message"] del query_args["head_message"]
destination = "%s?%s" % (REQUEST.URL, six.moves.urllib.parse.urlencode(query_args, True)) destination = "%s?%s" % (
REQUEST.URL,
six.moves.urllib.parse.urlencode(query_args, True),
)
destination = destination.replace( destination = destination.replace(
"%", "%%" "%", "%%"
) # car ici utilisee dans un format string ! ) # car ici utilisee dans un format string !

View File

@ -31,6 +31,8 @@
import datetime import datetime
from operator import itemgetter from operator import itemgetter
from flask import url_for, g
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
@ -577,9 +579,14 @@ def etuds_select_boxes(
c = "" c = ""
sco_etud.format_etud_ident(etud) sco_etud.format_etud_ident(etud)
if etud["etudid"]: if etud["etudid"]:
elink = ( elink = """<a class="discretelink %s" href="%s">%s</a>""" % (
"""<a class="discretelink %s" href="ficheEtud?etudid=%s">%s</a>""" c,
% (c, etud["etudid"], etud["nomprenom"]) url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=etud["etudid"],
),
etud["nomprenom"],
) )
else: else:
# ce n'est pas un etudiant ScoDoc # ce n'est pas un etudiant ScoDoc

View File

@ -31,6 +31,8 @@ import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
from types import StringType from types import StringType
from operator import itemgetter from operator import itemgetter
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
@ -817,8 +819,11 @@ def evaluation_check_absences_html(
for etudid in etudids: for etudid in etudids:
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
H.append( H.append(
'<li><a class="discretelink" href="ficheEtud?etudid=%(etudid)s">%(nomprenom)s</a>' '<li><a class="discretelink" href="%s">'
% etud % url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
)
+ "%(nomprenom)s</a>" % etud
) )
if linkabs: if linkabs:
H.append( H.append(

View File

@ -31,6 +31,8 @@
""" """
from operator import itemgetter from operator import itemgetter
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
from app.scodoc import sco_formsemestre from app.scodoc import sco_formsemestre
@ -140,8 +142,11 @@ def _table_etuds_lycees(
bottom_titles = None bottom_titles = None
if not no_links: if not no_links:
for etud in etuds: for etud in etuds:
etud["_nom_target"] = "ficheEtud?etudid=" + etud["etudid"] fiche_url = url_for(
etud["_prenom_target"] = "ficheEtud?etudid=" + etud["etudid"] "scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
)
etud["_nom_target"] = fiche_url
etud["_prenom_target"] = fiche_url
etud["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (etud["etudid"]) etud["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (etud["etudid"])
tab = GenTable( tab = GenTable(
@ -230,8 +235,15 @@ def js_coords_lycees(etuds_by_lycee):
etuds_by_lycee[codelycee] etuds_by_lycee[codelycee]
) + ", ".join( ) + ", ".join(
[ [
'<a class="discretelink" href="ficheEtud?etudid=%s" title="">%s</a>' '<a class="discretelink" href="%s" title="">%s</a>'
% (e["etudid"], qjs(e["nomprenom"])) % (
url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=e["etudid"],
),
qjs(e["nomprenom"]),
)
for e in etuds_by_lycee[codelycee] for e in etuds_by_lycee[codelycee]
] ]
) )

View File

@ -29,6 +29,8 @@
""" """
from operator import itemgetter from operator import itemgetter
from flask import url_for, g
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
@ -171,8 +173,16 @@ def moduleimpl_inscriptions_edit(
% (etud["etudid"], checked) % (etud["etudid"], checked)
) )
H.append( H.append(
"""<a class="discretelink etudinfo" href="ficheEtud?etudid=%s" id="%s">%s</a>""" """<a class="discretelink etudinfo" href="%s" id="%s">%s</a>"""
% (etud["etudid"], etud["etudid"], etud["nomprenom"]) % (
url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=etud["etudid"],
),
etud["etudid"],
etud["nomprenom"],
)
) )
H.append("""</input></td>""") H.append("""</input></td>""")
@ -355,8 +365,15 @@ def moduleimpl_inscriptions_stats(context, formsemestre_id, REQUEST=None):
for info in UECaps[ue["ue_id"]]: for info in UECaps[ue["ue_id"]]:
etud = sco_etud.get_etud_info(etudid=info["etudid"], filled=True)[0] etud = sco_etud.get_etud_info(etudid=info["etudid"], filled=True)[0]
H.append( H.append(
'<li class="etud"><a class="discretelink" href="ficheEtud?etudid=%(etudid)s">%(nomprenom)s</a>' '<li class="etud"><a class="discretelink" href="%s">%s</a>'
% etud % (
url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=etud["etudid"],
),
etud["nomprenom"],
)
) )
if info["ue_status"]["event_date"]: if info["ue_status"]["event_date"]:
H.append( H.append(
@ -461,8 +478,13 @@ def _fmt_etud_set(context, ins, max_list_size=7):
etuds.sort(key=itemgetter("nom")) etuds.sort(key=itemgetter("nom"))
return ", ".join( return ", ".join(
[ [
'<a class="discretelink" href="ficheEtud?etudid=%(etudid)s">%(nomprenom)s</a>' '<a class="discretelink" href="%s">%s</a>'
% etud % (
url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
),
etud["nomprenom"],
)
for etud in etuds for etud in etuds
] ]
) )

View File

@ -30,6 +30,7 @@
Fiche description d'un étudiant et de son parcours Fiche description d'un étudiant et de son parcours
""" """
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
@ -384,13 +385,13 @@ def ficheEtud(context, etudid=None, REQUEST=None):
else: else:
info["tit_anno"] = "" info["tit_anno"] = ""
# Inscriptions # Inscriptions
if info["sems"]: # XXX rcl unused ? à voir # if info["sems"]: # XXX rcl unused ? à voir
rcl = ( # rcl = (
"""(<a href="%(ScoURL)s/Notes/formsemestre_validation_etud_form?check=1&etudid=%(etudid)s&formsemestre_id=%(last_formsemestre_id)s&desturl=ficheEtud?etudid=%(etudid)s">récapitulatif parcours</a>)""" # """(<a href="%(ScoURL)s/Notes/formsemestre_validation_etud_form?check=1&etudid=%(etudid)s&formsemestre_id=%(last_formsemestre_id)s&desturl=ficheEtud?etudid=%(etudid)s">récapitulatif parcours</a>)"""
% info # % info
) # )
else: # else:
rcl = "" # rcl = ""
info[ info[
"inscriptions_mkup" "inscriptions_mkup"
] = """<div class="ficheinscriptions" id="ficheinscriptions"> ] = """<div class="ficheinscriptions" id="ficheinscriptions">

View File

@ -31,6 +31,8 @@ Recapitule tous les semestres validés dans une feuille excel.
""" """
import collections import collections
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import sco_abs from app.scodoc import sco_abs
from app.scodoc import sco_core from app.scodoc import sco_core
@ -178,8 +180,11 @@ def formsemestre_poursuite_report(
infos = [] infos = []
ids = [] ids = []
for etud in etuds: for etud in etuds:
etud["_nom_target"] = "ficheEtud?etudid=" + etud["etudid"] fiche_url = url_for(
etud["_prenom_target"] = "ficheEtud?etudid=" + etud["etudid"] "scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
)
etud["_nom_target"] = fiche_url
etud["_prenom_target"] = fiche_url
etud["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (etud["etudid"]) etud["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (etud["etudid"])
info = etud_get_poursuite_info(context, sem, etud) info = etud_get_poursuite_info(context, sem, etud)
idd = _flatten_info(info) idd = _flatten_info(info)

View File

@ -51,6 +51,8 @@ from operator import itemgetter
from reportlab.platypus import Paragraph from reportlab.platypus import Paragraph
from reportlab.lib import styles from reportlab.lib import styles
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
@ -436,8 +438,11 @@ def pvjury_table(
"etudid": e["identite"]["etudid"], "etudid": e["identite"]["etudid"],
"code_nip": e["identite"]["code_nip"], "code_nip": e["identite"]["code_nip"],
"nomprenom": e["identite"]["nomprenom"], "nomprenom": e["identite"]["nomprenom"],
"_nomprenom_target": "%s/ficheEtud?etudid=%s" "_nomprenom_target": url_for(
% (scu.ScoURL(), e["identite"]["etudid"]), "scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=e["identite"]["etudid"],
),
"_nomprenom_td_attrs": 'id="%s" class="etudinfo"' % e["identite"]["etudid"], "_nomprenom_td_attrs": 'id="%s" class="etudinfo"' % e["identite"]["etudid"],
"parcours": e["parcours"], "parcours": e["parcours"],
"decision": _descr_decision_sem_abbrev( "decision": _descr_decision_sem_abbrev(

View File

@ -37,6 +37,8 @@ import time
import datetime import datetime
from operator import itemgetter from operator import itemgetter
from flask import url_for, g
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc import notesdb as ndb from app.scodoc import notesdb as ndb
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
@ -1096,8 +1098,11 @@ def table_suivi_parcours(
context, etud context, etud
) )
codes_etuds[etud["codeparcours"]].append(etud) codes_etuds[etud["codeparcours"]].append(etud)
etud["_nom_target"] = "ficheEtud?etudid=" + etud["etudid"] fiche_url = url_for(
etud["_prenom_target"] = "ficheEtud?etudid=" + etud["etudid"] "scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
)
etud["_nom_target"] = fiche_url
etud["_prenom_target"] = fiche_url
etud["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (etud["etudid"]) etud["_nom_td_attrs"] = 'id="%s" class="etudinfo"' % (etud["etudid"])
titles = { titles = {

View File

@ -43,6 +43,8 @@ from reportlab.lib.colors import Color
from reportlab.lib import colors from reportlab.lib import colors
from PIL import Image as PILImage from PIL import Image as PILImage
from flask import url_for, g
from app.scodoc.notes_log import log from app.scodoc.notes_log import log
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.TrivialFormulator import TrivialFormulator
@ -154,7 +156,15 @@ def trombino_html(context, groups_infos, REQUEST=None):
'<span class="unloaded_img" id="%s"><img border="0" height="90" alt="en cours" src="/ScoDoc/static/icons/loading.jpg"/></span>' '<span class="unloaded_img" id="%s"><img border="0" height="90" alt="en cours" src="/ScoDoc/static/icons/loading.jpg"/></span>'
% t["etudid"] % t["etudid"]
) )
H.append('<a href="ficheEtud?etudid=' + t["etudid"] + '">' + foto + "</a>") H.append(
'<a href="%s">%s</a>'
% (
url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=t["etudid"]
),
foto,
)
)
H.append("</span>") H.append("</span>")
H.append( H.append(
'<span class="trombi_legend"><span class="trombi_prenom">' '<span class="trombi_legend"><span class="trombi_prenom">'

View File

@ -58,6 +58,7 @@ import time
from xml.etree import ElementTree from xml.etree import ElementTree
from flask import g from flask import g
from flask import url_for
from flask import current_app from flask import current_app
from app.decorators import ( from app.decorators import (
@ -764,8 +765,14 @@ def _gen_form_saisie_groupe(
td_matin_class = ("matin_1", "matin_2", "matin_3")[i % 3] td_matin_class = ("matin_1", "matin_2", "matin_3")[i % 3]
H.append( H.append(
'<tr class="%s"><td><b class="etudinfo" id="%s"><a class="discretelink" href="ficheEtud?etudid=%s" target="new">%s</a></b>%s</td>' '<tr class="%s"><td><b class="etudinfo" id="%s"><a class="discretelink" href="%s" target="new">%s</a></b>%s</td>'
% (tr_class, etudid, etudid, etud["nomprenom"], capstr) % (
tr_class,
etudid,
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etud["nomprenom"],
capstr,
)
) )
etud_abs = sco_abs.list_abs_in_range( etud_abs = sco_abs.list_abs_in_range(
context, etudid, begin, end, moduleimpl_id=moduleimpl_id, cursor=cursor context, etudid, begin, end, moduleimpl_id=moduleimpl_id, cursor=cursor
@ -1217,7 +1224,9 @@ def _tableBillets(context, billets, etud=None, title=""):
b["nomprenom"] = "???" # should not occur b["nomprenom"] = "???" # should not occur
else: else:
b["nomprenom"] = e[0]["nomprenom"] b["nomprenom"] = e[0]["nomprenom"]
b["_nomprenom_target"] = "ficheEtud?etudid=%s" % b["etudid"] b["_nomprenom_target"] = url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=b["etudid"]
)
if etud and not title: if etud and not title:
title = "Billets d'absence déclarés par %(nomprenom)s" % etud title = "Billets d'absence déclarés par %(nomprenom)s" % etud
else: else:
@ -1423,8 +1432,12 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
REQUEST, REQUEST,
page_title="Traitement billet d'absence de %s" % etud["nomprenom"], page_title="Traitement billet d'absence de %s" % etud["nomprenom"],
), ),
'<h2>Traitement du billet %s : <a class="discretelink" href="ficheEtud?etudid=%s">%s</a></h2>' '<h2>Traitement du billet %s : <a class="discretelink" href="%s">%s</a></h2>'
% (billet_id, etudid, etud["nomprenom"]), % (
billet_id,
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
etud["nomprenom"],
),
] ]
tf = TrivialFormulator( tf = TrivialFormulator(

View File

@ -1033,7 +1033,9 @@ def view_module_abs(context, REQUEST, moduleimpl_id, format="html"):
"just": nb_abs_just, "just": nb_abs_just,
"nojust": nb_abs - nb_abs_just, "nojust": nb_abs - nb_abs_just,
"total": nb_abs, "total": nb_abs,
"_nomprenom_target": "ficheEtud?etudid=%s" % etudid, "_nomprenom_target": url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
),
} }
) )
@ -1365,8 +1367,8 @@ def formsemestre_desinscription(
return ( return (
html_sco_header.sco_header(context, REQUEST) html_sco_header.sco_header(context, REQUEST)
+ '<p>Etudiant désinscrit !</p><p><a class="stdlink" href="%s/ficheEtud?etudid=%s">retour à la fiche</a>' + '<p>Etudiant désinscrit !</p><p><a class="stdlink" href="%s">retour à la fiche</a>'
% (scu.ScoURL(), etudid) % url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
+ html_sco_header.sco_footer(context, REQUEST) + html_sco_header.sco_footer(context, REQUEST)
) )

View File

@ -43,7 +43,7 @@ except ImportError:
from zipfile import ZipFile from zipfile import ZipFile
import psycopg2 import psycopg2
from flask import g from flask import g, url_for
from flask import current_app from flask import current_app
from config import Config from config import Config
@ -246,8 +246,8 @@ def showEtudLog(context, etudid, format="html", REQUEST=None):
page_title="Opérations sur %(nomprenom)s" % etud, page_title="Opérations sur %(nomprenom)s" % etud,
html_title="<h2>Opérations effectuées sur l'étudiant %(nomprenom)s</h2>" % etud, html_title="<h2>Opérations effectuées sur l'étudiant %(nomprenom)s</h2>" % etud,
filename="log_" + scu.make_filename(etud["nomprenom"]), filename="log_" + scu.make_filename(etud["nomprenom"]),
html_next_section='<ul><li><a href="ficheEtud?etudid=%(etudid)s">fiche de %(nomprenom)s</a></li></ul>' html_next_section='<ul><li><a href="%s">fiche de %(nomprenom)s</a></li></ul>'
% etud, % url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
preferences=sco_preferences.SemPreferences( preferences=sco_preferences.SemPreferences(
context, context,
), ),
@ -511,7 +511,9 @@ def doAddAnnotation(context, etudid, comment, REQUEST):
}, },
) )
logdb(REQUEST, cnx, method="addAnnotation", etudid=etudid) logdb(REQUEST, cnx, method="addAnnotation", etudid=etudid)
return REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid) return REQUEST.RESPONSE.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
@bp.route("/doSuppressAnnotation") @bp.route("/doSuppressAnnotation")
@ -534,7 +536,12 @@ def doSuppressAnnotation(context, etudid, annotation_id, REQUEST):
sco_etud.etud_annotations_delete(cnx, annotation_id) sco_etud.etud_annotations_delete(cnx, annotation_id)
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"ficheEtud?etudid=%s&head_message=Annotation%%20supprimée" % (etudid) url_for(
"scolar.ficheEtud",
scodoc_dept=g.scodoc_dept,
etudid=etudid,
head_message="Annotation%%20supprimée",
)
) )
@ -594,7 +601,7 @@ def formChangeCoordonnees(context, etudid, REQUEST):
initvalues=adr, initvalues=adr,
submitlabel="Valider le formulaire", submitlabel="Valider le formulaire",
) )
dest_url = scu.ScoURL() + "/ficheEtud?etudid=" + etudid dest_url = url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
if tf[0] == 0: if tf[0] == 0:
return header + "\n".join(H) + tf[1] + html_sco_header.sco_footer(REQUEST) return header + "\n".join(H) + tf[1] + html_sco_header.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
@ -666,7 +673,8 @@ def etud_photo_orig_page(context, etudid=None, REQUEST=None):
H = [ H = [
html_sco_header.sco_header(context, REQUEST, page_title=etud["nomprenom"]), html_sco_header.sco_header(context, REQUEST, page_title=etud["nomprenom"]),
"<h2>%s</h2>" % etud["nomprenom"], "<h2>%s</h2>" % etud["nomprenom"],
'<div><a href="ficheEtud?etudid=%s">' % etudid, '<div><a href="%s">'
% url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
sco_photos.etud_photo_orig_html(context, etud), sco_photos.etud_photo_orig_html(context, etud),
"</a></div>", "</a></div>",
html_sco_header.sco_footer(REQUEST), html_sco_header.sco_footer(REQUEST),
@ -710,7 +718,9 @@ def formChangePhoto(context, etudid=None, REQUEST=None):
submitlabel="Valider", submitlabel="Valider",
cancelbutton="Annuler", cancelbutton="Annuler",
) )
dest_url = scu.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"] dest_url = url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud["etudid"]
)
if tf[0] == 0: if tf[0] == 0:
return ( return (
"\n".join(H) "\n".join(H)
@ -743,14 +753,16 @@ def formSuppressPhoto(context, etudid=None, REQUEST=None, dialog_confirmed=False
"<p>Confirmer la suppression de la photo de %(nomprenom)s ?</p>" % etud, "<p>Confirmer la suppression de la photo de %(nomprenom)s ?</p>" % etud,
dest_url="", dest_url="",
REQUEST=REQUEST, REQUEST=REQUEST,
cancel_url="ficheEtud?etudid=%s" % etudid, cancel_url=url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
),
parameters={"etudid": etudid}, parameters={"etudid": etudid},
) )
sco_photos.suppress_photo(context, etud, REQUEST=REQUEST) sco_photos.suppress_photo(context, etud, REQUEST=REQUEST)
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
scu.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"] url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
) )
@ -906,7 +918,9 @@ def _do_dem_or_def_etud(
}, },
) )
if REQUEST: if REQUEST:
return REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid) return REQUEST.RESPONSE.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
@bp.route("/doCancelDem", methods=["GET", "POST"]) @bp.route("/doCancelDem", methods=["GET", "POST"])
@ -988,7 +1002,9 @@ def _do_cancel_dem_or_def(
"<p>Confirmer l'annulation de la %s ?</p>" % operation_name, "<p>Confirmer l'annulation de la %s ?</p>" % operation_name,
dest_url="", dest_url="",
REQUEST=REQUEST, REQUEST=REQUEST,
cancel_url="ficheEtud?etudid=%s" % etudid, cancel_url=url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
),
parameters={"etudid": etudid, "formsemestre_id": formsemestre_id}, parameters={"etudid": etudid, "formsemestre_id": formsemestre_id},
) )
# #
@ -1011,7 +1027,9 @@ def _do_cancel_dem_or_def(
{"etudid": etudid, "formsemestre_id": formsemestre_id}, {"etudid": etudid, "formsemestre_id": formsemestre_id},
) )
cnx.commit() cnx.commit()
return REQUEST.RESPONSE.redirect("ficheEtud?etudid=%s" % etudid) return REQUEST.RESPONSE.redirect(
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
@bp.route("/etudident_create_form", methods=["GET", "POST"]) @bp.route("/etudident_create_form", methods=["GET", "POST"])
@ -1057,8 +1075,8 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
raise ValueError("missing etudid parameter") raise ValueError("missing etudid parameter")
descr.append(("etudid", {"default": etudid, "input_type": "hidden"})) descr.append(("etudid", {"default": etudid, "input_type": "hidden"}))
H.append( H.append(
'<h2>Modification d\'un étudiant (<a href="ficheEtud?etudid=%s">fiche</a>)</h2>' '<h2>Modification d\'un étudiant (<a href="%s">fiche</a>)</h2>'
% etudid % url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
) )
initvalues = sco_etud.etudident_list(cnx, {"etudid": etudid}) initvalues = sco_etud.etudident_list(cnx, {"etudid": etudid})
assert len(initvalues) == 1 assert len(initvalues) == 1
@ -1443,18 +1461,30 @@ def etudident_delete(context, etudid, dialog_confirmed=False, REQUEST=None):
if not dialog_confirmed: if not dialog_confirmed:
return scu.confirm_dialog( return scu.confirm_dialog(
context, context,
"""<h2>Confirmer la suppression de l'étudiant <b>%(nomprenom)s</b> ?</h2> """<h2>Confirmer la suppression de l'étudiant <b>{e[nomprenom]}</b> ?</h2>
</p> </p>
<p style="top-margin: 2ex; bottom-margin: 2ex;">Prenez le temps de vérifier que vous devez vraiment supprimer cet étudiant !</p> <p style="top-margin: 2ex; bottom-margin: 2ex;">Prenez le temps de vérifier
<p>Cette opération <font color="red"><b>irréversible</b></font> efface toute trace de l'étudiant: inscriptions, <b>notes</b>, absences... dans <b>tous les semestres</b> qu'il a fréquenté.</p> que vous devez vraiment supprimer cet étudiant !
<p>Dans la plupart des cas, vous avez seulement besoin de le <ul>désinscrire</ul> d'un semestre ? (dans ce cas passez par sa fiche, menu associé au semestre)</p> </p>
<p>Cette opération <font color="red"><b>irréversible</b></font>
efface toute trace de l'étudiant: inscriptions, <b>notes</b>, absences...
dans <b>tous les semestres</b> qu'il a fréquenté.
</p>
<p>Dans la plupart des cas, vous avez seulement besoin de le <ul>désinscrire</ul>
d'un semestre ? (dans ce cas passez par sa fiche, menu associé au semestre)</p>
<p><a href="ficheEtud?etudid=%(etudid)s">Vérifier la fiche de %(nomprenom)s</a> <p><a href="{fiche_url}">Vérifier la fiche de {e[nomprenom]}</a>
</p>""" </p>""".format(
% etud, e=etud,
fiche_url=url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
),
),
dest_url="", dest_url="",
REQUEST=REQUEST, REQUEST=REQUEST,
cancel_url="ficheEtud?etudid=%s" % etudid, cancel_url=url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid
),
OK="Supprimer définitivement cet étudiant", OK="Supprimer définitivement cet étudiant",
parameters={"etudid": etudid}, parameters={"etudid": etudid},
) )
@ -1583,8 +1613,16 @@ def check_group_apogee(
mailstat = "inconnu" mailstat = "inconnu"
nmailmissing += 1 nmailmissing += 1
H.append( H.append(
'<tr><td><a href="ficheEtud?etudid=%s">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' '<tr><td><a href="%s">%s</a></td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>'
% (etudid, nom, nom_usuel, prenom, mailstat, code_nip, info_apogee) % (
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid),
nom,
nom_usuel,
prenom,
mailstat,
code_nip,
info_apogee,
)
) )
H.append("</table>") H.append("</table>")
H.append("<ul>") H.append("<ul>")