forked from ScoDoc/ScoDoc
JS initialisation datatables + id sur GenTable. Fix #880.
This commit is contained in:
parent
489acb26d2
commit
42882154d5
@ -73,6 +73,7 @@ class BulletinGeneratorStandardBUT(BulletinGeneratorStandard):
|
||||
html_class="notes_bulletin",
|
||||
html_class_ignore_default=True,
|
||||
html_with_td_classes=True,
|
||||
table_id="bul-table",
|
||||
)
|
||||
table_objects = table.gen(fmt=fmt)
|
||||
objects += table_objects
|
||||
|
@ -176,6 +176,7 @@ class GenTable:
|
||||
self.xml_link = xml_link
|
||||
# HTML parameters:
|
||||
if not table_id: # random id
|
||||
log("Warning: GenTable() called without table_id")
|
||||
self.table_id = "gt_" + str(random.randint(0, 1000000))
|
||||
else:
|
||||
self.table_id = table_id
|
||||
|
@ -157,5 +157,6 @@ def table_billets(
|
||||
rows=rows,
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
table_id="table_billets",
|
||||
)
|
||||
return tab
|
||||
|
@ -288,6 +288,7 @@ def apo_table_compare_etud_results(A, B):
|
||||
html_class="table_leftalign",
|
||||
html_with_td_classes=True,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="apo_table_compare_etud_results",
|
||||
)
|
||||
return T
|
||||
|
||||
|
@ -917,6 +917,7 @@ class ApoData:
|
||||
columns_ids=columns_ids,
|
||||
titles=dict(zip(columns_ids, columns_ids)),
|
||||
rows=rows,
|
||||
table_id="build_cr_table",
|
||||
xls_sheet_name="Decisions ScoDoc",
|
||||
)
|
||||
return T
|
||||
@ -969,6 +970,7 @@ class ApoData:
|
||||
"rcue": "RCUE",
|
||||
},
|
||||
rows=rows,
|
||||
table_id="adsup_table",
|
||||
xls_sheet_name="ADSUPs",
|
||||
)
|
||||
|
||||
@ -1054,6 +1056,7 @@ def nar_etuds_table(apo_data, nar_etuds):
|
||||
columns_ids=columns_ids,
|
||||
titles=dict(zip(columns_ids, columns_ids)),
|
||||
rows=rows,
|
||||
table_id="nar_etuds_table",
|
||||
xls_sheet_name="NAR ScoDoc",
|
||||
)
|
||||
return table.excel()
|
||||
|
@ -114,6 +114,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
|
||||
html_class="notes_bulletin",
|
||||
html_class_ignore_default=True,
|
||||
html_with_td_classes=True,
|
||||
table_id="std_bul_table",
|
||||
)
|
||||
|
||||
return T.gen(fmt=fmt)
|
||||
|
@ -141,6 +141,7 @@ def formsemestre_table_estim_cost(
|
||||
""",
|
||||
origin=f"""Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}""",
|
||||
filename=f"EstimCout-S{formsemestre.semestre_id}",
|
||||
table_id="formsemestre_table_estim_cost",
|
||||
)
|
||||
return tab
|
||||
|
||||
|
@ -222,6 +222,7 @@ def table_debouche_etudids(etudids, keep_numeric=True):
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign table_listegroupe",
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="table_debouche_etudids",
|
||||
)
|
||||
return tab
|
||||
|
||||
|
@ -198,6 +198,18 @@ def _sem_table_gt(formsemestres: Query, showcodes=False, fmt="html") -> GenTable
|
||||
if current_user.has_permission(Permission.EditApogee):
|
||||
html_class += " apo_editable"
|
||||
tab = GenTable(
|
||||
columns_ids=columns_ids,
|
||||
html_class_ignore_default=True,
|
||||
html_class=html_class,
|
||||
html_sortable=True,
|
||||
html_table_attrs=f"""
|
||||
data-apo_save_url="{url_for('notes.formsemestre_set_apo_etapes', scodoc_dept=g.scodoc_dept)}"
|
||||
data-elt_annee_apo_save_url="{url_for('notes.formsemestre_set_elt_annee_apo', scodoc_dept=g.scodoc_dept)}"
|
||||
data-elt_sem_apo_save_url="{url_for('notes.formsemestre_set_elt_sem_apo', scodoc_dept=g.scodoc_dept)}"
|
||||
""",
|
||||
html_with_td_classes=True,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
rows=sems,
|
||||
titles={
|
||||
"formsemestre_id": "id",
|
||||
"semestre_id_n": "S#",
|
||||
@ -211,19 +223,7 @@ def _sem_table_gt(formsemestres: Query, showcodes=False, fmt="html") -> GenTable
|
||||
"elt_sem_apo": "Elt. sem. Apo.",
|
||||
"formation": "Formation",
|
||||
},
|
||||
columns_ids=columns_ids,
|
||||
rows=sems,
|
||||
table_id="semlist",
|
||||
html_class_ignore_default=True,
|
||||
html_class=html_class,
|
||||
html_sortable=True,
|
||||
html_table_attrs=f"""
|
||||
data-apo_save_url="{url_for('notes.formsemestre_set_apo_etapes', scodoc_dept=g.scodoc_dept)}"
|
||||
data-elt_annee_apo_save_url="{url_for('notes.formsemestre_set_elt_annee_apo', scodoc_dept=g.scodoc_dept)}"
|
||||
data-elt_sem_apo_save_url="{url_for('notes.formsemestre_set_elt_sem_apo', scodoc_dept=g.scodoc_dept)}"
|
||||
""",
|
||||
html_with_td_classes=True,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
)
|
||||
|
||||
return tab
|
||||
|
@ -490,6 +490,7 @@ def table_apo_csv_list(semset):
|
||||
# base_url = '%s?formsemestre_id=%s' % (request.base_url, formsemestre_id),
|
||||
# caption='Maquettes enregistrées',
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="apo_csv_list",
|
||||
)
|
||||
|
||||
return tab
|
||||
@ -582,6 +583,7 @@ def _view_etuds_page(
|
||||
html_class="table_leftalign",
|
||||
filename="students_apo",
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="view_etuds_page",
|
||||
)
|
||||
if fmt != "html":
|
||||
return tab.make_page(fmt=fmt)
|
||||
@ -798,6 +800,7 @@ def view_apo_csv(etape_apo="", semset_id="", fmt="html"):
|
||||
filename="students_" + etape_apo,
|
||||
caption="Étudiants Apogée en " + etape_apo,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="view_apo_csv",
|
||||
)
|
||||
|
||||
if fmt != "html":
|
||||
|
@ -666,7 +666,9 @@ class EtapeBilan:
|
||||
col_ids,
|
||||
self.titres,
|
||||
html_class="repartition",
|
||||
html_sortable=True,
|
||||
html_with_td_classes=True,
|
||||
table_id="apo-repartition",
|
||||
).gen(fmt="html")
|
||||
)
|
||||
return "\n".join(H)
|
||||
@ -762,9 +764,9 @@ class EtapeBilan:
|
||||
rows,
|
||||
col_ids,
|
||||
titles,
|
||||
table_id="detail",
|
||||
html_class="table_leftalign",
|
||||
html_sortable=True,
|
||||
table_id="apo-detail",
|
||||
).gen(fmt="html")
|
||||
)
|
||||
return "\n".join(H)
|
||||
|
@ -633,6 +633,7 @@ def formsemestre_evaluations_delai_correction(formsemestre_id, fmt="html"):
|
||||
base_url="%s?formsemestre_id=%s" % (request.base_url, formsemestre_id),
|
||||
origin=f"""Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}""",
|
||||
filename=scu.make_filename("evaluations_delais_" + formsemestre.titre_annee()),
|
||||
table_id="formsemestre_evaluations_delai_correction",
|
||||
)
|
||||
return tab.make_page(fmt=fmt)
|
||||
|
||||
|
@ -106,6 +106,7 @@ def _build_results_table(start_date=None, end_date=None, types_parcours=[]):
|
||||
html_class="table_leftalign",
|
||||
html_sortable=True,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="export_result_table",
|
||||
)
|
||||
return tab, semlist
|
||||
|
||||
|
@ -236,6 +236,7 @@ def search_etud_in_dept(expnom=""):
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="search_etud_in_dept",
|
||||
)
|
||||
H.append(tab.html())
|
||||
if len(etuds) > 20: # si la page est grande
|
||||
@ -384,6 +385,7 @@ def table_etud_in_accessible_depts(expnom=None):
|
||||
rows=etuds,
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
table_id="etud_in_accessible_depts",
|
||||
)
|
||||
|
||||
H.append('<div class="table_etud_in_dept">')
|
||||
@ -419,13 +421,13 @@ def search_inscr_etud_by_nip(code_nip, fmt="json"):
|
||||
"""
|
||||
result, _ = search_etud_in_accessible_depts(code_nip=code_nip)
|
||||
|
||||
T = []
|
||||
rows = []
|
||||
for etuds in result:
|
||||
if etuds:
|
||||
dept_id = etuds[0]["dept"]
|
||||
for e in etuds:
|
||||
for sem in e["sems"]:
|
||||
T.append(
|
||||
rows.append(
|
||||
{
|
||||
"dept": dept_id,
|
||||
"etudid": e["etudid"],
|
||||
@ -450,6 +452,6 @@ def search_inscr_etud_by_nip(code_nip, fmt="json"):
|
||||
"date_debut_iso",
|
||||
"date_fin_iso",
|
||||
)
|
||||
tab = GenTable(columns_ids=columns_ids, rows=T)
|
||||
tab = GenTable(columns_ids=columns_ids, rows=rows, table_id="inscr_etud_by_nip")
|
||||
|
||||
return tab.make_page(fmt=fmt, with_html_headers=False, publish=True)
|
||||
|
@ -649,20 +649,20 @@ def formation_list_table(detail: bool) -> GenTable:
|
||||
"semestres_ues": "Semestres avec UEs",
|
||||
}
|
||||
return GenTable(
|
||||
columns_ids=columns_ids,
|
||||
rows=rows,
|
||||
titles=titles,
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
caption=title,
|
||||
html_caption=title,
|
||||
table_id="formation_list_table",
|
||||
html_class="formation_list_table table_leftalign",
|
||||
html_with_td_classes=True,
|
||||
html_sortable=True,
|
||||
base_url=f"{request.base_url}" + ("?detail=on" if detail else ""),
|
||||
caption=title,
|
||||
columns_ids=columns_ids,
|
||||
html_caption=title,
|
||||
html_class="formation_list_table table_leftalign",
|
||||
html_sortable=True,
|
||||
html_with_td_classes=True,
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
page_title=title,
|
||||
pdf_title=title,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
rows=rows,
|
||||
table_id="formation_list_table",
|
||||
titles=titles,
|
||||
)
|
||||
|
||||
|
||||
|
@ -527,15 +527,16 @@ def table_formsemestres(
|
||||
preferences = sco_preferences.SemPreferences()
|
||||
tab = GenTable(
|
||||
columns_ids=columns_ids,
|
||||
rows=sems,
|
||||
titles=titles,
|
||||
html_class="table_leftalign",
|
||||
html_empty_element="<p><em>aucun résultat</em></p>",
|
||||
html_next_section=html_next_section,
|
||||
html_sortable=True,
|
||||
html_title=html_title,
|
||||
html_next_section=html_next_section,
|
||||
html_empty_element="<p><em>aucun résultat</em></p>",
|
||||
page_title="Semestres",
|
||||
preferences=preferences,
|
||||
rows=sems,
|
||||
table_id="table_formsemestres",
|
||||
titles=titles,
|
||||
)
|
||||
return tab
|
||||
|
||||
|
@ -726,20 +726,21 @@ def formsemestre_description_table(
|
||||
rows.append(sums)
|
||||
|
||||
return GenTable(
|
||||
columns_ids=columns_ids,
|
||||
rows=rows,
|
||||
titles=titles,
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
base_url=f"{request.base_url}?formsemestre_id={formsemestre_id}&with_evals={with_evals}",
|
||||
caption=title,
|
||||
columns_ids=columns_ids,
|
||||
html_caption=title,
|
||||
html_class="table_leftalign formsemestre_description",
|
||||
base_url=f"{request.base_url}?formsemestre_id={formsemestre_id}&with_evals={with_evals}",
|
||||
page_title=title,
|
||||
html_title=html_sco_header.html_sem_header(
|
||||
"Description du semestre", with_page_header=False
|
||||
),
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
page_title=title,
|
||||
pdf_title=title,
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
rows=rows,
|
||||
table_id="formsemestre_description_table",
|
||||
titles=titles,
|
||||
)
|
||||
|
||||
|
||||
|
@ -92,5 +92,6 @@ def groups_export_annotations(group_ids, formsemestre_id=None, fmt="html"):
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
table_id="groups_export_annotations",
|
||||
)
|
||||
return table.make_page(fmt=fmt)
|
||||
|
@ -661,6 +661,7 @@ def groups_table(
|
||||
text_fields_separator=prefs["moodle_csv_separator"],
|
||||
text_with_titles=prefs["moodle_csv_with_headerline"],
|
||||
preferences=prefs,
|
||||
table_id="groups_table",
|
||||
)
|
||||
#
|
||||
if fmt == "html":
|
||||
@ -1028,10 +1029,9 @@ def export_groups_as_moodle_csv(formsemestre_id=None):
|
||||
moodle_sem_name = sem["session_id"]
|
||||
|
||||
columns_ids = ("email", "semestre_groupe")
|
||||
T = []
|
||||
for partition_id in partitions_etud_groups:
|
||||
rows = []
|
||||
for partition_id, members in partitions_etud_groups.items():
|
||||
partition = sco_groups.get_partition(partition_id)
|
||||
members = partitions_etud_groups[partition_id]
|
||||
for etudid in members:
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
group_name = members[etudid]["group_name"]
|
||||
@ -1040,16 +1040,17 @@ def export_groups_as_moodle_csv(formsemestre_id=None):
|
||||
elts.append(partition["partition_name"])
|
||||
if group_name:
|
||||
elts.append(group_name)
|
||||
T.append({"email": etud["email"], "semestre_groupe": "-".join(elts)})
|
||||
rows.append({"email": etud["email"], "semestre_groupe": "-".join(elts)})
|
||||
# Make table
|
||||
prefs = sco_preferences.SemPreferences(formsemestre_id)
|
||||
tab = GenTable(
|
||||
rows=T,
|
||||
columns_ids=("email", "semestre_groupe"),
|
||||
filename=moodle_sem_name + "-moodle",
|
||||
titles={x: x for x in columns_ids},
|
||||
preferences=prefs,
|
||||
rows=rows,
|
||||
text_fields_separator=prefs["moodle_csv_separator"],
|
||||
text_with_titles=prefs["moodle_csv_with_headerline"],
|
||||
preferences=prefs,
|
||||
table_id="export_groups_as_moodle_csv",
|
||||
titles={x: x for x in columns_ids},
|
||||
)
|
||||
return tab.make_page(fmt="csv")
|
||||
|
@ -834,11 +834,12 @@ def adm_table_description_format():
|
||||
columns_ids = ("attribute", "type", "writable", "description", "aliases_str")
|
||||
|
||||
tab = GenTable(
|
||||
titles=titles,
|
||||
columns_ids=columns_ids,
|
||||
rows=list(Fmt.values()),
|
||||
html_sortable=True,
|
||||
html_class="table_leftalign",
|
||||
html_sortable=True,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
rows=list(Fmt.values()),
|
||||
table_id="adm_table_description_format",
|
||||
titles=titles,
|
||||
)
|
||||
return tab
|
||||
|
@ -747,10 +747,11 @@ def etuds_select_box_xls(src_cat):
|
||||
else:
|
||||
e["paiementinscription_str"] = "-"
|
||||
tab = GenTable(
|
||||
titles=titles,
|
||||
columns_ids=columns_ids,
|
||||
rows=etuds,
|
||||
caption="%(title)s. %(help)s" % src_cat["infos"],
|
||||
columns_ids=columns_ids,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
rows=etuds,
|
||||
table_id="etuds_select_box_xls",
|
||||
titles=titles,
|
||||
)
|
||||
return tab.excel() # tab.make_page(filename=src_cat["infos"]["filename"])
|
||||
|
@ -599,20 +599,21 @@ def _make_table_notes(
|
||||
)
|
||||
# display
|
||||
tab = GenTable(
|
||||
titles=titles,
|
||||
columns_ids=columns_ids,
|
||||
rows=rows,
|
||||
html_sortable=True,
|
||||
base_url=base_url,
|
||||
filename=filename,
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
caption=caption,
|
||||
html_next_section=html_next_section,
|
||||
page_title="Notes de " + formsemestre.titre_mois(),
|
||||
html_title=html_title,
|
||||
pdf_title=pdf_title,
|
||||
columns_ids=columns_ids,
|
||||
filename=filename,
|
||||
html_class="notes_evaluation",
|
||||
html_next_section=html_next_section,
|
||||
html_sortable=True,
|
||||
html_title=html_title,
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
page_title="Notes de " + formsemestre.titre_mois(),
|
||||
pdf_title=pdf_title,
|
||||
preferences=sco_preferences.SemPreferences(formsemestre.id),
|
||||
rows=rows,
|
||||
table_id="table-liste-notes",
|
||||
titles=titles,
|
||||
# html_generate_cells=False # la derniere ligne (moyennes) est incomplete
|
||||
)
|
||||
if fmt == "bordereau":
|
||||
|
@ -180,6 +180,7 @@ def _table_etuds_lycees(etuds, group_lycees, title, preferences, no_links=False)
|
||||
html_class="table_leftalign table_listegroupe",
|
||||
bottom_titles=bottom_titles,
|
||||
preferences=preferences,
|
||||
table_id="table_etuds_lycees",
|
||||
)
|
||||
return tab, etuds_by_lycee
|
||||
|
||||
|
@ -351,7 +351,7 @@ class ScoDocPageTemplate(PageTemplate):
|
||||
canv.drawString(
|
||||
self.preferences["pdf_footer_x"] * mm,
|
||||
self.preferences["pdf_footer_y"] * mm,
|
||||
content + " " + self.preferences["pdf_footer_extra"],
|
||||
content + " " + (self.preferences["pdf_footer_extra"] or ""),
|
||||
)
|
||||
canv.restoreState()
|
||||
|
||||
|
@ -378,6 +378,7 @@ class PlacementRunner:
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
self.moduleimpl_data["formsemestre_id"]
|
||||
),
|
||||
table_id="placement_pdf",
|
||||
)
|
||||
return tab.make_page(fmt="pdf", with_html_headers=False)
|
||||
|
||||
|
@ -221,6 +221,7 @@ def formsemestre_poursuite_report(formsemestre_id, fmt="html"):
|
||||
html_class="table_leftalign table_listegroupe",
|
||||
pdf_link=False, # pas d'export pdf
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
table_id="formsemestre_poursuite_report",
|
||||
)
|
||||
tab.filename = scu.make_filename("poursuite " + sem["titreannee"])
|
||||
|
||||
|
@ -252,6 +252,7 @@ def formsemestre_pvjury(formsemestre_id, fmt="html", publish=True):
|
||||
html_class="table_leftalign",
|
||||
html_sortable=True,
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
table_id="formsemestre_pvjury",
|
||||
)
|
||||
if fmt != "html":
|
||||
return tab.make_page(
|
||||
@ -312,6 +313,7 @@ def formsemestre_pvjury(formsemestre_id, fmt="html", publish=True):
|
||||
html_sortable=True,
|
||||
html_with_td_classes=True,
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
table_id="formsemestre_pvjury_counts",
|
||||
).html()
|
||||
)
|
||||
H.append(
|
||||
|
@ -236,6 +236,7 @@ def _results_by_category(
|
||||
html_col_width="4em",
|
||||
html_sortable=True,
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
table_id=f"results_by_category-{category_name}",
|
||||
)
|
||||
|
||||
|
||||
@ -695,19 +696,18 @@ def table_suivi_cohorte(
|
||||
if statut:
|
||||
dbac += " statut: %s" % statut
|
||||
tab = GenTable(
|
||||
titles=titles,
|
||||
caption="Suivi cohorte " + pp + sem["titreannee"] + dbac,
|
||||
columns_ids=columns_ids,
|
||||
rows=L,
|
||||
filename=scu.make_filename("cohorte " + sem["titreannee"]),
|
||||
html_class="table_cohorte",
|
||||
html_col_width="4em",
|
||||
html_sortable=True,
|
||||
filename=scu.make_filename("cohorte " + sem["titreannee"]),
|
||||
origin="Généré par %s le " % sco_version.SCONAME
|
||||
+ scu.timedate_human_repr()
|
||||
+ "",
|
||||
caption="Suivi cohorte " + pp + sem["titreannee"] + dbac,
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
page_title="Suivi cohorte " + sem["titreannee"],
|
||||
html_class="table_cohorte",
|
||||
preferences=sco_preferences.SemPreferences(formsemestre.id),
|
||||
rows=L,
|
||||
table_id="table_suivi_cohorte",
|
||||
titles=titles,
|
||||
)
|
||||
# Explication: liste des semestres associés à chaque date
|
||||
if not P:
|
||||
@ -1304,6 +1304,7 @@ def table_suivi_cursus(formsemestre_id, only_primo=False, grouped_parcours=True)
|
||||
"code_cursus": len(etuds),
|
||||
},
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
table_id="table_suivi_cursus",
|
||||
)
|
||||
return tab
|
||||
|
||||
|
@ -87,15 +87,16 @@ def formsemestre_but_indicateurs(formsemestre_id: int, fmt="html"):
|
||||
bacs.append("Total")
|
||||
|
||||
tab = GenTable(
|
||||
titles={bac: bac for bac in bacs},
|
||||
columns_ids=["titre_indicateur"] + bacs,
|
||||
rows=rows,
|
||||
html_sortable=False,
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
filename=scu.make_filename(f"Indicateurs_BUT_{formsemestre.titre_annee()}"),
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
html_caption="Indicateurs BUT annuels.",
|
||||
base_url=f"{request.base_url}?formsemestre_id={formsemestre_id}",
|
||||
columns_ids=["titre_indicateur"] + bacs,
|
||||
filename=scu.make_filename(f"Indicateurs_BUT_{formsemestre.titre_annee()}"),
|
||||
html_caption="Indicateurs BUT annuels.",
|
||||
html_sortable=False,
|
||||
origin=f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}",
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
rows=rows,
|
||||
titles={bac: bac for bac in bacs},
|
||||
table_id="formsemestre_but_indicateurs",
|
||||
)
|
||||
title = "Indicateurs suivi annuel BUT"
|
||||
t = tab.make_page(
|
||||
|
@ -378,9 +378,8 @@ class SemSet(dict):
|
||||
|
||||
def html_diagnostic(self):
|
||||
"""Affichage de la partie Effectifs et Liste des étudiants
|
||||
(actif seulement si un portail est configuré) XXX pourquoi ??
|
||||
(actif seulement si un portail est configuré)
|
||||
"""
|
||||
if sco_portal_apogee.has_portal():
|
||||
return self.bilan.html_diagnostic()
|
||||
return ""
|
||||
|
||||
@ -482,10 +481,9 @@ def semset_page(fmt="html"):
|
||||
# (remplacé par n liens vers chacun des semestres)
|
||||
# s['_semtitles_str_target'] = s['_export_link_target']
|
||||
# Experimental:
|
||||
s[
|
||||
"_title_td_attrs"
|
||||
] = 'class="inplace_edit" data-url="edit_semset_set_title" id="%s"' % (
|
||||
s["semset_id"]
|
||||
s["_title_td_attrs"] = (
|
||||
'class="inplace_edit" data-url="edit_semset_set_title" id="%s"'
|
||||
% (s["semset_id"])
|
||||
)
|
||||
|
||||
tab = GenTable(
|
||||
@ -513,6 +511,7 @@ def semset_page(fmt="html"):
|
||||
html_class="table_leftalign",
|
||||
filename="semsets",
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="table-semsets",
|
||||
)
|
||||
if fmt != "html":
|
||||
return tab.make_page(fmt=fmt)
|
||||
|
@ -169,6 +169,7 @@ def evaluation_list_operations(evaluation_id):
|
||||
preferences=sco_preferences.SemPreferences(
|
||||
evaluation.moduleimpl.formsemestre_id
|
||||
),
|
||||
table_id="evaluation_list_operations",
|
||||
)
|
||||
return tab.make_page()
|
||||
|
||||
@ -241,6 +242,7 @@ def formsemestre_list_saisies_notes(formsemestre_id, fmt="html"):
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
base_url="%s?formsemestre_id=%s" % (request.base_url, formsemestre_id),
|
||||
origin=f"Généré par {sco_version.SCONAME} le " + scu.timedate_human_repr() + "",
|
||||
table_id="formsemestre_list_saisies_notes",
|
||||
)
|
||||
return tab.make_page(fmt=fmt)
|
||||
|
||||
|
@ -239,6 +239,7 @@ def list_users(
|
||||
base_url="%s?all_depts=%s" % (request.base_url, 1 if all_depts else 0),
|
||||
pdf_link=False, # table is too wide to fit in a paper page => disable pdf
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="list-users",
|
||||
)
|
||||
|
||||
return tab.make_page(fmt=fmt, with_html_headers=False)
|
||||
|
@ -155,18 +155,9 @@ function get_query_args() {
|
||||
|
||||
// Tables (gen_tables)
|
||||
$(function () {
|
||||
if ($("table.gt_table").length > 0) {
|
||||
const url = new URL(document.URL);
|
||||
const order_info_key = JSON.stringify(["table_order", url.pathname]);
|
||||
let order_info;
|
||||
const x = localStorage.getItem(order_info_key);
|
||||
if (x) {
|
||||
try {
|
||||
order_info = JSON.parse(x);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
if ($("table.gt_table, table.gt_table_searchable").length > 0) {
|
||||
|
||||
|
||||
var table_options = {
|
||||
paging: false,
|
||||
searching: false,
|
||||
@ -178,20 +169,47 @@ $(function () {
|
||||
},
|
||||
orderCellsTop: true, // cellules ligne 1 pour tri
|
||||
aaSorting: [], // Prevent initial sorting
|
||||
order: order_info,
|
||||
order: "",
|
||||
drawCallback: function (settings) {
|
||||
// permet de conserver l'ordre de tri des colonnes
|
||||
let table = $("table.gt_table").DataTable();
|
||||
let order_info = JSON.stringify(table.order());
|
||||
let currentTable = $(settings.nTable);
|
||||
let order_info_key = get_table_order_info_key(currentTable.attr("id"));
|
||||
let dataTableInstance = $(currentTable).DataTable();
|
||||
let order_info = JSON.stringify(dataTableInstance.order());
|
||||
localStorage.setItem(order_info_key, order_info);
|
||||
},
|
||||
};
|
||||
$("table.gt_table").DataTable(table_options);
|
||||
|
||||
$('.gt_table').each(function() {
|
||||
const x = localStorage.getItem(get_table_order_info_key(this.id));
|
||||
if (x) {
|
||||
try {
|
||||
let order_info = JSON.parse(x);
|
||||
console.log("set order=" + order_info);
|
||||
table_options.order = order_info;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
delete table_options.order;
|
||||
}
|
||||
} else {
|
||||
delete table_options.order;
|
||||
}
|
||||
|
||||
$(this).DataTable(table_options);
|
||||
});
|
||||
|
||||
table_options["searching"] = true;
|
||||
$("table.gt_table_searchable").DataTable(table_options);
|
||||
$("table.gt_table_searchable").each(function() {
|
||||
$(this).DataTable(table_options);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function get_table_order_info_key(table_id) {
|
||||
const url = new URL(document.URL);
|
||||
return JSON.stringify(["table_order", table_id, url.pathname]);
|
||||
}
|
||||
|
||||
// Show tags (readonly)
|
||||
function readOnlyTags(nodes) {
|
||||
// nodes are textareas, hide them and create a span showing tags
|
||||
|
@ -1248,6 +1248,7 @@ def view_module_abs(moduleimpl_id, fmt="html"):
|
||||
filename="absmodule_" + scu.make_filename(modimpl.module.titre_str()),
|
||||
caption=f"Absences dans le module {modimpl.module.titre_str()}",
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="view_module_abs",
|
||||
)
|
||||
|
||||
if fmt != "html":
|
||||
@ -1340,7 +1341,7 @@ def formsemestre_enseignants_list(formsemestre_id, fmt="html"):
|
||||
|
||||
# --- Generate page with table
|
||||
title = f"Enseignants de {formsemestre.titre_mois()}"
|
||||
T = GenTable(
|
||||
table = GenTable(
|
||||
columns_ids=["nom_fmt", "prenom_fmt", "descr_mods", "nbabsadded", "email"],
|
||||
titles={
|
||||
"nom_fmt": "Nom",
|
||||
@ -1361,8 +1362,9 @@ def formsemestre_enseignants_list(formsemestre_id, fmt="html"):
|
||||
caption="""Tous les enseignants (responsables ou associés aux modules de
|
||||
ce semestre) apparaissent. Le nombre de saisies d'absences est indicatif.""",
|
||||
preferences=sco_preferences.SemPreferences(formsemestre_id),
|
||||
table_id="formsemestre_enseignants_list",
|
||||
)
|
||||
return T.make_page(page_title=title, title=title, fmt=fmt)
|
||||
return table.make_page(page_title=title, title=title, fmt=fmt)
|
||||
|
||||
|
||||
@bp.route("/edit_enseignants_form_delete", methods=["GET", "POST"])
|
||||
|
@ -128,6 +128,7 @@ def refcomp_table():
|
||||
}
|
||||
for ref in refs
|
||||
],
|
||||
table_id="refcomp_table",
|
||||
)
|
||||
return render_template(
|
||||
"but/refcomp_table.j2",
|
||||
|
@ -332,6 +332,7 @@ def showEtudLog(etudid, fmt="html"):
|
||||
fiche de {etud['nomprenom']}</a></li>
|
||||
</ul>""",
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="showEtudLog",
|
||||
)
|
||||
|
||||
return tab.make_page(fmt=fmt)
|
||||
|
@ -36,7 +36,7 @@ def xmls_compare(x, y):
|
||||
def test_export_xml(test_client):
|
||||
"""exports XML compatibles ScoDoc 7"""
|
||||
# expected_result est le résultat de l'ancienne fonction ScoDoc7:
|
||||
for (data, expected_result) in (
|
||||
for data, expected_result in (
|
||||
(
|
||||
[{"id": 1, "ues": [{"note": 10}, {}, {"valeur": 25}]}, {"bis": 2}],
|
||||
"""<?xml version="1.0" encoding="utf-8"?>
|
||||
@ -122,6 +122,7 @@ def test_export_xml(test_client):
|
||||
table = GenTable(
|
||||
rows=[{"nom": "Toto", "age": 26}, {"nom": "Titi", "age": 21}],
|
||||
columns_ids=("nom", "age"),
|
||||
table_id="test_export_xml",
|
||||
)
|
||||
table_xml = table.xml()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user