From fca2740518464b900bd95da3a006408bc780913d Mon Sep 17 00:00:00 2001 From: IDK Date: Wed, 24 Feb 2021 09:18:53 +0100 Subject: [PATCH] Fix: URL --- ZScolar.py | 4 ++++ html_sidebar.py | 21 ++++++++++----------- sco_dept.py | 17 +++++++++++------ sco_evaluations.py | 4 +++- sco_formsemestre_custommenu.py | 2 +- sco_formsemestre_edit.py | 2 +- sco_formsemestre_status.py | 5 +---- sco_formsemestre_validation.py | 8 ++++---- sco_preferences.py | 2 +- 9 files changed, 36 insertions(+), 29 deletions(-) diff --git a/ZScolar.py b/ZScolar.py index 6cc176cce..ad1672963 100644 --- a/ZScolar.py +++ b/ZScolar.py @@ -394,6 +394,10 @@ REQUEST.URL0=%s
""" return self.ScoURL() + "/Entreprises" + def AbsencesURL(self): + """URL of Absences""" + return self.ScoURL() + "/Absences" + def UsersURL(self): """URL of Users e.g. https://scodoc.xxx.fr/ScoDoc/DEPT/Scolarite/Users diff --git a/html_sidebar.py b/html_sidebar.py index 0079b562c..5fc75035d 100644 --- a/html_sidebar.py +++ b/html_sidebar.py @@ -42,7 +42,13 @@ Génération de la "sidebar" (marge gauche des pages HTML) def sidebar_common(context, REQUEST=None): "partie commune a toutes les sidebar" authuser = REQUEST.AUTHENTICATED_USER - params = {"ScoURL": context.ScoURL(), "authuser": str(authuser)} + params = { + "ScoURL": context.ScoURL(), + "UsersURL": context.UsersURL(), + "NotesURL": context.NotesURL(), + "AbsencesURL": context.AbsencesURL(), + "authuser": str(authuser), + } H = [ 'ScoDoc', '
%(authuser)s
déconnexion
' @@ -50,8 +56,8 @@ def sidebar_common(context, REQUEST=None): context.sidebar_dept(REQUEST), """

Scolarité

Semestres
- Programmes
- Absences
+ Programmes
+ Absences
""" % params, ] @@ -60,14 +66,7 @@ def sidebar_common(context, REQUEST=None): ScoUsersView, context ): H.append( - """Utilisateurs
""" - % params - ) - - if 0: # XXX experimental - H.append( - """Services
""" - % params + """Utilisateurs
""" % params ) if authuser.has_permission(ScoChangePreferences, context): diff --git a/sco_dept.py b/sco_dept.py index 7564ab2a5..b19418339 100644 --- a/sco_dept.py +++ b/sco_dept.py @@ -129,11 +129,12 @@ def index_html(context, REQUEST=None, showcodes=0, showsemtable=0): ) H.append( - """

+ """

Chercher étape courante:

""" + % context.NotesURL() ) # authuser = REQUEST.AUTHENTICATED_USER @@ -155,9 +156,10 @@ Chercher étape courante:

Exports Apogée

