forked from ScoDoc/DocScoDoc
élimination des qq REQUESTS et correction publication XML/XLS/JSON/...
This commit is contained in:
parent
0a50edc9f0
commit
75f43bbdde
@ -56,7 +56,6 @@ from app.scodoc import sco_etud
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from six.moves import range
|
||||
|
||||
JAVASCRIPTS = html_sco_header.BOOTSTRAP_MULTISELECT_JS + [
|
||||
"js/etud_info.js",
|
||||
@ -65,11 +64,10 @@ JAVASCRIPTS = html_sco_header.BOOTSTRAP_MULTISELECT_JS + [
|
||||
|
||||
CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS
|
||||
|
||||
|
||||
# view:
|
||||
def groups_view(
|
||||
group_ids=[],
|
||||
group_ids=(),
|
||||
format="html",
|
||||
REQUEST=None,
|
||||
# Options pour listes:
|
||||
with_codes=0,
|
||||
etat=None,
|
||||
@ -94,7 +92,6 @@ def groups_view(
|
||||
return groups_table(
|
||||
groups_infos=groups_infos,
|
||||
format=format,
|
||||
REQUEST=REQUEST,
|
||||
with_codes=with_codes,
|
||||
etat=etat,
|
||||
with_paiement=with_paiement,
|
||||
@ -134,7 +131,6 @@ def groups_view(
|
||||
groups_table(
|
||||
groups_infos=groups_infos,
|
||||
format=format,
|
||||
REQUEST=REQUEST,
|
||||
with_codes=with_codes,
|
||||
etat=etat,
|
||||
with_paiement=with_paiement,
|
||||
@ -143,11 +139,11 @@ def groups_view(
|
||||
),
|
||||
"</div>",
|
||||
"""<div class="tab-pane" id="tab-photos">""",
|
||||
tab_photos_html(groups_infos, etat=etat, REQUEST=REQUEST),
|
||||
tab_photos_html(groups_infos, etat=etat),
|
||||
#'<p>hello</p>',
|
||||
"</div>",
|
||||
'<div class="tab-pane" id="tab-abs">',
|
||||
tab_absences_html(groups_infos, etat=etat, REQUEST=REQUEST),
|
||||
tab_absences_html(groups_infos, etat=etat),
|
||||
"</div>",
|
||||
)
|
||||
)
|
||||
@ -296,7 +292,7 @@ class DisplayedGroupsInfos(object):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
group_ids=[], # groupes specifies dans l'URL, ou un seul int
|
||||
group_ids=(), # groupes specifies dans l'URL, ou un seul int
|
||||
formsemestre_id=None,
|
||||
etat=None,
|
||||
select_all_when_unspecified=False,
|
||||
@ -421,7 +417,6 @@ class DisplayedGroupsInfos(object):
|
||||
|
||||
# Ancien ZScolar.group_list renommé ici en group_table
|
||||
def groups_table(
|
||||
REQUEST=None,
|
||||
groups_infos=None, # instance of DisplayedGroupsInfos
|
||||
with_codes=0,
|
||||
etat=None,
|
||||
@ -529,7 +524,8 @@ def groups_table(
|
||||
# et groupes:
|
||||
for partition_id in etud["partitions"]:
|
||||
etud[partition_id] = etud["partitions"][partition_id]["group_name"]
|
||||
# Ajoute colonne pour moodle: semestre_groupe, de la forme RT-DUT-FI-S3-2021-PARTITION-GROUPE
|
||||
# Ajoute colonne pour moodle: semestre_groupe, de la forme
|
||||
# RT-DUT-FI-S3-2021-PARTITION-GROUPE
|
||||
moodle_groupename = []
|
||||
if groups_infos.selected_partitions:
|
||||
# il y a des groupes selectionnes, utilise leurs partitions
|
||||
@ -638,22 +634,21 @@ def groups_table(
|
||||
[
|
||||
"""<span style="margin-left: 2em;"><select name="group_list_options" id="group_list_options" class="multiselect" multiple="multiple">""",
|
||||
"\n".join(Of),
|
||||
"""
|
||||
</select></span>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#group_list_options').multiselect(
|
||||
{
|
||||
includeSelectAllOption: false,
|
||||
nonSelectedText:'Options...',
|
||||
onChange: function(element, checked){
|
||||
change_list_options();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
""",
|
||||
"""</select></span>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#group_list_options').multiselect(
|
||||
{
|
||||
includeSelectAllOption: false,
|
||||
nonSelectedText:'Options...',
|
||||
onChange: function(element, checked){
|
||||
change_list_options();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>
|
||||
""",
|
||||
]
|
||||
)
|
||||
H.append("</h3></form>")
|
||||
@ -797,7 +792,7 @@ def groups_table(
|
||||
raise ValueError("unsupported format")
|
||||
|
||||
|
||||
def tab_absences_html(groups_infos, etat=None, REQUEST=None):
|
||||
def tab_absences_html(groups_infos, etat=None):
|
||||
"""contenu du tab "absences et feuilles diverses" """
|
||||
authuser = current_user
|
||||
H = ['<div class="tab-content">']
|
||||
@ -808,10 +803,10 @@ def tab_absences_html(groups_infos, etat=None, REQUEST=None):
|
||||
"<h3>Absences</h3>",
|
||||
'<ul class="ul_abs">',
|
||||
"<li>",
|
||||
form_choix_saisie_semaine(groups_infos, REQUEST=REQUEST), # Ajout Le Havre
|
||||
form_choix_saisie_semaine(groups_infos), # Ajout Le Havre
|
||||
"</li>",
|
||||
"<li>",
|
||||
form_choix_jour_saisie_hebdo(groups_infos, REQUEST=REQUEST),
|
||||
form_choix_jour_saisie_hebdo(groups_infos),
|
||||
"</li>",
|
||||
"""<li><a class="stdlink" href="Absences/EtatAbsencesGr?%s&debut=%s&fin=%s">État des absences du groupe</a></li>"""
|
||||
% (
|
||||
@ -856,17 +851,17 @@ def tab_absences_html(groups_infos, etat=None, REQUEST=None):
|
||||
return "".join(H)
|
||||
|
||||
|
||||
def tab_photos_html(groups_infos, etat=None, REQUEST=None):
|
||||
def tab_photos_html(groups_infos, etat=None):
|
||||
"""contenu du tab "photos" """
|
||||
from app.scodoc import sco_trombino
|
||||
|
||||
if not groups_infos.members:
|
||||
return '<div class="tab-content"><h3>Aucun étudiant !</h3></div>'
|
||||
|
||||
return sco_trombino.trombino_html(groups_infos, REQUEST=REQUEST)
|
||||
return sco_trombino.trombino_html(groups_infos)
|
||||
|
||||
|
||||
def form_choix_jour_saisie_hebdo(groups_infos, moduleimpl_id=None, REQUEST=None):
|
||||
def form_choix_jour_saisie_hebdo(groups_infos, moduleimpl_id=None):
|
||||
"""Formulaire choix jour semaine pour saisie."""
|
||||
authuser = current_user
|
||||
if not authuser.has_permission(Permission.ScoAbsChange):
|
||||
@ -908,7 +903,7 @@ def form_choix_jour_saisie_hebdo(groups_infos, moduleimpl_id=None, REQUEST=None)
|
||||
|
||||
# Ajout Le Havre
|
||||
# Formulaire saisie absences semaine
|
||||
def form_choix_saisie_semaine(groups_infos, REQUEST=None):
|
||||
def form_choix_saisie_semaine(groups_infos):
|
||||
authuser = current_user
|
||||
if not authuser.has_permission(Permission.ScoAbsChange):
|
||||
return ""
|
||||
|
@ -104,7 +104,7 @@ def _trombino_html_header():
|
||||
return html_sco_header.sco_header(javascripts=["js/trombino.js"])
|
||||
|
||||
|
||||
def trombino_html(groups_infos, REQUEST=None):
|
||||
def trombino_html(groups_infos):
|
||||
"HTML snippet for trombino (with title and menu)"
|
||||
menuTrombi = [
|
||||
{
|
||||
|
@ -585,9 +585,9 @@ def send_file(data, filename="", suffix="", mime=None, attached=None):
|
||||
"""
|
||||
if attached is None:
|
||||
if mime == XML_MIMETYPE or mime == JSON_MIMETYPE:
|
||||
attached = True
|
||||
else:
|
||||
attached = False
|
||||
else:
|
||||
attached = True
|
||||
# if attached and not filename:
|
||||
# raise ValueError("send_file: missing attachement filename")
|
||||
if filename:
|
||||
|
Loading…
Reference in New Issue
Block a user