From 40177b5717fc30fc75e1f9260d5f6fe1f151781d Mon Sep 17 00:00:00 2001 From: Pascal Date: Fri, 14 Jun 2024 09:33:11 +0200 Subject: [PATCH 01/48] Update atlasRoutes.py --- atlas/atlasRoutes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/atlas/atlasRoutes.py b/atlas/atlasRoutes.py index 21b95163d..621a7c51e 100644 --- a/atlas/atlasRoutes.py +++ b/atlas/atlasRoutes.py @@ -31,6 +31,7 @@ vmMedias, vmCorTaxonAttribut, vmTaxonsMostView, + vmStatutBdcRepository, ) From ec105d3baad8881e0d23020941f6ed1c692d2531 Mon Sep 17 00:00:00 2001 From: Pascal Date: Fri, 14 Jun 2024 09:35:40 +0200 Subject: [PATCH 02/48] Update config_schema.py --- atlas/configuration/config_schema.py | 1 + 1 file changed, 1 insertion(+) diff --git a/atlas/configuration/config_schema.py b/atlas/configuration/config_schema.py index e1e292cd1..14e1abf95 100644 --- a/atlas/configuration/config_schema.py +++ b/atlas/configuration/config_schema.py @@ -207,6 +207,7 @@ class Meta: SPLIT_NOM_VERN = fields.Boolean(load_default=True) INTERACTIVE_MAP_LIST = fields.Boolean(load_default=True) AVAILABLE_LANGUAGES = fields.Dict(load_default=LANGUAGES) + STATUS_BDC_ENABLE = fields.Boolean(load_default=True) # Flask parameter enabling auto reload of templates # (no need to restart the atlas service when updating templates) # Defaults to False to have the best performance in production From f9beaa7ea600c5bd9684bdde950585362a69f032 Mon Sep 17 00:00:00 2001 From: Pascal Date: Fri, 14 Jun 2024 09:37:06 +0200 Subject: [PATCH 03/48] Create vmStatutBdc.py --- atlas/modeles/entities/vmStatutBdc.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 atlas/modeles/entities/vmStatutBdc.py diff --git a/atlas/modeles/entities/vmStatutBdc.py b/atlas/modeles/entities/vmStatutBdc.py new file mode 100644 index 000000000..5e4167cab --- /dev/null +++ b/atlas/modeles/entities/vmStatutBdc.py @@ -0,0 +1,20 @@ +# -*- coding:utf-8 -*- + +from sqlalchemy import Column, Integer, MetaData, String, Table, Float +from sqlalchemy.ext.declarative import declarative_base + +from atlas.utils import engine + +Base = declarative_base() +metadata = MetaData() + +class VmStatutBdc(Base): + __table__ = Table( + 'vm_taxons', metadata, + Column('cd_ref', Integer), + Column('code_statut', String(50)), + Column('label_statut', String(250)), + Column('cd_type_statut', String(50)), + Column('lb_type_statut', String(250)), + schema='atlas', autoload=True, autoload_with=engine + ) From ee2aed277ce087bdec90b401a04bcac92f0893c3 Mon Sep 17 00:00:00 2001 From: Pascal Date: Fri, 14 Jun 2024 09:38:01 +0200 Subject: [PATCH 04/48] Create vmStatutBdcRepository.py --- .../repositories/vmStatutBdcRepository.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 atlas/modeles/repositories/vmStatutBdcRepository.py diff --git a/atlas/modeles/repositories/vmStatutBdcRepository.py b/atlas/modeles/repositories/vmStatutBdcRepository.py new file mode 100644 index 000000000..f0530b086 --- /dev/null +++ b/atlas/modeles/repositories/vmStatutBdcRepository.py @@ -0,0 +1,24 @@ +from flask import current_app +from sqlalchemy.sql import text + +from atlas.modeles import utils + +def fctSortDict(value): + return value['cd_type_statut'] + +def getTaxonsStatutBdc(connection, cd_ref): + sql="SELECT * FROM atlas.vm_statut_bdc WHERE cd_ref = :thiscdref" + req = connection.execute(text(sql), thiscdref=cd_ref) + tsb = list() + for r in req: + temp = { + 'code_statut':r.code_statut, + 'label_statut':r.label_statut, + 'cd_type_statut':r.cd_type_statut, + 'lb_type_statut':r.lb_type_statut, + 'lb_adm_tr':r.lb_adm_tr + } + tsb.append(temp) + taxonStatutBdc = sorted(tsb, key=fctSortDict) + + return taxonStatutBdc From 3e355873ac79e56508a0dbec12892b32532b3cd7 Mon Sep 17 00:00:00 2001 From: Pascal Date: Fri, 14 Jun 2024 09:39:22 +0200 Subject: [PATCH 05/48] Update ficheEspece.css --- atlas/static/css/ficheEspece.css | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/atlas/static/css/ficheEspece.css b/atlas/static/css/ficheEspece.css index 554cf640d..13370665f 100644 --- a/atlas/static/css/ficheEspece.css +++ b/atlas/static/css/ficheEspece.css @@ -284,3 +284,78 @@ text { .carousel-indicators { bottom: 0px; } + +#statut-bdc { + margin-top: 15px; + padding-top : 10px; + padding-bottom : 10px; +} + +div#statut-bdc span.NT { + color: white; + background-color: #cce226 ; +} + +div#statut-bdc span.LC { + color: white; + background-color: #60c659 ; +} + +div#statut-bdc span.EN { + color: white; + background-color: #fc7f3f ; +} + +div#statut-bdc span.VU { + background-color: #f9e814 ; +} + +div#statut-bdc span.CR { + color: white; + background-color: #d81e05 ; +} + +div#statut-bdc span.RE { + color: white; + background-color: #5b1064 ; +} + +div#statut-bdc span.NA { + color: white; + background-color: #929392 ; +} + +div#statut-bdc span.NE { + background-color: white ; +} + +div#statut-bdc span.DD { + background-color: #d1d1c6 ; +} + +div#statut-bdc span.DHFF { + color: white; + background-color: #afdde9 ; +} + +div#statut-bdc span.PN { + color: white; + background-color: #ffccaa ; +} + +div#statut-bdc span.bloc-statut-bdc { + /*border: 1px solid grey; + padding: 5px;*/ + padding-left: 5px; + padding-right: 5px; + border-radius: 25%; + +} + +div#statut-bdc span { + border-radius: 10%; +} + +div#statut-bdc span.bloc-sbdc-new { + margin-left: 15px; +} From 8ac87882eb63f8d81cbdda704e2b623519b9f067 Mon Sep 17 00:00:00 2001 From: Pascal Date: Fri, 14 Jun 2024 09:40:59 +0200 Subject: [PATCH 06/48] Update identityCard.html --- .../templates/speciesSheet/identityCard.html | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/atlas/templates/speciesSheet/identityCard.html b/atlas/templates/speciesSheet/identityCard.html index f54a82bc8..506d4617c 100644 --- a/atlas/templates/speciesSheet/identityCard.html +++ b/atlas/templates/speciesSheet/identityCard.html @@ -91,6 +91,43 @@

