diff --git a/app/__init__.py b/app/__init__.py index 6f94517860..7998f19a95 100755 --- a/app/__init__.py +++ b/app/__init__.py @@ -19,11 +19,7 @@ from flask import current_app, g, request from flask import Flask from flask import abort, flash, has_request_context from flask import render_template - -# from flask.json import JSONEncoder from flask.logging import default_handler - -from flask_bootstrap import Bootstrap from flask_caching import Cache from flask_json import FlaskJSON, json_response from flask_login import LoginManager, current_user @@ -34,6 +30,7 @@ from flask_sqlalchemy import SQLAlchemy from jinja2 import select_autoescape import sqlalchemy as sa import werkzeug.debug +from wtforms.fields import HiddenField from flask_cas import CAS @@ -59,8 +56,6 @@ login.login_view = "auth.login" login.login_message = "Identifiez-vous pour accéder à cette page." mail = Mail() -bootstrap = Bootstrap() -# moment = Moment() CACHE_TYPE = os.environ.get("CACHE_TYPE") cache = Cache( @@ -304,7 +299,6 @@ def create_app(config_class=DevConfig): login.init_app(app) mail.init_app(app) app.extensions["mail"].debug = 0 # disable copy of mails to stderr - bootstrap.init_app(app) cache.init_app(app) sco_cache.CACHE = cache if CACHE_TYPE: # non default @@ -320,6 +314,12 @@ def create_app(config_class=DevConfig): app.register_error_handler(503, postgresql_server_error) app.register_error_handler(APIInvalidParams, handle_invalid_usage) + # Add some globals + # previously in Flask-Bootstrap: + app.jinja_env.globals["bootstrap_is_hidden_field"] = lambda field: isinstance( + field, HiddenField + ) + from app.auth import bp as auth_bp app.register_blueprint(auth_bp, url_prefix="/auth") @@ -549,8 +549,8 @@ def truncate_database(): CREATE OR REPLACE FUNCTION reset_sequences(username IN VARCHAR) RETURNS void AS $$ DECLARE statements CURSOR FOR - SELECT sequence_name - FROM information_schema.sequences + SELECT sequence_name + FROM information_schema.sequences ORDER BY sequence_name ; BEGIN FOR stmt IN statements LOOP diff --git a/app/scodoc/html_sco_header.py b/app/scodoc/html_sco_header.py index fd62737092..2585c88736 100644 --- a/app/scodoc/html_sco_header.py +++ b/app/scodoc/html_sco_header.py @@ -95,7 +95,7 @@ _HTML_BEGIN = f"""
ScoDoc est un logiciel libre écrit en
Python.
- Information et documentation sur
+ Information et documentation sur
Chargement des configurations CAS des utilisateurs
@@ -17,15 +17,15 @@
Attention: ce mécanisme permet de changer le mot de passe ScoDoc
+ Attention: ce mécanisme permet de changer le mot de passe ScoDoc
mais ne changera pas votre mot de passe sur le système de l'établissement.
- Si vous vous connectez via vos identifiants de l'université (CAS), passez
+ Si vous vous connectez via vos identifiants de l'université (CAS), passez
par la procédure de celle-ci (ENT ou autre).
{{date}} Si le problème persiste, contacter l'administrateur de votre site,
- ou l'assistance sur le canal Discord.
Pour aider à corriger le problème, nous vous
remercions d'envoyer ce rapport d'erreur
(qui contient des données anonymisées sur votre configuration):
-
- On peut remplir ou modifier le contenu des colonnes active,
+ On peut remplir ou modifier le contenu des colonnes active,
cas_id, cas_allow_login, cas_allow_scodoc_login,
et email_institutionnel
- Les autres colonnes sont là pour information et seront ignorées à l'import,
+ Les autres colonnes sont là pour information et seront ignorées à l'import,
sauf évidemment user_name qui sert à repérer l'utilisateur.
- (Note: active active ou désactive le compte, sans lien avec CAS, mais il
- est commode de réviser la liste des utilisateurs actifs à l'occasion de la configuration CAS.
+ (Note: active active ou désactive le compte, sans lien avec CAS, mais il
+ est commode de réviser la liste des utilisateurs actifs à l'occasion de la configuration CAS.
Pareil pour email_institutionnel)
@@ -50,4 +50,4 @@
L'accès à ScoDoc est strictement réservé aux personnels de
l'établissement. Les étudiants n'y ont pas accès. Pour toute information,
contactez la personne responsable de votre établissement.
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/auth/register.j2 b/app/templates/auth/register.j2
index 0c1c1b03f6..72eefedb61 100644
--- a/app/templates/auth/register.j2
+++ b/app/templates/auth/register.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends "base.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Création utilisateur
@@ -9,4 +9,4 @@
{{ wtf.quick_form(form) }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/auth/reset_password.j2 b/app/templates/auth/reset_password.j2
index 8d0f02360a..3b03c76f35 100644
--- a/app/templates/auth/reset_password.j2
+++ b/app/templates/auth/reset_password.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends "base.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Changez votre mot de passe ScoDoc
@@ -14,4 +14,4 @@
{{ wtf.quick_form(form) }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/auth/reset_password_request.j2 b/app/templates/auth/reset_password_request.j2
index 291d89a382..78460f637f 100644
--- a/app/templates/auth/reset_password_request.j2
+++ b/app/templates/auth/reset_password_request.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends "base.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Demande d'un nouveau mot de passe
@@ -11,13 +11,13 @@
{% if is_cas_enabled %}
{{ "Désactiver" if u.active else "Activer" }} l'utilisateur {{ u.get_nomplogin() }} ?
@@ -15,4 +15,4 @@
{{ wtf.quick_form(form) }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/auth/user_info_page.j2 b/app/templates/auth/user_info_page.j2
index ff008361ea..8a6cb7f6e4 100644
--- a/app/templates/auth/user_info_page.j2
+++ b/app/templates/auth/user_info_page.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends "base.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
@@ -45,14 +45,14 @@
or current_user.has_permission(Permission.UsersAdmin, user.dept)
) %}
Associer un référentiel de compétences
@@ -15,7 +15,7 @@
Référentiel actuellement associé:
{% if formation.referentiel_competence is not none %}
{{ formation.referentiel_competence.specialite_long }}
- supprimer
{% else %}
@@ -35,4 +35,4 @@
}}">passer par cette page.
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/but/refcomp_load.j2 b/app/templates/but/refcomp_load.j2
index 18cf30ae08..b6c88cefa0 100644
--- a/app/templates/but/refcomp_load.j2
+++ b/app/templates/but/refcomp_load.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends "base.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Charger un référentiel de compétences
@@ -28,4 +28,4 @@
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/but/refcomp_table.j2 b/app/templates/but/refcomp_table.j2
index b1b1a5ca51..0c7585dc09 100644
--- a/app/templates/but/refcomp_table.j2
+++ b/app/templates/but/refcomp_table.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends "sco_page.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Référentiels de compétences chargés
@@ -32,4 +32,4 @@
ScoDoc importe le format XML généré par Orébut, et peut exporter une représentation JSON.
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/config_cas.j2 b/app/templates/config_cas.j2
index 05fb21586d..b1d532f88f 100644
--- a/app/templates/config_cas.j2
+++ b/app/templates/config_cas.j2
@@ -1,5 +1,5 @@
{% extends "base.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Configuration du Service d'Authentification Central (CAS)
diff --git a/app/templates/config_codes_decisions.j2 b/app/templates/config_codes_decisions.j2
index 8bdd338d3c..352f98354f 100644
--- a/app/templates/config_codes_decisions.j2
+++ b/app/templates/config_codes_decisions.j2
@@ -1,5 +1,5 @@
{% extends "base.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Configuration des codes de décision exportés vers Apogée
@@ -20,4 +20,4 @@
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/config_logos.j2 b/app/templates/config_logos.j2
index 918c1f9ab6..7d0fdd016d 100644
--- a/app/templates/config_logos.j2
+++ b/app/templates/config_logos.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% macro render_field(field, with_label=True) %}
Créer un département
@@ -12,4 +12,4 @@
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/entreprises/form.j2 b/app/templates/entreprises/form.j2
index e531177824..d5a8c37e4e 100644
--- a/app/templates/entreprises/form.j2
+++ b/app/templates/entreprises/form.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
@@ -59,4 +59,4 @@
var as_utilisateurs = new bsn.AutoSuggest('utilisateur', responsables_options);
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/entreprises/form_ajout_correspondants.j2 b/app/templates/entreprises/form_ajout_correspondants.j2
index ada71b1550..9bc6cff627 100644
--- a/app/templates/entreprises/form_ajout_correspondants.j2
+++ b/app/templates/entreprises/form_ajout_correspondants.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
@@ -88,4 +88,4 @@
}
}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/entreprises/form_ajout_entreprise.j2 b/app/templates/entreprises/form_ajout_entreprise.j2
index bdd32aef2a..89f3620154 100644
--- a/app/templates/entreprises/form_ajout_entreprise.j2
+++ b/app/templates/entreprises/form_ajout_entreprise.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Ajout entreprise
@@ -55,4 +55,4 @@
document.getElementById("ville").value = ''
}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/entreprises/form_ajout_stage_apprentissage.j2 b/app/templates/entreprises/form_ajout_stage_apprentissage.j2
index 071e4d1fcc..a8881d4b3d 100644
--- a/app/templates/entreprises/form_ajout_stage_apprentissage.j2
+++ b/app/templates/entreprises/form_ajout_stage_apprentissage.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
diff --git a/app/templates/entreprises/form_envoi_offre.j2 b/app/templates/entreprises/form_envoi_offre.j2
index ab1be632f8..1490d88af3 100644
--- a/app/templates/entreprises/form_envoi_offre.j2
+++ b/app/templates/entreprises/form_envoi_offre.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
@@ -72,7 +72,7 @@
Validation entreprise
@@ -12,4 +12,4 @@
{{ wtf.quick_form(form) }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/entreprises/import_donnees.j2 b/app/templates/entreprises/import_donnees.j2
index be3a7dfab4..3344a62978 100644
--- a/app/templates/entreprises/import_donnees.j2
+++ b/app/templates/entreprises/import_donnees.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
@@ -195,7 +195,7 @@
Code postal : {{ entreprise.codepostal }}
Ville : {{ entreprise.ville }}
Pays : {{ entreprise.pays }}
- Fiche entreprise
@@ -222,7 +222,7 @@
Code postal : {{ site.codepostal }}
Ville : {{ site.ville }}
Pays : {{ site.pays }}
- Fiche entreprise
@@ -264,4 +264,4 @@
{% endif %}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/entreprises/preferences.j2 b/app/templates/entreprises/preferences.j2
index 8fb5a86125..2658f1ca7c 100644
--- a/app/templates/entreprises/preferences.j2
+++ b/app/templates/entreprises/preferences.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
{% include 'entreprises/nav.j2' %}
@@ -14,4 +14,4 @@
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/error_500.j2 b/app/templates/error_500.j2
index 790aff3e11..9a02d0efbd 100644
--- a/app/templates/error_500.j2
+++ b/app/templates/error_500.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block title %}Une erreur est survenue !{% endblock %}
@@ -12,14 +12,14 @@
{{ title }}
@@ -12,4 +12,4 @@
{{ wtf.quick_form(form) }}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/formation/ue_assoc_parcours_ects.j2 b/app/templates/formation/ue_assoc_parcours_ects.j2
index d7ea10ba9e..290d0d1694 100644
--- a/app/templates/formation/ue_assoc_parcours_ects.j2
+++ b/app/templates/formation/ue_assoc_parcours_ects.j2
@@ -1,6 +1,6 @@
{# Association d'ECTS à une UE par parcours #}
{% extends "sco_page.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
diff --git a/app/templates/formsemestre/change_formation.j2 b/app/templates/formsemestre/change_formation.j2
index 8c0b8b5b3e..b0e8c9e02f 100644
--- a/app/templates/formsemestre/change_formation.j2
+++ b/app/templates/formsemestre/change_formation.j2
@@ -1,5 +1,5 @@
{% extends "sco_page.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
diff --git a/app/templates/formsemestre/edit_modimpls_codes.j2 b/app/templates/formsemestre/edit_modimpls_codes.j2
index d70b6e2801..a663207d3a 100644
--- a/app/templates/formsemestre/edit_modimpls_codes.j2
+++ b/app/templates/formsemestre/edit_modimpls_codes.j2
@@ -1,5 +1,5 @@
{% extends "sco_page.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
diff --git a/app/templates/formsemestre/edt.j2 b/app/templates/formsemestre/edt.j2
index 267d05e815..0c4edce758 100644
--- a/app/templates/formsemestre/edt.j2
+++ b/app/templates/formsemestre/edt.j2
@@ -1,5 +1,5 @@
{% extends "sco_page.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
diff --git a/app/templates/main/index.j2 b/app/templates/main/index.j2
index 9298d86b8f..ca2408bbf5 100644
--- a/app/templates/main/index.j2
+++ b/app/templates/main/index.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
@@ -54,4 +54,4 @@
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/sco_page.j2 b/app/templates/sco_page.j2
index 7cbfd96b05..6cc4a863ae 100644
--- a/app/templates/sco_page.j2
+++ b/app/templates/sco_page.j2
@@ -1,5 +1,5 @@
{# -*- mode: jinja-html -*- #}
-{% extends 'bootstrap/base.html' %}
+{% extends 'babase.j2' %}
{% block styles %}
{{super()}}
@@ -52,7 +52,7 @@
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/scodoc.j2 b/app/templates/scodoc.j2
index e62102ffd7..235835d230 100644
--- a/app/templates/scodoc.j2
+++ b/app/templates/scodoc.j2
@@ -1,6 +1,6 @@
{# -*- mode: jinja-html -*- #}
{% extends 'base.j2' %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
ScoDoc 9 - suivi scolarité
@@ -53,7 +53,7 @@
{% endif %}
-
@@ -63,4 +63,4 @@
le logiciel libre ScoDoc.
-{% endblock %}
\ No newline at end of file
+{% endblock %}
diff --git a/app/templates/scodoc/forms/placement.j2 b/app/templates/scodoc/forms/placement.j2
index 7631b743cf..7cb5b482ed 100644
--- a/app/templates/scodoc/forms/placement.j2
+++ b/app/templates/scodoc/forms/placement.j2
@@ -1,4 +1,4 @@
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% macro render_field(field) %}
@@ -77,4 +77,4 @@
-
\ No newline at end of file
+
diff --git a/app/templates/scodoc/role_create.j2 b/app/templates/scodoc/role_create.j2
index 9c21b5d686..4f2627e7d4 100644
--- a/app/templates/scodoc/role_create.j2
+++ b/app/templates/scodoc/role_create.j2
@@ -1,12 +1,12 @@
{# -*- mode: jinja-html -*- #}
{% extends "base.j2" %}
-{% import 'bootstrap/wtf.html' as wtf %}
+{% import 'wtf.j2' as wtf %}
{% block app_content %}
Créer un rôle