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

View File

@ -56,7 +56,7 @@ import cgi
import jaxml import jaxml
# --------------- # ---------------
from sco_zope import * from sco_zope import * # pylint: disable=unused-wildcard-import
# --------------- # ---------------
import sco_utils as scu 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: if tf[0] == 0:
return "\n".join(H) + tf[1] + self.sco_footer(REQUEST) return "\n".join(H) + tf[1] + self.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(self.ScoURL())
else: else:
e = tf[2]["begin"].split("/") e = tf[2]["begin"].split("/")
begin = e[2] + "-" + e[1] + "-" + e[0] + " 00:00:00" 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) return "\n".join(H) + "<br/>" + tf[1] + F + self.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(self.ScoURL())
else: else:
n = self._ProcessBilletAbsence( n = self._ProcessBilletAbsence(
billet, tf[2]["estjust"], tf[2]["description"], REQUEST billet, tf[2]["estjust"], tf[2]["description"], REQUEST

View File

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

View File

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

View File

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

View File

@ -294,11 +294,16 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
</head> </head>
<body> <body>
<p> <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> <tt>
<span class="locked">[verrouillé]</span> REQUEST.URL=%s<br/>
REQUEST.URL0=%s<br/>
</tt>
</p> </p>
</body> </body>
""" """ % (
REQUEST.URL,
REQUEST.URL0,
)
# return ( # return (
# self.sco_header(REQUEST) # self.sco_header(REQUEST)
# + """<div class="xp">%s</div>""" % x # + """<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 !') # raise NoteProcessError('test exception !')
# essai: liste des permissions # 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 from AccessControl.Permission import Permission # pylint: disable=import-error
permissions = self.ac_inherited_permissions(1) 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") security.declareProtected(ScoView, "ScoURL")
def ScoURL(self): 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 # absolute_url is the classic Zope method
# The avoid the burden of configuring a proxy zope object, we offer # The avoid the burden of configuring a proxy zope object, we offer
# a custom configuration via scodoc_config # 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() 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") security.declareProtected(ScoView, "sco_header")
sco_header = html_sco_header.sco_header sco_header = html_sco_header.sco_header
security.declareProtected(ScoView, "sco_footer") 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, initvalues=adr,
submitlabel="Valider le formulaire", submitlabel="Valider le formulaire",
) )
dest_url = self.ScoURL() + "/ficheEtud?etudid=" + etudid
if tf[0] == 0: if tf[0] == 0:
return header + "\n".join(H) + tf[1] + self.sco_footer(REQUEST) return header + "\n".join(H) + tf[1] + self.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
if adrs: if adrs:
scolars.adresse_edit(cnx, args=tf[2], context=self) scolars.adresse_edit(cnx, args=tf[2], context=self)
else: else:
scolars.adresse_create(cnx, args=tf[2]) scolars.adresse_create(cnx, args=tf[2])
logdb(REQUEST, cnx, method="changeCoordonnees", etudid=etudid) logdb(REQUEST, cnx, method="changeCoordonnees", etudid=etudid)
REQUEST.RESPONSE.redirect("ficheEtud?etudid=" + etudid) REQUEST.RESPONSE.redirect(dest_url)
# --- Gestion des groupes: # --- Gestion des groupes:
security.declareProtected(ScoView, "affectGroups") 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", submitlabel="Valider",
cancelbutton="Annuler", cancelbutton="Annuler",
) )
dest_url = self.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
if tf[0] == 0: if tf[0] == 0:
return ( return (
"\n".join(H) "\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) + self.sco_footer(REQUEST)
) )
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(dest_url)
REQUEST.URL1 + "/ficheEtud?etudid=" + etud["etudid"]
)
else: else:
data = tf[2]["photofile"].read() data = tf[2]["photofile"].read()
status, diag = sco_photos.store_photo(self, etud, data, REQUEST=REQUEST) status, diag = sco_photos.store_photo(self, etud, data, REQUEST=REQUEST)
if status != 0: if status != 0:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(dest_url)
self.ScoURL() + "/ficheEtud?etudid=" + etud["etudid"]
)
else: else:
H.append('<p class="warning">Erreur:' + diag + "</p>") H.append('<p class="warning">Erreur:' + diag + "</p>")
return "\n".join(H) + self.sco_footer(REQUEST) 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) sco_photos.suppress_photo(self, etud, REQUEST=REQUEST)
return REQUEST.RESPONSE.redirect( 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"]] to_inval = [s["formsemestre_id"] for s in etud["sems"]]
if to_inval: if to_inval:
self.Notes._inval_cache(formsemestre_id_list=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") 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" "formulaire import xls"
if formsemestre_id: if formsemestre_id:
sem = sco_formsemestre.get_formsemestre(self.Notes, formsemestre_id) sem = sco_formsemestre.get_formsemestre(self.Notes, formsemestre_id)
dest_url = (
self.ScoURL()
+ "/formsemestre_status?formsemestre_id=%s" % formsemestre_id
)
else: else:
sem = None sem = None
dest_url = self.ScoURL()
if sem and sem["etat"] != "1": if sem and sem["etat"] != "1":
raise ScoValueError("Modification impossible: semestre verrouille") raise ScoValueError("Modification impossible: semestre verrouille")
H = [ H = [
@ -2327,7 +2365,7 @@ Les champs avec un astérisque (*) doivent être présents (nulls non autorisés
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + "</li></ol>" + "\n".join(S) + F return "\n".join(H) + tf[1] + "</li></ol>" + "\n".join(S) + F
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
return ImportScolars.students_import_excel( return ImportScolars.students_import_excel(
self, self,
@ -2464,7 +2502,11 @@ Les champs avec un astérisque (*) doivent être présents (nulls non autorisés
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + help_text + F return "\n".join(H) + tf[1] + help_text + F
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(
self.ScoURL()
+ "/formsemestre_status?formsemestre_id="
+ formsemestre_id
)
else: else:
return self._students_import_admission( return self._students_import_admission(
tf[2]["csvfile"], tf[2]["csvfile"],
@ -2673,7 +2715,7 @@ def manage_addZScolarForm(context, DeptId, REQUEST=None):
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + context.standard_html_footer(context) return "\n".join(H) + tf[1] + context.standard_html_footer(context)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect("/ScoDoc")
else: else:
DeptId = tf[2]["DeptId"].strip() DeptId = tf[2]["DeptId"].strip()
db_cnx_string = tf[2]["db_cnx_string"].strip() db_cnx_string = tf[2]["db_cnx_string"].strip()

View File

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

View File

@ -164,7 +164,9 @@ def etud_upload_file_form(context, REQUEST, etudid):
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST) return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1 + "/ficheEtud?etudid=" + etudid) return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ficheEtud?etudid=" + etudid
)
else: else:
data = tf[2]["datafile"].read() data = tf[2]["datafile"].read()
descr = tf[2]["description"] descr = tf[2]["description"]
@ -172,7 +174,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(REQUEST.URL1 + "/ficheEtud?etudid=" + etudid) return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ficheEtud?etudid=" + etudid
)
def _store_etud_file_to_new_archive( 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>' '<li><a href="formsemestre_status?formsemestre_id=%(formsemestre_id)s">%(titremois)s</a></li>'
% sem % 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: else:
if not dialog_confirmed: if not dialog_confirmed:
return context.confirmDialog( return context.confirmDialog(
@ -73,7 +73,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
% F, % F,
REQUEST=REQUEST, REQUEST=REQUEST,
OK="Supprimer cette formation", OK="Supprimer cette formation",
cancel_url=REQUEST.URL1, cancel_url=context.NotesURL(),
parameters={"formation_id": formation_id}, parameters={"formation_id": formation_id},
) )
else: else:
@ -81,7 +81,7 @@ def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST
H.append( H.append(
"""<p>OK, formation supprimée.</p> """<p>OK, formation supprimée.</p>
<p><a class="stdlink" href="%s">continuer</a></p>""" <p><a class="stdlink" href="%s">continuer</a></p>"""
% REQUEST.URL1 % context.NotesURL()
) )
H.append(context.sco_footer(REQUEST)) 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: if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST) return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(context.NotesURL())
else: else:
# check unicity : constraint UNIQUE(acronyme,titre,version) # check unicity : constraint UNIQUE(acronyme,titre,version)
if create: if create:

View File

@ -75,7 +75,7 @@ associé.
submitlabel="Créer cette matière", 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: if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST) 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, "<h2>Suppression de la matière %(titre)s" % M,
" dans l'UE (%(acronyme)s))</h2>" % UE, " dans l'UE (%(acronyme)s))</h2>" % UE,
] ]
dest_url = context.NotesURL() + "/ue_list?formation_id=" + str(UE["formation_id"])
tf = TrivialFormulator( tf = TrivialFormulator(
REQUEST.URL0, REQUEST.URL0,
REQUEST.form, REQUEST.form,
@ -116,12 +116,10 @@ def matiere_delete(context, matiere_id=None, REQUEST=None):
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + context.sco_footer(REQUEST) return "\n".join(H) + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
context.do_matiere_delete(matiere_id, REQUEST) context.do_matiere_delete(matiere_id, REQUEST)
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(dest_url)
REQUEST.URL1 + "/ue_list?formation_id=" + str(UE["formation_id"])
)
def matiere_edit(context, matiere_id=None, REQUEST=None): def matiere_edit(context, matiere_id=None, REQUEST=None):
@ -181,7 +179,7 @@ associé.
submitlabel="Modifier les valeurs", 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: if tf[0] == 0:
return "\n".join(H) + tf[1] + help + context.sco_footer(REQUEST) 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: else:
context.do_module_create(tf[2], REQUEST) context.do_module_create(tf[2], REQUEST)
return REQUEST.RESPONSE.redirect( 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, """<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( tf = TrivialFormulator(
REQUEST.URL0, REQUEST.URL0,
REQUEST.form, REQUEST.form,
@ -240,7 +240,7 @@ def module_edit(context, module_id=None, REQUEST=None):
semestres_indices = range(1, parcours.NB_SEM + 1) 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 = [ H = [
context.sco_header( context.sco_header(

View File

@ -221,7 +221,7 @@ def ue_edit(context, ue_id=None, create=False, formation_id=None, REQUEST=None):
else: else:
do_ue_edit(context, tf[2]) do_ue_edit(context, tf[2])
return REQUEST.RESPONSE.redirect( 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): def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
"""Dialog to edit the custom menu""" """Dialog to edit the custom menu"""
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
dest_url = (
context.NotesURL() + "formsemestre_status?formsemestre_id=%s" % formsemestre_id
)
H = [ H = [
context.html_sem_header(REQUEST, "Modification du menu du semestre ", sem), 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> """<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: if tf[0] == 0:
return "\n".join(H) + "\n" + tf[1] + context.sco_footer(REQUEST) return "\n".join(H) + "\n" + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
# form submission # form submission
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
@ -153,6 +156,4 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
"url": tf[2]["url_" + custommenu_id], "url": tf[2]["url_" + custommenu_id],
}, },
) )
REQUEST.RESPONSE.redirect( REQUEST.RESPONSE.redirect(dest_url)
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
)

View File

@ -72,9 +72,7 @@ def formsemestre_createwithmodules(context, REQUEST=None):
def formsemestre_editwithmodules(context, REQUEST, formsemestre_id): def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
"""Page modification semestre""" """Page modification semestre"""
# portage from dtml # portage from dtml
authuser = REQUEST.AUTHENTICATED_USER
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
H = [ H = [
context.html_sem_header( context.html_sem_header(
REQUEST, REQUEST,
@ -711,7 +709,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
"formsemestre_id": formsemestre_id, "formsemestre_id": formsemestre_id,
"responsable_id": tf[2][module_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( return REQUEST.RESPONSE.redirect(
"formsemestre_status?formsemestre_id=%s&amp;head_message=Nouveau%%20semestre%%20créé" "formsemestre_status?formsemestre_id=%s&amp;head_message=Nouveau%%20semestre%%20créé"
% formsemestre_id % formsemestre_id
@ -848,7 +846,6 @@ def formsemestre_clone(context, formsemestre_id, REQUEST=None):
""" """
Formulaire clonage d'un semestre Formulaire clonage d'un semestre
""" """
authuser = REQUEST.AUTHENTICATED_USER
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
# Liste des enseignants avec forme pour affichage / saisie avec suggestion # Liste des enseignants avec forme pour affichage / saisie avec suggestion
userlist = context.Users.get_userlist() userlist = context.Users.get_userlist()
@ -1019,7 +1016,7 @@ def do_formsemestre_clone(
args = e.copy() args = e.copy()
del args["jour"] # erase date del args["jour"] # erase date
args["moduleimpl_id"] = mid args["moduleimpl_id"] = mid
evaluation_id = context.do_evaluation_create(REQUEST=REQUEST, **args) _ = context.do_evaluation_create(REQUEST=REQUEST, **args)
# 3- copy uecoefs # 3- copy uecoefs
objs = sco_formsemestre.formsemestre_uecoef_list( objs = sco_formsemestre.formsemestre_uecoef_list(
@ -1028,7 +1025,7 @@ def do_formsemestre_clone(
for obj in objs: for obj in objs:
args = obj.copy() args = obj.copy()
args["formsemestre_id"] = formsemestre_id 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) # NB: don't copy notes_formsemestre_custommenu (usually specific)
@ -1051,7 +1048,7 @@ def do_formsemestre_clone(
for obj in objs: for obj in objs:
args = obj.copy() args = obj.copy()
args["formsemestre_id"] = formsemestre_id 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 # 5- Copy partitions
if clone_partitions: if clone_partitions:
@ -1061,7 +1058,6 @@ def do_formsemestre_clone(
for part in sco_groups.get_partitions_list(context, orig_formsemestre_id): for part in sco_groups.get_partitions_list(context, orig_formsemestre_id):
if part["partition_name"] != None: if part["partition_name"] != None:
partname = part["partition_name"] partname = part["partition_name"]
orig_partition_id = part["partition_id"]
new_partition_id = sco_groups.partition_create( new_partition_id = sco_groups.partition_create(
context, context,
formsemestre_id, formsemestre_id,
@ -1081,7 +1077,7 @@ def do_formsemestre_clone(
if newpart["partition_id"] == g[0]: if newpart["partition_id"] == g[0]:
part_id = g[0] part_id = g[0]
for group_name in g[1]: for group_name in g[1]:
group_id = sco_groups.createGroup( _ = sco_groups.createGroup(
context, part_id, group_name=group_name, REQUEST=REQUEST 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]) H.append(tf[1])
return "\n".join(H) + context.sco_footer(REQUEST) return "\n".join(H) + context.sco_footer(REQUEST)
elif tf[0] == -1: # cancel elif tf[0] == -1: # cancel
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(
context.NotesURL()
+ "formsemestre_status?formsemestre_id="
+ formsemestre_id
)
else: else:
return REQUEST.RESPONSE.redirect( return REQUEST.RESPONSE.redirect(
"formsemestre_delete2?formsemestre_id=" + formsemestre_id "formsemestre_delete2?formsemestre_id=" + formsemestre_id
@ -1274,9 +1274,6 @@ def formsemestre_delete2(
context, formsemestre_id, dialog_confirmed=False, REQUEST=None context, formsemestre_id, dialog_confirmed=False, REQUEST=None
): ):
"""Delete a formsemestre (confirmation)""" """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 # Confirmation dialog
if not dialog_confirmed: if not dialog_confirmed:
return context.confirmDialog( return context.confirmDialog(
@ -1288,7 +1285,9 @@ def formsemestre_delete2(
) )
# Bon, s'il le faut... # Bon, s'il le faut...
do_formsemestre_delete(context, formsemestre_id, REQUEST) 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): 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: if not ok:
return err return err
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
F = context.formation_list(args={"formation_id": sem["formation_id"]})[0]
footer = context.sco_footer(REQUEST) footer = context.sco_footer(REQUEST)
help = """<p class="help"> 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) partition = get_partition(context, partition_id)
formsemestre_id = partition["formsemestre_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): if not can_change_groups(context, REQUEST, formsemestre_id):
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) 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: if tf[0] == 0:
return "\n".join(H) + "\n" + tf[1] + context.sco_footer(REQUEST) return "\n".join(H) + "\n" + tf[1] + context.sco_footer(REQUEST)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(REQUEST.URL1) return REQUEST.RESPONSE.redirect(dest_url)
else: else:
# form submission # form submission
log( log(
@ -1279,8 +1281,7 @@ def groups_auto_repartition(context, partition_id=None, REQUEST=None):
context, etudid, group_id, partition, REQUEST=REQUEST context, etudid, group_id, partition, REQUEST=REQUEST
) )
log("%s in group %s" % (etudid, group_id)) log("%s in group %s" % (etudid, group_id))
# envoie sur page edition groupes return REQUEST.RESPONSE.redirect(dest_url)
return REQUEST.RESPONSE.redirect("affectGroups?partition_id=%s" % partition_id)
def get_prev_moy(context, etudid, formsemestre_id): def get_prev_moy(context, etudid, formsemestre_id):

View File

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

View File

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