forked from ScoDoc/ScoDoc
Fix: recherche etud, urls
This commit is contained in:
parent
9313ffdb3b
commit
3d176a945f
@ -171,18 +171,32 @@ def DBSelectArgs(
|
|||||||
cl.append("T0.%s = T%d.%s" % (id_name, i, aux_id))
|
cl.append("T0.%s = T%d.%s" % (id_name, i, aux_id))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
cond += " and ".join(cl)
|
cond += " and ".join(cl)
|
||||||
# Traitement des expressions régulières:
|
|
||||||
# n'autorise pas d'expressions
|
|
||||||
if test == "~":
|
|
||||||
for k in vals.keys():
|
|
||||||
vals[k] = vals[k].translate(_SQL_REMOVE_BAD_CHARS)
|
|
||||||
|
|
||||||
if vals:
|
if vals:
|
||||||
if aux_tables: # paren
|
if aux_tables: # paren
|
||||||
cond += " AND ( "
|
cond += " AND ( "
|
||||||
cond += operator.join(
|
|
||||||
["T0.%s%s%%(%s)s" % (x, test, x) for x in vals.keys() if vals[x] != None]
|
if test == "~":
|
||||||
)
|
# Traitement des expressions régulières:
|
||||||
|
# n'autorise pas d'expressions
|
||||||
|
explist = []
|
||||||
|
for k in vals.keys():
|
||||||
|
# n'applique ~ qu'aux strings
|
||||||
|
if isinstance(vals[k], str):
|
||||||
|
vals[k] = vals[k].translate(_SQL_REMOVE_BAD_CHARS)
|
||||||
|
explist.append("T0.%s~%%(%s)s" % (k, k))
|
||||||
|
elif vals[k] is not None:
|
||||||
|
explist.append("T0.%s=%%(%s)s" % (k, k))
|
||||||
|
cond += operator.join(explist)
|
||||||
|
else:
|
||||||
|
cond += operator.join(
|
||||||
|
[
|
||||||
|
"T0.%s%s%%(%s)s" % (x, test, x)
|
||||||
|
for x in vals.keys()
|
||||||
|
if vals[x] != None
|
||||||
|
]
|
||||||
|
)
|
||||||
|
# conditions sur NULLs:
|
||||||
cnuls = " and ".join(
|
cnuls = " and ".join(
|
||||||
["T0.%s is NULL" % x for x in vals.keys() if vals[x] is None]
|
["T0.%s is NULL" % x for x in vals.keys() if vals[x] is None]
|
||||||
)
|
)
|
||||||
|
@ -872,8 +872,10 @@ def _make_listes_sem(context, sem, REQUEST=None, with_absences=True):
|
|||||||
H.append('<p class="help indent">Aucun groupe dans cette partition')
|
H.append('<p class="help indent">Aucun groupe dans cette partition')
|
||||||
if sco_groups.sco_permissions_check.can_change_groups(formsemestre_id):
|
if sco_groups.sco_permissions_check.can_change_groups(formsemestre_id):
|
||||||
H.append(
|
H.append(
|
||||||
' (<a href="affectGroups?partition_id=%s" class="stdlink">créer</a>)'
|
f""" (<a href="{url_for("scolar.affectGroups",
|
||||||
% partition["partition_id"]
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
partition_id=partition["partition_id"])
|
||||||
|
}" class="stdlink">créer</a>)"""
|
||||||
)
|
)
|
||||||
H.append("</p>")
|
H.append("</p>")
|
||||||
if sco_groups.sco_permissions_check.can_change_groups(formsemestre_id):
|
if sco_groups.sco_permissions_check.can_change_groups(formsemestre_id):
|
||||||
|
@ -924,8 +924,12 @@ def editPartitionForm(context, formsemestre_id=None, REQUEST=None):
|
|||||||
]
|
]
|
||||||
H.append(", ".join(lg))
|
H.append(", ".join(lg))
|
||||||
H.append(
|
H.append(
|
||||||
'</td><td><a class="stdlink" href="affectGroups?partition_id=%s">répartir</a></td>'
|
f"""</td><td><a class="stdlink" href="{
|
||||||
% p["partition_id"]
|
url_for("scolar.affectGroups",
|
||||||
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
partition_id=p["partition_id"])
|
||||||
|
}">répartir</a></td>
|
||||||
|
"""
|
||||||
)
|
)
|
||||||
H.append(
|
H.append(
|
||||||
'<td><a class="stdlink" href="partition_rename?partition_id=%s">renommer</a></td>'
|
'<td><a class="stdlink" href="partition_rename?partition_id=%s">renommer</a></td>'
|
||||||
@ -1185,7 +1189,13 @@ def group_set_name(context, group_id, group_name, REQUEST=None, redirect=1):
|
|||||||
|
|
||||||
# redirect to partition edit page:
|
# redirect to partition edit page:
|
||||||
if redirect:
|
if redirect:
|
||||||
return flask.redirect("affectGroups?partition_id=" + str(group["partition_id"]))
|
return flask.redirect(
|
||||||
|
url_for(
|
||||||
|
"scolar.affectGroups",
|
||||||
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
partition_id=group["partition_id"],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def group_rename(context, group_id, REQUEST=None):
|
def group_rename(context, group_id, REQUEST=None):
|
||||||
@ -1245,7 +1255,9 @@ 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
|
# renvoie sur page édition groupes
|
||||||
dest_url = "affectGroups?partition_id=%s" % partition_id
|
dest_url = url_for(
|
||||||
|
"scolar.affectGroups", scodoc_dept=g.scodoc_dept, partition_id=partition_id
|
||||||
|
)
|
||||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
if not sco_permissions_check.can_change_groups(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)
|
||||||
|
@ -392,9 +392,11 @@ def formsemestre_inscr_passage(
|
|||||||
]
|
]
|
||||||
): # il y a au moins une vraie partition
|
): # il y a au moins une vraie partition
|
||||||
H.append(
|
H.append(
|
||||||
"""<li><a class="stdlink" href="affectGroups?partition_id=%s">Répartir les groupes de %s</a></li>
|
f"""<li><a class="stdlink" href="{
|
||||||
|
url_for("scolar.affectGroups",
|
||||||
|
scodoc_dept=g.scodoc_dept, partition_id=partition["partition_id"])
|
||||||
|
}">Répartir les groupes de {partition["partition_name"]}</a></li>
|
||||||
"""
|
"""
|
||||||
% (partition["partition_id"], partition["partition_name"])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -32,6 +32,8 @@ import time
|
|||||||
import pprint
|
import pprint
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
|
from flask import g, url_for
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
from app.scodoc import html_sco_header
|
from app.scodoc import html_sco_header
|
||||||
@ -254,9 +256,12 @@ def formsemestre_synchro_etuds(
|
|||||||
)
|
)
|
||||||
if partitions: # il y a au moins une vraie partition
|
if partitions: # il y a au moins une vraie partition
|
||||||
H.append(
|
H.append(
|
||||||
"""<li><a class="stdlink" href="affectGroups?partition_id=%s">Répartir les groupes de %s</a></li>
|
f"""<li><a class="stdlink" href="{
|
||||||
|
url_for("scolar.affectGroups",
|
||||||
|
scodoc_dept=g.scodoc_dept,
|
||||||
|
partition_id=partitions[0]["partition_id"]
|
||||||
|
)}">Répartir les groupes de partitions[0]["partition_name"]</a></li>
|
||||||
"""
|
"""
|
||||||
% (partitions[0]["partition_id"], partitions[0]["partition_name"])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
H.append(footer)
|
H.append(footer)
|
||||||
|
@ -809,7 +809,7 @@ def _gen_form_saisie_groupe(
|
|||||||
'<td><a title=%s><input type="checkbox" name="abslist:list" value="%s" %s onclick="on_toggled(this, \'%s\', \'%s\')"/></a></td>'
|
'<td><a title=%s><input type="checkbox" name="abslist:list" value="%s" %s onclick="on_toggled(this, \'%s\', \'%s\')"/></a></td>'
|
||||||
% (
|
% (
|
||||||
bulle_pm,
|
bulle_pm,
|
||||||
etudid + ":" + date + ":" + "pm",
|
str(etudid) + ":" + date + ":" + "pm",
|
||||||
checked,
|
checked,
|
||||||
etudid,
|
etudid,
|
||||||
date + ":pm",
|
date + ":pm",
|
||||||
@ -820,7 +820,7 @@ def _gen_form_saisie_groupe(
|
|||||||
# place la liste des etudiants et les dates pour pouvoir effacer les absences
|
# place la liste des etudiants et les dates pour pouvoir effacer les absences
|
||||||
H.append(
|
H.append(
|
||||||
'<input type="hidden" name="etudids" value="%s"/>'
|
'<input type="hidden" name="etudids" value="%s"/>'
|
||||||
% ",".join([etud["etudid"] for etud in etuds])
|
% ",".join([str(etud["etudid"]) for etud in etuds])
|
||||||
)
|
)
|
||||||
H.append('<input type="hidden" name="datedebut" value="%s"/>' % dates[0])
|
H.append('<input type="hidden" name="datedebut" value="%s"/>' % dates[0])
|
||||||
H.append('<input type="hidden" name="datefin" value="%s"/>' % dates[-1])
|
H.append('<input type="hidden" name="datefin" value="%s"/>' % dates[-1])
|
||||||
|
Loading…
Reference in New Issue
Block a user