forked from ScoDoc/ScoDoc
Compare commits
8 Commits
aa9d85f4bd
...
0509f1c923
Author | SHA1 | Date | |
---|---|---|---|
0509f1c923 | |||
659c790af2 | |||
88d9356209 | |||
84580a8a6f | |||
bf53dfa93a | |||
c1d8a34e34 | |||
dc53fe8395 | |||
464d678299 |
@ -685,6 +685,7 @@ class GenTable:
|
||||
javascripts=(),
|
||||
with_html_headers=True,
|
||||
publish=True,
|
||||
template="sco_page.j2",
|
||||
):
|
||||
"""
|
||||
Build page at given format
|
||||
@ -703,7 +704,7 @@ class GenTable:
|
||||
H.append(self.html())
|
||||
if with_html_headers:
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
template,
|
||||
content="\n".join(H),
|
||||
title=page_title,
|
||||
javascripts=javascripts,
|
||||
|
@ -36,7 +36,6 @@ from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||
from app.scodoc.sco_exceptions import ScoPermissionDenied
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_bulletins_pdf
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_groups_view
|
||||
@ -123,18 +122,18 @@ def do_formsemestre_archive(
|
||||
)
|
||||
if table_html:
|
||||
flash(f"Moyennes archivées le {date}", category="info")
|
||||
data = "\n".join(
|
||||
[
|
||||
html_sco_header.sco_header(
|
||||
page_title=f"Moyennes archivées le {date}",
|
||||
no_sidebar=True,
|
||||
),
|
||||
f'<h2 class="fontorange">Valeurs archivées le {date}</h2>',
|
||||
"""<style type="text/css">table.notes_recapcomplet tr { color: rgb(185,70,0); }
|
||||
data = render_template(
|
||||
"sco_page.j2",
|
||||
no_sidebar=True,
|
||||
title=f"Moyennes archivées le {date}",
|
||||
content="\n".join(
|
||||
[
|
||||
f'<h2 class="fontorange">Valeurs archivées le {date}</h2>',
|
||||
"""<style type="text/css">table.notes_recapcomplet tr { color: rgb(185,70,0); }
|
||||
</style>""",
|
||||
table_html,
|
||||
html_sco_header.sco_footer(),
|
||||
]
|
||||
table_html,
|
||||
]
|
||||
),
|
||||
)
|
||||
PV_ARCHIVER.store(
|
||||
archive_id, "Tableau_moyennes.html", data, dept_id=formsemestre.dept_id
|
||||
@ -254,7 +253,6 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
|
||||
}">Paramétrage</a>"
|
||||
(accessible à l'administrateur du département).</em>
|
||||
</p>""",
|
||||
html_sco_header.sco_footer(),
|
||||
]
|
||||
|
||||
descr = [
|
||||
|
@ -29,7 +29,7 @@
|
||||
Rapport (table) avec dernier semestre fréquenté et débouché de chaque étudiant
|
||||
"""
|
||||
import http
|
||||
from flask import url_for, g, request
|
||||
from flask import g, render_template, request, url_for
|
||||
|
||||
from app import log
|
||||
from app.comp import res_sem
|
||||
@ -40,7 +40,6 @@ import app.scodoc.notesdb as ndb
|
||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc import safehtml
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_permissions_check
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_tag_module
|
||||
@ -78,6 +77,7 @@ def report_debouche_date(start_year=None, fmt="html"):
|
||||
title="""<h2 class="formsemestre">Débouchés étudiants </h2>""",
|
||||
fmt=fmt,
|
||||
with_html_headers=True,
|
||||
template="sco_page_dept.j2",
|
||||
)
|
||||
|
||||
|
||||
@ -226,14 +226,16 @@ def table_debouche_etudids(etudids, keep_numeric=True):
|
||||
|
||||
def report_debouche_ask_date(msg: str) -> str:
|
||||
"""Formulaire demande date départ"""
|
||||
return f"""{html_sco_header.sco_header()}
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
content=f"""
|
||||
<h2>Table des débouchés des étudiants</h2>
|
||||
<form method="GET">
|
||||
{msg}
|
||||
<input type="text" name="start_year" value="" size=10/>
|
||||
</form>
|
||||
{html_sco_header.sco_footer()}
|
||||
"""
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -323,11 +325,11 @@ def itemsuivi_set_date(itemsuivi_id, item_date):
|
||||
return ("", 204)
|
||||
|
||||
|
||||
def itemsuivi_set_situation(object, value):
|
||||
def itemsuivi_set_situation(obj, value):
|
||||
"""set situation"""
|
||||
if not sco_permissions_check.can_edit_suivi():
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
itemsuivi_id = object
|
||||
itemsuivi_id = obj
|
||||
situation = value.strip("-_ \t")
|
||||
# log('itemsuivi_set_situation %s : %s' % (itemsuivi_id, situation))
|
||||
cnx = ndb.GetDBConnexion()
|
||||
|
@ -29,7 +29,7 @@
|
||||
(portage from DTML)
|
||||
"""
|
||||
import flask
|
||||
from flask import flash, g, url_for, request
|
||||
from flask import flash, g, url_for, render_template, request
|
||||
import sqlalchemy
|
||||
|
||||
from app import db
|
||||
@ -54,7 +54,6 @@ def formation_delete(formation_id=None, dialog_confirmed=False):
|
||||
formation: Formation = Formation.query.get_or_404(formation_id)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Suppression d'une formation"),
|
||||
f"""<h2>Suppression de la formation {formation.titre} ({formation.acronyme})</h2>""",
|
||||
]
|
||||
formsemestres = formation.formsemestres.all()
|
||||
@ -85,6 +84,7 @@ def formation_delete(formation_id=None, dialog_confirmed=False):
|
||||
OK="Supprimer cette formation",
|
||||
cancel_url=url_for("notes.index_html", scodoc_dept=g.scodoc_dept),
|
||||
parameters={"formation_id": formation_id},
|
||||
template="sco_page_dept.j2",
|
||||
)
|
||||
else:
|
||||
do_formation_delete(formation_id)
|
||||
@ -95,8 +95,9 @@ def formation_delete(formation_id=None, dialog_confirmed=False):
|
||||
}">continuer</a></p>"""
|
||||
)
|
||||
|
||||
H.append(html_sco_header.sco_footer())
|
||||
return "\n".join(H)
|
||||
return render_template(
|
||||
"sco_page-dept.j2", content="\n".join(H), title="Suppression d'une formation"
|
||||
)
|
||||
|
||||
|
||||
def do_formation_delete(formation_id):
|
||||
|
@ -51,7 +51,6 @@ from app.scodoc.sco_exceptions import (
|
||||
ScoGenError,
|
||||
ScoNonEmptyFormationObject,
|
||||
)
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import codes_cursus
|
||||
from app.scodoc import sco_edit_matiere
|
||||
from app.scodoc import sco_moduleimpl
|
||||
@ -208,8 +207,8 @@ def module_delete(module_id=None):
|
||||
)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Suppression d'un module"),
|
||||
f"""<h2>Suppression du module {module.titre or "<em>sans titre</em>"} ({module.code})</h2>""",
|
||||
f"""<h2>Suppression du module {module.titre or "<em>sans titre</em>"}
|
||||
({module.code})</h2>""",
|
||||
]
|
||||
|
||||
dest_url = url_for(
|
||||
@ -227,7 +226,11 @@ def module_delete(module_id=None):
|
||||
cancelbutton="Annuler",
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title="Suppression d'un module",
|
||||
content="\n".join(H) + tf[1],
|
||||
)
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(dest_url)
|
||||
else:
|
||||
@ -372,16 +375,6 @@ def module_edit(
|
||||
"""
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title=page_title,
|
||||
cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"],
|
||||
javascripts=[
|
||||
"libjs/jQuery-tagEditor/jquery.tag-editor.min.js",
|
||||
"libjs/jQuery-tagEditor/jquery.caret.min.js",
|
||||
"js/module_tag_editor.js",
|
||||
"js/module_edit.js",
|
||||
],
|
||||
),
|
||||
f"""<h2>{title}</h2>""",
|
||||
render_template(
|
||||
"scodoc/help/modules.j2",
|
||||
@ -780,7 +773,7 @@ def module_edit(
|
||||
scu.get_request_args(),
|
||||
descr,
|
||||
html_foot_markup=(
|
||||
f"""<div class="sco_tag_module_edit"><span
|
||||
f"""<div class="scobox sco_tag_module_edit"><span
|
||||
class="sco_tag_edit"><textarea data-module_id="{module_id}" class="module_tag_editor"
|
||||
>{','.join(sco_tag_module.module_tag_list(module_id))}</textarea></span></div>
|
||||
"""
|
||||
@ -793,8 +786,17 @@ def module_edit(
|
||||
)
|
||||
#
|
||||
if tf[0] == 0:
|
||||
return (
|
||||
"\n".join(H)
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title=page_title,
|
||||
cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"],
|
||||
javascripts=[
|
||||
"libjs/jQuery-tagEditor/jquery.tag-editor.min.js",
|
||||
"libjs/jQuery-tagEditor/jquery.caret.min.js",
|
||||
"js/module_tag_editor.js",
|
||||
"js/module_edit.js",
|
||||
],
|
||||
content="\n".join(H)
|
||||
+ tf[1]
|
||||
+ (
|
||||
f"""
|
||||
@ -805,8 +807,7 @@ def module_edit(
|
||||
"""
|
||||
if not create
|
||||
else ""
|
||||
)
|
||||
+ html_sco_header.sco_footer()
|
||||
),
|
||||
)
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(
|
||||
@ -904,9 +905,6 @@ def module_table(formation_id):
|
||||
raise ScoValueError("invalid formation !")
|
||||
formation: Formation = Formation.query.get_or_404(formation_id)
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title=f"Liste des modules de {formation.titre}"
|
||||
),
|
||||
f"""<h2>Listes des modules dans la formation {formation.titre} ({formation.acronyme}</h2>
|
||||
<ul class="notes_module_list">
|
||||
""",
|
||||
@ -926,8 +924,11 @@ def module_table(formation_id):
|
||||
)
|
||||
H.append("</li>")
|
||||
H.append("</ul>")
|
||||
H.append(html_sco_header.sco_footer())
|
||||
return "\n".join(H)
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title=f"Liste des modules de {formation.titre}",
|
||||
content="\n".join(H),
|
||||
)
|
||||
|
||||
|
||||
def module_is_locked(module_id):
|
||||
|
@ -505,8 +505,11 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
||||
else:
|
||||
clone_form = ""
|
||||
|
||||
return f"""
|
||||
{html_sco_header.sco_header(page_title=title, javascripts=["js/edit_ue.js"])}
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title=title,
|
||||
javascripts=["js/edit_ue.js"],
|
||||
content=f"""
|
||||
<h2>{title}, (formation {formation.acronyme}, version {formation.version})</h2>
|
||||
<p class="help">Les UEs sont des groupes de modules dans une formation donnée,
|
||||
utilisés pour la validation (on calcule des moyennes par UE et applique des
|
||||
@ -529,9 +532,8 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No
|
||||
|
||||
<div id="bonus_description" class="scobox"></div>
|
||||
<div id="ue_list_code" class="sco_box sco_green_bg"></div>
|
||||
|
||||
{html_sco_header.sco_footer()}
|
||||
"""
|
||||
""",
|
||||
)
|
||||
elif tf[0] == 1:
|
||||
if create:
|
||||
if not tf[2]["ue_code"]:
|
||||
|
@ -486,7 +486,8 @@ def formsemestre_evaluations_cal(formsemestre_id):
|
||||
<div class="cal_evaluations">
|
||||
{ cal_html }
|
||||
</div>
|
||||
<p>soit {nb_evals} évaluations planifiées;
|
||||
<div class="scobox maxwidth">
|
||||
<p>soit {nb_evals} évaluations planifiées :
|
||||
</p>
|
||||
<ul>
|
||||
<li>en <span style=
|
||||
@ -508,6 +509,7 @@ def formsemestre_evaluations_cal(formsemestre_id):
|
||||
)
|
||||
}" class="stdlink">voir les délais de correction</a>
|
||||
</p>
|
||||
</div>
|
||||
""",
|
||||
)
|
||||
|
||||
|
@ -825,7 +825,7 @@ def excel_feuille_listeappel(
|
||||
ws.append_blank_row()
|
||||
|
||||
# bas de page (date, serveur)
|
||||
dt = time.strftime("%d/%m/%Y à %Hh%M")
|
||||
dt = time.strftime(scu.DATEATIME_FMT)
|
||||
if server_name:
|
||||
dt += " sur " + server_name
|
||||
cell_2 = ws.make_cell(("Liste éditée le " + dt), style1i)
|
||||
|
@ -174,7 +174,9 @@ def formation_table_recap(formation: Formation, fmt="html") -> Response:
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
table_id="formation_table_recap",
|
||||
)
|
||||
return tab.make_page(fmt=fmt, javascripts=["js/formation_recap.js"])
|
||||
return tab.make_page(
|
||||
fmt=fmt, javascripts=["js/formation_recap.js"], template="sco_page_dept.j2"
|
||||
)
|
||||
|
||||
|
||||
def export_recap_formations_annee_scolaire(annee_scolaire):
|
||||
|
@ -149,6 +149,7 @@ def formsemestre_associate_new_version(
|
||||
"formation_id": formation_id,
|
||||
"formsemestre_id": formsemestre_id,
|
||||
},
|
||||
template="sco_page_dept.j2",
|
||||
)
|
||||
elif request.method == "POST":
|
||||
if formsemestre_id is not None: # pas dans le form car checkbox disabled
|
||||
|
@ -60,7 +60,6 @@ from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc.sco_vdi import ApoEtapeVDI
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import codes_cursus
|
||||
from app.scodoc import sco_edit_module
|
||||
from app.scodoc import sco_formsemestre
|
||||
@ -80,20 +79,20 @@ def _default_sem_title(formation):
|
||||
|
||||
def formsemestre_createwithmodules():
|
||||
"""Page création d'un semestre"""
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title="Création d'un semestre",
|
||||
javascripts=["libjs/AutoSuggest.js", "js/formsemestre_edit.js"],
|
||||
cssstyles=["css/autosuggest_inquisitor.css"],
|
||||
),
|
||||
"""<h2>Mise en place d'un semestre de formation</h2>""",
|
||||
]
|
||||
H = ["""<h2>Mise en place d'un semestre de formation</h2>"""]
|
||||
r = do_formsemestre_createwithmodules()
|
||||
if isinstance(r, str):
|
||||
H.append(r)
|
||||
else:
|
||||
if not isinstance(r, str):
|
||||
return r # response redirect
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
H.append(r)
|
||||
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title="Création d'un semestre",
|
||||
content="\n".join(H),
|
||||
javascripts=["libjs/AutoSuggest.js", "js/formsemestre_edit.js"],
|
||||
cssstyles=["css/autosuggest_inquisitor.css"],
|
||||
)
|
||||
|
||||
|
||||
def formsemestre_editwithmodules(formsemestre_id: int):
|
||||
@ -1398,7 +1397,8 @@ def do_formsemestre_clone(
|
||||
formsemestre.parcours = formsemestre_orig.parcours
|
||||
|
||||
# 6- Copy description
|
||||
formsemestre.description = formsemestre_orig.description.clone()
|
||||
if formsemestre_orig.description:
|
||||
formsemestre.description = formsemestre_orig.description.clone()
|
||||
|
||||
db.session.add(formsemestre)
|
||||
db.session.commit()
|
||||
|
@ -802,7 +802,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
|
||||
})</span></h3>"""
|
||||
)
|
||||
#
|
||||
H.append('<div class="sem-groups-abs">')
|
||||
H.append('<div class="sem-groups-abs space-before-18">')
|
||||
|
||||
disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre)
|
||||
show_abs: str = "hidden" if disable_abs else ""
|
||||
@ -812,6 +812,8 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
|
||||
groups = partition.groups.all()
|
||||
effectifs = {g.id: g.get_nb_inscrits() for g in groups}
|
||||
partition_is_empty = sum(effectifs.values()) == 0
|
||||
if partition_is_empty and (partition.is_default() or partition.is_parcours()):
|
||||
continue # inutile de montrer des partitions vides non éditables
|
||||
H.append(
|
||||
f"""
|
||||
<div class="sem-groups-partition">
|
||||
@ -909,7 +911,9 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
|
||||
)
|
||||
|
||||
H.append("</div>") # /sem-groups-assi
|
||||
if partition_is_empty and not partition.is_default():
|
||||
if partition_is_empty and not (
|
||||
partition.is_default() or partition.is_parcours()
|
||||
):
|
||||
H.append(
|
||||
'<div class="help sem-groups-none">Aucun groupe peuplé dans cette partition'
|
||||
)
|
||||
@ -924,41 +928,72 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
|
||||
H.append("</div>")
|
||||
H.append("</div>") # /sem-groups-partition
|
||||
|
||||
# Boite avec liens divers
|
||||
autres_liens = []
|
||||
if formsemestre.can_change_groups():
|
||||
H.append(
|
||||
f"""<h4><a class="stdlink"
|
||||
autres_liens.append(
|
||||
f"""<a class="stdlink"
|
||||
title="une partition est un ensemble de groupes: TD, TP, ..."
|
||||
href="{url_for("scolar.partition_editor",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=formsemestre.id,
|
||||
edit_partition=1)
|
||||
}">Ajouter une partition</a></h4>"""
|
||||
}">Ajouter une partition</a>"""
|
||||
)
|
||||
|
||||
# --- Formulaire importation Assiduité excel (si autorisé)
|
||||
if current_user.has_permission(Permission.AbsChange) and not disable_abs:
|
||||
H.append(
|
||||
f"""<p>
|
||||
autres_liens.append(
|
||||
f"""
|
||||
<a class="stdlink" href="{url_for('assiduites.feuille_abs_formsemestre',
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=formsemestre.id)}">
|
||||
Importation de l'assiduité depuis un fichier excel</a>
|
||||
</p>"""
|
||||
"""
|
||||
)
|
||||
|
||||
# --- Lien Traitement Justificatifs:
|
||||
|
||||
if (
|
||||
current_user.has_permission(Permission.AbsJustifView)
|
||||
and current_user.has_permission(Permission.JustifValidate)
|
||||
and not disable_abs
|
||||
):
|
||||
H.append(
|
||||
f"""<p>
|
||||
autres_liens.append(
|
||||
f"""
|
||||
<a class="stdlink" href="{url_for('assiduites.traitement_justificatifs',
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=formsemestre.id)}">
|
||||
Traitement des justificatifs d'absence</a>
|
||||
</p>"""
|
||||
"""
|
||||
)
|
||||
|
||||
# --- Lien pour mail aux enseignants
|
||||
# Construit la liste de tous les enseignants de ce semestre:
|
||||
mails_enseignants = set(u.email for u in formsemestre.responsables)
|
||||
for modimpl in formsemestre.modimpls_sorted:
|
||||
mails_enseignants.add(sco_users.user_info(modimpl.responsable_id)["email"])
|
||||
mails_enseignants |= {u.email for u in modimpl.enseignants if u.email}
|
||||
adrlist = list(mails_enseignants - {None, ""})
|
||||
if adrlist:
|
||||
autres_liens.append(
|
||||
f"""
|
||||
<a class="stdlink" href="mailto:?cc={','.join(adrlist)}">Courrier aux {
|
||||
len(adrlist)} enseignants du semestre</a>
|
||||
"""
|
||||
)
|
||||
|
||||
# Met le tout en boite
|
||||
if autres_liens:
|
||||
H.append(
|
||||
f"""
|
||||
<div class="sem-groups-partition sem-groups-autres-liens">
|
||||
<div class="sem-groups-none">
|
||||
<ul>
|
||||
<li>{'</li><li>'.join(autres_liens)}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
"""
|
||||
)
|
||||
|
||||
H.append("</div>")
|
||||
@ -1033,8 +1068,9 @@ def formsemestre_status_head(formsemestre_id: int = None, page_title: str = None
|
||||
)
|
||||
if evals["last_modif"]:
|
||||
H.append(
|
||||
" <em>(dernière note saisie le %s)</em>"
|
||||
% evals["last_modif"].strftime("%d/%m/%Y à %Hh%M")
|
||||
f""" <em>(dernière note saisie le {
|
||||
evals["last_modif"].strftime(scu.DATEATIME_FMT)
|
||||
})</em>"""
|
||||
)
|
||||
H.append("</td></tr>")
|
||||
H.append("</table>")
|
||||
@ -1073,12 +1109,6 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
|
||||
modimpls = formsemestre.modimpls_sorted
|
||||
nt = res_sem.load_formsemestre_results(formsemestre)
|
||||
|
||||
# Construit la liste de tous les enseignants de ce semestre:
|
||||
mails_enseignants = set(u.email for u in formsemestre.responsables)
|
||||
for modimpl in modimpls:
|
||||
mails_enseignants.add(sco_users.user_info(modimpl.responsable_id)["email"])
|
||||
mails_enseignants |= {u.email for u in modimpl.enseignants if u.email}
|
||||
|
||||
can_edit = formsemestre.can_be_edited_by(current_user)
|
||||
can_change_all_notes = current_user.has_permission(Permission.EditAllNotes) or (
|
||||
current_user.id in [resp.id for resp in formsemestre.responsables]
|
||||
@ -1206,20 +1236,11 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True):
|
||||
)
|
||||
# --- LISTE DES ETUDIANTS
|
||||
H += [
|
||||
'<div class="formsemestre-groupes">',
|
||||
'<div class="formsemestre-groupes space-before-24">',
|
||||
_make_listes_sem(formsemestre),
|
||||
"</div>",
|
||||
]
|
||||
|
||||
# --- Lien mail enseignants:
|
||||
adrlist = list(mails_enseignants - {None, ""})
|
||||
if adrlist:
|
||||
H.append(
|
||||
f"""<p>
|
||||
<a class="stdlink" href="mailto:?cc={','.join(adrlist)}">Courrier aux {
|
||||
len(adrlist)} enseignants du semestre</a>
|
||||
</p>"""
|
||||
)
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
content="".join(H),
|
||||
|
@ -583,6 +583,11 @@ def formsemestre_recap_parcours_table(
|
||||
)
|
||||
is_cur = situation_etud_cursus.formsemestre_id == formsemestre.id
|
||||
num_sem += 1
|
||||
url_status = url_for(
|
||||
"notes.formsemestre_status",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=formsemestre.id,
|
||||
)
|
||||
|
||||
dpv = sco_pv_dict.dict_pvjury(formsemestre.id, etudids=[etudid])
|
||||
pv = dpv["decisions"][0]
|
||||
@ -642,7 +647,7 @@ def formsemestre_recap_parcours_table(
|
||||
H.append(
|
||||
f"""
|
||||
<td class="rcp_type_sem" style="background-color:{bgcolor};">{num_sem}{pm}</td>
|
||||
<td class="datedebut">{formsemestre.mois_debut()}</td>
|
||||
<td class="datedebut"><a href="{url_status}">{formsemestre.mois_debut()}</a></td>
|
||||
<td class="rcp_titre_sem"><a class="formsemestre_status_link"
|
||||
href="{
|
||||
url_for("notes.formsemestre_bulletinetud", scodoc_dept=g.scodoc_dept,
|
||||
@ -724,8 +729,9 @@ def formsemestre_recap_parcours_table(
|
||||
f"""Autre formation: {formsemestre.formation.formation_code}"""
|
||||
)
|
||||
H.append(
|
||||
'<td class="datefin">%s</td><td class="sem_info">%s</td>'
|
||||
% (formsemestre.mois_fin(), sem_info.get(formsemestre.id, default_sem_info))
|
||||
f"""<td class="datefin"><a href="{url_status}">{formsemestre.mois_fin()}</a></td>
|
||||
<td class="sem_info">{sem_info.get(formsemestre.id, default_sem_info)}</td>
|
||||
"""
|
||||
)
|
||||
# Moy Gen (sous le code decision)
|
||||
H.append(
|
||||
|
@ -65,7 +65,7 @@ def groups_export_annotations(group_ids, formsemestre_id=None, fmt="html"):
|
||||
)
|
||||
annotations = groups_list_annotation(groups_infos.group_ids)
|
||||
for annotation in annotations:
|
||||
annotation["date_str"] = annotation["date"].strftime("%d/%m/%Y à %Hh%M")
|
||||
annotation["date_str"] = annotation["date"].strftime(scu.DATEATIME_FMT)
|
||||
if fmt == "xls":
|
||||
columns_ids = ("etudid", "nom", "prenom", "date", "comment")
|
||||
else:
|
||||
|
@ -782,16 +782,21 @@ def groups_table(
|
||||
[
|
||||
tab.html(),
|
||||
f"""
|
||||
<ul>
|
||||
<li><a class="stdlink" href="{tab.base_url}&fmt=xls">Table Excel</a>
|
||||
</li>
|
||||
<li><a class="stdlink" href="{tab.base_url}&fmt=moodlecsv">Fichier CSV pour Moodle (groupe sélectionné)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="stdlink" href="export_groups_as_moodle_csv?formsemestre_id={groups_infos.formsemestre_id}">
|
||||
Fichier CSV pour Moodle (tous les groupes)</a>
|
||||
<em>(voir le paramétrage pour modifier le format des fichiers Moodle exportés)</em>
|
||||
</li>""",
|
||||
<ul>
|
||||
<li><a class="stdlink" href="{tab.base_url}&fmt=xls">Table Excel
|
||||
groupe(s) {groups_infos.groups_titles}</a>
|
||||
</li>
|
||||
<li><a class="stdlink" href="{tab.base_url}&fmt=moodlecsv">Fichier CSV pour
|
||||
Moodle groupe(s) {groups_infos.groups_titles}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="stdlink" href="{{
|
||||
url_for('notes.export_groups_as_moodle_csv',
|
||||
scodoc_dept=g.scodoc_dept, formsemestre_id=groups_infos.formsemestre_id)
|
||||
}}">
|
||||
Fichier CSV pour Moodle (tous les groupes)</a>
|
||||
<em>(voir le paramétrage pour modifier le format des fichiers Moodle exportés)</em>
|
||||
</li>""",
|
||||
]
|
||||
)
|
||||
if amail_inst:
|
||||
|
@ -656,7 +656,7 @@ def _ligne_evaluation(
|
||||
if etat["last_modif"]:
|
||||
H.append(
|
||||
f"""<span class="mievr_lastmodif">(dernière modif le {
|
||||
etat["last_modif"].strftime("%d/%m/%Y à %Hh%M")})</span>"""
|
||||
etat["last_modif"].strftime(scu.DATEATIME_FMT)})</span>"""
|
||||
)
|
||||
#
|
||||
H.append(
|
||||
|
@ -51,7 +51,7 @@ from wtforms import (
|
||||
from app.models import Evaluation, ModuleImpl
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
from app.scodoc import html_sco_header, sco_preferences
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_edit_module
|
||||
from app.scodoc import sco_evaluations
|
||||
from app.scodoc import sco_excel
|
||||
@ -204,14 +204,14 @@ def placement_eval_selectetuds(evaluation_id):
|
||||
% runner.__dict__
|
||||
)
|
||||
return runner.exec_placement() # calcul et generation du fichier
|
||||
htmls = [
|
||||
html_sco_header.sco_header(),
|
||||
sco_evaluations.evaluation_describe(evaluation_id=evaluation_id),
|
||||
"<h3>Placement et émargement des étudiants</h3>",
|
||||
render_template("scodoc/forms/placement.j2", form=form),
|
||||
]
|
||||
footer = html_sco_header.sco_footer()
|
||||
return "\n".join(htmls) + "<p>" + footer
|
||||
|
||||
return render_template(
|
||||
"scodoc/forms/placement.j2",
|
||||
evaluations_description=sco_evaluations.evaluation_describe(
|
||||
evaluation_id=evaluation_id
|
||||
),
|
||||
form=form,
|
||||
)
|
||||
|
||||
|
||||
class PlacementRunner:
|
||||
|
@ -350,7 +350,7 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids: list[int] = None, etudid
|
||||
etud = Identite.get_etud(etudid)
|
||||
etudids = [etudid]
|
||||
else:
|
||||
etuddescr = ""
|
||||
etud = None
|
||||
if not group_ids:
|
||||
# tous les inscrits du semestre
|
||||
group_ids = [sco_groups.get_default_group(formsemestre_id)]
|
||||
@ -399,7 +399,7 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids: list[int] = None, etudid
|
||||
if tf[0] == 0:
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title=f"Édition du PV de jury de {etud.nom_prenom()}",
|
||||
title=f"Édition du PV de jury {('de ' + etud.nom_prenom()) if etud else ''}",
|
||||
content=f"""<h2 class="formsemestre">Édition du PV de jury
|
||||
de <a class="discretelink" href="{
|
||||
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||
|
@ -37,7 +37,7 @@ import time
|
||||
import datetime
|
||||
from operator import itemgetter
|
||||
|
||||
from flask import url_for, g, request
|
||||
from flask import url_for, g, render_template, request
|
||||
import pydot
|
||||
|
||||
from app import log
|
||||
@ -50,7 +50,6 @@ from app.models.etudiants import Identite
|
||||
|
||||
from app.scodoc import (
|
||||
codes_cursus,
|
||||
html_sco_header,
|
||||
sco_etud,
|
||||
sco_formsemestre,
|
||||
sco_formsemestre_inscriptions,
|
||||
@ -411,11 +410,6 @@ def formsemestre_report_counts(
|
||||
if fmt != "html":
|
||||
return tableau
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
cssstyles=sco_groups_view.CSSSTYLES,
|
||||
javascripts=sco_groups_view.JAVASCRIPTS,
|
||||
page_title=title,
|
||||
),
|
||||
tableau,
|
||||
"\n".join(F),
|
||||
"""<p class="help">Le tableau affiche le nombre d'étudiants de ce semestre dans chacun
|
||||
@ -423,9 +417,14 @@ def formsemestre_report_counts(
|
||||
pour les lignes et les colonnes. Le <tt>codedecision</tt> est le code de la décision
|
||||
du jury.
|
||||
</p>""",
|
||||
html_sco_header.sco_footer(),
|
||||
]
|
||||
return "\n".join(H)
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
cssstyles=sco_groups_view.CSSSTYLES,
|
||||
javascripts=sco_groups_view.JAVASCRIPTS,
|
||||
title=title,
|
||||
content="\n".join(H),
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@ -813,11 +812,6 @@ def formsemestre_suivi_cohorte(
|
||||
href="{burl}&percent=1">Afficher les résultats en pourcentages</a></p>"""
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
cssstyles=sco_groups_view.CSSSTYLES,
|
||||
javascripts=sco_groups_view.JAVASCRIPTS,
|
||||
page_title=tab.page_title,
|
||||
),
|
||||
"""<h2 class="formsemestre">Suivi cohorte: devenir des étudiants de ce semestre</h2>""",
|
||||
_gen_form_selectetuds(
|
||||
formsemestre.id,
|
||||
@ -853,9 +847,14 @@ def formsemestre_suivi_cohorte(
|
||||
</p>
|
||||
""",
|
||||
expl,
|
||||
html_sco_header.sco_footer(),
|
||||
]
|
||||
return "\n".join(H)
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
cssstyles=sco_groups_view.CSSSTYLES,
|
||||
javascripts=sco_groups_view.JAVASCRIPTS,
|
||||
title=tab.page_title,
|
||||
content="\n".join(H),
|
||||
)
|
||||
|
||||
|
||||
def _gen_form_selectetuds(
|
||||
@ -1365,15 +1364,11 @@ def formsemestre_suivi_cursus(
|
||||
]
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title=tab.page_title,
|
||||
),
|
||||
"""<h2 class="formsemestre">Cursus suivis par les étudiants de ce semestre</h2>""",
|
||||
"\n".join(F),
|
||||
t,
|
||||
html_sco_header.sco_footer(),
|
||||
]
|
||||
return "\n".join(H)
|
||||
return render_template("sco_page.j2", title=tab.page_title, content="\n".join(H))
|
||||
|
||||
|
||||
# -------------
|
||||
@ -1742,12 +1737,6 @@ def formsemestre_graph_cursus(
|
||||
)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
cssstyles=sco_groups_view.CSSSTYLES,
|
||||
javascripts=sco_groups_view.JAVASCRIPTS,
|
||||
page_title="Graphe cursus de %(titreannee)s" % sem,
|
||||
no_sidebar=True,
|
||||
),
|
||||
"""<h2 class="formsemestre">Cursus des étudiants de ce semestre</h2>""",
|
||||
doc,
|
||||
f"<p>{len(etuds)} étudiants sélectionnés</p>",
|
||||
@ -1771,11 +1760,12 @@ def formsemestre_graph_cursus(
|
||||
),
|
||||
"""<p>Origine et devenir des étudiants inscrits dans %(titreannee)s"""
|
||||
% sem,
|
||||
"""(<a href="%s">version pdf</a>"""
|
||||
% url_for("notes.formsemestre_graph_cursus", fmt="pdf", **url_kw),
|
||||
""", <a href="%s">image PNG</a>)"""
|
||||
% url_for("notes.formsemestre_graph_cursus", fmt="png", **url_kw),
|
||||
f"""
|
||||
f"""(<a href="{
|
||||
url_for("notes.formsemestre_graph_cursus", fmt="pdf", **url_kw)
|
||||
}">version pdf</a>,
|
||||
<a href="{
|
||||
url_for("notes.formsemestre_graph_cursus", fmt="png", **url_kw)}">image PNG</a>)
|
||||
|
||||
</p>
|
||||
<p class="help">Le graphe permet de suivre les étudiants inscrits dans le semestre
|
||||
sélectionné (dessiné en vert). Chaque rectangle représente un semestre (cliquez dedans
|
||||
@ -1788,8 +1778,14 @@ def formsemestre_graph_cursus(
|
||||
étudiants appartenant aux groupes indiqués <em>dans le semestre d'origine</em>.
|
||||
</p>
|
||||
""",
|
||||
html_sco_header.sco_footer(),
|
||||
]
|
||||
return "\n".join(H)
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
cssstyles=sco_groups_view.CSSSTYLES,
|
||||
javascripts=sco_groups_view.JAVASCRIPTS,
|
||||
page_title=f"Graphe cursus de {sem['titreannee']}",
|
||||
no_sidebar=True,
|
||||
content="\n".join(H),
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"invalid format: {fmt}")
|
||||
|
@ -31,21 +31,18 @@
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
from flask import request
|
||||
from flask import render_template, request
|
||||
|
||||
from app import db
|
||||
from app.but import jury_but
|
||||
from app.models import FormSemestre
|
||||
from app.models.formsemestre import FormSemestreInscription
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import codes_cursus
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
|
||||
from app.scodoc import sco_preferences
|
||||
import sco_version
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
import sco_version
|
||||
|
||||
|
||||
# Titres, ordonnés
|
||||
@ -107,13 +104,11 @@ def formsemestre_but_indicateurs(formsemestre_id: int, fmt="html"):
|
||||
if fmt != "html":
|
||||
return t
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title=title),
|
||||
t,
|
||||
"""<p class="help">
|
||||
</p>""",
|
||||
html_sco_header.sco_footer(),
|
||||
]
|
||||
return "\n".join(H)
|
||||
return render_template("sco_page.j2", title=title, content="\n".join(H))
|
||||
|
||||
|
||||
def but_indicateurs_by_bac(formsemestre: FormSemestre) -> dict[str:dict]:
|
||||
|
@ -40,17 +40,15 @@ sem_set_list()
|
||||
"""
|
||||
|
||||
import flask
|
||||
from flask import g, url_for
|
||||
from flask import g, render_template, url_for
|
||||
|
||||
from app import db, log
|
||||
from app.comp import res_sem
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import FormSemestre
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_etape_apogee
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_formsemestre_status
|
||||
from app.scodoc import sco_portal_apogee
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc.sco_etape_bilan import EtapeBilan
|
||||
@ -412,7 +410,7 @@ def do_semset_delete(semset_id, dialog_confirmed=False):
|
||||
s = SemSet(semset_id=semset_id)
|
||||
if not dialog_confirmed:
|
||||
return scu.confirm_dialog(
|
||||
"<h2>Suppression de l'ensemble %(title)s ?</h2>" % s,
|
||||
f"<h2>Suppression de l'ensemble {s['title']} ?</h2>",
|
||||
dest_url="",
|
||||
parameters={"semset_id": semset_id},
|
||||
cancel_url="semset_page",
|
||||
@ -421,14 +419,14 @@ def do_semset_delete(semset_id, dialog_confirmed=False):
|
||||
return flask.redirect("semset_page")
|
||||
|
||||
|
||||
def edit_semset_set_title(id=None, value=None):
|
||||
def edit_semset_set_title(oid=None, value=None):
|
||||
"""Change title of semset"""
|
||||
title = value.strip()
|
||||
if not id:
|
||||
if not oid:
|
||||
raise ScoValueError("empty semset_id")
|
||||
SemSet(semset_id=id)
|
||||
SemSet(semset_id=oid)
|
||||
cnx = ndb.GetDBConnexion()
|
||||
semset_edit(cnx, {"semset_id": id, "title": title})
|
||||
semset_edit(cnx, {"semset_id": oid, "title": title})
|
||||
return title
|
||||
|
||||
|
||||
@ -517,22 +515,18 @@ def semset_page(fmt="html"):
|
||||
|
||||
page_title = "Ensembles de semestres"
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title=page_title,
|
||||
javascripts=["libjs/jinplace-1.2.1.min.js"],
|
||||
),
|
||||
"""<script>$(function() {
|
||||
$('.inplace_edit').jinplace();
|
||||
});
|
||||
</script>""",
|
||||
"<h2>%s</h2>" % page_title,
|
||||
f"<h2>{page_title}</h2>",
|
||||
]
|
||||
H.append(tab.html())
|
||||
|
||||
annee_courante = int(scu.annee_scolaire())
|
||||
menu_annee = "\n".join(
|
||||
[
|
||||
'<option value="%s">%s</option>' % (i, i)
|
||||
f"""<option value="{i}">{i}</option>"""
|
||||
for i in range(2014, annee_courante + 1)
|
||||
]
|
||||
)
|
||||
@ -561,8 +555,8 @@ def semset_page(fmt="html"):
|
||||
|
||||
H.append(
|
||||
"""
|
||||
<div>
|
||||
<h4>Autres opérations:</h4>
|
||||
<div class="scobox space-before-24">
|
||||
<div class="scobox-title">Autres opérations :</div>
|
||||
<ul>
|
||||
<li><a class="stdlink" href="scodoc_table_results">
|
||||
Table des résultats de tous les semestres
|
||||
@ -575,4 +569,9 @@ def semset_page(fmt="html"):
|
||||
"""
|
||||
)
|
||||
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title=page_title,
|
||||
javascripts=["libjs/jinplace-1.2.1.min.js"],
|
||||
content="\n".join(H),
|
||||
)
|
||||
|
@ -49,7 +49,6 @@ import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||
from app.scodoc.sco_exceptions import ScoPDFFormatError, ScoValueError
|
||||
from app.scodoc.sco_pdf import SU
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import htmlutils
|
||||
from app.scodoc import sco_import_etuds
|
||||
from app.scodoc import sco_excel
|
||||
@ -90,12 +89,7 @@ def trombino(
|
||||
return _listeappel_photos_pdf(groups_infos)
|
||||
elif fmt == "doc":
|
||||
return sco_trombino_doc.trombino_doc(groups_infos)
|
||||
else:
|
||||
raise Exception("invalid format")
|
||||
|
||||
|
||||
def _trombino_html_header():
|
||||
return html_sco_header.sco_header(javascripts=["js/trombino.js"])
|
||||
raise ValueError("invalid format")
|
||||
|
||||
|
||||
def trombino_html(groups_infos):
|
||||
@ -251,14 +245,18 @@ def trombino_copy_photos(group_ids=None, dialog_confirmed=False):
|
||||
back_url = "groups_photos?" + str(groups_infos.groups_query_args)
|
||||
|
||||
portal_url = sco_portal_apogee.get_portal_url()
|
||||
header = html_sco_header.sco_header(page_title="Chargement des photos")
|
||||
footer = html_sco_header.sco_footer()
|
||||
if not portal_url:
|
||||
return f"""{ header }
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
content=f"""
|
||||
<p>portail non configuré</p>
|
||||
<p><a href="{back_url}" class="stdlink">Retour au trombinoscope</a></p>
|
||||
{ footer }
|
||||
"""
|
||||
<div>
|
||||
<a class="stdlink" href="{back_url}" class="stdlink">
|
||||
Retour au trombinoscope
|
||||
</a>
|
||||
</div>
|
||||
""",
|
||||
)
|
||||
if not dialog_confirmed:
|
||||
return scu.confirm_dialog(
|
||||
f"""<h2>Copier les photos du portail vers ScoDoc ?</h2>
|
||||
@ -285,14 +283,18 @@ def trombino_copy_photos(group_ids=None, dialog_confirmed=False):
|
||||
|
||||
msg.append(f"<b>{nok} photos correctement chargées</b>")
|
||||
|
||||
return f"""{ header }
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
content=f"""
|
||||
<h2>Chargement des photos depuis le portail</h2>
|
||||
<ul><li>
|
||||
{ '</li><li>'.join(msg) }
|
||||
</li></ul>
|
||||
<p><a href="{back_url}">retour au trombinoscope</a>
|
||||
{ footer }
|
||||
"""
|
||||
<div class="space-before-24">
|
||||
<a class="stdlink" href="{back_url}">retour au trombinoscope</a>
|
||||
</div>
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
def _get_etud_platypus_image(t, image_width=2 * cm):
|
||||
@ -506,7 +508,6 @@ def photos_import_files_form(group_ids=()):
|
||||
back_url = f"groups_photos?{groups_infos.groups_query_args}"
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Import des photos des étudiants"),
|
||||
f"""<h2 class="formsemestre">Téléchargement des photos des étudiants</h2>
|
||||
<p><b>Vous pouvez aussi charger les photos individuellement via la fiche
|
||||
de chaque étudiant (menu "Étudiant" / "Changer la photo").</b>
|
||||
@ -526,7 +527,6 @@ def photos_import_files_form(group_ids=()):
|
||||
<li style="padding-top: 2em;">
|
||||
""",
|
||||
]
|
||||
F = html_sco_header.sco_footer()
|
||||
vals = scu.get_request_args()
|
||||
vals["group_ids"] = groups_infos.group_ids
|
||||
tf = TrivialFormulator(
|
||||
@ -540,37 +540,40 @@ def photos_import_files_form(group_ids=()):
|
||||
)
|
||||
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + tf[1] + "</li></ol>" + F
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(back_url)
|
||||
else:
|
||||
|
||||
def callback(etud: Identite, data, filename):
|
||||
return sco_photos.store_photo(etud, data, filename)
|
||||
|
||||
(
|
||||
ignored_zipfiles,
|
||||
unmatched_files,
|
||||
stored_etud_filename,
|
||||
) = zip_excel_import_files(
|
||||
xlsfile=tf[2]["xlsfile"],
|
||||
zipfile=tf[2]["zipfile"],
|
||||
callback=callback,
|
||||
filename_title="fichier_photo",
|
||||
back_url=back_url,
|
||||
)
|
||||
return render_template(
|
||||
"scolar/photos_import_files.j2",
|
||||
page_title="Téléchargement des photos des étudiants",
|
||||
ignored_zipfiles=ignored_zipfiles,
|
||||
unmatched_files=unmatched_files,
|
||||
stored_etud_filename=stored_etud_filename,
|
||||
next_page=url_for(
|
||||
"scolar.groups_photos",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=groups_infos.formsemestre_id,
|
||||
),
|
||||
"sco_page.j2",
|
||||
title="Import des photos des étudiants",
|
||||
content="\n".join(H) + tf[1] + "</li></ol>",
|
||||
)
|
||||
if tf[0] == -1:
|
||||
return flask.redirect(back_url)
|
||||
|
||||
def callback(etud: Identite, data, filename):
|
||||
return sco_photos.store_photo(etud, data, filename)
|
||||
|
||||
(
|
||||
ignored_zipfiles,
|
||||
unmatched_files,
|
||||
stored_etud_filename,
|
||||
) = zip_excel_import_files(
|
||||
xlsfile=tf[2]["xlsfile"],
|
||||
zipfile=tf[2]["zipfile"],
|
||||
callback=callback,
|
||||
filename_title="fichier_photo",
|
||||
back_url=back_url,
|
||||
)
|
||||
return render_template(
|
||||
"scolar/photos_import_files.j2",
|
||||
page_title="Téléchargement des photos des étudiants",
|
||||
ignored_zipfiles=ignored_zipfiles,
|
||||
unmatched_files=unmatched_files,
|
||||
stored_etud_filename=stored_etud_filename,
|
||||
next_page=url_for(
|
||||
"scolar.groups_photos",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=groups_infos.formsemestre_id,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _norm_zip_filename(fn, lowercase=True):
|
||||
|
@ -556,7 +556,7 @@ MONTH_NAMES = (
|
||||
)
|
||||
DAY_NAMES = ("lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche")
|
||||
|
||||
TIME_FMT = "%H:%M" # affichage des heures
|
||||
TIME_FMT = "%Hh%M" # affichage des heures
|
||||
DATE_FMT = "%d/%m/%Y" # affichage des dates
|
||||
DATEATIME_FMT = DATE_FMT + " à " + TIME_FMT
|
||||
DATETIME_FMT = DATE_FMT + " " + TIME_FMT
|
||||
@ -1339,7 +1339,7 @@ def format_telephone(n: str | None) -> str:
|
||||
#
|
||||
def timedate_human_repr():
|
||||
"representation du temps courant pour utilisateur"
|
||||
return time.strftime("%d/%m/%Y à %Hh%M")
|
||||
return time.strftime(DATEATIME_FMT)
|
||||
|
||||
|
||||
def annee_scolaire_repr(year, month):
|
||||
@ -1525,6 +1525,7 @@ def confirm_dialog(
|
||||
help_msg=None,
|
||||
parameters: dict = None,
|
||||
target_variable="dialog_confirmed",
|
||||
template="sco_page.j2",
|
||||
):
|
||||
"""HTML confirmation dialog: submit (POST) to same page or dest_url if given."""
|
||||
parameters = parameters or {}
|
||||
@ -1565,7 +1566,7 @@ def confirm_dialog(
|
||||
if help_msg:
|
||||
H.append('<p class="help">' + help_msg + "</p>")
|
||||
if add_headers:
|
||||
return render_template("sco_page.j2", content="\n".join(H))
|
||||
return render_template(template, content="\n".join(H))
|
||||
else:
|
||||
return "\n".join(H)
|
||||
|
||||
|
@ -55,11 +55,19 @@ div.container {
|
||||
div.sco-app-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-right: 8px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.space-before-18 {
|
||||
margin-top: 18px;
|
||||
margin-top: 18px !important;
|
||||
}
|
||||
|
||||
.space-before-24 {
|
||||
margin-top: 24px !important;
|
||||
}
|
||||
|
||||
div.scobox.maxwidth {
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
div.scobox {
|
||||
@ -748,14 +756,14 @@ div.fiche_etud {
|
||||
/* rgb(255,240,128); */
|
||||
border: 1px solid gray;
|
||||
width: 910px;
|
||||
padding: 10px;
|
||||
padding: 24px 10px 10px 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
div.menus_etud {
|
||||
position: absolute;
|
||||
margin-left: 1px;
|
||||
margin-top: 1px;
|
||||
margin-left: 10px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
div.fiche_etud h2 {
|
||||
@ -2059,6 +2067,10 @@ ul.ue_inscr_list li.etud {
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
.sem-groups-autres-liens {
|
||||
background-color: var(--sco-color-box-bg);
|
||||
}
|
||||
|
||||
.sem-groups-list .stdlink,
|
||||
.sem-groups-list .stdlink:visited {
|
||||
color: rgb(0, 0, 192);
|
||||
|
@ -1,10 +0,0 @@
|
||||
// Affichage progressif du trombinoscope html
|
||||
|
||||
$().ready(function () {
|
||||
var spans = $(".unloaded_img");
|
||||
for (var i = 0; i < spans.size(); i++) {
|
||||
var sp = spans[i];
|
||||
var etudid = sp.id;
|
||||
$(sp).load(SCO_URL + "etud_photo_html?etudid=" + etudid);
|
||||
}
|
||||
});
|
@ -45,7 +45,7 @@
|
||||
<h2 style="color: crimson;">{{titre_form}}</h2>
|
||||
<div class="scobox">
|
||||
<div id="excel-content">
|
||||
<p class="hint">Avertissement : le fichier doit respecter le format suivant</p>
|
||||
<p class="hint">Le fichier importé doit respecter le format suivant</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
@ -53,12 +53,12 @@
|
||||
</li>
|
||||
<li class="star">colonne B : Date de début</li>
|
||||
<li class="star">colonne C : Date de fin</li>
|
||||
<li class="opt">colonne D : État (ABS,RET,PRE, ABS si vide)</li>
|
||||
<li class="opt">colonne D : État (ABS, RET, PRE), considéré ABSent si vide</li>
|
||||
<li class="opt">colonne E : code du module</li>
|
||||
</ul>
|
||||
|
||||
<p class="hint"><span class="opt"></span> : Colonne optionnelle, les cases peuvent être vides</p>
|
||||
<p class="hint"><span class="star"></span> : Formats autorisés :
|
||||
<p class="hint"><span class="star"></span> : Formats de dates autorisés :
|
||||
<ul>
|
||||
<li>
|
||||
<pre>aaaa-mm-jjThh:mm:ss</pre>
|
||||
@ -73,21 +73,23 @@
|
||||
|
||||
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<label for="type_identifiant">Type d'identifiant d'étudiant (etudid, ine, nip)</label>
|
||||
<label for="type_identifiant">Type d'identifiant d'étudiant (etudid, INE, NIP)</label>
|
||||
<select name="type_identifiant" id="type_identifiant">
|
||||
<option value="etudid">ETUDID</option>
|
||||
<option value="etudid">etudid</option>
|
||||
<option value="ine">INE</option>
|
||||
<option value="nip">NIP</option>
|
||||
</select>
|
||||
<br>
|
||||
<label for="file">
|
||||
Sélectionnez un fichier:
|
||||
|
||||
</label>
|
||||
<input id="file" type="file" name="file"
|
||||
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
|
||||
<br>
|
||||
<button type="submit">Importer</button>
|
||||
<div class="space-before-18">
|
||||
<label for="file">
|
||||
Sélectionnez un fichier:
|
||||
|
||||
</label>
|
||||
<input id="file" type="file" name="file"
|
||||
accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" />
|
||||
</div>
|
||||
<div class="space-before-18">
|
||||
<button type="submit">Importer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<br />
|
||||
Ces utilisateurs peuvent être réactivés à tout moment.
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row space-before-24">
|
||||
<div class="col-md-4">
|
||||
{{ wtf.quick_form(form, button_map={'submit':'secondary'}) }}
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<em>établi le {{time.strftime("%d/%m/%Y à %Hh%M")}} (notes sur 20)</em>
|
||||
<em>établi le {{time.strftime(scu.DATEATIME_FMT)}} (notes sur 20)</em>
|
||||
<span class="rightjust">
|
||||
<select name="version" onchange="self.location.href='{{
|
||||
url_for('notes.formsemestre_bulletinetud',
|
||||
|
@ -158,7 +158,7 @@
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
Bulletin généré par ScoDoc le {{time.strftime("%d/%m/%Y à %Hh%M")}}. Explication des codes sur
|
||||
Bulletin généré par ScoDoc le {{time.strftime(scu.DATEATIME_FMT)}}. Explication des codes sur
|
||||
<a href="https://scodoc.org/BUTCodesJury">https://scodoc.org/BUTCodesJury</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
{% extends "sco_page.j2" %}
|
||||
{% extends "sco_page_dept.j2" %}
|
||||
|
||||
{% block styles %}
|
||||
{{super()}}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{# -*- mode: jinja-html -*- #}
|
||||
{% extends "base.j2" %}
|
||||
{% extends "sco_page_dept.j2" %}
|
||||
{% import 'wtf.j2' as wtf %}
|
||||
|
||||
{% block app_content %}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{# -*- mode: jinja-html -*- #}
|
||||
{% extends "sco_page.j2" %}
|
||||
{% extends "sco_page_dept.j2" %}
|
||||
{% block styles %}
|
||||
{{super()}}
|
||||
<link href="{{scu.STATIC_DIR}}/css/refcomp_parcours_niveaux.css" rel="stylesheet" type="text/css" />
|
||||
|
@ -1,5 +1,5 @@
|
||||
{# -*- mode: jinja-html -*- #}
|
||||
{% extends "sco_page.j2" %}
|
||||
{% extends "sco_page_dept.j2" %}
|
||||
{% import 'wtf.j2' as wtf %}
|
||||
|
||||
{% block app_content %}
|
||||
|
@ -51,7 +51,7 @@ une formation utilisant une autre version de référentiel, pensez à revalider
|
||||
pour l'étudiant{{etud.ne}} {{etud.html_link_fiche()|safe}}
|
||||
<ul>
|
||||
<li>DUT 120 spécialité {{formsemestre.formation.referentiel_competence.specialite_long}}
|
||||
enregistré le {{time.strftime("%d/%m/%Y à %Hh%M")}}
|
||||
enregistré le {{time.strftime(scu.DATEATIME_FMT)}}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{# Association d'ECTS à une UE par parcours #}
|
||||
{% extends "sco_page.j2" %}
|
||||
{% extends "sco_page_dept.j2" %}
|
||||
{% import 'wtf.j2' as wtf %}
|
||||
|
||||
{% block styles %}
|
||||
@ -23,18 +23,20 @@
|
||||
<form method="POST">
|
||||
{% for field in form %}
|
||||
{% if field.name != 'csrf_token' %}
|
||||
<div>
|
||||
<label for="{{ field.id }}">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
{% for error in field.errors %}
|
||||
<div class="error-message">{{ error }}</div>
|
||||
{% endfor %}
|
||||
<div class="space-before-18">
|
||||
<label for="{{ field.id }}">{{ field.label }}</label>
|
||||
{{ field }}
|
||||
{% for error in field.errors %}
|
||||
<div class="error-message">{{ error }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ form.csrf_token }}
|
||||
<input type="submit" name="submit" value="Enregistrer">
|
||||
<input type="submit" name="cancel" value="Annuler">
|
||||
<div class="space-before-24">
|
||||
<input type="submit" name="submit" value="Enregistrer">
|
||||
<input type="submit" name="cancel" value="Annuler">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -20,6 +20,7 @@
|
||||
<div class="tab-content">
|
||||
<h2>{{ title }}</h2>
|
||||
|
||||
<div class="scobox">
|
||||
<p class="help">
|
||||
{{ explanation|safe }}
|
||||
</p>
|
||||
@ -46,5 +47,6 @@
|
||||
<input type="submit" value="Générer">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,4 +1,26 @@
|
||||
{# -*- mode: jinja-html -*- #}
|
||||
{% extends "sco_page_dept.j2" %}
|
||||
|
||||
|
||||
{% block styles %}
|
||||
{{super()}}
|
||||
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/table_editor.css">
|
||||
{% endblock %}
|
||||
|
||||
{% block app_content %}
|
||||
<h2>Formation {{formation.titre}} ({{formation.acronyme}})
|
||||
[version {{formation.version}}] code {{formation.formation_code}}
|
||||
{% if read_only %}
|
||||
{{scu.icontag("lock32_img", title="verrouillé")|safe}}
|
||||
{% endif %}
|
||||
</h2>
|
||||
|
||||
{% if read_only %}
|
||||
<span class="warning">
|
||||
Formation verrouilée car un ou plusieurs semestres verrouillés l'utilisent.
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
<h2>{% if not read_only %}Édition des c{% else %}C{%endif%}oefficients des modules vers les UEs</h2>
|
||||
<div class="help">
|
||||
{% if not read_only %}
|
||||
@ -59,8 +81,11 @@
|
||||
<div class="champs_coef_hors_parcours champs_legende"></div>
|
||||
<div class="help">module non associé au parcours de cette UE, le coef devrait être nul.</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block scripts %}
|
||||
{{super()}}
|
||||
<script src="{{scu.STATIC_DIR}}/js/table_editor.js"></script>
|
||||
<script>
|
||||
var read_only = {{ "true" if read_only else "false"}};
|
||||
$(function () {
|
||||
@ -113,3 +138,4 @@
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
@ -1,3 +1,5 @@
|
||||
{% extends 'sco_page.j2' %}
|
||||
|
||||
{% import 'wtf.j2' as wtf %}
|
||||
|
||||
{% macro render_field(field) %}
|
||||
@ -15,6 +17,12 @@
|
||||
</tr>
|
||||
{% endmacro %}
|
||||
|
||||
{% block app_content %}
|
||||
|
||||
{{ evaluations_description|safe}}
|
||||
|
||||
<h3 class="space-before-24">Placement et émargement des étudiants</h3>
|
||||
|
||||
<div class="saisienote_etape1 form_placement">
|
||||
<form method=post>
|
||||
{{ form.evaluation_id }}
|
||||
@ -78,3 +86,4 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,5 +1,5 @@
|
||||
{# -*- mode: jinja-html -*- #}
|
||||
{% extends 'base.j2' %}
|
||||
{% extends 'sco_page.j2' %}
|
||||
|
||||
{% block app_content %}
|
||||
|
||||
|
@ -24,7 +24,8 @@
|
||||
##############################################################################
|
||||
|
||||
"""
|
||||
Module absences: remplacé par assiduité en août 2023, reste ici seulement la gestion des "billets"
|
||||
Module absences: remplacé par assiduité en août 2023,
|
||||
reste ici seulement la gestion des "billets"
|
||||
|
||||
"""
|
||||
|
||||
@ -32,8 +33,7 @@ import dateutil
|
||||
import dateutil.parser
|
||||
|
||||
import flask
|
||||
from flask import g, request
|
||||
from flask import abort, flash, url_for
|
||||
from flask import abort, flash, g, render_template, request, url_for
|
||||
from flask_login import current_user
|
||||
|
||||
from app import db, log
|
||||
@ -54,11 +54,8 @@ from app.scodoc import sco_utils as scu
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.scodoc.sco_exceptions import ScoValueError
|
||||
from app.scodoc.TrivialFormulator import TrivialFormulator
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_cal
|
||||
from app.scodoc import sco_assiduites as scass
|
||||
from app.scodoc import sco_abs_billets
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc import sco_preferences
|
||||
|
||||
|
||||
@ -77,11 +74,7 @@ from app.scodoc import sco_preferences
|
||||
def index_html():
|
||||
"""Gestionnaire absences, page principale"""
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title="Billets d'absences",
|
||||
),
|
||||
]
|
||||
H = []
|
||||
if current_user.has_permission(
|
||||
Permission.AbsChange
|
||||
) and sco_preferences.get_preference("handle_billets_abs"):
|
||||
@ -93,8 +86,9 @@ def index_html():
|
||||
</li></ul>
|
||||
"""
|
||||
)
|
||||
H.append(html_sco_header.sco_footer())
|
||||
return "\n".join(H)
|
||||
return render_template(
|
||||
"sco_page_dept.j2", title="Billets d'absences", content="\n".join(H)
|
||||
)
|
||||
|
||||
|
||||
# ----- Gestion des "billets d'absence": signalement par les etudiants eux mêmes (à travers le portail)
|
||||
@ -158,12 +152,8 @@ def add_billets_absence_form(etudid):
|
||||
"""Formulaire ajout billet (pour tests seulement, le vrai
|
||||
formulaire accessible aux etudiants étant sur le portail étudiant).
|
||||
"""
|
||||
etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0]
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title="Billet d'absence de %s" % etud["nomprenom"]
|
||||
)
|
||||
]
|
||||
_ = Identite.get_etud(etudid) # check
|
||||
H = ["""<h2>Formulaire ajout billet (pour tests)</h2>"""]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
scu.get_request_args(),
|
||||
@ -179,7 +169,11 @@ def add_billets_absence_form(etudid):
|
||||
),
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title="""Billet d'absence de {etud["nomprenom"]}""",
|
||||
content="\n".join(H) + tf[1],
|
||||
)
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(url_for("scolar.index_html", scodoc_dept=g.scodoc_dept))
|
||||
else:
|
||||
@ -242,11 +236,8 @@ def list_billets():
|
||||
et formulaire recherche d'un billet.
|
||||
"""
|
||||
table = sco_abs_billets.table_billets_etud(etat=False)
|
||||
T = table.html()
|
||||
table_html = table.html()
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title="Billet d'absence non traités",
|
||||
),
|
||||
f"<h2>Billets d'absence en attente de traitement ({table.get_nb_rows()})</h2>",
|
||||
]
|
||||
|
||||
@ -257,15 +248,18 @@ def list_billets():
|
||||
submitbutton=False,
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + tf[1] + T + html_sco_header.sco_footer()
|
||||
else:
|
||||
return flask.redirect(
|
||||
url_for(
|
||||
"absences.process_billet_absence_form",
|
||||
billet_id=tf[2]["billet_id"],
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
)
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title="Billet d'absence non traités",
|
||||
content="\n".join(H) + tf[1] + table_html,
|
||||
)
|
||||
return flask.redirect(
|
||||
url_for(
|
||||
"absences.process_billet_absence_form",
|
||||
billet_id=tf[2]["billet_id"],
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/delete_billets_absence", methods=["POST", "GET"])
|
||||
@ -337,7 +331,8 @@ def _ProcessBilletAbsence(
|
||||
def process_billet_absence_form(billet_id: int):
|
||||
"""Formulaire traitement d'un billet"""
|
||||
if not isinstance(billet_id, int):
|
||||
raise abort(404, "billet_id invalide")
|
||||
abort(404, "billet_id invalide")
|
||||
return # safety guard
|
||||
billet: BilletAbsence = (
|
||||
BilletAbsence.query.filter_by(id=billet_id)
|
||||
.join(Identite)
|
||||
@ -352,9 +347,6 @@ def process_billet_absence_form(billet_id: int):
|
||||
etud = billet.etudiant
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title=f"Traitement billet d'absence de {etud.nomprenom}",
|
||||
),
|
||||
f"""<h2>Traitement du billet {billet.id} : <a class="discretelink" href="{
|
||||
url_for("scolar.fiche_etud", scodoc_dept=g.scodoc_dept, etudid=etud.id)
|
||||
}">{etud.nomprenom}</a></h2>
|
||||
@ -403,7 +395,11 @@ def process_billet_absence_form(billet_id: int):
|
||||
</p>
|
||||
"""
|
||||
|
||||
return "\n".join(H) + "<br>" + tf[1] + F + html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title=f"Traitement billet d'absence de {etud.nomprenom}",
|
||||
content="\n".join(H) + "<br>" + tf[1] + F,
|
||||
)
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(url_for("scolar.index_html", scodoc_dept=g.scodoc_dept))
|
||||
else:
|
||||
@ -414,7 +410,7 @@ def process_billet_absence_form(billet_id: int):
|
||||
j = "non justifiées"
|
||||
H.append('<div class="head_message">')
|
||||
if n > 0:
|
||||
H.append("%d absences (1/2 journées) %s ajoutées" % (n, j))
|
||||
H.append(f"{n} absences (1/2 journées) {j} ajoutées")
|
||||
elif n == 0:
|
||||
H.append("Aucun jour d'absence dans les dates indiquées !")
|
||||
elif n < 0:
|
||||
@ -434,4 +430,8 @@ def process_billet_absence_form(billet_id: int):
|
||||
)
|
||||
tab = sco_abs_billets.table_billets(billets, etud=etud)
|
||||
H.append(tab.html())
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title=f"Traitement billet d'absence de {etud.nomprenom}",
|
||||
content="\n".join(H),
|
||||
)
|
||||
|
@ -1073,10 +1073,10 @@ def signal_assiduites_group():
|
||||
select_all_when_unspecified=True,
|
||||
)
|
||||
if not groups_infos.members:
|
||||
return (
|
||||
html_sco_header.sco_header(page_title="Saisie de l'assiduité")
|
||||
+ "<h3>Aucun étudiant ! </h3>"
|
||||
+ html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title="Saisie de l'assiduité",
|
||||
content="<h3>Aucun étudiant !</h3>",
|
||||
)
|
||||
|
||||
# --- Filtrage par formsemestre ---
|
||||
@ -1952,10 +1952,10 @@ def signal_assiduites_hebdo():
|
||||
group_ids, formsemestre_id=formsemestre.id, select_all_when_unspecified=True
|
||||
)
|
||||
if not groups_infos.members:
|
||||
return (
|
||||
html_sco_header.sco_header(page_title="Assiduité: saisie hebdomadaire")
|
||||
+ "<h3>Aucun étudiant ! </h3>"
|
||||
+ html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title="Assiduité: feuille saisie hebdomadaire",
|
||||
content="<h3>Aucun étudiant !</h3>",
|
||||
)
|
||||
|
||||
# Récupération des étudiants
|
||||
@ -2305,12 +2305,10 @@ def feuille_abs_hebdo():
|
||||
group_ids, formsemestre_id=formsemestre.id, select_all_when_unspecified=True
|
||||
)
|
||||
if not groups_infos.members:
|
||||
return (
|
||||
html_sco_header.sco_header(
|
||||
page_title="Assiduité: feuille saisie hebdomadaire"
|
||||
)
|
||||
+ "<h3>Aucun étudiant ! </h3>"
|
||||
+ html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title="Assiduité: feuille saisie hebdomadaire",
|
||||
content="<h3>Aucun étudiant !</h3>",
|
||||
)
|
||||
|
||||
# Gestion des jours
|
||||
|
@ -60,7 +60,6 @@ from app.models import (
|
||||
ScoDocSiteConfig,
|
||||
)
|
||||
from app.scodoc import (
|
||||
html_sco_header,
|
||||
sco_bulletins_json,
|
||||
sco_cache,
|
||||
sco_formsemestre_exterieurs,
|
||||
@ -251,27 +250,23 @@ def formsemestre_validation_but(
|
||||
</div>
|
||||
"""
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
page_title=f"Validation BUT S{formsemestre.semestre_id}",
|
||||
formsemestre_id=formsemestre_id,
|
||||
etudid=etudid,
|
||||
H = ["""<div class="jury_but">"""]
|
||||
inscription = formsemestre.etuds_inscriptions.get(etudid)
|
||||
if not inscription:
|
||||
raise ScoValueError("étudiant non inscrit au semestre")
|
||||
if inscription.etat != scu.INSCRIT:
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title=f"Validation BUT S{formsemestre.semestre_id}",
|
||||
sco=ScoData(etud=etud, formsemestre=formsemestre),
|
||||
cssstyles=[
|
||||
"css/jury_but.css",
|
||||
"css/cursus_but.css",
|
||||
],
|
||||
javascripts=("js/jury_but.js",),
|
||||
),
|
||||
"""<div class="jury_but">
|
||||
""",
|
||||
]
|
||||
inscription = formsemestre.etuds_inscriptions.get(etudid)
|
||||
if not inscription:
|
||||
raise ScoValueError("étudiant non inscrit au semestre")
|
||||
if inscription.etat != scu.INSCRIT:
|
||||
return (
|
||||
"\n".join(H)
|
||||
+ f"""
|
||||
content=(
|
||||
"\n".join(H)
|
||||
+ f"""
|
||||
<div>
|
||||
<div class="bull_head">
|
||||
<div>
|
||||
@ -291,7 +286,7 @@ def formsemestre_validation_but(
|
||||
{navigation_div}
|
||||
</div>
|
||||
"""
|
||||
+ html_sco_header.sco_footer()
|
||||
),
|
||||
)
|
||||
|
||||
deca = jury_but.DecisionsProposeesAnnee(etud, formsemestre)
|
||||
@ -341,7 +336,7 @@ def formsemestre_validation_but(
|
||||
êtes-vous certain de vouloir enregistrer une décision de jury ?
|
||||
</div>"""
|
||||
if read_only:
|
||||
warning += f"""<div class="warning">Affichage en lecture seule</div>"""
|
||||
warning += """<div class="warning">Affichage en lecture seule</div>"""
|
||||
|
||||
if deca.formsemestre_impair:
|
||||
inscription = deca.formsemestre_impair.etuds_inscriptions.get(etud.id)
|
||||
@ -507,7 +502,17 @@ def formsemestre_validation_but(
|
||||
</div>
|
||||
"""
|
||||
)
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title=f"Validation BUT S{formsemestre.semestre_id}",
|
||||
sco=ScoData(etud=etud, formsemestre=formsemestre),
|
||||
cssstyles=[
|
||||
"css/jury_but.css",
|
||||
"css/cursus_but.css",
|
||||
],
|
||||
javascripts=("js/jury_but.js",),
|
||||
content="\n".join(H),
|
||||
)
|
||||
|
||||
|
||||
@bp.route(
|
||||
|
@ -88,7 +88,6 @@ from app.scodoc.sco_exceptions import (
|
||||
ScoInvalidIdType,
|
||||
)
|
||||
from app.scodoc import (
|
||||
html_sco_header,
|
||||
sco_apogee_compare,
|
||||
sco_archives_formsemestre,
|
||||
sco_assiduites,
|
||||
@ -770,8 +769,10 @@ def formation_import_xml_form():
|
||||
cancelbutton="Annuler",
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return f"""
|
||||
{ html_sco_header.sco_header(page_title="Import d'une formation") }
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title="Import d'une formation",
|
||||
content=f"""
|
||||
<h2>Import d'une formation</h2>
|
||||
<p>Création d'une formation (avec UE, matières, modules)
|
||||
à partir un fichier XML (réservé aux utilisateurs avertis).
|
||||
@ -783,8 +784,8 @@ def formation_import_xml_form():
|
||||
}">page des référentiels</a>).
|
||||
</p>
|
||||
{ tf[1] }
|
||||
{ html_sco_header.sco_footer() }
|
||||
"""
|
||||
""",
|
||||
)
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(url_for("notes.index_html", scodoc_dept=g.scodoc_dept))
|
||||
else:
|
||||
@ -792,8 +793,10 @@ def formation_import_xml_form():
|
||||
tf[2]["xmlfile"].read()
|
||||
)
|
||||
|
||||
return f"""
|
||||
{ html_sco_header.sco_header(page_title="Import d'une formation") }
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title="Import d'une formation",
|
||||
content=f"""
|
||||
<h2>Import effectué !</h2>
|
||||
<ul>
|
||||
<li><a class="stdlink" href="{
|
||||
@ -806,8 +809,8 @@ def formation_import_xml_form():
|
||||
(en cas d'erreur, par exemple pour charger auparavant le référentiel de compétences)
|
||||
</li>
|
||||
</ul>
|
||||
{ html_sco_header.sco_footer() }
|
||||
"""
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
sco_publish("/module_move", sco_edit_formation.module_move, Permission.EditFormation)
|
||||
@ -2182,15 +2185,17 @@ def formsemestre_bulletins_mailetuds(
|
||||
if sent:
|
||||
nb_sent += 1
|
||||
#
|
||||
return f"""
|
||||
{html_sco_header.sco_header()}
|
||||
return render_template(
|
||||
"sco_page.j2",
|
||||
title="Mailing bulletins",
|
||||
content=f"""
|
||||
<p>{nb_sent} bulletins sur {len(inscriptions)} envoyés par mail !</p>
|
||||
<p><a class="stdlink" href="{url_for('notes.formsemestre_status',
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=formsemestre_id)
|
||||
}">continuer</a></p>
|
||||
{html_sco_header.sco_footer()}
|
||||
"""
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
sco_publish(
|
||||
@ -2258,10 +2263,8 @@ def appreciation_add_form(
|
||||
else:
|
||||
action = "Ajout"
|
||||
H = [
|
||||
html_sco_header.sco_header(),
|
||||
f"""<h2>{action} d'une appréciation sur {etud.nomprenom}</h2>""",
|
||||
]
|
||||
F = html_sco_header.sco_footer()
|
||||
descr = [
|
||||
("edit", {"input_type": "hidden", "default": edit}),
|
||||
("etudid", {"input_type": "hidden"}),
|
||||
@ -2286,7 +2289,7 @@ def appreciation_add_form(
|
||||
submitlabel="Ajouter appréciation",
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + "\n" + tf[1] + F
|
||||
return render_template("sco_page.j2", content="\n".join(H) + "\n" + tf[1])
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(bul_url)
|
||||
else:
|
||||
@ -2643,7 +2646,7 @@ def check_form_integrity(formation_id, fix=False):
|
||||
else:
|
||||
txth = "OK"
|
||||
log("ok")
|
||||
return html_sco_header.sco_header() + txth + html_sco_header.sco_footer()
|
||||
return render_template("sco_page.j2", content=txth)
|
||||
|
||||
|
||||
@bp.route("/check_formsemestre_integrity")
|
||||
@ -2681,6 +2684,4 @@ def check_formsemestre_integrity(formsemestre_id):
|
||||
else:
|
||||
diag = ["OK"]
|
||||
log("ok")
|
||||
return (
|
||||
html_sco_header.sco_header() + "<br>".join(diag) + html_sco_header.sco_footer()
|
||||
)
|
||||
return render_template("sco_page.j2", content="<br>".join(diag))
|
||||
|
@ -31,24 +31,18 @@ PN / Edition des coefs
|
||||
Emmanuel Viennet, 2021
|
||||
"""
|
||||
|
||||
from flask import url_for
|
||||
from flask import g, request
|
||||
from flask import g, render_template, request, url_for
|
||||
from flask_json import as_json
|
||||
from flask_login import current_user
|
||||
from flask.templating import render_template
|
||||
from app.scodoc.codes_cursus import UE_SPORT
|
||||
|
||||
|
||||
from app import db, models
|
||||
|
||||
from app.comp import moy_ue
|
||||
from app.decorators import scodoc, permission_required
|
||||
from app.models import ApcParcours, Formation, Module
|
||||
from app.views import notes_bp as bp
|
||||
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc.codes_cursus import UE_SPORT
|
||||
from app.scodoc import sco_utils as scu
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
from app.views import notes_bp as bp
|
||||
|
||||
|
||||
@bp.route("/table_modules_ue_coefs/<int:formation_id>")
|
||||
@ -197,51 +191,23 @@ def edit_modules_ue_coefs():
|
||||
formation_id=formation_id
|
||||
).first_or_404()
|
||||
locked = formation.has_locked_sems(semestre_idx)
|
||||
if locked:
|
||||
lockicon = scu.icontag("lock32_img", title="verrouillé")
|
||||
else:
|
||||
lockicon = ""
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
cssstyles=["css/table_editor.css"],
|
||||
javascripts=[
|
||||
"js/table_editor.js",
|
||||
],
|
||||
page_title=f"Coefs programme {formation.acronyme}",
|
||||
),
|
||||
f"""<h2>Formation {formation.titre} ({formation.acronyme})
|
||||
[version {formation.version}] code {formation.formation_code}
|
||||
{lockicon}
|
||||
</h2>
|
||||
""",
|
||||
(
|
||||
"""<span class="warning">Formation verrouilée car un ou plusieurs
|
||||
semestres verrouillés l'utilisent.
|
||||
</span>"""
|
||||
if locked
|
||||
else ""
|
||||
),
|
||||
render_template(
|
||||
"pn/form_modules_ue_coefs.j2",
|
||||
formation=formation,
|
||||
data_source=url_for(
|
||||
"notes.table_modules_ue_coefs",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formation_id=formation_id,
|
||||
semestre_idx=semestre_idx,
|
||||
parcours_id=parcours_id,
|
||||
),
|
||||
data_save=url_for(
|
||||
"notes.set_module_ue_coef",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
),
|
||||
read_only=locked
|
||||
or not current_user.has_permission(Permission.EditFormation),
|
||||
return render_template(
|
||||
"pn/form_modules_ue_coefs.j2",
|
||||
formation=formation,
|
||||
data_source=url_for(
|
||||
"notes.table_modules_ue_coefs",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formation_id=formation_id,
|
||||
semestre_idx=semestre_idx,
|
||||
semestre_ids=range(1, formation.get_cursus().NB_SEM + 1),
|
||||
parcours_id=parcours_id,
|
||||
),
|
||||
html_sco_header.sco_footer(),
|
||||
]
|
||||
|
||||
return "\n".join(H)
|
||||
data_save=url_for(
|
||||
"notes.set_module_ue_coef",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
),
|
||||
read_only=locked or not current_user.has_permission(Permission.EditFormation),
|
||||
semestre_idx=semestre_idx,
|
||||
semestre_ids=range(1, formation.get_cursus().NB_SEM + 1),
|
||||
parcours_id=parcours_id,
|
||||
title=f"Coefs programme {formation.acronyme}",
|
||||
)
|
||||
|
@ -64,7 +64,7 @@ from app.decorators import (
|
||||
permission_required,
|
||||
)
|
||||
|
||||
from app.scodoc import html_sco_header, sco_import_users, sco_roles_default
|
||||
from app.scodoc import sco_import_users, sco_roles_default
|
||||
from app.scodoc import sco_users
|
||||
from app.scodoc import sco_utils as scu
|
||||
from app.scodoc import sco_xml
|
||||
@ -74,7 +74,6 @@ from app.scodoc.sco_import_users import generate_password
|
||||
from app.scodoc.sco_permissions_check import can_handle_passwd
|
||||
from app.scodoc.TrivialFormulator import TrivialFormulator, tf_error_message
|
||||
from app.views import users_bp as bp
|
||||
from app.views import scodoc_bp
|
||||
|
||||
|
||||
_ = lambda x: x # sans babel
|
||||
@ -92,7 +91,7 @@ class ChangePasswordForm(FlaskForm):
|
||||
validators=[
|
||||
EqualTo(
|
||||
"new_password",
|
||||
message="Les deux saisies sont " "différentes, recommencez",
|
||||
message="Les deux saisies sont différentes, recommencez",
|
||||
),
|
||||
],
|
||||
)
|
||||
@ -106,9 +105,9 @@ class ChangePasswordForm(FlaskForm):
|
||||
submit = SubmitField()
|
||||
cancel = SubmitField("Annuler")
|
||||
|
||||
def validate_email(self, email):
|
||||
"vérifie que le mail est unique"
|
||||
user = User.query.filter_by(email=email.data.strip()).first()
|
||||
def validate_email(self, e_mail):
|
||||
"vérifie que le mail est unique (inline wtf validator)"
|
||||
user = User.query.filter_by(email=e_mail.data.strip()).first()
|
||||
if user is not None and self.user_name.data != user.user_name:
|
||||
raise ValidationError(
|
||||
_("Cette adresse e-mail est déjà attribuée à un autre compte")
|
||||
@ -120,6 +119,7 @@ class ChangePasswordForm(FlaskForm):
|
||||
raise ValidationError("Mot de passe trop simple, recommencez")
|
||||
|
||||
def validate_old_password(self, old_password):
|
||||
"vérifie password actuel"
|
||||
if not current_user.check_password(old_password.data):
|
||||
raise ValidationError("Mot de passe actuel incorrect, ré-essayez")
|
||||
|
||||
@ -855,9 +855,7 @@ def import_users_generate_excel_sample():
|
||||
@scodoc7func
|
||||
def import_users_form():
|
||||
"""Import utilisateurs depuis feuille Excel"""
|
||||
head = html_sco_header.sco_header(page_title="Import utilisateurs")
|
||||
H = [
|
||||
head,
|
||||
"""<h2>Téléchargement d'une liste d'utilisateurs</h2>
|
||||
<p style="color: red">A utiliser pour importer de <b>nouveaux</b>
|
||||
utilisateurs (enseignants ou secrétaires)
|
||||
@ -886,12 +884,10 @@ def import_users_form():
|
||||
<li><b>Étape 1: </b><a class="stdlink" href="{
|
||||
url_for("users.import_users_generate_excel_sample", scodoc_dept=g.scodoc_dept)
|
||||
}">Obtenir la feuille excel vide à remplir</a>
|
||||
ou bien la liste complète des utilisateurs.
|
||||
</li>
|
||||
<li><b> Étape 2:</b>
|
||||
"""
|
||||
)
|
||||
F = html_sco_header.sco_footer()
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
scu.get_request_args(),
|
||||
@ -915,7 +911,11 @@ def import_users_form():
|
||||
submitlabel="Télécharger",
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + tf[1] + "</li></ul>" + help_msg + F
|
||||
return render_template(
|
||||
"sco_page_dept.j2",
|
||||
title="Import utilisateurs",
|
||||
content="\n".join(H) + tf[1] + "</li></ul>" + help_msg,
|
||||
)
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(url_for("scolar.index_html", docodc_dept=g.scodoc_dept))
|
||||
|
||||
@ -923,8 +923,10 @@ def import_users_form():
|
||||
ok, diags, nb_created = sco_import_users.import_excel_file(
|
||||
tf[2]["xlsfile"], tf[2]["force"]
|
||||
)
|
||||
H = [html_sco_header.sco_header(page_title="Import utilisateurs")]
|
||||
H.append("<ul>")
|
||||
H = [
|
||||
"""<h2>Téléchargement d'une liste d'utilisateurs</h2>
|
||||
<ul>"""
|
||||
]
|
||||
for diag in diags:
|
||||
H.append(f"<li>{diag}</li>")
|
||||
H.append("</ul>")
|
||||
@ -942,7 +944,9 @@ def import_users_form():
|
||||
<p><a class="stdlink" href="{dest_url}">Continuer</a></p>
|
||||
"""
|
||||
)
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
return render_template(
|
||||
"sco_page_dept.j2", title="Import utilisateurs", content="\n".join(H)
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/user_info_page")
|
||||
@ -1061,76 +1065,6 @@ def form_change_password(user_name=None):
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/change_password", methods=["POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def change_password(user_name, password, password2):
|
||||
"Change the password for user given by user_name"
|
||||
if user_name is not None: # scodoc7func converti en int !
|
||||
user_name = str(user_name)
|
||||
u = User.query.filter_by(user_name=user_name).first()
|
||||
# Check access permission
|
||||
if not can_handle_passwd(u):
|
||||
# access denied
|
||||
log(
|
||||
f"change_password: access denied (authuser={current_user}, user_name={user_name})"
|
||||
)
|
||||
raise AccessDenied("vous n'avez pas la permission de changer ce mot de passe")
|
||||
H = []
|
||||
F = html_sco_header.sco_footer()
|
||||
# check password
|
||||
dest_url = url_for(
|
||||
"users.form_change_password", scodoc_dept=g.scodoc_dept, user_name=user_name
|
||||
)
|
||||
if password != password2:
|
||||
H.append(
|
||||
f"""<p>Les deux mots de passes saisis sont différents !</p>
|
||||
<p><a href="{dest_url}" class="stdlink">Recommencer</a></p>
|
||||
"""
|
||||
)
|
||||
else:
|
||||
if not is_valid_password(password):
|
||||
H.append(
|
||||
f"""<p><b>ce mot de passe n'est pas assez compliqué !</b>
|
||||
<br>(oui, il faut un mot de passe vraiment compliqué !)
|
||||
</p>
|
||||
<p><a href="{dest_url}" class="stdlink">Recommencer</a></p>
|
||||
"""
|
||||
)
|
||||
else:
|
||||
# ok, strong password
|
||||
db.session.add(u)
|
||||
u.set_password(password)
|
||||
db.session.commit()
|
||||
#
|
||||
# ici page simplifiee car on peut ne plus avoir
|
||||
# le droit d'acceder aux feuilles de style
|
||||
return f"""<?xml version="1.0" encoding="{scu.SCO_ENCODING}"?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mot de passe changé</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset={scu.SCO_ENCODING}" />
|
||||
<body>
|
||||
<h1>Mot de passe changé !</h1>
|
||||
<h2>Changement effectué</h2>
|
||||
<p>Ne notez pas ce mot de passe, mais mémorisez le !</p>
|
||||
<p>Rappel: il est <b>interdit</b> de communiquer son mot de passe à
|
||||
un tiers, même si c'est un collègue de confiance !</p>
|
||||
<p><b>Si vous n'êtes pas administrateur, le système va vous redemander
|
||||
votre login et nouveau mot de passe au prochain accès.</b>
|
||||
</p>
|
||||
<a href="{
|
||||
url_for("scolar.index_html", scodoc_dept=g.scodoc_dept)
|
||||
}" class="stdlink">Continuer</a>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
return html_sco_header.sco_header() + "\n".join(H) + F
|
||||
|
||||
|
||||
@bp.route("/toggle_active_user/<user_name>", methods=["GET", "POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.UsersAdmin)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.7.6"
|
||||
SCOVERSION = "9.7.9"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
@ -4,7 +4,7 @@ debian_version=$(cat /etc/debian_version)
|
||||
debian_version=${debian_version%%.*}
|
||||
|
||||
die() {
|
||||
echo
|
||||
echo
|
||||
echo "Erreur: $1"
|
||||
echo
|
||||
exit 1
|
||||
@ -17,8 +17,8 @@ export PATH="${PATH}":/usr/sbin:/sbin
|
||||
umask 0022
|
||||
|
||||
export SCODOC_DIR=/opt/scodoc
|
||||
export SCODOC_VAR_DIR=/opt/scodoc-data
|
||||
|
||||
export SCODOC_VAR_DIR=/opt/scodoc-data
|
||||
export SCODOC_INSTALL_STATUS_FILE="${SCODOC_VAR_DIR}/.install_status"
|
||||
export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version"
|
||||
export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos"
|
||||
|
||||
@ -49,7 +49,7 @@ else
|
||||
fi
|
||||
export PSQL
|
||||
|
||||
# tcp port for SQL server
|
||||
# tcp port for SQL server
|
||||
# Important note: if changed, you should probably also change it in
|
||||
# sco_utils.py (SCO_DEFAULT_SQL_PORT).
|
||||
export POSTGRES_PORT=5432
|
||||
|
@ -3,11 +3,17 @@
|
||||
# Post-installation de scodoc
|
||||
# ici, le répertoire /opt/scodoc vient d'être installé
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
cd /opt/scodoc || (echo "Error chdir to /opt/scodoc"; exit 1)
|
||||
|
||||
# On peut donc charger la config:
|
||||
source /opt/scodoc/tools/config.sh
|
||||
source /opt/scodoc/tools/utils.sh
|
||||
source /opt/scodoc/tools/config.sh || (echo "Error loading /opt/scodoc/tools/config.sh"; exit 1)
|
||||
source /opt/scodoc/tools/utils.sh || (echo "Error loading /opt/scodoc/tools/utils.sh"; exit 1)
|
||||
|
||||
# Enleve fichier de statut d'installation s'il existe
|
||||
# (la présence de ce fichier indique que l'install s'est bien passée)
|
||||
remove_install_status
|
||||
|
||||
# -- Création au besoin de notre utilisateur
|
||||
# adduser --system "${SCODOC_USER}"
|
||||
@ -26,7 +32,7 @@ do
|
||||
then
|
||||
echo adding $locname
|
||||
echo "$locname ${locname##*.}" >> /etc/locale.gen
|
||||
/usr/sbin/locale-gen --keep-existing
|
||||
/usr/sbin/locale-gen --keep-existing
|
||||
fi
|
||||
done
|
||||
echo "debian postinst: scodoc9 systemd service is $(systemctl is-active scodoc9)"
|
||||
@ -44,7 +50,7 @@ then
|
||||
if [[ ! "${SN}" =~ ^[0-9].* ]]
|
||||
then
|
||||
SN='' # fix for invalid previous replies
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# first install
|
||||
echo "mode: install"
|
||||
@ -56,10 +62,10 @@ CMD="curl --fail --connect-timeout 5 --silent https://scodoc.org/scodoc-installm
|
||||
|
||||
SVERSION="$(${CMD})"
|
||||
if [ "$?" == 0 ]; then
|
||||
#echo "answer=${SVERSION}"
|
||||
#echo "answer=${SVERSION}"
|
||||
echo "${SVERSION}" > "${SCODOC_VERSION_DIR}"/scodoc.sn
|
||||
else
|
||||
echo 'Warning: cannot connect to scodoc release server'
|
||||
echo 'Warning: cannot connect to scodoc release server'
|
||||
fi
|
||||
|
||||
# ------------ LIEN VERS .env
|
||||
@ -117,7 +123,7 @@ cp "$SCODOC_DIR"/tools/etc/scodoc-logrotate /etc/logrotate.d/scodoc
|
||||
chmod 644 /etc/logrotate.d/scodoc
|
||||
|
||||
# ------------ CONFIG SERVICE SCODOC
|
||||
echo
|
||||
echo
|
||||
echo "Installation du service systemd scodoc9..."
|
||||
cp "$SCODOC_DIR"/tools/etc/scodoc9.service /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
@ -134,3 +140,6 @@ systemctl enable scodoc9
|
||||
|
||||
# --- RESTART SCODOC
|
||||
systemctl restart scodoc9
|
||||
|
||||
# On est arrivé au bout du post-install !
|
||||
create_install_status
|
||||
|
19
tools/debian/prerm
Executable file
19
tools/debian/prerm
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Pre-removal script for scodoc
|
||||
# This script is called by dpkg before removing the package
|
||||
|
||||
cd /opt/scodoc || (echo "Error chdir to /opt/scodoc"; exit 1)
|
||||
|
||||
# On peut donc charger la config:
|
||||
source /opt/scodoc/tools/config.sh || (echo "Error loading /opt/scodoc/tools/config.sh"; exit 1)
|
||||
source /opt/scodoc/tools/utils.sh || (echo "Error loading /opt/scodoc/tools/utils.sh"; exit 1)
|
||||
|
||||
check_uid_root
|
||||
|
||||
remove_install_status
|
||||
|
||||
|
||||
|
@ -1,15 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Upgrade ScoDoc installation using APT
|
||||
#
|
||||
#
|
||||
# This script STOP and RESTART ScoDoc and should be runned as root
|
||||
#
|
||||
# Upgrade also the Linux system using apt.
|
||||
#
|
||||
# Script for ScoDoc 9
|
||||
# Script for ScoDoc 9. Lancé automatiquement par scodoc-updater.
|
||||
#
|
||||
# E. Viennet, sep 2013, mar 2017, jun 2019, aug 2020, dec 2020, aug 21
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Le répertoire de ce script:
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
@ -29,7 +30,7 @@ if [ -z "$SCODOC_UPGRADE_RUNNING" ]
|
||||
# install spécifiquement scodoc9, utile si les dépendances Debian de scodoc9
|
||||
# ont été changées, ce qui peut provoquer un
|
||||
# "packages have been kept back"
|
||||
apt install scodoc9
|
||||
apt install scodoc9 || alarm_admin "apt install scodoc9 failed"
|
||||
fi
|
||||
systemctl restart redis
|
||||
systemctl restart nginx
|
||||
|
@ -2,12 +2,12 @@
|
||||
# Misc utilities for ScoDoc install shell scripts
|
||||
|
||||
to_lower() {
|
||||
echo "$1" | tr "[:upper:]" "[:lower:]"
|
||||
}
|
||||
echo "$1" | tr "[:upper:]" "[:lower:]"
|
||||
}
|
||||
|
||||
to_upper() {
|
||||
echo "$1" | tr "[:lower:]" "[:upper:]"
|
||||
}
|
||||
echo "$1" | tr "[:lower:]" "[:upper:]"
|
||||
}
|
||||
|
||||
norm_ans() {
|
||||
x=$(to_upper "$1" | tr O Y)
|
||||
@ -15,7 +15,7 @@ norm_ans() {
|
||||
}
|
||||
|
||||
check_uid_root() {
|
||||
if [ "$UID" != "0" ]
|
||||
if [ "$UID" != "0" ]
|
||||
then
|
||||
echo "Erreur: le script $1 doit etre lance par root"
|
||||
exit 1
|
||||
@ -24,7 +24,7 @@ check_uid_root() {
|
||||
|
||||
terminate() {
|
||||
status=${2:-1} # default: exit 1
|
||||
echo
|
||||
echo
|
||||
echo "Erreur: $1"
|
||||
echo
|
||||
exit $status
|
||||
@ -95,8 +95,8 @@ set_scodoc_var_dir() {
|
||||
}
|
||||
|
||||
|
||||
# XXX inutilise
|
||||
gen_passwd() {
|
||||
# XXX inutilise
|
||||
gen_passwd() {
|
||||
PASSWORD_LENGTH="8"
|
||||
ALLOWABLE_ASCII="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@#$%^&*()_+=-?><"
|
||||
SEED=$(head -c4 /dev/urandom | od -t u4 | awk '{ print $2 }')
|
||||
@ -110,3 +110,26 @@ gen_passwd() {
|
||||
done
|
||||
echo "$password"
|
||||
}
|
||||
|
||||
|
||||
# Status file: indique si l'install s'est complètement déroulée
|
||||
create_install_status() {
|
||||
touch "${SCODOC_INSTALL_STATUS_FILE}" || die "can't create ${SCODOC_INSTALL_STATUS_FILE}"
|
||||
}
|
||||
remove_install_status() {
|
||||
if [ -e "${SCODOC_INSTALL_STATUS_FILE}" ]
|
||||
then
|
||||
rm -f "${SCODOC_INSTALL_STATUS_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
alarm_admin() {
|
||||
echo "Error: alarm_admin $1"
|
||||
echo "Sending email to admin..."
|
||||
echo "Subject: ScoDoc: $1" | mail -s "ScoDoc: $1" root <<EOF
|
||||
|
||||
Erreur lors de la mise à jour de ScoDoc sur $(hostname --fqdn)
|
||||
|
||||
EOF
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user