From 6baec61e0ea5169dfa66372269b8edc8238bd131 Mon Sep 17 00:00:00 2001 From: lehmann Date: Tue, 21 Dec 2021 22:22:55 +0100 Subject: [PATCH 1/6] =?UTF-8?q?Bulletin=20:=20Liens=20vers=20plus=20bas=20?= =?UTF-8?q?+=20lien=20vers=20fiche=20=C3=A9tudiant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/releve-but.css | 7 +++++++ app/static/js/releve-but.js | 30 ++++++++++++++++++++++++------ app/templates/but/bulletin.html | 5 +++-- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/app/static/css/releve-but.css b/app/static/css/releve-but.css index 2f9766de..60d4f01c 100644 --- a/app/static/css/releve-but.css +++ b/app/static/css/releve-but.css @@ -98,6 +98,10 @@ section>div:nth-child(1){ /************/ /* Etudiant */ /************/ +.info_etudiant{ + color: #000; + text-decoration: none; +} .etudiant{ display: flex; align-items: center; @@ -194,6 +198,9 @@ h3{ .info{ opacity: 0.9; } +.syntheseModule{ + cursor: pointer; +} .eval, .syntheseModule{ position: relative; display: flex; diff --git a/app/static/js/releve-but.js b/app/static/js/releve-but.js index 9b974fe6..126cb219 100644 --- a/app/static/js/releve-but.js +++ b/app/static/js/releve-but.js @@ -27,6 +27,10 @@ class releveBUT extends HTMLElement { moduleOnOff(){ this.parentElement.classList.toggle("moduleOnOff"); } + goTo(){ + let module = this.dataset.module; + this.parentElement.parentElement.parentElement.parentElement.querySelector("#Module_" + module).scrollIntoView(); + } set setConfig(config){ this.config.showURL = config.showURL ?? this.config.showURL; @@ -46,6 +50,9 @@ class releveBUT extends HTMLElement { this.shadow.querySelectorAll(".ue, .module").forEach(e => { e.addEventListener("click", this.moduleOnOff) }) + this.shadow.querySelectorAll(".syntheseModule").forEach(e => { + e.addEventListener("click", this.goTo) + }) this.shadow.children[0].classList.add("ready"); } @@ -132,8 +139,15 @@ class releveBUT extends HTMLElement { showInformations(data) { this.shadow.querySelector(".studentPic").src = data.etudiant.photo_url || "default_Student.svg"; - let output = ` -
+ let output = ''; + + if(this.config.showURL){ + output += ``; + } else { + output += `
`; + } + + output += `
${this.civilite(data.etudiant.civilite)} ${data.etudiant.nom} @@ -150,8 +164,12 @@ class releveBUT extends HTMLElement { Code INE : ${data.etudiant.code_ine}
${data.formation.titre}
-
`; + if(this.config.showURL){ + output += `
`; + } else { + output += `
`; + } this.shadow.querySelector(".infoEtudiant").innerHTML = output; } @@ -226,8 +244,8 @@ class releveBUT extends HTMLElement { let titre = data.ressources[module]?.titre || data.saes[module]?.titre; let url = data.ressources[module]?.url || data.saes[module]?.url; output += ` -
-
${this.URL(url, `${module} - ${titre}`)}
+
+
${module} - ${titre}
${dataModule.moyenne} Coef. ${dataModule.coef} @@ -249,7 +267,7 @@ class releveBUT extends HTMLElement { let output = ""; Object.entries(module).forEach(([numero, content]) => { output += ` -
+

${this.URL(content.url, `${numero} - ${content.titre}`)}

diff --git a/app/templates/but/bulletin.html b/app/templates/but/bulletin.html index 727a144d..27146ed4 100644 --- a/app/templates/but/bulletin.html +++ b/app/templates/but/bulletin.html @@ -22,9 +22,10 @@ .dateInscription, .numerosEtudiant, .dateNaissance{ - display: none; + display: none; }`; releve.shadowRoot.appendChild(style); - }) + }); + document.querySelector("html").style.scrollBehavior = "smooth"; {% endblock %} \ No newline at end of file From d86bb3e9b70cdaa4ec65015139882b987d84c25f Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 22 Dec 2021 10:23:17 +0100 Subject: [PATCH 2/6] =?UTF-8?q?le=20fichier=20oubli=C3=A9=20en=209.1.13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logos.py | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 app/api/logos.py diff --git a/app/api/logos.py b/app/api/logos.py new file mode 100644 index 00000000..4fdb1099 --- /dev/null +++ b/app/api/logos.py @@ -0,0 +1,97 @@ +# -*- mode: python -*- +# -*- coding: utf-8 -*- + +############################################################################## +# +# Gestion scolarite IUT +# +# Copyright (c) 1999 - 2021 Emmanuel Viennet. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Emmanuel Viennet emmanuel.viennet@viennet.net +# +############################################################################## + +"""API: gestion des logos +Contrib @jmp +""" + +from datetime import datetime +from flask import jsonify, g, send_file + +from app.api import bp +from app.api import requested_format +from app.api.auth import token_auth +from app.api.errors import error_response +from app.models import Departement +from app.scodoc.sco_logos import list_logos, find_logo +from app.scodoc.sco_permissions import Permission + + +@bp.route("/logos", methods=["GET"]) +@token_auth.login_required +def api_get_glob_logos(): + if not g.current_user.has_permission(Permission.ScoSuperAdmin, None): + return error_response(401, message="accès interdit") + required_format = requested_format() # json only + if required_format is None: + return error_response(400, "Illegal format") + logos = list_logos()[None] + return jsonify(list(logos.keys())) + + +@bp.route("/logos/", methods=["GET"]) +@token_auth.login_required +def api_get_glob_logo(logoname): + if not g.current_user.has_permission(Permission.ScoSuperAdmin, None): + return error_response(401, message="accès interdit") + logo = find_logo(logoname=logoname) + if logo is None: + return error_response(404, message="logo not found") + logo.select() + return send_file( + logo.filepath, + mimetype=f"image/{logo.suffix}", + last_modified=datetime.now(), + ) + + +@bp.route("/departements//logos", methods=["GET"]) +@token_auth.login_required +def api_get_local_logos(departement): + dept_id = Departement.from_acronym(departement).id + if not g.current_user.has_permission(Permission.ScoChangePreferences, departement): + return error_response(401, message="accès interdit") + logos = list_logos().get(dept_id, dict()) + return jsonify(list(logos.keys())) + + +@bp.route("/departements//logos/", methods=["GET"]) +@token_auth.login_required +def api_get_local_logo(departement, logoname): + # format = requested_format("jpg", ['png', 'jpg']) XXX ? + dept_id = Departement.from_acronym(departement).id + if not g.current_user.has_permission(Permission.ScoChangePreferences, departement): + return error_response(401, message="accès interdit") + logo = find_logo(logoname=logoname, dept_id=dept_id) + if logo is None: + return error_response(404, message="logo not found") + logo.select() + return send_file( + logo.filepath, + mimetype=f"image/{logo.suffix}", + last_modified=datetime.now(), + ) From 799245b265ae5212685f4a0a5f61088811261a2b Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 22 Dec 2021 10:30:35 +0100 Subject: [PATCH 3/6] version 9.1.13 --- sco_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sco_version.py b/sco_version.py index 8baaca5e..811be249 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.12" +SCOVERSION = "9.1.13" SCONAME = "ScoDoc" From 9eb2c2462b5af2b3bd540c84c686dc35dc7833fe Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 22 Dec 2021 13:13:01 +0100 Subject: [PATCH 4/6] liens marge gauche --- app/scodoc/html_sidebar.py | 4 +++- app/templates/sidebar_dept.html | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py index a96da1a3..c35f3042 100644 --- a/app/scodoc/html_sidebar.py +++ b/app/scodoc/html_sidebar.py @@ -39,8 +39,10 @@ from app.scodoc.sco_permissions import Permission def sidebar_common(): "partie commune à toutes les sidebar" + home_link = url_for("scodoc.index", scodoc_dept=g.scodoc_dept) H = [ - f"""ScoDoc 9.1 + f"""ScoDoc 9.1
+ Accueil
Dépt. {{ prefs["DeptName"] }} -Accueil
+

Dépt. {{ prefs["DeptName"] }} +

{% if prefs["DeptIntranetURL"] %} - + {{ prefs["DeptIntranetTitle"] }} {% endif %}
From d12db963895cf274d8b97d0b6b2e4b854199e2be Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 22 Dec 2021 14:31:44 +0100 Subject: [PATCH 5/6] typo --- app/views/scodoc.py | 2 +- sco_version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/scodoc.py b/app/views/scodoc.py index c098f034..dfd8bcfe 100644 --- a/app/views/scodoc.py +++ b/app/views/scodoc.py @@ -134,7 +134,7 @@ def get_etud_dept(): last_etud = None last_date = None for etud in etuds: - inscriptions = FormsemestreInscription.query.filter_by(etudid=etud.id).all() + inscriptions = FormSemestreInscription.query.filter_by(etudid=etud.id).all() for ins in inscriptions: date_fin = FormSemestre.query.get(ins.formsemestre_id).date_fin if (last_date is None) or date_fin > last_date: diff --git a/sco_version.py b/sco_version.py index 811be249..e2e05e13 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.13" +SCOVERSION = "9.1.14" SCONAME = "ScoDoc" From 429820b7865f4747476f089a1ef13d4f11324a62 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 23 Dec 2021 00:18:05 +0100 Subject: [PATCH 6/6] 9.1.15 --- sco_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sco_version.py b/sco_version.py index e2e05e13..3de53222 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.14" +SCOVERSION = "9.1.15" SCONAME = "ScoDoc"