1
0
forked from ScoDoc/ScoDoc

fix for int ids

This commit is contained in:
Emmanuel Viennet 2021-08-15 09:55:35 +02:00
parent 7478160094
commit 545274c562
10 changed files with 32 additions and 24 deletions

View File

@ -163,7 +163,7 @@ class TF(object):
"true if form has been submitted"
if self.is_submitted:
return True
return self.values.get("%s-submitted" % self.formid, False)
return self.values.get("%s_submitted" % self.formid, False)
def canceled(self):
"true if form has been canceled"
@ -363,7 +363,7 @@ class TF(object):
'<form action="%s" method="%s" id="%s" enctype="%s" name="%s" %s>'
% (self.form_url, self.method, self.formid, enctype, name, klass)
)
R.append('<input type="hidden" name="%s-submitted" value="1"/>' % self.formid)
R.append('<input type="hidden" name="%s_submitted" value="1"/>' % self.formid)
if self.top_buttons:
R.append(buttons_markup + "<p></p>")
R.append('<table class="tf">')
@ -490,7 +490,10 @@ class TF(object):
# from app.scodoc.notes_log import log # debug only
# log('checkbox: values[%s] = "%s"' % (field,repr(values[field]) ))
# log("descr['allowed_values'][%s] = '%s'" % (i, repr(descr['allowed_values'][i])))
if descr["allowed_values"][i] in values[field]:
if (
values[field]
and descr["allowed_values"][i] in values[field]
):
checked = 'checked="checked"'
else:
checked = ""

View File

