1
0
forked from ScoDoc/ScoDoc

WIP migration

This commit is contained in:
Emmanuel Viennet 2021-06-15 12:34:33 +02:00
parent ea09f18377
commit 3af2c460b7
48 changed files with 1579 additions and 1540 deletions

View File

@ -239,7 +239,7 @@ def students_import_excel(
if formsemestre_id:
dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id
else:
dest = context.NotesURL()
dest = scu.NotesURL()
H = [
html_sco_header.sco_header(context, REQUEST, page_title="Import etudiants")
]

View File

@ -133,7 +133,7 @@ class ZAbsences(
# --------------------------------------------------------------------
# used to view content of the object
security.declareProtected(ScoView, "index_html")
index_html = sco_abs_views.absences_index_html
index_html = sco_abs_views.index_html
security.declareProtected(ScoView, "EtatAbsences")
EtatAbsences = sco_abs_views.EtatAbsences

File diff suppressed because it is too large Load Diff

View File

@ -60,7 +60,7 @@ import sco_bulletins_xml
def go(app, n=0, verbose=True):
context = app.ScoDoc.objectValues("Folder")[n].Scolarite
if verbose:
print("context in dept ", sco_core.get_dept_id())
print("context in dept ", scu.get_dept_id())
return context
@ -72,9 +72,9 @@ def go_dept(app, dept, verbose=True):
except AttributeError:
# ignore other folders, like old "icons"
continue
if sco_core.get_dept_id() == dept:
if scu.get_dept_id() == dept:
if verbose:
print("context in dept ", sco_core.get_dept_id())
print("context in dept ", scu.get_dept_id())
return context
raise ValueError("dep %s not found" % dept)

View File

@ -28,6 +28,7 @@
import cgi
import sco_utils as scu
import html_sidebar
import VERSION
"""
@ -169,7 +170,7 @@ def sco_header(
params = {
"page_title": page_title or VERSION.SCONAME,
"no_side_bar": no_side_bar,
"ScoURL": context.ScoURL(),
"ScoURL": scu.ScoURL(),
"encoding": scu.SCO_ENCODING,
"titrebandeau_mkup": "<td>" + titrebandeau + "</td>",
"authuser": str(REQUEST.AUTHENTICATED_USER),
@ -319,7 +320,7 @@ def sco_header(
Vous avez reçu un mot de passe temporaire.<br/>
Vous devez le changer: <a href="%s/Users/form_change_password?user_name=%s">cliquez ici</a>
</div>"""
% (context.ScoURL(), str(authuser))
% (scu.ScoURL(), str(authuser))
)
#
if head_message:

View File

@ -26,6 +26,7 @@
##############################################################################
import sco_utils as scu
import sco_preferences
from sco_abs import getAbsSemEtud
from sco_permissions import (
ScoUsersAdmin,
@ -43,10 +44,10 @@ def sidebar_common(context, REQUEST=None):
"partie commune a toutes les sidebar"
authuser = REQUEST.AUTHENTICATED_USER
params = {
"ScoURL": context.ScoURL(),
"UsersURL": context.UsersURL(),
"NotesURL": context.NotesURL(),
"AbsencesURL": context.AbsencesURL(),
"ScoURL": scu.ScoURL(),
"UsersURL": scu.UsersURL(),
"NotesURL": scu.NotesURL(),
"AbsencesURL": scu.AbsencesURL(),
"authuser": str(authuser),
}
H = [
@ -81,7 +82,7 @@ def sidebar_common(context, REQUEST=None):
def sidebar(context, REQUEST=None):
"Main HTML page sidebar"
# rewritten from legacy DTML code
params = {"ScoURL": context.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)]
@ -171,7 +172,7 @@ def sidebar_dept(context, REQUEST=None):
),
"DeptIntranetURL": sco_preferences.get_preference(context, "DeptIntranetURL"),
"DeptName": sco_preferences.get_preference(context, "DeptName"),
"ScoURL": context.ScoURL(),
"ScoURL": scu.ScoURL(),
}
H = [

View File

@ -244,7 +244,7 @@ def abs_notification_message(context, sem, prefs, etudid, nbabs, nbabsjust):
values["nbabs"] = nbabs
values["nbabsjust"] = nbabsjust
values["nbabsnonjust"] = nbabs - nbabsjust
values["url_ficheetud"] = context.ScoURL() + "/ficheEtud?etudid=" + etudid
values["url_ficheetud"] = scu.ScoURL() + "/ficheEtud?etudid=" + etudid
template = prefs["abs_notification_mail_tmpl"]
if template:

View File

@ -217,7 +217,7 @@ def SignaleAbsenceEtud(context, REQUEST=None): # etudid implied
</td><td>
"""
% etud,
"""<a href="%s/ficheEtud?etudid=%s">""" % (context.ScoURL(), etud["etudid"]),
"""<a href="%s/ficheEtud?etudid=%s">""" % (scu.ScoURL(), etud["etudid"]),
sco_photos.etud_photo_html(
context,
etudid=etudid,
@ -370,7 +370,7 @@ def JustifAbsenceEtud(context, REQUEST=None): # etudid implied
</td><td>
"""
% etud,
"""<a href="%s/ficheEtud?etudid=%s">""" % (context.ScoURL(), etud["etudid"]),
"""<a href="%s/ficheEtud?etudid=%s">""" % (scu.ScoURL(), etud["etudid"]),
sco_photos.etud_photo_html(
context,
etudid=etudid,
@ -480,7 +480,7 @@ def AnnuleAbsenceEtud(context, REQUEST=None): # etudid implied
</td><td>
"""
% etud, # "
"""<a href="%s/ficheEtud?etudid=%s">""" % (context.ScoURL(), etud["etudid"]),
"""<a href="%s/ficheEtud?etudid=%s">""" % (scu.ScoURL(), etud["etudid"]),
sco_photos.etud_photo_html(
context,
etudid=etudid,
@ -707,7 +707,7 @@ def CalAbs(context, REQUEST=None): # etud implied
</tr>
</table>"""
% (
context.ScoURL(),
scu.ScoURL(),
etudid,
sco_photos.etud_photo_html(
context,
@ -843,7 +843,7 @@ def ListeAbsEtud(
raise ValueError("Invalid format !")
def absences_index_html(context, REQUEST=None):
def index_html(context, REQUEST=None):
"""Gestionnaire absences, page principale"""
# crude portage from 1999 DTML
sems = sco_formsemestre.do_formsemestre_list(context)

View File

@ -93,7 +93,7 @@ class BaseArchiver:
:return: path to directory of archives for this object (eg formsemestre_id or etudid).
If directory does not yet exist, create it.
"""
dept_dir = os.path.join(self.root, sco_core.get_dept_id())
dept_dir = os.path.join(self.root, scu.get_dept_id())
try:
scu.GSL.acquire()
if not os.path.isdir(dept_dir):
@ -111,7 +111,7 @@ class BaseArchiver:
"""
:return: list of archive oids
"""
base = os.path.join(self.root, sco_core.get_dept_id()) + os.path.sep
base = os.path.join(self.root, scu.get_dept_id()) + os.path.sep
dirs = glob.glob(base + "*")
return [os.path.split(x)[1] for x in dirs]
@ -368,7 +368,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 context._can_edit_pv(REQUEST, formsemestre_id):
if not sco_permissions.can_edit_pv(context, REQUEST, formsemestre_id):
raise AccessDenied(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
)
@ -551,7 +551,7 @@ def formsemestre_delete_archive(
context, REQUEST, formsemestre_id, archive_name, dialog_confirmed=False
):
"""Delete an archive"""
if not context._can_edit_pv(REQUEST, formsemestre_id):
if not sco_permissions.can_edit_pv(context, REQUEST, formsemestre_id):
raise AccessDenied(
"opération non autorisée pour %s" % str(REQUEST.AUTHENTICATED_USER)
)

View File

@ -165,9 +165,7 @@ def etud_upload_file_form(context, REQUEST, etudid):
if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ficheEtud?etudid=" + etudid
)
return REQUEST.RESPONSE.redirect(scu.NotesURL() + "/ficheEtud?etudid=" + etudid)
else:
data = tf[2]["datafile"].read()
descr = tf[2]["description"]
@ -175,9 +173,7 @@ def etud_upload_file_form(context, REQUEST, etudid):
_store_etud_file_to_new_archive(
context, REQUEST, etudid, data, filename, description=descr
)
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ficheEtud?etudid=" + etudid
)
return REQUEST.RESPONSE.redirect(scu.NotesURL() + "/ficheEtud?etudid=" + etudid)
def _store_etud_file_to_new_archive(

View File

@ -1181,7 +1181,9 @@ def _formsemestre_bulletinetud_header_html(
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": context._can_validate_sem(REQUEST, formsemestre_id),
"enabled": sco_permcan_validate_semdate_sem(
context, REQUEST, formsemestre_id
),
},
{
"title": "Enregistrer note d'une UE externe",
@ -1190,7 +1192,9 @@ def _formsemestre_bulletinetud_header_html(
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": context._can_validate_sem(REQUEST, formsemestre_id),
"enabled": sco_permcan_validate_semdate_sem(
context, REQUEST, formsemestre_id
),
},
{
"title": "Entrer décisions jury",
@ -1199,7 +1203,9 @@ def _formsemestre_bulletinetud_header_html(
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": context._can_validate_sem(REQUEST, formsemestre_id),
"enabled": sco_permcan_validate_semdate_sem(
context, REQUEST, formsemestre_id
),
},
{
"title": "Editer PV jury",
@ -1231,7 +1237,7 @@ def _formsemestre_bulletinetud_header_html(
<a href="%s/ficheEtud?etudid=%s">%s</a>
"""
% (
context.ScoURL(),
scu.ScoURL(),
etudid,
sco_photos.etud_photo_html(
context, etud, title="fiche de " + etud["nom"], REQUEST=REQUEST

View File

@ -143,7 +143,7 @@ def process_field(
return text
# --- PDF format:
# handle logos:
image_dir = scu.SCODOC_LOGOS_DIR + "/logos_" + sco_core.get_dept_id() + "/"
image_dir = scu.SCODOC_LOGOS_DIR + "/logos_" + scu.get_dept_id() + "/"
if not os.path.exists(image_dir):
image_dir = scu.SCODOC_LOGOS_DIR + "/" # use global logos
text = re.sub(

View File

@ -85,7 +85,7 @@ et sur page "réglages bulletin" (avec formsemestre_id)
# def _sig_filename(context, side, formsemestre_id=None):
# if not side in ("left", "right"):
# raise ValueError("side must be left or right")
# dirs = [SCODOC_LOGOS_DIR, sco_core.get_dept_id()]
# dirs = [SCODOC_LOGOS_DIR, scu.get_dept_id()]
# if formsemestre_id:
# dirs.append(formsemestre_id)
# dirs.append("bul_sig_{}".format(side))

View File

@ -6,6 +6,8 @@
import types
from flask import url_for
import sco_utils as scu
from notes_table import NOTES_CACHE_INST, CacheNotesTable
from scodoc_manager import sco_mgr
@ -30,12 +32,6 @@ def test_refactor(context, x=1):
)
def get_dept_id():
if g.scodoc_dept in sco_mgr.get_dept_ids():
return g.scodoc_dept
raise ScoInvalidDept("département invalide: %s" % g.scodoc_dept)
#
# Cache global: chaque instance, repérée par sa connexion db, a un cache
# qui est recréé à la demande

View File

@ -211,7 +211,7 @@ def report_debouche_ask_date(context, REQUEST=None):
# def debouche_set(context, object, value, REQUEST=None):
# """Set debouche (field in admission table, may be deprecated ?)
# """
# if not context.can_edit_suivi(REQUEST):
# if not sco_permissions.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')
@ -263,7 +263,7 @@ def itemsuivi_get(cnx, itemsuivi_id, ignore_errors=False):
def itemsuivi_suppress(context, itemsuivi_id, REQUEST=None):
"""Suppression d'un item"""
if not context.can_edit_suivi(REQUEST):
if not sco_permissions.can_edit_suivi(context, REQUEST):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
cnx = context.GetDBConnexion()
item = itemsuivi_get(cnx, itemsuivi_id, ignore_errors=True)
@ -277,7 +277,7 @@ def itemsuivi_create(
context, etudid, item_date=None, situation="", REQUEST=None, format=None
):
"""Creation d'un item"""
if not context.can_edit_suivi(REQUEST):
if not sco_permissions.can_edit_suivi(context, REQUEST):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
cnx = context.GetDBConnexion()
itemsuivi_id = _itemsuivi_create(
@ -295,7 +295,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 context.can_edit_suivi(REQUEST):
if not sco_permissions.can_edit_suivi(context, REQUEST):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
# log('itemsuivi_set_date %s : %s' % (itemsuivi_id, item_date))
cnx = context.GetDBConnexion()
@ -306,7 +306,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 context.can_edit_suivi(REQUEST):
if not sco_permissions.can_edit_suivi(context, REQUEST):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
itemsuivi_id = object
situation = value.strip("-_ \t")
@ -364,7 +364,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 context.can_edit_suivi(REQUEST):
if not sco_permissions.can_edit_suivi(context, REQUEST):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
if not taglist:
taglist = []

View File

@ -134,7 +134,7 @@ Chercher étape courante: <input name="etape_apo" type="text" size="8" spellchec
</form
</p>
"""
% context.NotesURL()
% scu.NotesURL()
)
#
authuser = REQUEST.AUTHENTICATED_USER
@ -159,7 +159,7 @@ Chercher étape courante: <input name="etape_apo" type="text" size="8" spellchec
<li><a class="stdlink" href="%s/semset_page">Années scolaires / exports Apogée</a></li>
</ul>
"""
% context.NotesURL()
% scu.NotesURL()
)
#
H.append(
@ -205,7 +205,7 @@ def _sem_table(context, sems):
cur_idx = sem["semestre_id"]
else:
sem["trclass"] = ""
sem["notes_url"] = context.NotesURL()
sem["notes_url"] = scu.NotesURL()
H.append(tmpl % sem)
H.append("</table>")
return "\n".join(H)
@ -254,7 +254,7 @@ def _sem_table_gt(context, sems, showcodes=False):
def _style_sems(context, sems):
"""ajoute quelques attributs de présentation pour la table"""
for sem in sems:
sem["notes_url"] = context.NotesURL()
sem["notes_url"] = scu.NotesURL()
sem["_groupicon_target"] = (
"%(notes_url)s/formsemestre_status?formsemestre_id=%(formsemestre_id)s"
% sem

View File

@ -65,7 +65,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
'<li><a href="formsemestre_status?formsemestre_id=%(formsemestre_id)s">%(titremois)s</a></li>'
% sem
)
H.append('</ul><p><a href="%s">Revenir</a></p>' % context.NotesURL())
H.append('</ul><p><a href="%s">Revenir</a></p>' % scu.NotesURL())
else:
if not dialog_confirmed:
return scu.confirm_dialog(
@ -77,7 +77,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
% F,
REQUEST=REQUEST,
OK="Supprimer cette formation",
cancel_url=context.NotesURL(),
cancel_url=scu.NotesURL(),
parameters={"formation_id": formation_id},
)
else:
@ -85,7 +85,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
H.append(
"""<p>OK, formation supprimée.</p>
<p><a class="stdlink" href="%s">continuer</a></p>"""
% context.NotesURL()
% scu.NotesURL()
)
H.append(html_sco_header.sco_footer(context, REQUEST))
@ -199,7 +199,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(context.NotesURL())
return REQUEST.RESPONSE.redirect(scu.NotesURL())
else:
# check unicity : constraint UNIQUE(acronyme,titre,version)
if create:

View File

@ -77,7 +77,7 @@ associé.
submitlabel="Créer cette matière",
)
dest_url = context.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"]
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"]
if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer(context, REQUEST)
@ -108,7 +108,7 @@ def matiere_delete(context, matiere_id=None, REQUEST=None):
"<h2>Suppression de la matière %(titre)s" % M,
" dans l'UE (%(acronyme)s))</h2>" % UE,
]
dest_url = context.NotesURL() + "/ue_list?formation_id=" + str(UE["formation_id"])
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + str(UE["formation_id"])
tf = TrivialFormulator(
REQUEST.URL0,
REQUEST.form,
@ -185,7 +185,7 @@ associé.
submitlabel="Modifier les valeurs",
)
dest_url = context.NotesURL() + "/ue_list?formation_id=" + U["formation_id"]
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + U["formation_id"]
if tf[0] == 0:
return (

View File

@ -174,7 +174,7 @@ def module_create(context, matiere_id=None, REQUEST=None):
else:
context.do_module_create(tf[2], REQUEST)
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"]
scu.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"]
)
@ -193,7 +193,7 @@ def module_delete(context, module_id=None, REQUEST=None):
"""<h2>Suppression du module %(titre)s (%(code)s)</h2>""" % Mod,
]
dest_url = context.NotesURL() + "/ue_list?formation_id=" + Mod["formation_id"]
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + Mod["formation_id"]
tf = TrivialFormulator(
REQUEST.URL0,
REQUEST.form,
@ -242,7 +242,7 @@ def module_edit(context, module_id=None, REQUEST=None):
semestres_indices = range(1, parcours.NB_SEM + 1)
dest_url = context.NotesURL() + "/ue_list?formation_id=" + Mod["formation_id"]
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + Mod["formation_id"]
H = [
html_sco_header.sco_header(

View File

@ -223,7 +223,7 @@ def ue_edit(context, ue_id=None, create=False, formation_id=None, REQUEST=None):
else:
do_ue_edit(context, tf[2])
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ue_list?formation_id=" + formation_id
scu.NotesURL() + "/ue_list?formation_id=" + formation_id
)

View File

@ -109,7 +109,7 @@ def do_evaluation_delete(context, REQUEST, evaluation_id):
mod = context.do_module_list(args={"module_id": M["module_id"]})[0]
mod["moduleimpl_id"] = M["moduleimpl_id"]
mod["url"] = (
context.NotesURL() + "/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod
scu.NotesURL() + "/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod
)
sco_news.add(
context,
@ -787,7 +787,7 @@ def evaluation_describe(context, evaluation_id="", edit_in_place=True, REQUEST=N
group_id = sco_groups.get_default_group(context, formsemestre_id)
H.append(
'<span class="noprint"><a href="%s/Absences/EtatAbsencesDate?group_ids=%s&date=%s">(absences ce jour)</a></span>'
% (context.ScoURL(), group_id, urllib.quote(E["jour"], safe=""))
% (scu.ScoURL(), group_id, urllib.quote(E["jour"], safe=""))
)
H.append(
'</p><p>Coefficient dans le module: <b>%s</b>, notes sur <span id="eval_note_max">%g</span> '

View File

@ -174,7 +174,7 @@ def _build_results_list(context, dpv_by_sem, etuds_infos):
"nom_usuel": etud["nom_usuel"],
"prenom": etud["prenom"],
"civilite_str": etud["civilite_str"],
"_nom_target": "%s/ficheEtud?etudid=%s" % (context.ScoURL(), etudid),
"_nom_target": "%s/ficheEtud?etudid=%s" % (scu.ScoURL(), etudid),
"_nom_td_attrs": 'id="%s" class="etudinfo"' % etudid,
"bac": bac.abbrev(),
"parcours": dec["parcours"],
@ -198,7 +198,7 @@ def _build_results_list(context, dpv_by_sem, etuds_infos):
int(sem["annee_debut"]), sem["mois_debut_ord"]
)
r["sid"] = "{} {} {}".format(
sem["sem_id_txt"], sco_core.get_dept_id(), sem["modalite"]
sem["sem_id_txt"], scu.get_dept_id(), sem["modalite"]
)
rows.append(r)

View File

@ -122,7 +122,7 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
if len(etuds) == 1:
# va directement a la fiche
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ficheEtud?etudid=" + etuds[0]["etudid"]
scu.NotesURL() + "/ficheEtud?etudid=" + etuds[0]["etudid"]
)
H = [

View File

@ -80,7 +80,7 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
"""Dialog to edit the custom menu"""
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
dest_url = (
context.NotesURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id
scu.NotesURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id
)
H = [
html_sco_header.html_sem_header(

View File

@ -1273,9 +1273,7 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None):
return "\n".join(H) + html_sco_header.sco_footer(context, REQUEST)
elif tf[0] == -1: # cancel
return REQUEST.RESPONSE.redirect(
context.NotesURL()
+ "/formsemestre_status?formsemestre_id="
+ formsemestre_id
scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
)
else:
return REQUEST.RESPONSE.redirect(
@ -1299,9 +1297,7 @@ def formsemestre_delete2(
)
# Bon, s'il le faut...
do_formsemestre_delete(context, formsemestre_id, REQUEST)
return REQUEST.RESPONSE.redirect(
context.ScoURL() + "?head_message=Semestre%20supprimé"
)
return REQUEST.RESPONSE.redirect(scu.ScoURL() + "?head_message=Semestre%20supprimé")
def formsemestre_has_decisions_or_compensations(context, formsemestre_id):

View File

@ -192,13 +192,13 @@ def formsemestre_ext_create_form(context, etudid, formsemestre_id, REQUEST=None)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
"%s/formsemestre_bulletinetud?formsemestre_id==%s&etudid=%s"
% (context.ScoURL(), formsemestre_id, etudid)
% (scu.ScoURL(), formsemestre_id, etudid)
)
else:
tf[2]["formation_id"] = orig_sem["formation_id"]
formsemestre_ext_create(context, etudid, tf[2], REQUEST=REQUEST)
return REQUEST.RESPONSE.redirect(
"%s/ficheEtud?etudid=%s" % (context.ScoURL(), etudid)
"%s/ficheEtud?etudid=%s" % (scu.ScoURL(), etudid)
)

View File

@ -159,7 +159,7 @@ def formsemestre_inscription_with_modules_form(
H.append("<p>aucune session de formation !</p>")
H.append(
'<h3>ou</h3> <a class="stdlink" href="%s/ficheEtud?etudid=%s">retour à la fiche de %s</a>'
% (context.ScoURL(), etudid, etud["nomprenom"])
% (scu.ScoURL(), etudid, etud["nomprenom"])
)
return "\n".join(H) + F
@ -244,9 +244,7 @@ def formsemestre_inscription_with_modules(
REQUEST=REQUEST,
method="formsemestre_inscription_with_modules",
)
return REQUEST.RESPONSE.redirect(
context.ScoURL() + "/ficheEtud?etudid=" + etudid
)
return REQUEST.RESPONSE.redirect(scu.ScoURL() + "/ficheEtud?etudid=" + etudid)
else:
# formulaire choix groupe
H.append(
@ -400,7 +398,7 @@ function chkbx_select(field_id, state) {
return "\n".join(H) + "\n" + tf[1] + F
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
"%s/ficheEtud?etudid=%s" % (context.ScoURL(), etudid)
"%s/ficheEtud?etudid=%s" % (scu.ScoURL(), etudid)
)
else:
# Inscriptions aux modules choisis
@ -437,7 +435,7 @@ function chkbx_select(field_id, state) {
H.append(
"""<h3>Aucune modification à effectuer</h3>
<p><a class="stdlink" href="%s/ficheEtud?etudid=%s">retour à la fiche étudiant</a></p>"""
% (context.ScoURL(), etudid)
% (scu.ScoURL(), etudid)
)
return "\n".join(H) + F
@ -495,7 +493,7 @@ function chkbx_select(field_id, state) {
etudid,
modulesimpls_ainscrire,
modulesimpls_adesinscrire,
context.ScoURL(),
scu.ScoURL(),
etudid,
)
)
@ -560,7 +558,7 @@ def do_moduleimpl_incription_options(
<p><a class="stdlink" href="%s/ficheEtud?etudid=%s">
Retour à la fiche étudiant</a></p>
"""
% (context.ScoURL(), etudid),
% (scu.ScoURL(), etudid),
html_sco_header.sco_footer(context, REQUEST),
]
return "\n".join(H)

View File

@ -418,13 +418,15 @@ def formsemestre_status_menubar(context, sem, REQUEST):
"hidebac": 1,
"pref_override": 0,
},
"enabled": context._can_validate_sem(REQUEST, formsemestre_id),
"enabled": sco_permissions.can_validate_sem(
context, REQUEST, formsemestre_id
),
},
{
"title": "Editer les PV et archiver les résultats",
"endpoint": "notes.formsemestre_archive",
"args": {"formsemestre_id": formsemestre_id},
"enabled": context._can_edit_pv(REQUEST, formsemestre_id),
"enabled": sco_permissions.can_edit_pv(context, REQUEST, formsemestre_id),
},
{
"title": "Documents archivés",
@ -534,7 +536,7 @@ def formsemestre_page_title(context, REQUEST):
def fill_formsemestre(context, sem, REQUEST=None):
"""Add some useful fields to help display formsemestres"""
notes_url = context.NotesURL()
notes_url = scu.NotesURL()
sem["notes_url"] = notes_url
formsemestre_id = sem["formsemestre_id"]
if sem["etat"] != "1":
@ -755,7 +757,7 @@ def formsemestre_description(
def _make_listes_sem(context, sem, REQUEST=None, with_absences=True):
context = context
authuser = REQUEST.AUTHENTICATED_USER
r = context.ScoURL() # root url
r = scu.ScoURL() # root url
# construit l'URL "destination"
# (a laquelle on revient apres saisie absences)
query_args = cgi.parse_qs(REQUEST.QUERY_STRING)

View File

@ -142,7 +142,7 @@ def formsemestre_validation_etud_form(
H.append(
'</td><td style="text-align: right;"><a href="%s/ficheEtud?etudid=%s">%s</a></td></tr></table>'
% (
context.ScoURL(),
scu.ScoURL(),
etudid,
sco_photos.etud_photo_html(
context, etud, title="fiche de %s" % etud["nom"], REQUEST=REQUEST
@ -159,7 +159,7 @@ def formsemestre_validation_etud_form(
H.append(
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>)"""
% (context.ScoURL(), etudid)
% (scu.ScoURL(), etudid)
)
)
return "\n".join(H + Footer)
@ -1088,7 +1088,7 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
(
'</td><td style="text-align: right;"><a href="%s/ficheEtud?etudid=%s">%s</a></td></tr></table>'
% (
context.ScoURL(),
scu.ScoURL(),
etudid,
sco_photos.etud_photo_html(
context, etud, title="fiche de %s" % etud["nom"], REQUEST=REQUEST
@ -1177,9 +1177,7 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
context.NotesURL()
+ "/formsemestre_status?formsemestre_id="
+ formsemestre_id
scu.NotesURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
)
else:
if tf[2]["semestre_id"]:
@ -1197,7 +1195,7 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST=
REQUEST=REQUEST,
)
return REQUEST.RESPONSE.redirect(
context.ScoURL()
scu.ScoURL()
+ "/Notes/formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s&head_message=Validation%%20d'UE%%20enregistree"
% (formsemestre_id, etudid)
)
@ -1324,7 +1322,7 @@ def etud_ue_suppress_validation(context, etudid, formsemestre_id, ue_id, REQUEST
_invalidate_etud_formation_caches(context, etudid, sem["formation_id"])
return REQUEST.RESPONSE.redirect(
context.NotesURL()
scu.NotesURL()
+ "/formsemestre_validate_previous_ue?etudid=%s&formsemestre_id=%s"
% (etudid, formsemestre_id)
)

View File

@ -175,7 +175,7 @@ def mail_password(u, context=None, reset=False):
if not u["email"]:
return
u["url"] = context.ScoURL()
u["url"] = scu.ScoURL()
txt = (
"""

View File

@ -185,7 +185,7 @@ def do_evaluation_listenotes(context, REQUEST):
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
"%s/Notes/moduleimpl_status?moduleimpl_id=%s"
% (context.ScoURL(), E["moduleimpl_id"])
% (scu.ScoURL(), E["moduleimpl_id"])
)
else:
anonymous_listing = tf[2]["anonymous_listing"]

View File

@ -281,7 +281,7 @@ def _send_news_by_mail(context, n):
)
# Transforme les URL en URL absolue
base = context.ScoURL()
base = scu.ScoURL()
txt = re.sub('href=.*?"', 'href="' + base + "/", txt)
# Transforme les liens HTML en texte brut: '<a href="url">texte</a>' devient 'texte: url'

View File

@ -157,7 +157,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
scolars.fillEtudsInfo(context, [etud])
#
info = etud
info["ScoURL"] = context.ScoURL()
info["ScoURL"] = scu.ScoURL()
info["authuser"] = authuser
info["info_naissance"] = info["date_naissance"]
if info["lieu_naissance"]:
@ -265,7 +265,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
if authuser.has_permission(Permission.ScoEtudInscrit, context):
l.append(
'<a href="%s/Notes/formsemestre_inscription_with_modules_form?etudid=%s">inscrire</a></li>'
% (context.ScoURL(), etudid)
% (scu.ScoURL(), etudid)
)
l.append("</b></b>")
info["liste_inscriptions"] = "\n".join(l)
@ -275,7 +275,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
alist = []
annos = scolars.etud_annotations_list(cnx, args={"etudid": etudid})
for a in annos:
if not context.canSuppressAnnotation(a["id"], REQUEST):
if not sco_permissions.can_suppress_annotation(context, a["id"], REQUEST):
a["dellink"] = ""
else:
a[
@ -351,7 +351,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
# Devenir de l'étudiant:
has_debouche = True # info['debouche']
if context.can_edit_suivi(REQUEST):
if sco_permissions.can_edit_suivi(context, REQUEST):
suivi_readonly = "0"
link_add_suivi = """<li class="adddebouche">
<a id="adddebouchelink" class="stdlink" href="#">ajouter une ligne</a>

View File

@ -200,7 +200,7 @@ class ScolarsPageTemplate(PageTemplate):
# XXX COPIED from sco_pvpdf, to be refactored (no time now)
# Search background in dept specific dir, then in global config dir
for image_dir in (
SCODOC_LOGOS_DIR + "/logos_" + sco_core.get_dept_id() + "/",
SCODOC_LOGOS_DIR + "/logos_" + scu.get_dept_id() + "/",
SCODOC_LOGOS_DIR + "/", # global logos
):
for suffix in LOGOS_IMAGES_ALLOWED_TYPES:

View File

@ -56,3 +56,65 @@ class Permission:
Permission.init_permissions()
import scolars
import sco_formsemestre
def can_suppress_annotation(context, annotation_id, REQUEST):
"""True if current user can suppress this annotation
Seuls l'auteur de l'annotation et le chef de dept peuvent supprimer
une annotation.
"""
cnx = context.GetDBConnexion()
annos = scolars.etud_annotations_list(cnx, args={"id": annotation_id})
if len(annos) != 1:
raise ScoValueError("annotation inexistante !")
anno = annos[0]
authuser = REQUEST.AUTHENTICATED_USER
# note: les anciennes installations n'ont pas le role ScoEtudSupprAnnotations
# c'est pourquoi on teste aussi ScoEtudInscrit (normalement détenue par le chef)
return (
(str(authuser) == anno["zope_authenticated_user"])
or authuser.has_permission(Permission.ScoEtudSupprAnnotations, context)
or authuser.has_permission(Permission.ScoEtudInscrit, context)
)
def can_edit_suivi(context, REQUEST=None):
"""Vrai si l'utilisateur peut modifier les informations de suivi sur la page etud" """
authuser = REQUEST.AUTHENTICATED_USER
return authuser.has_permission(Permission.ScoEtudChangeAdr, context)
def can_validate_sem(context, REQUEST, formsemestre_id):
"Vrai si utilisateur peut saisir decision de jury dans ce semestre"
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
if sem["etat"] != "1":
return False # semestre verrouillé
return is_chef_or_diretud(context, REQUEST, sem)
def can_edit_pv(context, REQUEST, formsemestre_id):
"Vrai si utilisateur peut editer un PV de jury de ce semestre"
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
if is_chef_or_diretud(context, REQUEST, 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, context)
def is_chef_or_diretud(context, REQUEST, sem):
"Vrai si utilisateur est admin, chef dept ou responsable du semestre"
authuser = REQUEST.AUTHENTICATED_USER
if authuser.has_permission(Permission.ScoImplement, context):
return True # admin, chef dept
uid = str(authuser)
if uid in sem["responsables"]:
return True
return False

View File

@ -315,7 +315,7 @@ def get_new_filename(context, etudid):
"""Constructs a random filename to store a new image.
The path is constructed as: Fxx/etudid
"""
dept = sco_core.get_dept_id()
dept = scu.get_dept_id()
return find_new_dir() + dept + "_" + etudid

View File

@ -192,7 +192,7 @@ def do_placement_selectetuds(context, REQUEST):
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
"%s/Notes/moduleimpl_status?moduleimpl_id=%s"
% (context.ScoURL(), E["moduleimpl_id"])
% (scu.ScoURL(), E["moduleimpl_id"])
)
else:
placement_method = tf[2]["placement_method"]
@ -217,9 +217,7 @@ def do_placement_selectetuds(context, REQUEST):
)
+ "&".join(gs)
)
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/do_placement?" + query
)
return REQUEST.RESPONSE.redirect(scu.NotesURL() + "/do_placement?" + query)
else:
raise ValueError(
"invalid placement_method (%s)" % tf[2]["placement_method"]

View File

@ -1942,7 +1942,7 @@ class sco_base_preferences:
"""HTML dialog: edit global preferences"""
H = [
self.html_sco_header.sco_header(context, REQUEST, page_title="Préférences"),
"<h2>Préférences globales pour %s</h2>" % self.context.ScoURL(),
"<h2>Préférences globales pour %s</h2>" % self.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>
""",
@ -1960,13 +1960,13 @@ class sco_base_preferences:
"\n".join(H) + tf[1] + self.html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(self.context.ScoURL()) # cancel
return REQUEST.RESPONSE.redirect(scu.ScoURL()) # cancel
else:
for pref in PREFS:
self.prefs[None][pref[0]] = tf[2][pref[0]]
self.save()
return REQUEST.RESPONSE.redirect(
self.context.ScoURL() + "?head_message=Préférences modifiées"
scu.ScoURL() + "?head_message=Préférences modifiées"
)
@ -1975,7 +1975,7 @@ _SCO_BASE_PREFERENCES = {} # { URL: sco_base_preferences instance }
def get_base_preferences(context):
"""Return global preferences for this context"""
u = context.ScoURL()
u = scu.ScoURL()
if not u in _SCO_BASE_PREFERENCES:
_SCO_BASE_PREFERENCES[u] = sco_base_preferences(context)
return _SCO_BASE_PREFERENCES[u]
@ -2063,7 +2063,7 @@ function set_global_pref(el, pref_name) {
submitlabel="Enregistrer les modifications",
)
dest_url = (
self.context.NotesURL()
self.scu.NotesURL()
+ "/formsemestre_status?formsemestre_id=%s" % self.formsemestre_id
)
if tf[0] == 0:
@ -2116,7 +2116,7 @@ function set_global_pref(el, pref_name) {
)
elif destination == "global":
return REQUEST.RESPONSE.redirect(
self.context.ScoURL() + "/edit_preferences"
self.scu.ScoURL() + "/edit_preferences"
)

View File

@ -433,7 +433,7 @@ def pvjury_table(
"code_nip": e["identite"]["code_nip"],
"nomprenom": e["identite"]["nomprenom"],
"_nomprenom_target": "%s/ficheEtud?etudid=%s"
% (context.ScoURL(), e["identite"]["etudid"]),
% (scu.ScoURL(), e["identite"]["etudid"]),
"_nomprenom_td_attrs": 'id="%s" class="etudinfo"' % e["identite"]["etudid"],
"parcours": e["parcours"],
"decision": _descr_decision_sem_abbrev(

View File

@ -201,7 +201,7 @@ class CourrierIndividuelTemplate(PageTemplate):
self.logo_header = None
# Search logos in dept specific dir, then in global scu.CONFIG dir
for image_dir in (
scu.SCODOC_LOGOS_DIR + "/logos_" + sco_core.get_dept_id() + "/",
scu.SCODOC_LOGOS_DIR + "/logos_" + scu.get_dept_id() + "/",
scu.SCODOC_LOGOS_DIR + "/", # global logos
):
for suffix in scu.LOGOS_IMAGES_ALLOWED_TYPES:

View File

@ -126,7 +126,7 @@ def formsemestre_recapcomplet(
H.append(
"""(cliquer sur un nom pour afficher son bulletin ou <a class="stdlink" href="%s/Notes/formsemestre_bulletins_pdf?formsemestre_id=%s">ici avoir le classeur papier</a>)"""
% (context.ScoURL(), formsemestre_id)
% (scu.ScoURL(), formsemestre_id)
)
if not parcours.UE_IS_MODULE:
H.append(
@ -165,7 +165,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 context._can_validate_sem(REQUEST, formsemestre_id):
if sco_permcan_validate_semdate_sem(context, REQUEST, formsemestre_id):
H.append("<p>")
if modejury:
H.append(

View File

@ -965,7 +965,7 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
# Le formulaire de saisie des notes:
destination = "%s/Notes/moduleimpl_status?moduleimpl_id=%s" % (
context.ScoURL(),
scu.ScoURL(),
E["moduleimpl_id"],
)
form = _form_saisie_notes(

View File

@ -55,6 +55,8 @@ except ImportError:
from PIL import Image as PILImage
from flask import g, url_for
from VERSION import SCOVERSION
import VERSION
@ -319,6 +321,63 @@ LOGOS_IMAGES_ALLOWED_TYPES = ("jpg", "png") # remind that PIL does not read pdf
TYPE_ADMISSION_DEFAULT = "Inconnue"
TYPES_ADMISSION = (TYPE_ADMISSION_DEFAULT, "APB", "APB-PC", "CEF", "Direct")
# Support for ScoDoc7 compatibility
def get_dept_id():
if g.scodoc_dept in sco_mgr.get_dept_ids():
return g.scodoc_dept
raise ScoInvalidDept("département invalide: %s" % g.scodoc_dept)
def ScoURL():
"""base URL for this sco instance.
e.g. https://scodoc.xxx.fr/ScoDoc/DEPT/Scolarite
= page accueil département
"""
return url_for("scolar.index_html", scodoc_dept=g.scodoc_dept)[
: -len("/index_html")
].encode(SCO_ENCODING)
def NotesURL():
"""URL of Notes
e.g. https://scodoc.xxx.fr/ScoDoc/DEPT/Scolarite/Notes
= url de base des méthodes de notes
(page accueil programmes).
"""
return url_for("notes.index_html", scodoc_dept=g.scodoc_dept)[
: -len("/index_html")
].encode(SCO_ENCODING)
def EntreprisesURL():
"""URL of Enterprises
e.g. https://scodoc.xxx.fr/ScoDoc/DEPT/Scolarite/Entreprises
= url de base des requêtes de ZEntreprises
et page accueil Entreprises
"""
return "NotImplemented".encode(SCO_ENCODING)
# url_for("entreprises.index_html", scodoc_dept=g.scodoc_dept)[
# : -len("/index_html")
# ]
def AbsencesURL():
"""URL of Absences"""
return url_for("absences.index_html", scodoc_dept=g.scodoc_dept)[
: -len("/index_html")
].encode(SCO_ENCODING)
def UsersURL():
"""URL of Users
e.g. https://scodoc.xxx.fr/ScoDoc/DEPT/Scolarite/Users
= url de base des requêtes ZScoUsers
et page accueil users
"""
return "NotImplemented"
# ---- Simple python utilities

View File

@ -911,7 +911,7 @@ def fillEtudsInfo(context, etuds):
# open('/tmp/t','w').write( str(etuds) )
for etud in etuds:
etudid = etud["etudid"]
etud["dept"] = sco_core.get_dept_id()
etud["dept"] = scu.get_dept_id()
adrs = adresse_list(cnx, {"etudid": etudid})
if not adrs:
# certains "vieux" etudiants n'ont pas d'adresse

View File

@ -121,9 +121,7 @@ def _toboolean(x):
#
# --------------------------------------------------------------------
sco_publish(
"/absences_index_html", sco_abs_views.absences_index_html, Permission.ScoView
)
sco_publish("/index_html", sco_abs_views.index_html, Permission.ScoView)
sco_publish("/EtatAbsences", sco_abs_views.EtatAbsences, Permission.ScoView)
sco_publish("/CalAbs", sco_abs_views.CalAbs, Permission.ScoView)
sco_publish(
@ -1677,7 +1675,7 @@ def AddBilletAbsenceForm(context, etudid, REQUEST=None):
if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(context.ScoURL())
return REQUEST.RESPONSE.redirect(scu.ScoURL())
else:
e = tf[2]["begin"].split("/")
begin = e[2] + "-" + e[1] + "-" + e[0] + " 00:00:00"
@ -1955,7 +1953,7 @@ def ProcessBilletAbsenceForm(context, billet_id, REQUEST=None):
return "\n".join(H) + "<br/>" + tf[1] + F + context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(context.ScoURL())
return REQUEST.RESPONSE.redirect(scu.ScoURL())
else:
n = context._ProcessBilletAbsence(
billet, tf[2]["estjust"], tf[2]["description"], REQUEST

1304
app/views/entreprises.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -75,6 +75,7 @@ from app.scodoc.sco_permissions import Permission, ScoImplement
from app.scodoc.TrivialFormulator import TrivialFormulator
from app.scodoc import sco_core
from app.scodoc import htmlutils
from app.scodoc import html_sco_header
from app.scodoc import notes_table
from app.scodoc import pe_view
from app.scodoc import sco_apogee_compare
@ -501,7 +502,7 @@ def formation_import_xml_form(context, REQUEST):
if tf[0] == 0:
return "\n".join(H) + tf[1] + footer
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(context.NotesURL())
return REQUEST.RESPONSE.redirect(scu.NotesURL())
else:
formation_id, _, _ = context.formation_import_xml(tf[2]["xmlfile"], REQUEST)
@ -660,7 +661,7 @@ def _do_ue_delete(context, ue_id, delete_validations=False, REQUEST=None, force=
#
if not force:
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ue_list?formation_id=" + str(ue["formation_id"])
scu.NotesURL() + "/ue_list?formation_id=" + str(ue["formation_id"])
)
else:
return None
@ -1897,7 +1898,7 @@ def formsemestre_desinscription(
return (
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>'
% (context.ScoURL(), etudid)
% (scu.ScoURL(), etudid)
+ context.sco_footer(REQUEST)
)
@ -1979,7 +1980,7 @@ def etud_desinscrit_ue(context, etudid, formsemestre_id, ue_id, REQUEST=None):
context, etudid, formsemestre_id, ue_id, REQUEST=REQUEST
)
return REQUEST.RESPONSE.redirect(
context.ScoURL()
scu.ScoURL()
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
+ formsemestre_id
)
@ -1994,7 +1995,7 @@ def etud_inscrit_ue(context, etudid, formsemestre_id, ue_id, REQUEST=None):
context, etudid, formsemestre_id, ue_id, REQUEST=REQUEST
)
return REQUEST.RESPONSE.redirect(
context.ScoURL()
scu.ScoURL()
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
+ formsemestre_id
)
@ -2298,7 +2299,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
context.ScoURL()
scu.ScoURL()
+ "/Notes/moduleimpl_status?moduleimpl_id="
+ E["moduleimpl_id"]
)
@ -2309,7 +2310,7 @@ def evaluation_delete(context, REQUEST, evaluation_id):
+ """<p>OK, évaluation supprimée.</p>
<p><a class="stdlink" href="%s">Continuer</a></p>"""
% (
context.ScoURL()
scu.ScoURL()
+ "/Notes/moduleimpl_status?moduleimpl_id="
+ E["moduleimpl_id"]
)
@ -2822,38 +2823,7 @@ def appreciation_add_form(
return REQUEST.RESPONSE.redirect(bull_url)
def _can_edit_pv(context, REQUEST, formsemestre_id):
"Vrai si utilisateur peut editer un PV de jury de ce semestre"
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
if context._is_chef_or_diretud(REQUEST, 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, context)
# --- FORMULAIRE POUR VALIDATION DES UE ET SEMESTRES
def _can_validate_sem(context, REQUEST, formsemestre_id):
"Vrai si utilisateur peut saisir decision de jury dans ce semestre"
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
if sem["etat"] != "1":
return False # semestre verrouillé
return context._is_chef_or_diretud(REQUEST, sem)
def _is_chef_or_diretud(context, REQUEST, sem):
"Vrai si utilisateur est admin, chef dept ou responsable du semestre"
authuser = REQUEST.AUTHENTICATED_USER
if authuser.has_permission(Permission.ScoImplement, context):
return True # admin, chef dept
uid = str(authuser)
if uid in sem["responsables"]:
return True
return False
@bp.route("/formsemestre_validation_etud_form")
@ -2870,7 +2840,7 @@ def formsemestre_validation_etud_form(
REQUEST=None,
):
"Formulaire choix jury pour un étudiant"
readonly = not context._can_validate_sem(REQUEST, formsemestre_id)
readonly = not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id)
return sco_formsemestre_validation.formsemestre_validation_etud_form(
context,
formsemestre_id,
@ -2897,12 +2867,12 @@ def formsemestre_validation_etud(
REQUEST=None,
):
"Enregistre choix jury pour un étudiant"
if not context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
@ -2933,12 +2903,12 @@ def formsemestre_validation_etud_manu(
REQUEST=None,
):
"Enregistre choix jury pour un étudiant"
if not context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
@ -2963,12 +2933,12 @@ def formsemestre_validate_previous_ue(
context, formsemestre_id, etudid=None, REQUEST=None
):
"Form. saisie UE validée hors ScoDoc "
if not context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
return sco_formsemestre_validation.formsemestre_validate_previous_ue(
@ -2990,12 +2960,12 @@ def formsemestre_ext_edit_ue_validations(
context, formsemestre_id, etudid=None, REQUEST=None
):
"Form. edition UE semestre extérieur"
if not context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
return sco_formsemestre_exterieurs.formsemestre_ext_edit_ue_validations(
@ -3015,12 +2985,12 @@ 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 context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
return sco_formsemestre_validation.etud_ue_suppress_validation(
@ -3033,12 +3003,12 @@ 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 context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
@ -3052,12 +3022,12 @@ 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 context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
@ -3071,12 +3041,12 @@ def do_formsemestre_validation_auto(context, formsemestre_id, REQUEST):
@scodoc7func(context)
def formsemestre_fix_validation_ues(context, formsemestre_id, REQUEST=None):
"Verif/reparation codes UE"
if not context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
@ -3092,12 +3062,12 @@ def formsemestre_validation_suppress_etud(
context, formsemestre_id, etudid, REQUEST=None, dialog_confirmed=False
):
"""Suppression des decisions de jury pour un etudiant."""
if not context._can_validate_sem(REQUEST, formsemestre_id):
if not sco_permissions.can_validate_sem(context, REQUEST, formsemestre_id):
return scu.confirm_dialog(
context,
message="<p>Opération non autorisée pour %s</h2>"
% REQUEST.AUTHENTICATED_USER,
dest_url=context.ScoURL(),
dest_url=scu.ScoURL(),
REQUEST=REQUEST,
)
if not dialog_confirmed:
@ -3138,7 +3108,7 @@ def formsemestre_validation_suppress_etud(
context, formsemestre_id, etudid
)
return REQUEST.RESPONSE.redirect(
context.ScoURL()
scu.ScoURL()
+ "/Notes/formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&head_message=Décision%%20supprimée"
% (formsemestre_id, etudid)
)

View File

@ -299,7 +299,7 @@ def rssnews(context, REQUEST=None):
return sco_news.scolar_news_summary_rss(
context,
"Nouvelles de " + sco_preferences.get_preference(context, "DeptName"),
context.ScoURL(),
scu.ScoURL(),
)
@ -489,13 +489,6 @@ sco_publish(
# Debouche / devenir etudiant
# vrai si l'utilisateur peut modifier les informations de suivi sur la page etud"
def can_edit_suivi(context, REQUEST=None):
authuser = REQUEST.AUTHENTICATED_USER
return authuser.has_permission(Permission.ScoEtudChangeAdr, context)
sco_publish(
"/itemsuivi_suppress", sco_debouche.itemsuivi_suppress, Permission.ScoEtudChangeAdr
)
@ -542,35 +535,12 @@ def doAddAnnotation(context, etudid, comment, REQUEST):
return REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid)
@bp.route("/canSuppressAnnotation")
@permission_required(Permission.ScoView)
@scodoc7func(context)
def canSuppressAnnotation(context, annotation_id, REQUEST):
"""True if current user can suppress this annotation
Seuls l'auteur de l'annotation et le chef de dept peuvent supprimer
une annotation.
"""
cnx = context.GetDBConnexion()
annos = scolars.etud_annotations_list(cnx, args={"id": annotation_id})
if len(annos) != 1:
raise ScoValueError("annotation inexistante !")
anno = annos[0]
authuser = REQUEST.AUTHENTICATED_USER
# note: les anciennes installations n'ont pas le role ScoEtudSupprAnnotations
# c'est pourquoi on teste aussi ScoEtudInscrit (normalement détenue par le chef)
return (
(str(authuser) == anno["zope_authenticated_user"])
or authuser.has_permission(Permission.ScoEtudSupprAnnotations, context)
or authuser.has_permission(Permission.ScoEtudInscrit, context)
)
@bp.route("/doSuppressAnnotation")
@permission_required(Permission.ScoView)
@scodoc7func(context)
def doSuppressAnnotation(context, etudid, annotation_id, REQUEST):
"""Suppression annotation."""
if not context.canSuppressAnnotation(annotation_id, REQUEST):
if not sco_permissions.can_suppress_annotation(context, annotation_id, REQUEST):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
cnx = context.GetDBConnexion()
@ -643,7 +613,7 @@ def formChangeCoordonnees(context, etudid, REQUEST):
initvalues=adr,
submitlabel="Valider le formulaire",
)
dest_url = context.ScoURL() + "/ficheEtud?etudid=" + etudid
dest_url = scu.ScoURL() + "/ficheEtud?etudid=" + etudid
if tf[0] == 0:
return header + "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1:
@ -759,7 +729,7 @@ def formChangePhoto(context, etudid=None, REQUEST=None):
submitlabel="Valider",
cancelbutton="Annuler",
)
dest_url = context.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
dest_url = scu.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
if tf[0] == 0:
return (
"\n".join(H)
@ -799,7 +769,7 @@ def formSuppressPhoto(context, etudid=None, REQUEST=None, dialog_confirmed=False
sco_photos.suppress_photo(context, etud, REQUEST=REQUEST)
return REQUEST.RESPONSE.redirect(
context.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
scu.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
)
@ -1531,7 +1501,7 @@ def etudident_delete(context, etudid, dialog_confirmed=False, REQUEST=None):
if to_inval:
context.Notes._inval_cache(formsemestre_id_list=to_inval) # >
return REQUEST.RESPONSE.redirect(
context.ScoURL() + r"?head_message=Etudiant%20supprimé"
scu.ScoURL() + r"?head_message=Etudiant%20supprimé"
)
@ -1683,12 +1653,11 @@ def form_students_import_excel(context, REQUEST, formsemestre_id=None):
if formsemestre_id:
sem = sco_formsemestre.get_formsemestre(context.Notes, formsemestre_id)
dest_url = (
context.ScoURL()
+ "/formsemestre_status?formsemestre_id=%s" % formsemestre_id
scu.ScoURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id
)
else:
sem = None
dest_url = context.ScoURL()
dest_url = scu.ScoURL()
if sem and sem["etat"] != "1":
raise ScoValueError("Modification impossible: semestre verrouille")
H = [
@ -1729,7 +1698,7 @@ def form_students_import_excel(context, REQUEST, formsemestre_id=None):
(qui doit avoir été créé au préalable). <a class="stdlink" href="%s?showcodes=1">Cliquez ici pour afficher les codes</a>
</p>
"""
% (context.ScoURL())
% (scu.ScoURL())
)
H.append("""<ol><li>""")
@ -1951,7 +1920,7 @@ def form_students_import_infos_admissions(context, REQUEST, formsemestre_id=None
return "\n".join(H) + tf[1] + help_text + F
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
context.ScoURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
scu.ScoURL() + "/formsemestre_status?formsemestre_id=" + formsemestre_id
)
else:
return context._students_import_admission(