""" + % context.NotesURL() ) # H.append( @@ -175,9 +177,9 @@ Chercher étape courante: %(tmpcode)s - %(lockimg)s %(groupicon)s + %(lockimg)s %(groupicon)s %(mois_debut)s- %(mois_fin)s - %(titre_num)s + %(titre_num)s (%(responsable_name)s) @@ -199,6 +201,7 @@ def _sem_table(context, sems): cur_idx = sem["semestre_id"] else: sem["trclass"] = "" + sem["notes_url"] = context.NotesURL() H.append(tmpl % sem) H.append("") return "\n".join(H) @@ -245,14 +248,16 @@ 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["_groupicon_target"] = ( - "Notes/formsemestre_status?formsemestre_id=%(formsemestre_id)s" % sem + "%(notes_url)s/formsemestre_status?formsemestre_id=%(formsemestre_id)s" + % sem ) sem["_formsemestre_id_class"] = "blacktt" sem["dash_mois_fin"] = ' %(anneescolaire)s' % sem sem["_dash_mois_fin_class"] = "datesem" sem["titre_resp"] = ( - """%(titre_num)s + """%(titre_num)s (%(responsable_name)s)""" % sem ) diff --git a/sco_evaluations.py b/sco_evaluations.py index 21595fe0d..0c5bdc769 100644 --- a/sco_evaluations.py +++ b/sco_evaluations.py @@ -108,7 +108,9 @@ def do_evaluation_delete(context, REQUEST, evaluation_id): # news mod = context.do_module_list(args={"module_id": M["module_id"]})[0] mod["moduleimpl_id"] = M["moduleimpl_id"] - mod["url"] = "Notes/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod + mod["url"] = ( + context.NotesURL() + "/moduleimpl_status?moduleimpl_id=%(moduleimpl_id)s" % mod + ) sco_news.add( context, REQUEST, diff --git a/sco_formsemestre_custommenu.py b/sco_formsemestre_custommenu.py index ae828c8de..5918a9c33 100644 --- a/sco_formsemestre_custommenu.py +++ b/sco_formsemestre_custommenu.py @@ -81,7 +81,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 + context.NotesURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id ) H = [ context.html_sem_header(REQUEST, "Modification du menu du semestre ", sem), diff --git a/sco_formsemestre_edit.py b/sco_formsemestre_edit.py index 0c10c1417..86692b086 100644 --- a/sco_formsemestre_edit.py +++ b/sco_formsemestre_edit.py @@ -1265,7 +1265,7 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None): elif tf[0] == -1: # cancel return REQUEST.RESPONSE.redirect( context.NotesURL() - + "formsemestre_status?formsemestre_id=" + + "/formsemestre_status?formsemestre_id=" + formsemestre_id ) else: diff --git a/sco_formsemestre_status.py b/sco_formsemestre_status.py index 99267a291..3ff709d2f 100644 --- a/sco_formsemestre_status.py +++ b/sco_formsemestre_status.py @@ -505,10 +505,7 @@ def formsemestre_page_title(context, REQUEST): def fill_formsemestre(context, sem, REQUEST=None): """Add some useful fields to help display formsemestres""" - # Notes URL - notes_url = context.absolute_url() - if "/Notes" not in notes_url: - notes_url += "/Notes" + notes_url = context.NotesURL() sem["notes_url"] = notes_url formsemestre_id = sem["formsemestre_id"] if sem["etat"] != "1": diff --git a/sco_formsemestre_validation.py b/sco_formsemestre_validation.py index 97b67a6f3..151abaa23 100644 --- a/sco_formsemestre_validation.py +++ b/sco_formsemestre_validation.py @@ -1163,8 +1163,8 @@ def formsemestre_validate_previous_ue(context, formsemestre_id, etudid, REQUEST= return "\n".join(H) + tf[1] + X + warn + context.sco_footer(REQUEST) elif tf[0] == -1: return REQUEST.RESPONSE.redirect( - context.ScoURL() - + "/Notes/formsemestre_status?formsemestre_id=" + context.NotesURL() + + "/formsemestre_status?formsemestre_id=" + formsemestre_id ) else: @@ -1310,8 +1310,8 @@ 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.ScoURL() - + "/Notes/formsemestre_validate_previous_ue?etudid=%s&formsemestre_id=%s" + context.NotesURL() + + "/formsemestre_validate_previous_ue?etudid=%s&formsemestre_id=%s" % (etudid, formsemestre_id) ) diff --git a/sco_preferences.py b/sco_preferences.py index 49b29ff93..3b356cf5d 100644 --- a/sco_preferences.py +++ b/sco_preferences.py @@ -2047,7 +2047,7 @@ function set_global_pref(el, pref_name) { ) dest_url = ( self.context.NotesURL() - + "formsemestre_status?formsemestre_id=%s" % self.formsemestre_id + + "/formsemestre_status?formsemestre_id=%s" % self.formsemestre_id ) if tf[0] == 0: return "\n".join(H) + tf[1] + self.context.sco_footer(REQUEST)