@ -527,7 +527,7 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
else:
e["name"] = e["description"] or "le %s" % e["jour"]
e["target_html"] = (
"evaluation_listenotes?evaluation_id=%s&format=html&tf-submitted=1"
"evaluation_listenotes?evaluation_id=%s&format=html&tf_submitted=1"
% e["evaluation_id"]
)
e["name_html"] = '<a class="bull_link" href="%s">%s</a>' % (
@ -575,9 +575,12 @@ def _ue_mod_bulletin(context, etudid, formsemestre_id, ue_id, modimpls, nt, vers
e = e.copy()
mod["evaluations_incompletes"].append(e)
e["name"] = (e["description"] or "") + " (%s)" % e["jour"]
e["target_html"] = (
"evaluation_listenotes?evaluation_id=%s&format=html&tf-submitted=1"
% e["evaluation_id"]
e["target_html"] = url_for(
"notes.evaluation_listenotes",
scodoc_dept=g.scodoc_dept,
evaluation_id=e["evaluation_id"],
tf_submitted=1,
format="html",
)
e["name_html"] = '<a class="bull_link" href="%s">%s</a>' % (
e["target_html"],

View File

@ -346,8 +346,8 @@ def _check_duplicate_code(cnx, args, code_name, context, edit=True, REQUEST=None
dest_url = "ficheEtud"
parameters = {"etudid": etudid}
else:
if "tf-submitted" in args:
del args["tf-submitted"]
if "tf_submitted" in args:
del args["tf_submitted"]
OK = "Continuer"
dest_url = "etudident_create_form"
parameters = args

View File

@ -1241,7 +1241,7 @@ def evaluation_create_form(
else:
initvalues["visibulletinlist"] = []
if (
REQUEST.form.get("tf-submitted", False)
REQUEST.form.get("tf_submitted", False)
and "visibulletinlist" not in REQUEST.form
):
REQUEST.form["visibulletinlist"] = []

View File

@ -111,7 +111,7 @@ def formsemestre_editwithmodules(context, REQUEST, formsemestre_id):
H.append(r)
else:
return r # response redirect
if not REQUEST.form.get("tf-submitted", False):
if not REQUEST.form.get("tf_submitted", False):
H.append(
"""<p class="help">Seuls les modules cochés font partie de ce semestre. Pour les retirer, les décocher et appuyer sur le bouton "modifier".
</p>
@ -625,7 +625,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
else:
initvalues["gestion_compensation_lst"] = []
if (
REQUEST.form.get("tf-submitted", False)
REQUEST.form.get("tf_submitted", False)
and "gestion_compensation_lst" not in REQUEST.form
):
REQUEST.form["gestion_compensation_lst"] = []
@ -636,7 +636,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
else:
initvalues["gestion_semestrielle_lst"] = []
if (
REQUEST.form.get("tf-submitted", False)
REQUEST.form.get("tf_submitted", False)
and "gestion_semestrielle_lst" not in REQUEST.form
):
REQUEST.form["gestion_semestrielle_lst"] = []
@ -647,7 +647,7 @@ def do_formsemestre_createwithmodules(context, REQUEST=None, edit=False):
else:
initvalues["bul_publish_xml_lst"] = []
if (
REQUEST.form.get("tf-submitted", False)
REQUEST.form.get("tf_submitted", False)
and "bul_publish_xml_lst" not in REQUEST.form
):
REQUEST.form["bul_publish_xml_lst"] = []

View File

@ -480,7 +480,7 @@ def formsemestre_inscription_option(context, etudid, formsemestre_id, REQUEST=No
modimpls_by_ue_names[ue_id].append(
"%s %s" % (mod["module"]["code"], mod["module"]["titre"])
)
if not REQUEST.form.get("tf-submitted", False):
if not REQUEST.form.get("tf_submitted", False):
# inscrit ?
for ins in inscr:
if ins["moduleimpl_id"] == mod["moduleimpl_id"]:

View File

@ -92,7 +92,7 @@ def do_evaluation_listenotes(context, REQUEST):
context, E["evaluation_id"], include_default=True
)
grlabs = [g["group_name"] or "tous" for g in groups] # legendes des boutons
grnams = [g["group_id"] for g in groups] # noms des checkbox
grnams = [str(g["group_id"]) for g in groups] # noms des checkbox
if len(evals) > 1:
descr = [
@ -414,12 +414,14 @@ def _make_table_notes(
for e in evals:
rlinks[e["evaluation_id"]] = "afficher"
rlinks[
"_" + e["evaluation_id"] + "_help"
"_" + str(e["evaluation_id"]) + "_help"
] = "afficher seulement les notes de cette évaluation"
rlinks["_" + e["evaluation_id"] + "_target"] = (
"evaluation_listenotes?evaluation_id=" + e["evaluation_id"]
rlinks["_" + str(e["evaluation_id"]) + "_target"] = url_for(
"notes.evaluation_listenotes",
scodoc_dept=g.scodoc_dept,
evaluation_id=e["evaluation_id"],
)
rlinks["_" + e["evaluation_id"] + "_td_attrs"] = ' class="tdlink" '
rlinks["_" + str(e["evaluation_id"]) + "_td_attrs"] = ' class="tdlink" '
rows.append(rlinks)
if len(evals) == 1: # colonne "Rem." seulement si une eval

View File

@ -574,7 +574,7 @@ def moduleimpl_status(context, moduleimpl_id=None, partition_id=None, REQUEST=No
if gr_moyenne["gr_nb_notes"] > 0:
H.append("%(gr_moy)s" % gr_moyenne)
H.append(
"""&nbsp; (<a href="evaluation_listenotes?tf-submitted=1&evaluation_id=%s&group_ids%%3Alist=%s">%s notes</a>"""
"""&nbsp; (<a href="evaluation_listenotes?tf_submitted=1&evaluation_id=%s&group_ids%%3Alist=%s">%s notes</a>"""
% (
eval["evaluation_id"],
gr_moyenne["group_id"],

View File

@ -1189,7 +1189,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
infos = []
else:
prenom = REQUEST.form.get("prenom", "")
if REQUEST.form.get("tf-submitted", False) and not prenom:
if REQUEST.form.get("tf_submitted", False) and not prenom:
prenom = initvalues.get("prenom", "")
infos = sco_portal_apogee.get_infos_apogee(context, nom, prenom)

View File

@ -321,9 +321,9 @@ def create_user_form(context, REQUEST, user_name=None, edit=0):
},
),
]
if "tf-submitted" in REQUEST.form and not "roles" in REQUEST.form:
if "tf_submitted" in REQUEST.form and not "roles" in REQUEST.form:
REQUEST.form["roles"] = []
if "tf-submitted" in REQUEST.form:
if "tf_submitted" in REQUEST.form:
# Ajoute roles existants mais non modifiables (disabled dans le form)
REQUEST.form["roles"] = list(
set(REQUEST.form["roles"]).union(