{{ taxon.taxonSearch.nom_complet_html|safe }}

{% endfor %} + {% if configuration.STATUS_BDC_ENABLE %} +
+ {% for sbdc in statutBdc %} + {% if loop.first %} + {{sbdc.cd_type_statut}} : + + {{sbdc.code_statut}} + + {% else %} + {% set prev_key = loop.index0 - 1 %} + {% if sbdc.cd_type_statut == statutBdc[prev_key].cd_type_statut %} + + {{sbdc.code_statut}} + + {% else %} + {{sbdc.cd_type_statut}} : + + {{sbdc.code_statut}} + + {% endif %} + {% endif %} + {% endfor %} +
+ {% endif %} + - {% if configuration.STATUS_BDC_ENABLE %} + {% if configuration.AFFICHAGE_STATUTS %}
{% for sbdc in statutBdc %} {% if loop.first %} From 3da15790ff43e6ca4ca876d392fd9820b42d4d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Antoine=20Dupr=C3=A9?= Date: Thu, 9 Jan 2025 21:48:18 +0100 Subject: [PATCH 27/48] Move statuts HTML code to a custom template --- .gitignore | 1 + .../custom/templates/statuts.html.sample | 34 ++++++++++++++++++ .../templates/speciesSheet/identityCard.html | 35 +------------------ 3 files changed, 36 insertions(+), 34 deletions(-) create mode 100644 atlas/static/custom/templates/statuts.html.sample diff --git a/.gitignore b/.gitignore index 7367652f2..883f966ac 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ atlas/static/custom/templates/credits.html atlas/static/custom/templates/mentions-legales.html atlas/static/custom/templates/personal-data.html atlas/static/custom/templates/navbar.html +atlas/static/custom/templates/statuts.html data/ref/emprise_territoire.* data/ref/communes.dbf diff --git a/atlas/static/custom/templates/statuts.html.sample b/atlas/static/custom/templates/statuts.html.sample new file mode 100644 index 000000000..47fc3df1c --- /dev/null +++ b/atlas/static/custom/templates/statuts.html.sample @@ -0,0 +1,34 @@ +
+ {% for sbdc in statutBdc %} + {% if loop.first %} + {{sbdc.cd_type_statut}} : + + {{sbdc.code_statut}} + + {% else %} + {% set prev_key = loop.index0 - 1 %} + {% if sbdc.cd_type_statut == statutBdc[prev_key].cd_type_statut %} + + {{sbdc.code_statut}} + + {% else %} + {{sbdc.cd_type_statut}} : + + {{sbdc.code_statut}} + + {% endif %} + {% endif %} + {% endfor %} +
diff --git a/atlas/templates/speciesSheet/identityCard.html b/atlas/templates/speciesSheet/identityCard.html index f466a72ed..d796dcdae 100644 --- a/atlas/templates/speciesSheet/identityCard.html +++ b/atlas/templates/speciesSheet/identityCard.html @@ -92,40 +92,7 @@

{{ taxon.taxonSearch.nom_complet_html|safe }}

{% if configuration.AFFICHAGE_STATUTS %} -
- {% for sbdc in statutBdc %} - {% if loop.first %} - {{sbdc.cd_type_statut}} : - - {{sbdc.code_statut}} - - {% else %} - {% set prev_key = loop.index0 - 1 %} - {% if sbdc.cd_type_statut == statutBdc[prev_key].cd_type_statut %} - - {{sbdc.code_statut}} - - {% else %} - {{sbdc.cd_type_statut}} : - - {{sbdc.code_statut}} - - {% endif %} - {% endif %} - {% endfor %} -
+ {% include url_for('static', filename='custom/templates/statuts.html') %} {% endif %}