diff --git a/ImportScolars.py b/ImportScolars.py index 4502abd332..8e06e93c5c 100644 --- a/ImportScolars.py +++ b/ImportScolars.py @@ -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("
Département " + DeptId - + """ supprimé du serveur web (la base de données n'est pas affectée)!
""" - % REQUEST.URL1 + + """ supprimé du serveur web (la base de données n'est pas affectée)!""" ) _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 diff --git a/ZScoUsers.py b/ZScoUsers.py index 64355f434b..2550bb4f31 100644 --- a/ZScoUsers.py +++ b/ZScoUsers.py @@ -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] + "" + 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("Import excel: %s
" % diag) H.append("OK, import terminé !
") - H.append('' % REQUEST.URL1) + H.append( + '' % 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" ) diff --git a/ZScolar.py b/ZScolar.py index 314b9bb2b7..0537b67ecd 100644 --- a/ZScolar.py +++ b/ZScolar.py @@ -294,11 +294,16 @@ class ZScolar(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
-UE11 Découverte métiers (code UCOD46, 16 ECTS, Apo VRTU11)
-[verrouillé]
+
+REQUEST.URL=%s
+REQUEST.URL0=%s
+
OK, formation supprimée.
""" - % 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: diff --git a/sco_edit_matiere.py b/sco_edit_matiere.py index a0eec6f68b..98a86dfee5 100644 --- a/sco_edit_matiere.py +++ b/sco_edit_matiere.py @@ -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): "Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.
@@ -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) diff --git a/sco_formsemestre_edit.py b/sco_formsemestre_edit.py index 2a05e2f55f..556b512142 100644 --- a/sco_formsemestre_edit.py +++ b/sco_formsemestre_edit.py @@ -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&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 = """diff --git a/sco_groups.py b/sco_groups.py index 26a2e6770b..c4746f6087 100644 --- a/sco_groups.py +++ b/sco_groups.py @@ -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): diff --git a/sco_placement.py b/sco_placement.py index 3c50b19f78..9487db08f5 100644 --- a/sco_placement.py +++ b/sco_placement.py @@ -217,7 +217,9 @@ def do_placement_selectetuds(context, REQUEST): ) + "&".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"] diff --git a/sco_preferences.py b/sco_preferences.py index d7bb3ed3b9..49b29ff935 100644 --- a/sco_preferences.py +++ b/sco_preferences.py @@ -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&formsemestre_id=" - + self.formsemestre_id + dest_url + "&head_message=Préférences modifiées" ) elif destination == "again": return REQUEST.RESPONSE.redirect(