Replaced Zope URL1 and URL2

This commit is contained in:
IDK 2021-02-07 09:10:26 +01:00
parent 860ca5d8f7
commit 154e7bf3e8
18 changed files with 160 additions and 111 deletions

View File

@ -239,7 +239,7 @@ def students_import_excel(
if formsemestre_id:
dest = "formsemestre_status?formsemestre_id=%s" % formsemestre_id
else:
dest = REQUEST.URL1
dest = context.NotesURL()
H = [context.sco_header(REQUEST, page_title="Import etudiants")]
H.append("<ul>")
for d in diag:

View File

@ -56,7 +56,7 @@ import cgi
import jaxml
# ---------------
from sco_zope import *
from sco_zope import * # pylint: disable=unused-wildcard-import
# ---------------
import sco_utils as scu
@ -1604,7 +1604,7 @@ ou entrez une date pour visualiser les absents un jour donné&nbsp;:
if tf[0] == 0:
return "\n".join(H) + tf[1] + self.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(self.ScoURL())
else:
e = tf[2]["begin"].split("/")
begin = e[2] + "-" + e[1] + "-" + e[0] + " 00:00:00"
@ -1865,7 +1865,7 @@ ou entrez une date pour visualiser les absents un jour donné&nbsp;:
return "\n".join(H) + "<br/>" + tf[1] + F + self.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(self.ScoURL())
else:
n = self._ProcessBilletAbsence(
billet, tf[2]["estjust"], tf[2]["description"], REQUEST

View File

@ -296,7 +296,7 @@ class ZEntreprises(
c[
"_date_target"
] = "%s/entreprise_contact_edit?entreprise_contact_id=%s" % (
REQUEST.URL1,
self.EntreprisesURL(),
c["entreprise_contact_id"],
)
c["entreprise"] = sco_entreprises.do_entreprise_list(
@ -306,7 +306,7 @@ class ZEntreprises(
c["etud"] = self.getEtudInfo(etudid=c["etudid"], filled=1)[0]
c["etudnom"] = c["etud"]["nomprenom"]
c["_etudnom_target"] = "%s/ficheEtud?etudid=%s" % (
REQUEST.URL1,
self.ScoURL(),
c["etudid"],
)
else:
@ -374,7 +374,7 @@ class ZEntreprises(
c[
"_nomprenom_target"
] = "%s/entreprise_correspondant_edit?entreprise_corresp_id=%s" % (
REQUEST.URL1,
self.EntreprisesURL(),
c["entreprise_corresp_id"],
)
@ -462,7 +462,7 @@ class ZEntreprises(
)[0]
link_create_corr = (
'<a href="%s/entreprise_correspondant_create?entreprise_id=%s">créer un nouveau correspondant</a>'
% (REQUEST.URL1, c["entreprise_id"])
% (self.EntreprisesURL(), c["entreprise_id"])
)
E = sco_entreprises.do_entreprise_list(
self, args={"entreprise_id": c["entreprise_id"]}
@ -562,7 +562,7 @@ class ZEntreprises(
% entreprise_contact_id
)
elif tf[0] == -1:
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
else:
etudok = sco_entreprises.do_entreprise_check_etudiant(
self, tf[2]["etudiant"]
@ -573,7 +573,7 @@ class ZEntreprises(
tf[2].update({"etudid": etudok[1]})
sco_entreprises.do_entreprise_contact_edit(self, tf[2])
REQUEST.RESPONSE.redirect(
REQUEST.URL1
self.EntreprisesURL()
+ "/entreprise_contact_list?entreprise_id="
+ str(c["entreprise_id"])
)
@ -682,13 +682,13 @@ class ZEntreprises(
elif tf[0] == -1:
REQUEST.RESPONSE.redirect(
"%s/entreprise_correspondant_list?entreprise_id=%s"
% (REQUEST.URL1, c["entreprise_id"])
% (self.EntreprisesURL(), c["entreprise_id"])
)
else:
sco_entreprises.do_entreprise_correspondant_edit(self, tf[2])
REQUEST.RESPONSE.redirect(
"%s/entreprise_correspondant_list?entreprise_id=%s"
% (REQUEST.URL1, c["entreprise_id"])
% (self.EntreprisesURL(), c["entreprise_id"])
)
H.append(entreprise_footer(self, REQUEST))
return "\n".join(H)
@ -708,7 +708,7 @@ class ZEntreprises(
curtime = time.strftime("%d/%m/%Y")
link_create_corr = (
'<a href="%s/entreprise_correspondant_create?entreprise_id=%s">créer un nouveau correspondant</a>'
% (REQUEST.URL1, entreprise_id)
% (self.EntreprisesURL(), entreprise_id)
)
H = [
entreprise_header(self, REQUEST=REQUEST, page_title="Suivi entreprises"),
@ -789,7 +789,7 @@ class ZEntreprises(
if tf[0] == 0:
H.append(tf[1])
elif tf[0] == -1:
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
else:
etudok = sco_entreprises.do_entreprise_check_etudiant(
self, tf[2]["etudiant"]
@ -799,7 +799,7 @@ class ZEntreprises(
else:
tf[2].update({"etudid": etudok[1]})
sco_entreprises.do_entreprise_contact_create(self, tf[2])
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
H.append(entreprise_footer(self, REQUEST))
return "\n".join(H)
@ -828,12 +828,12 @@ class ZEntreprises(
if tf[0] == 0:
H.append(tf[1])
elif tf[0] == -1:
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
else:
sco_entreprises.do_entreprise_contact_delete(
self, c["entreprise_contact_id"]
)
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
H.append(entreprise_footer(self, REQUEST))
return "\n".join(H)
@ -935,10 +935,10 @@ class ZEntreprises(
if tf[0] == 0:
H.append(tf[1])
elif tf[0] == -1:
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
else:
sco_entreprises.do_entreprise_correspondant_create(self, tf[2])
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
H.append(entreprise_footer(self, REQUEST))
return "\n".join(H)
@ -967,12 +967,12 @@ class ZEntreprises(
if tf[0] == 0:
H.append(tf[1])
elif tf[0] == -1:
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
else:
sco_entreprises.do_entreprise_correspondant_delete(
self, c["entreprise_corresp_id"]
)
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
H.append(entreprise_footer(self, REQUEST))
return "\n".join(H)
@ -1025,10 +1025,10 @@ class ZEntreprises(
if tf[0] == 0:
H.append(tf[1])
elif tf[0] == -1:
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
else:
sco_entreprises.do_entreprise_delete(self, E["entreprise_id"])
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(self.EntreprisesURL())
H.append(entreprise_footer(self, REQUEST))
return "\n".join(H)
@ -1120,10 +1120,10 @@ class ZEntreprises(
if tf[0] == 0:
return "\n".join(H) + tf[1] + entreprise_footer(self, REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
else:
sco_entreprises.do_entreprise_create(self, tf[2])
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(self.EntreprisesURL())
security.declareProtected(ScoEntrepriseView, "entreprise_edit")
@ -1295,7 +1295,7 @@ class ZEntreprises(
H.append("</ul>")
return "\n".join(H) + entreprise_footer(self, REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "?start=" + start)
return REQUEST.RESPONSE.redirect(self.EntreprisesURL() + "?start=" + start)
else:
sco_entreprises.do_entreprise_edit(self, tf[2])
return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "?start=" + start)
return REQUEST.RESPONSE.redirect(self.EntreprisesURL() + "?start=" + start)

View File

@ -257,10 +257,12 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
sco_formsemestre_edit.formsemestre_createwithmodules
)
security.declareProtected(ScoView, "formsemestre_editwithmodules")
security.declareProtected(
ScoView, "formsemestre_editwithmodules"
) # controle d'acces specifique pour dir. etud
formsemestre_editwithmodules = sco_formsemestre_edit.formsemestre_editwithmodules
security.declareProtected(ScoView, "formsemestre_clone")
security.declareProtected(ScoImplement, "formsemestre_clone")
formsemestre_clone = sco_formsemestre_edit.formsemestre_clone
security.declareProtected(ScoChangeFormation, "formsemestre_associate_new_version")
@ -521,7 +523,7 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
if tf[0] == 0:
return "\n".join(H) + tf[1] + footer
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(self.NotesURL())
else:
formation_id, _, _ = self.formation_import_xml(tf[2]["xmlfile"], REQUEST)
@ -675,7 +677,7 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
#
if not force:
return REQUEST.RESPONSE.redirect(
REQUEST.URL1 + "/ue_list?formation_id=" + str(ue["formation_id"])
self.NotesURL() + "/ue_list?formation_id=" + str(ue["formation_id"])
)
else:
return None

View File

@ -335,8 +335,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
return (
"<p>Département "
+ DeptId
+ """ supprimé du serveur web (la base de données n'est pas affectée)!</p><p><a href="%s">Continuer</a></p>"""
% REQUEST.URL1
+ """ supprimé du serveur web (la base de données n'est pas affectée)!</p><p><a href="/ScoDoc">Continuer</a></p>"""
)
_top_level_css = """
@ -973,5 +972,5 @@ def manage_addZScoDoc(self, id="ScoDoc", title="Site ScoDoc", REQUEST=None):
) # ne cree (presque rien), tout se passe lors du 1er accès
self._setObject(id, zscodoc)
if REQUEST is not None:
REQUEST.RESPONSE.redirect("%s/manage_workspace" % REQUEST.URL1)
REQUEST.RESPONSE.redirect("/ScoDoc/manage_workspace")
return id

View File

@ -792,11 +792,12 @@ class ZScoUsers(
descr,
initvalues=initvalues,
submitlabel=submitlabel,
cancelbutton="Annuler",
)
if tf[0] == 0:
return "\n".join(H) + "\n" + tf[1] + F
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(self.UsersURL())
else:
vals = tf[2]
roles = set(vals["roles"]).intersection(editable_roles)
@ -997,7 +998,7 @@ class ZScoUsers(
if tf[0] == 0:
return "\n".join(H) + tf[1] + "</li></ol>" + help + F
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(self.UsersURL())
else:
# IMPORT
diag = sco_import_users.import_excel_file(
@ -1006,7 +1007,9 @@ class ZScoUsers(
H = [head]
H.append("<p>Import excel: %s</p>" % diag)
H.append("<p>OK, import terminé !</p>")
H.append('<p><a class="stdlink" href="%s">Continuer</a></p>' % REQUEST.URL1)
H.append(
'<p><a class="stdlink" href="%s">Continuer</a></p>' % self.UsersURL()
)
return "\n".join(H) + help + F
security.declareProtected(ScoUsersAdmin, "import_users_generate_excel_sample")
@ -1037,7 +1040,7 @@ class ZScoUsers(
)
if REQUEST:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(self.UsersURL())
security.declareProtected(ScoUsersAdmin, "delete_user_form")
@ -1065,11 +1068,13 @@ class ZScoUsers(
% user_name,
dest_url="",
REQUEST=REQUEST,
cancel_url=REQUEST.URL1,
cancel_url=self.UsersURL(),
parameters={"user_name": user_name},
)
self._user_delete(user_name)
REQUEST.RESPONSE.redirect(REQUEST.URL1)
REQUEST.RESPONSE.redirect(
self.UsersURL() + r"?head_message=Utilisateur%20supprimé"
)
security.declareProtected(ScoView, "list_users")
@ -1260,8 +1265,8 @@ Il devra ensuite se connecter et le changer.
)
self.reset_password(user_name=user_name, REQUEST=REQUEST)
return REQUEST.RESPONSE.redirect(
REQUEST.URL1
+ "?head_message=mot%20de%20passe%20de%20"
self.UsersURL()
+ r"?head_message=mot%20de%20passe%20de%20"
+ user_name
+ "%20reinitialise"
)

View File

@ -294,11 +294,16 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
</head>
<body>
<p>
UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span class="span_ue_apo" style="display: inline" id="toto">VRTU11</span>)</span>
<span class="locked">[verrouillé]</span>
<tt>
REQUEST.URL=%s<br/>
REQUEST.URL0=%s<br/>
</tt>
</p>
</body>
"""
""" % (
REQUEST.URL,
REQUEST.URL0,
)
# return (
# self.sco_header(REQUEST)
# + """<div class="xp">%s</div>""" % x
@ -315,7 +320,7 @@ UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span
# raise NoteProcessError('test exception !')
# essai: liste des permissions
from AccessControl import getSecurityManager # pylint: disable=import-error
# from AccessControl import getSecurityManager # pylint: disable=import-error
from AccessControl.Permission import Permission # pylint: disable=import-error
permissions = self.ac_inherited_permissions(1)
@ -363,12 +368,40 @@ UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span
security.declareProtected(ScoView, "ScoURL")
def ScoURL(self):
"base URL for this sco instance"
"""base URL for this sco instance.
e.g. https://scodoc.xxx.fr/ScoDoc/DEPT/Scolarite
= page accueil département
"""
# absolute_url is the classic Zope method
# The avoid the burden of configuring a proxy zope object, we offer
# a custom configuration via scodoc_config
# XXX ne devrait pas marcher car l'URL dépend du département !!!
return scu.CONFIG.ABSOLUTE_URL or self.absolute_url()
def NotesURL(self):
"""URL of Notes
e.g. https://scodoc.xxx.fr/ScoDoc/DEPT/Scolarite/Notes
= url de base des requêtes de ZNotes
et page accueil programmes.
"""
return self.ScoURL() + "/Notes"
def EntreprisesURL(self):
"""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 self.ScoURL() + "/Entreprises"
def UsersURL(self):
"""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 self.ScoURL() + "/Users"
security.declareProtected(ScoView, "sco_header")
sco_header = html_sco_header.sco_header
security.declareProtected(ScoView, "sco_footer")
@ -1187,17 +1220,18 @@ UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span
initvalues=adr,
submitlabel="Valider le formulaire",
)
dest_url = self.ScoURL() + "/ficheEtud?etudid=" + etudid
if tf[0] == 0:
return header + "\n".join(H) + tf[1] + self.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(dest_url)
else:
if adrs:
scolars.adresse_edit(cnx, args=tf[2], context=self)
else:
scolars.adresse_create(cnx, args=tf[2])
logdb(REQUEST, cnx, method="changeCoordonnees", etudid=etudid)
REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid)
REQUEST.RESPONSE.redirect(dest_url)
# --- Gestion des groupes:
security.declareProtected(ScoView, "affectGroups")
@ -1310,6 +1344,7 @@ UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span
submitlabel="Valider",
cancelbutton="Annuler",
)
dest_url = self.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
if tf[0] == 0:
return (
"\n".join(H)
@ -1319,16 +1354,12 @@ UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span
+ self.sco_footer(REQUEST)
)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
REQUEST.URL1 + "/ficheEtud?etudid=" + etud["etudid"]
)
return REQUEST.RESPONSE.redirect(dest_url)
else:
data = tf[2]["photofile"].read()
status, diag = sco_photos.store_photo(self, etud, data, REQUEST=REQUEST)
if status != 0:
return REQUEST.RESPONSE.redirect(
self.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
)
return REQUEST.RESPONSE.redirect(dest_url)
else:
H.append('<p class="warning">Erreur:' + diag + "</p>")
return "\n".join(H) + self.sco_footer(REQUEST)
@ -1350,7 +1381,7 @@ UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span
sco_photos.suppress_photo(self, etud, REQUEST=REQUEST)
return REQUEST.RESPONSE.redirect(
REQUEST.URL1 + "/ficheEtud?etudid=" + etud["etudid"]
self.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
)
#
@ -2058,7 +2089,9 @@ UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span
to_inval = [s["formsemestre_id"] for s in etud["sems"]]
if to_inval:
self.Notes._inval_cache(formsemestre_id_list=to_inval) # >
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(
self.ScoURL() + r"?head_message=Etudiant%20supprimé"
)
security.declareProtected(ScoEtudInscrit, "check_group_apogee")
@ -2210,8 +2243,13 @@ UE11 Découverte métiers <span class="ue_code">(code UCOD46, 16 ECTS, Apo <span
"formulaire import xls"
if formsemestre_id:
sem = sco_formsemestre.get_formsemestre(self.Notes, formsemestre_id)
dest_url = (
self.ScoURL()
+ "/formsemestre_status?formsemestre_id=%s" % formsemestre_id
)
else:
sem = None
dest_url = self.ScoURL()
if sem and sem["etat"] != "1":
raise ScoValueError("Modification impossible: semestre verrouille")
H = [
@ -2327,7 +2365,7 @@ Les champs avec un astérisque (*) doivent être présents (nulls non autorisés
if tf[0] == 0:
return "\n".join(H) + tf[1] + "</li></ol>" + "\n".join(S) + F
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(dest_url)
else:
return ImportScolars.students_import_excel(
self,
@ -2464,7 +2502,11 @@ Les champs avec un astérisque (*) doivent être présents (nulls non autorisés
if tf[0] == 0:
return "\n".join(H) + tf[1] + help_text + F
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(
self.ScoURL()
+ "/formsemestre_status?formsemestre_id="
+ formsemestre_id
)
else:
return self._students_import_admission(
tf[2]["csvfile"],
@ -2673,7 +2715,7 @@ def manage_addZScolarForm(context, DeptId, REQUEST=None):
if tf[0] == 0:
return "\n".join(H) + tf[1] + context.standard_html_footer(context)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect("/ScoDoc")
else:
DeptId = tf[2]["DeptId"].strip()
db_cnx_string = tf[2]["db_cnx_string"].strip()

View File

@ -109,7 +109,6 @@ class DummyRequest:
self.AUTHENTICATED_USER = FakeUser("admin")
self.form = {}
self.URL = "http://scodoc/"
self.URL1 = self.URL
self.URL0 = self.URL
self.BASE0 = "localhost"
self.REMOTE_HOST = "localhost"

View File

@ -164,7 +164,9 @@ def etud_upload_file_form(context, REQUEST, etudid):
if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "/ficheEtud?etudid=" + etudid)
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ficheEtud?etudid=" + etudid
)
else:
data = tf[2]["datafile"].read()
descr = tf[2]["description"]
@ -172,7 +174,9 @@ 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(REQUEST.URL1 + "/ficheEtud?etudid=" + etudid)
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ficheEtud?etudid=" + etudid
)
def _store_etud_file_to_new_archive(

View File

@ -62,7 +62,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>' % REQUEST.URL1)
H.append('</ul><p><a href="%s">Revenir</a></p>' % context.NotesURL())
else:
if not dialog_confirmed:
return context.confirmDialog(
@ -73,7 +73,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
% F,
REQUEST=REQUEST,
OK="Supprimer cette formation",
cancel_url=REQUEST.URL1,
cancel_url=context.NotesURL(),
parameters={"formation_id": formation_id},
)
else:
@ -81,7 +81,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>"""
% REQUEST.URL1
% context.NotesURL()
)
H.append(context.sco_footer(REQUEST))
@ -191,7 +191,7 @@ def formation_edit(context, formation_id=None, create=False, REQUEST=None):
if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(context.NotesURL())
else:
# check unicity : constraint UNIQUE(acronyme,titre,version)
if create:

View File

@ -75,7 +75,7 @@ associé.
submitlabel="Créer cette matière",
)
dest_url = REQUEST.URL1 + "/ue_list?formation_id=" + UE["formation_id"]
dest_url = context.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"]
if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
@ -104,7 +104,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"])
tf = TrivialFormulator(
REQUEST.URL0,
REQUEST.form,
@ -116,12 +116,10 @@ def matiere_delete(context, matiere_id=None, REQUEST=None):
if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(dest_url)
else:
context.do_matiere_delete(matiere_id, REQUEST)
return REQUEST.RESPONSE.redirect(
REQUEST.URL1 + "/ue_list?formation_id=" + str(UE["formation_id"])
)
return REQUEST.RESPONSE.redirect(dest_url)
def matiere_edit(context, matiere_id=None, REQUEST=None):
@ -181,7 +179,7 @@ associé.
submitlabel="Modifier les valeurs",
)
dest_url = REQUEST.URL1 + "/ue_list?formation_id=" + U["formation_id"]
dest_url = context.NotesURL() + "/ue_list?formation_id=" + U["formation_id"]
if tf[0] == 0:
return "\n".join(H) + tf[1] + help + context.sco_footer(REQUEST)

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(
REQUEST.URL1 + "/ue_list?formation_id=" + UE["formation_id"]
context.NotesURL() + "/ue_list?formation_id=" + UE["formation_id"]
)
@ -191,7 +191,7 @@ def module_delete(context, module_id=None, REQUEST=None):
"""<h2>Suppression du module %(titre)s (%(code)s)</h2>""" % Mod,
]
dest_url = REQUEST.URL1 + "/ue_list?formation_id=" + Mod["formation_id"]
dest_url = context.NotesURL() + "/ue_list?formation_id=" + Mod["formation_id"]
tf = TrivialFormulator(
REQUEST.URL0,
REQUEST.form,
@ -240,7 +240,7 @@ def module_edit(context, module_id=None, REQUEST=None):
semestres_indices = range(1, parcours.NB_SEM + 1)
dest_url = REQUEST.URL1 + "/ue_list?formation_id=" + Mod["formation_id"]
dest_url = context.NotesURL() + "/ue_list?formation_id=" + Mod["formation_id"]
H = [
context.sco_header(

View File

@ -221,7 +221,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(
REQUEST.URL1 + "/ue_list?formation_id=" + formation_id
context.NotesURL() + "/ue_list?formation_id=" + formation_id
)

View File

@ -80,6 +80,9 @@ def formsemestre_custommenu_html(context, formsemestre_id, base_url=""):
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
)
H = [
context.html_sem_header(REQUEST, "Modification du menu du semestre ", sem),
"""<p class="help">Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.</p>
@ -126,7 +129,7 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
if tf[0] == 0:
return "\n".join(H) + "\n" + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(dest_url)
else:
# form submission
cnx = context.GetDBConnexion()
@ -153,6 +156,4 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
"url": tf[2]["url_" + custommenu_id],
},
)
REQUEST.RESPONSE.redirect(
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
)
REQUEST.RESPONSE.redirect(dest_url)

View File

@ -72,9 +72,7 @@ def formsemestre_createwithmodules(context, REQUEST=None):
def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
"""Page modification semestre"""
# portage from dtml
authuser = REQUEST.AUTHENTICATED_USER
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
H = [
context.html_sem_header(
REQUEST,
@ -711,7 +709,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
"formsemestre_id": formsemestre_id,
"responsable_id": tf[2][module_id],
}
mid = sco_moduleimpl.do_moduleimpl_create(context, modargs)
_ = sco_moduleimpl.do_moduleimpl_create(context, modargs)
return REQUEST.RESPONSE.redirect(
"formsemestre_status?formsemestre_id=%s&amp;head_message=Nouveau%%20semestre%%20créé"
% formsemestre_id
@ -848,7 +846,6 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None):
"""
Formulaire clonage d'un semestre
"""
authuser = REQUEST.AUTHENTICATED_USER
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
# Liste des enseignants avec forme pour affichage / saisie avec suggestion
userlist = context.Users.get_userlist()
@ -1019,7 +1016,7 @@ def do_formsemestre_clone(
args = e.copy()
del args["jour"] # erase date
args["moduleimpl_id"] = mid
evaluation_id = context.do_evaluation_create(REQUEST=REQUEST, **args)
_ = context.do_evaluation_create(REQUEST=REQUEST, **args)
# 3- copy uecoefs
objs = sco_formsemestre.formsemestre_uecoef_list(
@ -1028,7 +1025,7 @@ def do_formsemestre_clone(
for obj in objs:
args = obj.copy()
args["formsemestre_id"] = formsemestre_id
c = sco_formsemestre.formsemestre_uecoef_create(cnx, args)
_ = sco_formsemestre.formsemestre_uecoef_create(cnx, args)
# NB: don't copy notes_formsemestre_custommenu (usually specific)
@ -1051,7 +1048,7 @@ def do_formsemestre_clone(
for obj in objs:
args = obj.copy()
args["formsemestre_id"] = formsemestre_id
c = sco_compute_moy.formsemestre_ue_computation_expr_create(cnx, args)
_ = sco_compute_moy.formsemestre_ue_computation_expr_create(cnx, args)
# 5- Copy partitions
if clone_partitions:
@ -1061,7 +1058,6 @@ def do_formsemestre_clone(
for part in sco_groups.get_partitions_list(context, orig_formsemestre_id):
if part["partition_name"] != None:
partname = part["partition_name"]
orig_partition_id = part["partition_id"]
new_partition_id = sco_groups.partition_create(
context,
formsemestre_id,
@ -1081,7 +1077,7 @@ def do_formsemestre_clone(
if newpart["partition_id"] == g[0]:
part_id = g[0]
for group_name in g[1]:
group_id = sco_groups.createGroup(
_ = sco_groups.createGroup(
context, part_id, group_name=group_name, REQUEST=REQUEST
)
@ -1263,7 +1259,11 @@ def formsemestre_delete(context, formsemestre_id, REQUEST=None):
H.append(tf[1])
return "\n".join(H) + context.sco_footer(REQUEST)
elif tf[0] == -1: # cancel
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(
context.NotesURL()
+ "formsemestre_status?formsemestre_id="
+ formsemestre_id
)
else:
return REQUEST.RESPONSE.redirect(
"formsemestre_delete2?formsemestre_id=" + formsemestre_id
@ -1274,9 +1274,6 @@ def formsemestre_delete2(
context, formsemestre_id, dialog_confirmed=False, REQUEST=None
):
"""Delete a formsemestre (confirmation)"""
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
H = [context.html_sem_header(REQUEST, "Suppression du semestre", sem)]
# Confirmation dialog
if not dialog_confirmed:
return context.confirmDialog(
@ -1288,7 +1285,9 @@ def formsemestre_delete2(
)
# Bon, s'il le faut...
do_formsemestre_delete(context, formsemestre_id, REQUEST)
return REQUEST.RESPONSE.redirect(REQUEST.URL2 + "?head_message=Semestre%20supprimé")
return REQUEST.RESPONSE.redirect(
context.ScoURL() + "?head_message=Semestre%20supprimé"
)
def formsemestre_has_decisions_or_compensations(context, formsemestre_id):
@ -1491,7 +1490,6 @@ def formsemestre_edit_uecoefs(context, formsemestre_id, err_ue_id=None, REQUEST=
if not ok:
return err
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
footer = context.sco_footer(REQUEST)
help = """<p class="help">

View File

@ -1185,6 +1185,8 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
"""
partition = get_partition(context, partition_id)
formsemestre_id = partition["formsemestre_id"]
# renvoie sur page édition groupes
dest_url = "affectGroups?partition_id=%s" % partition_id
if not can_change_groups(context, REQUEST, formsemestre_id):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
@ -1225,7 +1227,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
if tf[0] == 0:
return "\n".join(H) + "\n" + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1)
return REQUEST.RESPONSE.redirect(dest_url)
else:
# form submission
log(
@ -1279,8 +1281,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
context, etudid, group_id, partition, REQUEST=REQUEST
)
log("%s in group %s" % (etudid, group_id))
# envoie sur page edition groupes
return REQUEST.RESPONSE.redirect("affectGroups?partition_id=%s" % partition_id)
return REQUEST.RESPONSE.redirect(dest_url)
def get_prev_moy(context, etudid, formsemestre_id):

View File

@ -217,7 +217,9 @@ def do_placement_selectetuds(context, REQUEST):
)
+ "&amp;".join(gs)
)
return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "/do_placement?" + query)
return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/do_placement?" + query
)
else:
raise ValueError(
"invalid placement_method (%s)" % tf[2]["placement_method"]

View File

@ -1943,13 +1943,13 @@ class sco_base_preferences:
if tf[0] == 0:
return "\n".join(H) + tf[1] + self.context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) # cancel
return REQUEST.RESPONSE.redirect(self.context.ScoURL()) # cancel
else:
for pref in PREFS:
self.prefs[None][pref[0]] = tf[2][pref[0]]
self.save()
return REQUEST.RESPONSE.redirect(
REQUEST.URL1 + "?head_message=Préférences modifiées"
self.context.ScoURL() + "?head_message=Préférences modifiées"
)
@ -1991,7 +1991,6 @@ class sem_preferences:
# The dialog
def edit(self, categories=[], REQUEST=None):
"""Dialog to edit semestre preferences in given categories"""
# log('XXX edit')
if not self.formsemestre_id:
raise ScoValueError(
"sem_preferences.edit doit etre appele sur un semestre !"
@ -2038,7 +2037,6 @@ function set_global_pref(el, pref_name) {
form.append(("create_local", {"input_type": "hidden"}))
form.append(("destination", {"input_type": "hidden"}))
form.append(("formsemestre_id", {"input_type": "hidden"}))
# log('REQUEST form=%s'%REQUEST.form)
tf = TrivialFormulator(
REQUEST.URL0,
REQUEST.form,
@ -2047,17 +2045,19 @@ function set_global_pref(el, pref_name) {
cssclass="sco_pref",
submitlabel="Enregistrer les modifications",
)
dest_url = (
self.context.NotesURL()
+ "formsemestre_status?formsemestre_id=%s" % self.formsemestre_id
)
if tf[0] == 0:
return "\n".join(H) + tf[1] + self.context.sco_footer(REQUEST)
elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(
REQUEST.URL1 + "?head_message=Annulé"
dest_url + "&head_message=Annulé"
) # cancel
else:
# log('tf[2]=%s' % tf[2]) # XXX
# Supprime pref locale du semestre (retour à la valeur globale)
if tf[2]["suppress"]:
# log('suppress %s' % tf[2]['suppress']) # XXX
self.base_prefs.delete(self.formsemestre_id, tf[2]["suppress"])
# Cree pref local (copie valeur globale)
if tf[2]["create_local"]:
@ -2089,9 +2089,7 @@ function set_global_pref(el, pref_name) {
destination = tf[2]["destination"]
if destination == "done" or destination == "":
return REQUEST.RESPONSE.redirect(
REQUEST.URL1
+ "/formsemestre_status?head_message=Préférences modifiées&amp;formsemestre_id="
+ self.formsemestre_id
dest_url + "&head_message=Préférences modifiées"
)
elif destination == "again":
return REQUEST.RESPONSE.redirect(