From 5117100391f0e7812bce4d774a7f5c5dd0905888 Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Mon, 11 Dec 2023 13:01:08 +0100 Subject: [PATCH] Update dependencies, port to bootstrap-flask/bootstrap 5 --- Dockerfile | 4 +- plugins/themes/templates/index.html | 37 --- plugins/themes/templates/xyzlayer.html | 27 -- requirements.txt | 23 +- access_control.py => src/access_control.py | 0 {controllers => src/controllers}/__init__.py | 0 .../controllers}/controller.py | 3 +- .../controllers}/groups_controller.py | 0 .../controllers}/permissions_controller.py | 3 +- .../registrable_groups_controller.py | 0 .../registration_requests_controller.py | 0 .../controllers}/resources_controller.py | 0 .../controllers}/roles_controller.py | 3 +- .../controllers}/users_controller.py | 0 {forms => src/forms}/__init__.py | 0 {forms => src/forms}/group_form.py | 0 {forms => src/forms}/permission_form.py | 0 .../forms}/registrable_group_form.py | 0 .../forms}/registration_request_form.py | 0 {forms => src/forms}/resource_form.py | 0 {forms => src/forms}/role_form.py | 0 {forms => src/forms}/user_form.py | 0 {plugins => src/plugins}/alkis/README.md | 0 {plugins => src/plugins}/alkis/__init__.py | 0 .../plugins}/alkis/controllers/__init__.py | 0 .../alkis/controllers/alkis_controller.py | 0 .../plugins}/alkis/forms/__init__.py | 0 .../plugins}/alkis/forms/alkis_form.py | 0 .../plugins}/alkis/templates/form.html | 14 +- .../plugins}/alkis/templates/index.html | 6 +- .../plugins}/config_editor/README.md | 0 .../plugins}/config_editor/__init__.py | 0 .../config_editor/controllers/__init__.py | 0 .../controllers/configs_controller.py | 4 +- .../config_editor/templates/editor.html | 1 + .../config_editor/templates/index.html | 4 +- {plugins => src/plugins}/themes/README.md | 0 {plugins => src/plugins}/themes/__init__.py | 0 .../plugins}/themes/controllers/__init__.py | 0 .../backgroundlayers_controller.py | 0 .../themes/controllers/files_controller.py | 0 .../controllers/mapthumbs_controller.py | 0 .../controllers/templates_controller.py | 0 .../themes/controllers/themes_controller.py | 0 .../plugins}/themes/forms/__init__.py | 0 .../themes/forms/backgroundlayer_form.py | 2 +- .../plugins}/themes/forms/file_form.py | 0 .../plugins}/themes/forms/mapthumb_form.py | 0 .../plugins}/themes/forms/template_form.py | 0 .../plugins}/themes/forms/theme_form.py | 4 +- .../plugins}/themes/static/application.css | 0 .../themes/templates/backgroundlayers.html | 22 +- .../plugins}/themes/templates/files.html | 20 +- src/plugins/themes/templates/index.html | 38 +++ .../themes/templates/info_template.html | 14 +- .../themes/templates/info_templates.html | 12 +- .../plugins}/themes/templates/mapthumbs.html | 8 +- .../plugins}/themes/templates/theme.html | 255 +++++++++--------- .../plugins}/themes/templates/themes.html | 80 +++--- .../plugins}/themes/templates/wmslayer.html | 44 ++- .../plugins}/themes/templates/wmtslayer.html | 72 ++--- src/plugins/themes/templates/xyzlayer.html | 26 ++ .../plugins}/themes/utils/__init__.py | 0 .../plugins}/themes/utils/themes.py | 0 {schemas => src/schemas}/qwc-admin-gui.json | 0 server.py => src/server.py | 4 +- server.wsgi => src/server.wsgi | 0 src/static/css/application.css | 33 +++ .../static}/css/bootstrap-chosen.css | 0 {static => src/static}/css/multi-select.css | 0 {static => src/static}/img/chosen-sprite.png | Bin .../static}/img/chosen-sprite@2x.png | Bin {static => src/static}/img/switch.png | Bin {static => src/static}/js/ace/ace.js | 0 .../static}/js/ace/ext-searchbox.js | 0 {static => src/static}/js/ace/mode-json.js | 0 {static => src/static}/js/ace/worker-json.js | 0 .../static}/js/chosen.jquery.min.js | 0 .../static}/js/jquery.multi-select.js | 0 src/templates/base.html | 119 ++++++++ src/templates/base_index.html | 192 +++++++++++++ {templates => src/templates}/groups/form.html | 13 +- .../templates}/groups/index.html | 0 {templates => src/templates}/home.html | 26 +- .../templates}/permissions/form.html | 83 +++--- src/templates/permissions/index.html | 79 ++++++ .../templates}/registrable_groups/form.html | 10 +- .../templates}/registrable_groups/index.html | 0 .../registration_requests/form.html | 22 +- .../registration_requests/index.html | 6 +- .../user_notification.txt | 0 .../templates}/resources/form.html | 17 +- .../templates}/resources/hierarchy.html | 14 +- .../templates}/resources/import_form.html | 12 +- src/templates/resources/index.html | 125 +++++++++ {templates => src/templates}/roles/form.html | 13 +- {templates => src/templates}/roles/index.html | 0 {templates => src/templates}/users/form.html | 27 +- {templates => src/templates}/users/index.html | 0 {translations => src/translations}/de.json | 0 {translations => src/translations}/en.json | 0 static/css/application.css | 32 --- templates/base.html | 101 ------- templates/base_index.html | 207 -------------- templates/permissions/index.html | 83 ------ templates/resources/index.html | 129 --------- 106 files changed, 1047 insertions(+), 1026 deletions(-) delete mode 100644 plugins/themes/templates/index.html delete mode 100644 plugins/themes/templates/xyzlayer.html rename access_control.py => src/access_control.py (100%) rename {controllers => src/controllers}/__init__.py (100%) rename {controllers => src/controllers}/controller.py (99%) rename {controllers => src/controllers}/groups_controller.py (100%) rename {controllers => src/controllers}/permissions_controller.py (99%) rename {controllers => src/controllers}/registrable_groups_controller.py (100%) rename {controllers => src/controllers}/registration_requests_controller.py (100%) rename {controllers => src/controllers}/resources_controller.py (100%) rename {controllers => src/controllers}/roles_controller.py (98%) rename {controllers => src/controllers}/users_controller.py (100%) rename {forms => src/forms}/__init__.py (100%) rename {forms => src/forms}/group_form.py (100%) rename {forms => src/forms}/permission_form.py (100%) rename {forms => src/forms}/registrable_group_form.py (100%) rename {forms => src/forms}/registration_request_form.py (100%) rename {forms => src/forms}/resource_form.py (100%) rename {forms => src/forms}/role_form.py (100%) rename {forms => src/forms}/user_form.py (100%) rename {plugins => src/plugins}/alkis/README.md (100%) rename {plugins => src/plugins}/alkis/__init__.py (100%) rename {plugins => src/plugins}/alkis/controllers/__init__.py (100%) rename {plugins => src/plugins}/alkis/controllers/alkis_controller.py (100%) rename {plugins => src/plugins}/alkis/forms/__init__.py (100%) rename {plugins => src/plugins}/alkis/forms/alkis_form.py (100%) rename {plugins => src/plugins}/alkis/templates/form.html (66%) rename {plugins => src/plugins}/alkis/templates/index.html (86%) rename {plugins => src/plugins}/config_editor/README.md (100%) rename {plugins => src/plugins}/config_editor/__init__.py (100%) rename {plugins => src/plugins}/config_editor/controllers/__init__.py (100%) rename {plugins => src/plugins}/config_editor/controllers/configs_controller.py (98%) rename {plugins => src/plugins}/config_editor/templates/editor.html (96%) rename {plugins => src/plugins}/config_editor/templates/index.html (78%) rename {plugins => src/plugins}/themes/README.md (100%) rename {plugins => src/plugins}/themes/__init__.py (100%) rename {plugins => src/plugins}/themes/controllers/__init__.py (100%) rename {plugins => src/plugins}/themes/controllers/backgroundlayers_controller.py (100%) rename {plugins => src/plugins}/themes/controllers/files_controller.py (100%) rename {plugins => src/plugins}/themes/controllers/mapthumbs_controller.py (100%) rename {plugins => src/plugins}/themes/controllers/templates_controller.py (100%) rename {plugins => src/plugins}/themes/controllers/themes_controller.py (100%) rename {plugins => src/plugins}/themes/forms/__init__.py (100%) rename {plugins => src/plugins}/themes/forms/backgroundlayer_form.py (98%) rename {plugins => src/plugins}/themes/forms/file_form.py (100%) rename {plugins => src/plugins}/themes/forms/mapthumb_form.py (100%) rename {plugins => src/plugins}/themes/forms/template_form.py (100%) rename {plugins => src/plugins}/themes/forms/theme_form.py (97%) rename {plugins => src/plugins}/themes/static/application.css (100%) rename {plugins => src/plugins}/themes/templates/backgroundlayers.html (61%) rename {plugins => src/plugins}/themes/templates/files.html (83%) create mode 100644 src/plugins/themes/templates/index.html rename {plugins => src/plugins}/themes/templates/info_template.html (50%) rename {plugins => src/plugins}/themes/templates/info_templates.html (85%) rename {plugins => src/plugins}/themes/templates/mapthumbs.html (81%) rename {plugins => src/plugins}/themes/templates/theme.html (50%) rename {plugins => src/plugins}/themes/templates/themes.html (78%) rename {plugins => src/plugins}/themes/templates/wmslayer.html (86%) rename {plugins => src/plugins}/themes/templates/wmtslayer.html (63%) create mode 100644 src/plugins/themes/templates/xyzlayer.html rename {plugins => src/plugins}/themes/utils/__init__.py (100%) rename {plugins => src/plugins}/themes/utils/themes.py (100%) rename {schemas => src/schemas}/qwc-admin-gui.json (100%) rename server.py => src/server.py (99%) rename server.wsgi => src/server.wsgi (100%) create mode 100644 src/static/css/application.css rename {static => src/static}/css/bootstrap-chosen.css (100%) rename {static => src/static}/css/multi-select.css (100%) rename {static => src/static}/img/chosen-sprite.png (100%) rename {static => src/static}/img/chosen-sprite@2x.png (100%) rename {static => src/static}/img/switch.png (100%) rename {static => src/static}/js/ace/ace.js (100%) rename {static => src/static}/js/ace/ext-searchbox.js (100%) rename {static => src/static}/js/ace/mode-json.js (100%) rename {static => src/static}/js/ace/worker-json.js (100%) rename {static => src/static}/js/chosen.jquery.min.js (100%) rename {static => src/static}/js/jquery.multi-select.js (100%) create mode 100644 src/templates/base.html create mode 100644 src/templates/base_index.html rename {templates => src/templates}/groups/form.html (64%) rename {templates => src/templates}/groups/index.html (100%) rename {templates => src/templates}/home.html (83%) rename {templates => src/templates}/permissions/form.html (66%) create mode 100644 src/templates/permissions/index.html rename {templates => src/templates}/registrable_groups/form.html (64%) rename {templates => src/templates}/registrable_groups/index.html (100%) rename {templates => src/templates}/registration_requests/form.html (81%) rename {templates => src/templates}/registration_requests/index.html (85%) rename {templates => src/templates}/registration_requests/user_notification.txt (100%) rename {templates => src/templates}/resources/form.html (87%) rename {templates => src/templates}/resources/hierarchy.html (84%) rename {templates => src/templates}/resources/import_form.html (63%) create mode 100644 src/templates/resources/index.html rename {templates => src/templates}/roles/form.html (66%) rename {templates => src/templates}/roles/index.html (100%) rename {templates => src/templates}/users/form.html (57%) rename {templates => src/templates}/users/index.html (100%) rename {translations => src/translations}/de.json (100%) rename {translations => src/translations}/en.json (100%) delete mode 100644 static/css/application.css delete mode 100644 templates/base.html delete mode 100644 templates/base_index.html delete mode 100644 templates/permissions/index.html delete mode 100644 templates/resources/index.html diff --git a/Dockerfile b/Dockerfile index ee94378..bab4223 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM sourcepole/qwc-uwsgi-base:alpine-v2023.10.26 -ADD . /srv/qwc_service +ADD requirements.txt /srv/qwc_service/requirements.txt # git: Required for pip with git repos # postgresql-dev g++ python3-dev: Required for psycopg2 @@ -10,4 +10,6 @@ RUN \ pip3 install --no-cache-dir -r /srv/qwc_service/requirements.txt && \ apk del build-deps +ADD src /srv/qwc_service/ + ENV SERVICE_MOUNTPOINT=/qwc_admin diff --git a/plugins/themes/templates/index.html b/plugins/themes/templates/index.html deleted file mode 100644 index f3c6629..0000000 --- a/plugins/themes/templates/index.html +++ /dev/null @@ -1,37 +0,0 @@ -{% extends "templates/base.html" %} -{% block title %}{{ title }}{% endblock %} -{% block container %} -
-
-
-
- {% block themes_container %} - {% endblock %} -
-
-
- -
-{% endblock %} -{% block scripts %} - {{ super() }} - -{% endblock %} diff --git a/plugins/themes/templates/xyzlayer.html b/plugins/themes/templates/xyzlayer.html deleted file mode 100644 index 646dd6c..0000000 --- a/plugins/themes/templates/xyzlayer.html +++ /dev/null @@ -1,27 +0,0 @@ -{% import "bootstrap/wtf.html" as wtf %} -{% extends "templates/base.html" %} - -{% block scripts %} -{% endblock %} -{%- block styles %} - {{ super() }} - -{%- endblock styles %} - -{% block title %}{{ title }}{% endblock %} -{% block container %} -

{{ title }}

- -
-
- {{ form.csrf_token }} - {{ wtf.form_field(form.url, placeholder="https://tile.openstreetmap.org/{z}/{x}/{y}.png", form_type="horizontal") }} - {{ wtf.form_field(form.name, form_type="horizontal") }} - {{ wtf.form_field(form.title, form_type="horizontal") }} - {{ wtf.form_field(form.attribution, form_type="horizontal") }} - {{ wtf.form_field(form.crs, form_type="horizontal") }} - {{ wtf.form_field(form.thumbnail, form_type="horizontal") }} - {{ wtf.form_field(form.submit, class="btn btn-primary", style="width:50%;margin-top:25px;") }} -
-
-{% endblock %} diff --git a/requirements.txt b/requirements.txt index 13f6d88..70c1744 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,12 @@ -Flask==2.3.2 -Flask-Bootstrap==3.3.7.1 -Flask-JWT-Extended==4.4.4 -Flask-Mail==0.9.1 -Flask-WTF==1.1.1 -flask_login==0.6.2 -python-dotenv==1.0.0 -psycopg2==2.9.6 +Flask==3.0.0 +Bootstrap-Flask==2.3.3 +Flask-JWT-Extended==4.5.3 +Flask-Mail2==1.0.2 +Flask-WTF==1.2.1 +flask_login==0.6.3 +psycopg2==2.9.9 requests==2.31.0 -SQLAlchemy==1.4.48 -Werkzeug==2.3.4 -email_validator==2.0.0.post2 -qwc-services-core==1.3.20 +SQLAlchemy==2.0.23 +Werkzeug==3.0.1 +email_validator==2.1.0.post1 +qwc-services-core==1.3.21 diff --git a/access_control.py b/src/access_control.py similarity index 100% rename from access_control.py rename to src/access_control.py diff --git a/controllers/__init__.py b/src/controllers/__init__.py similarity index 100% rename from controllers/__init__.py rename to src/controllers/__init__.py diff --git a/controllers/controller.py b/src/controllers/controller.py similarity index 99% rename from controllers/controller.py rename to src/controllers/controller.py index a028382..72e9766 100644 --- a/controllers/controller.py +++ b/src/controllers/controller.py @@ -1,7 +1,8 @@ from datetime import datetime import math -from flask import abort, flash, redirect, render_template, request, url_for, Markup +from flask import abort, flash, redirect, render_template, request, url_for +from markupsafe import Markup from sqlalchemy.exc import IntegrityError, InternalError from wtforms import ValidationError diff --git a/controllers/groups_controller.py b/src/controllers/groups_controller.py similarity index 100% rename from controllers/groups_controller.py rename to src/controllers/groups_controller.py diff --git a/controllers/permissions_controller.py b/src/controllers/permissions_controller.py similarity index 99% rename from controllers/permissions_controller.py rename to src/controllers/permissions_controller.py index 3e27475..f65e1a5 100644 --- a/controllers/permissions_controller.py +++ b/src/controllers/permissions_controller.py @@ -1,7 +1,8 @@ from collections import OrderedDict import math -from flask import flash, Markup, render_template, request, session as flask_session +from flask import flash, render_template, request, session as flask_session +from markupsafe import Markup from sqlalchemy.orm import joinedload from .controller import Controller diff --git a/controllers/registrable_groups_controller.py b/src/controllers/registrable_groups_controller.py similarity index 100% rename from controllers/registrable_groups_controller.py rename to src/controllers/registrable_groups_controller.py diff --git a/controllers/registration_requests_controller.py b/src/controllers/registration_requests_controller.py similarity index 100% rename from controllers/registration_requests_controller.py rename to src/controllers/registration_requests_controller.py diff --git a/controllers/resources_controller.py b/src/controllers/resources_controller.py similarity index 100% rename from controllers/resources_controller.py rename to src/controllers/resources_controller.py diff --git a/controllers/roles_controller.py b/src/controllers/roles_controller.py similarity index 98% rename from controllers/roles_controller.py rename to src/controllers/roles_controller.py index 5a5be9b..6e41b37 100644 --- a/controllers/roles_controller.py +++ b/src/controllers/roles_controller.py @@ -1,6 +1,7 @@ from .controller import Controller from forms import RoleForm -from flask import flash, Markup +from flask import flash +from markupsafe import Markup from wtforms import ValidationError diff --git a/controllers/users_controller.py b/src/controllers/users_controller.py similarity index 100% rename from controllers/users_controller.py rename to src/controllers/users_controller.py diff --git a/forms/__init__.py b/src/forms/__init__.py similarity index 100% rename from forms/__init__.py rename to src/forms/__init__.py diff --git a/forms/group_form.py b/src/forms/group_form.py similarity index 100% rename from forms/group_form.py rename to src/forms/group_form.py diff --git a/forms/permission_form.py b/src/forms/permission_form.py similarity index 100% rename from forms/permission_form.py rename to src/forms/permission_form.py diff --git a/forms/registrable_group_form.py b/src/forms/registrable_group_form.py similarity index 100% rename from forms/registrable_group_form.py rename to src/forms/registrable_group_form.py diff --git a/forms/registration_request_form.py b/src/forms/registration_request_form.py similarity index 100% rename from forms/registration_request_form.py rename to src/forms/registration_request_form.py diff --git a/forms/resource_form.py b/src/forms/resource_form.py similarity index 100% rename from forms/resource_form.py rename to src/forms/resource_form.py diff --git a/forms/role_form.py b/src/forms/role_form.py similarity index 100% rename from forms/role_form.py rename to src/forms/role_form.py diff --git a/forms/user_form.py b/src/forms/user_form.py similarity index 100% rename from forms/user_form.py rename to src/forms/user_form.py diff --git a/plugins/alkis/README.md b/src/plugins/alkis/README.md similarity index 100% rename from plugins/alkis/README.md rename to src/plugins/alkis/README.md diff --git a/plugins/alkis/__init__.py b/src/plugins/alkis/__init__.py similarity index 100% rename from plugins/alkis/__init__.py rename to src/plugins/alkis/__init__.py diff --git a/plugins/alkis/controllers/__init__.py b/src/plugins/alkis/controllers/__init__.py similarity index 100% rename from plugins/alkis/controllers/__init__.py rename to src/plugins/alkis/controllers/__init__.py diff --git a/plugins/alkis/controllers/alkis_controller.py b/src/plugins/alkis/controllers/alkis_controller.py similarity index 100% rename from plugins/alkis/controllers/alkis_controller.py rename to src/plugins/alkis/controllers/alkis_controller.py diff --git a/plugins/alkis/forms/__init__.py b/src/plugins/alkis/forms/__init__.py similarity index 100% rename from plugins/alkis/forms/__init__.py rename to src/plugins/alkis/forms/__init__.py diff --git a/plugins/alkis/forms/alkis_form.py b/src/plugins/alkis/forms/alkis_form.py similarity index 100% rename from plugins/alkis/forms/alkis_form.py rename to src/plugins/alkis/forms/alkis_form.py diff --git a/plugins/alkis/templates/form.html b/src/plugins/alkis/templates/form.html similarity index 66% rename from plugins/alkis/templates/form.html rename to src/plugins/alkis/templates/form.html index 7eb2317..696b0f9 100644 --- a/plugins/alkis/templates/form.html +++ b/src/plugins/alkis/templates/form.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "templates/base.html" %} {% block title %}{{ title }}{% endblock %} {% block scripts %} @@ -35,11 +35,11 @@

{{ title }}

{{ form.csrf_token }} - {{ wtf.form_field(form.pgservice, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.name, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.enable_alkis, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.enable_owner, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.header_template, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.submit, class="btn btn-primary") }} + {{ wtf.render_field(form.pgservice, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.name, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.enable_alkis, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.enable_owner, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.header_template, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.submit, class="btn btn-primary") }}
{% endblock %} diff --git a/plugins/alkis/templates/index.html b/src/plugins/alkis/templates/index.html similarity index 86% rename from plugins/alkis/templates/index.html rename to src/plugins/alkis/templates/index.html index 4fc2e50..df18ebe 100644 --- a/plugins/alkis/templates/index.html +++ b/src/plugins/alkis/templates/index.html @@ -3,7 +3,7 @@ {% block container %}

{{ title }}

- {{ utils.icon('plus') }} {% block new_resource_label %}Neu{% endblock %} + {{ utils.render_icon('plus-lg') }} {% block new_resource_label %}Neu{% endblock %} @@ -24,13 +24,13 @@

{{ title }}

{% endblock %} diff --git a/plugins/config_editor/README.md b/src/plugins/config_editor/README.md similarity index 100% rename from plugins/config_editor/README.md rename to src/plugins/config_editor/README.md diff --git a/plugins/config_editor/__init__.py b/src/plugins/config_editor/__init__.py similarity index 100% rename from plugins/config_editor/__init__.py rename to src/plugins/config_editor/__init__.py diff --git a/plugins/config_editor/controllers/__init__.py b/src/plugins/config_editor/controllers/__init__.py similarity index 100% rename from plugins/config_editor/controllers/__init__.py rename to src/plugins/config_editor/controllers/__init__.py diff --git a/plugins/config_editor/controllers/configs_controller.py b/src/plugins/config_editor/controllers/configs_controller.py similarity index 98% rename from plugins/config_editor/controllers/configs_controller.py rename to src/plugins/config_editor/controllers/configs_controller.py index 6274cf0..81d89f2 100644 --- a/plugins/config_editor/controllers/configs_controller.py +++ b/src/plugins/config_editor/controllers/configs_controller.py @@ -3,8 +3,8 @@ import os from shutil import copyfile -from flask import flash, json, Markup, redirect, render_template, request, \ - url_for +from flask import flash, json, redirect, render_template, request, url_for +from markupsafe import Markup from json.decoder import JSONDecodeError diff --git a/plugins/config_editor/templates/editor.html b/src/plugins/config_editor/templates/editor.html similarity index 96% rename from plugins/config_editor/templates/editor.html rename to src/plugins/config_editor/templates/editor.html index 1700c43..672ef40 100644 --- a/plugins/config_editor/templates/editor.html +++ b/src/plugins/config_editor/templates/editor.html @@ -73,5 +73,6 @@

{{ title }}

+ {% endblock %} diff --git a/plugins/config_editor/templates/index.html b/src/plugins/config_editor/templates/index.html similarity index 78% rename from plugins/config_editor/templates/index.html rename to src/plugins/config_editor/templates/index.html index ff3a58c..24382a2 100644 --- a/plugins/config_editor/templates/index.html +++ b/src/plugins/config_editor/templates/index.html @@ -8,10 +8,10 @@

{{ title }}



- {{ utils.icon('pencil') }} tenantConfig.json + {{ utils.render_icon('pencil') }} tenantConfig.json - {{ utils.icon('pencil') }} config.json + {{ utils.render_icon('pencil') }} config.json {% endblock %} diff --git a/plugins/themes/README.md b/src/plugins/themes/README.md similarity index 100% rename from plugins/themes/README.md rename to src/plugins/themes/README.md diff --git a/plugins/themes/__init__.py b/src/plugins/themes/__init__.py similarity index 100% rename from plugins/themes/__init__.py rename to src/plugins/themes/__init__.py diff --git a/plugins/themes/controllers/__init__.py b/src/plugins/themes/controllers/__init__.py similarity index 100% rename from plugins/themes/controllers/__init__.py rename to src/plugins/themes/controllers/__init__.py diff --git a/plugins/themes/controllers/backgroundlayers_controller.py b/src/plugins/themes/controllers/backgroundlayers_controller.py similarity index 100% rename from plugins/themes/controllers/backgroundlayers_controller.py rename to src/plugins/themes/controllers/backgroundlayers_controller.py diff --git a/plugins/themes/controllers/files_controller.py b/src/plugins/themes/controllers/files_controller.py similarity index 100% rename from plugins/themes/controllers/files_controller.py rename to src/plugins/themes/controllers/files_controller.py diff --git a/plugins/themes/controllers/mapthumbs_controller.py b/src/plugins/themes/controllers/mapthumbs_controller.py similarity index 100% rename from plugins/themes/controllers/mapthumbs_controller.py rename to src/plugins/themes/controllers/mapthumbs_controller.py diff --git a/plugins/themes/controllers/templates_controller.py b/src/plugins/themes/controllers/templates_controller.py similarity index 100% rename from plugins/themes/controllers/templates_controller.py rename to src/plugins/themes/controllers/templates_controller.py diff --git a/plugins/themes/controllers/themes_controller.py b/src/plugins/themes/controllers/themes_controller.py similarity index 100% rename from plugins/themes/controllers/themes_controller.py rename to src/plugins/themes/controllers/themes_controller.py diff --git a/plugins/themes/forms/__init__.py b/src/plugins/themes/forms/__init__.py similarity index 100% rename from plugins/themes/forms/__init__.py rename to src/plugins/themes/forms/__init__.py diff --git a/plugins/themes/forms/backgroundlayer_form.py b/src/plugins/themes/forms/backgroundlayer_form.py similarity index 98% rename from plugins/themes/forms/backgroundlayer_form.py rename to src/plugins/themes/forms/backgroundlayer_form.py index c7a1e41..cd5d944 100644 --- a/plugins/themes/forms/backgroundlayer_form.py +++ b/src/plugins/themes/forms/backgroundlayer_form.py @@ -15,7 +15,7 @@ class WMSLayerForm(FlaskForm): title = StringField("Title", validators=[DataRequired()]) attribution = StringField("Attribution") thumbnail = SelectField("Thumbnail", coerce=str, choices=[("", "")]) - tiled = BooleanField("tiled") + tiled = BooleanField("Tiled") submit = SubmitField("Save") diff --git a/plugins/themes/forms/file_form.py b/src/plugins/themes/forms/file_form.py similarity index 100% rename from plugins/themes/forms/file_form.py rename to src/plugins/themes/forms/file_form.py diff --git a/plugins/themes/forms/mapthumb_form.py b/src/plugins/themes/forms/mapthumb_form.py similarity index 100% rename from plugins/themes/forms/mapthumb_form.py rename to src/plugins/themes/forms/mapthumb_form.py diff --git a/plugins/themes/forms/template_form.py b/src/plugins/themes/forms/template_form.py similarity index 100% rename from plugins/themes/forms/template_form.py rename to src/plugins/themes/forms/template_form.py diff --git a/plugins/themes/forms/theme_form.py b/src/plugins/themes/forms/theme_form.py similarity index 97% rename from plugins/themes/forms/theme_form.py rename to src/plugins/themes/forms/theme_form.py index 23155e2..8e3d64d 100644 --- a/plugins/themes/forms/theme_form.py +++ b/src/plugins/themes/forms/theme_form.py @@ -112,8 +112,8 @@ class ThemeForm(FlaskForm): message="Please enter a comma separted list of names.")] ) collapseLayerGroupsBelowLevel = IntegerField( - "collapse layer groups below level", - description="Optional, layer tree level below which to initially \n collapse groups. By default the tree is completely expanded.", + "Collapse layer groups below level", + description="Optional, layer tree level below which to initially collapse groups. By default the tree is completely expanded.", validators=[Optional()] ) default = BooleanField( diff --git a/plugins/themes/static/application.css b/src/plugins/themes/static/application.css similarity index 100% rename from plugins/themes/static/application.css rename to src/plugins/themes/static/application.css diff --git a/plugins/themes/templates/backgroundlayers.html b/src/plugins/themes/templates/backgroundlayers.html similarity index 61% rename from plugins/themes/templates/backgroundlayers.html rename to src/plugins/themes/templates/backgroundlayers.html index 682439f..b51b392 100644 --- a/plugins/themes/templates/backgroundlayers.html +++ b/src/plugins/themes/templates/backgroundlayers.html @@ -3,13 +3,13 @@ {% block themes_container %}

{{ title }}

- {{ utils.icon('plus') }} WMS + {{ utils.render_icon('plus-lg') }} WMS - {{ utils.icon('plus') }} WMTS + {{ utils.render_icon('plus-lg') }} WMTS - {{ utils.icon('plus') }} XYZ + {{ utils.render_icon('plus-lg') }} XYZ
@@ -29,14 +29,16 @@

{{ title }}

{% endfor %} diff --git a/plugins/themes/templates/files.html b/src/plugins/themes/templates/files.html similarity index 83% rename from plugins/themes/templates/files.html rename to src/plugins/themes/templates/files.html index 67d6fe6..c655e2b 100644 --- a/plugins/themes/templates/files.html +++ b/src/plugins/themes/templates/files.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "plugins/themes/templates/index.html" %} {% block title %}{{ title }}{% endblock %} {% block themes_container %} @@ -7,8 +7,8 @@

{{ title }}

{{ form_project.csrf_token }} - {{ wtf.form_field(form_project.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }} - {{ wtf.form_field(form_project.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }} + {{ wtf.render_field(form_project.upload, form_type="horizontal") }} + {{ wtf.render_field(form_project.submit, class="btn btn-primary") }}
@@ -28,7 +28,7 @@

{{ title }}

@@ -41,8 +41,8 @@

{{ title }}

{{ form_layer.csrf_token }} - {{ wtf.form_field(form_layer.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }} - {{ wtf.form_field(form_layer.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }} + {{ wtf.render_field(form_layer.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }} + {{ wtf.render_field(form_layer.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
@@ -62,7 +62,7 @@

{{ title }}

@@ -75,8 +75,8 @@

{{ title }}

{{ form_template.csrf_token }} - {{ wtf.form_field(form_template.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }} - {{ wtf.form_field(form_template.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }} + {{ wtf.render_field(form_template.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }} + {{ wtf.render_field(form_template.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }}
@@ -96,7 +96,7 @@

{{ title }}

diff --git a/src/plugins/themes/templates/index.html b/src/plugins/themes/templates/index.html new file mode 100644 index 0000000..661c653 --- /dev/null +++ b/src/plugins/themes/templates/index.html @@ -0,0 +1,38 @@ +{% extends "templates/base.html" %} +{% block title %}{{ title }}{% endblock %} +{% block container %} + + +
+ {% block themes_container %} + {% endblock %} +
+{% endblock %} + +{% block scripts %} + {{ super() }} + +{% endblock %} diff --git a/plugins/themes/templates/info_template.html b/src/plugins/themes/templates/info_template.html similarity index 50% rename from plugins/themes/templates/info_template.html rename to src/plugins/themes/templates/info_template.html index 7d23a95..355fedf 100644 --- a/plugins/themes/templates/info_template.html +++ b/src/plugins/themes/templates/info_template.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "plugins/themes/templates/index.html" %} {% block title %}{{ title }}{% endblock %} {%- block styles %} @@ -10,13 +10,13 @@

{{ title }}

{{ form.csrf_token }} {% if is_disabled %} -{{ wtf.form_field(form.url, form_type="horizontal", horizontal_columns=('sm', 2, 5), disabled=True) }} -{{ wtf.form_field(form.layer, form_type="horizontal", horizontal_columns=('sm', 2, 5), disabled=True) }} +{{ wtf.render_field(form.url, form_type="horizontal", horizontal_columns=('sm', 2, 5), disabled=True) }} +{{ wtf.render_field(form.layer, form_type="horizontal", horizontal_columns=('sm', 2, 5), disabled=True) }} {% else %} -{{ wtf.form_field(form.url, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} -{{ wtf.form_field(form.layer, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} +{{ wtf.render_field(form.url, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} +{{ wtf.render_field(form.layer, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} {% endif %} -{{ wtf.form_field(form.template, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} -{{ wtf.form_field(form.submit, form_type="horizontal", class="btn btn-primary", horizontal_columns=('sm', 2, 5)) }} +{{ wtf.render_field(form.template, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} +{{ wtf.render_field(form.submit, form_type="horizontal", class="btn btn-primary", horizontal_columns=('sm', 2, 5)) }} {% endblock %} \ No newline at end of file diff --git a/plugins/themes/templates/info_templates.html b/src/plugins/themes/templates/info_templates.html similarity index 85% rename from plugins/themes/templates/info_templates.html rename to src/plugins/themes/templates/info_templates.html index 096e5a8..0cb86bd 100644 --- a/plugins/themes/templates/info_templates.html +++ b/src/plugins/themes/templates/info_templates.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "plugins/themes/templates/index.html" %} {% block title %}{{ title }}{% endblock %} {%- block styles %} @@ -13,7 +13,7 @@

{{ title }}

Templates
- {{ utils.icon('plus') }} + {{ utils.render_icon('plus-lg') }}
@@ -34,14 +34,14 @@

{{ title }}

- + @@ -53,4 +53,4 @@

{{ title }}

- {{ utils.icon('pencil') }} Bearbeiten + {{ utils.render_icon('pencil') }} Bearbeiten
{{ layer.name }} {{ layer.title }} - {% if layer.type == "wms" %} - - {{ utils.icon('pencil') }} +
{{ ns.item_index }} {{ item['name'] }} {{ layer['name'] }}{{ layer["info_template"]["template_path"].split("/")[-1] }}{{ layer.get("info_template", {}).get("template_path", "").split("/")[-1] }}
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/plugins/themes/templates/mapthumbs.html b/src/plugins/themes/templates/mapthumbs.html similarity index 81% rename from plugins/themes/templates/mapthumbs.html rename to src/plugins/themes/templates/mapthumbs.html index d59d8d8..b9d939b 100644 --- a/plugins/themes/templates/mapthumbs.html +++ b/src/plugins/themes/templates/mapthumbs.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "plugins/themes/templates/index.html" %} {% block title %}{{ title }}{% endblock %} {%- block styles %} @@ -13,8 +13,8 @@

{{ title }}

{{ form.csrf_token }} - {{ wtf.form_field(form.upload, horizontal_columns=('lg', 2, 10), class="btn btn-default") }} - {{ wtf.form_field(form.submit, horizontal_columns=('lg', 2, 10), class="btn btn-primary") }} + {{ wtf.render_field(form.upload, form_type="horizontal") }} + {{ wtf.render_field(form.submit, class="btn btn-primary") }}
@@ -24,7 +24,7 @@

{{ title }}

- {{ utils.icon('trash') }} + {{ utils.render_icon('trash') }} diff --git a/plugins/themes/templates/theme.html b/src/plugins/themes/templates/theme.html similarity index 50% rename from plugins/themes/templates/theme.html rename to src/plugins/themes/templates/theme.html index cb8405e..777d110 100644 --- a/plugins/themes/templates/theme.html +++ b/src/plugins/themes/templates/theme.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "templates/base.html" %} {% block scripts %} @@ -18,6 +18,7 @@ }; var rowIndex = {{ form.backgroundLayers.last_index + 1 }}; + var searchIndex = {{form.qgisSearchProvider.last_index + 1}}; var newSearchIndex = 0; @@ -33,7 +34,7 @@ form.on("submit", function() { textarea.value = editor.getValue(); }); -} + } $(function() { $('.search-col').on('click','button.accordion', function(){ @@ -59,11 +60,19 @@ {% for value, title in form.backgroundLayersList %} html += ''; {% endfor %} - html += ''; - html += '
'; - html += '
'; - html += ''; + html += ''; + html += ' '; + html += ''; + html += ''; + html += ' '; + html += ''; + html += '
'; + html += ` `; + html += ` `; + html += '
'; + html += ''; + html += ` `; + html += ''; $('#bl-table > tbody:last-child').append(html); }); @@ -147,14 +156,15 @@ createEditor(expressionTextarea, editorOptions); createEditor(fieldsTextarea, editorOptions); }); + }); -}); - -$('.search-col').find('textarea[id^="qgisSearchProvider-"]').each(function() { + $('.search-col').find('textarea[id^="qgisSearchProvider-"]').each(function() { createEditor(this, editorOptions); -}); + }); +{% endblock %} +{% block styles %} {% endblock %} {% block title %}{{ title }}{% endblock %} {% block container %} -
-
-
-
-

{{ title }}

- {{ form.csrf_token }} - {{ wtf.form_field(form.url, form_type="vertical") }} - {{ wtf.form_field(form.title, form_type="vertical") }} - {# TODO: default, extent #} - {{ wtf.form_field(form.thumbnail, form_type="vertical") }} - {{ wtf.form_field(form.attribution, form_type="vertical") }} - {{ wtf.form_field(form.format, form_type="vertical") }} - {{ wtf.form_field(form.mapCrs, form_type="vertical") }} - {{ wtf.form_field(form.additionalMouseCrs, form_type="vertical") }} - {{ wtf.form_field(form.searchProviders, form_type="vertical") }} - {{ wtf.form_field(form.scales, form_type="vertical") }} - {{ wtf.form_field(form.printScales, form_type="vertical") }} - {{ wtf.form_field(form.printResolutions, form_type="vertical") }} - {{ wtf.form_field(form.printLabelBlacklist, form_type="vertical") }} - {{ wtf.form_field(form.collapseLayerGroupsBelowLevel, form_type="vertical") }} - {{ wtf.form_field(form.default, form_type="vertical") }} - {{ wtf.form_field(form.tiled, form_type="vertical") }} - {{ wtf.form_field(form.mapTips, form_type="vertical") }} - {{ wtf.form_field(form.skipEmptyFeatureAttributes, form_type="vertical") }} -
-
-

Edit Qgis Searches

- +
+ {% for provider in form.qgisSearchProvider %} +
+ -
- {% for provider in form.qgisSearchProvider %} -
- -
-
- - {{ provider.title(class_='form-control') }} -
-
- - {{ provider.featureCount(class_='form-control') }} -
-
- - {{ provider.group(class_='form-control') }} -
-
- - {{ provider.searchDescription(class_='form-control') }} -
-
- - {{ provider.expression(class_='form-control') }} +
+
+ + {{ provider.title(class_='form-control') }}
-
- - {{ provider.fields(class_='form-control') }} -
-
- -
-
- -
- {% endfor %}
+ {% endfor %}
-
-
-
- - + +
+
+

Background layers

+
+ + - - - {% for layer in form.backgroundLayers %} - - - - - - + + + {% for layer in form.backgroundLayers %} + + + + + - - {% endfor %} - -
Background layer Print Layer - + {{ utils.render_icon('eye') }} -
{{ layer.layerName(class_='form-control') }}{{ layer.printLayer(class_='form-control') }} -
- {{ layer.visibility(class_='form-control checkbox') }} -
-
-
- - -
-
-
{{ layer.layerName(class_='form-control') }}{{ layer.printLayer(class_='form-control') }}{{ layer.visibility(class_='form-check-input') }} +
+ -
-
-
-
- {{ wtf.form_field(form.submit, class="btn btn-primary col-md-4") }} + +
+ + + + + + {% endfor %} + +
+ {{ wtf.render_field(form.submit, class="btn btn-primary") }} + -
{% endblock %} diff --git a/plugins/themes/templates/themes.html b/src/plugins/themes/templates/themes.html similarity index 78% rename from plugins/themes/templates/themes.html rename to src/plugins/themes/templates/themes.html index 481979d..5574087 100644 --- a/plugins/themes/templates/themes.html +++ b/src/plugins/themes/templates/themes.html @@ -39,10 +39,10 @@

{{ title }}

{% if key == "items" %}
@@ -63,25 +63,25 @@

{{ title }}

{{ item.url }} - {{ utils.icon('copy') }} + {{ utils.render_icon('copy') }} @@ -94,10 +94,10 @@

{{ title }}

{% elif key == "groups" %}
@@ -105,32 +105,34 @@

{{ title }}

{% for group in list %} {% set group_loop = loop %}
-
-
-
- - - - - -
-
-
+
@@ -149,25 +151,25 @@

{{ title }}

diff --git a/plugins/themes/templates/wmslayer.html b/src/plugins/themes/templates/wmslayer.html similarity index 86% rename from plugins/themes/templates/wmslayer.html rename to src/plugins/themes/templates/wmslayer.html index 7c3dff1..e667351 100644 --- a/plugins/themes/templates/wmslayer.html +++ b/src/plugins/themes/templates/wmslayer.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "templates/base.html" %} {% block scripts %} @@ -45,12 +45,13 @@ // read capbilities from input-url return new Promise((success, failure) => { $.get(url) - .success(function(data) { + .then(function(data) { + $("#wms-table").css('display', ''); var parser = new ol.format.WMSCapabilities(); capabilities = parser.read(data); success(); - }) - .error(function() { + },function() { + $("#wms-table").css('display', 'none'); alert('Could not read capabilities!'); }) }) @@ -200,20 +201,18 @@ {%- endblock styles %} -{% block title %}{{ title }}{% endblock %} +{% block title %}Add WMS background layer{% endblock %} {% block container %} -

{{ title }}

+

Add WMS background layer

-
+
- - - +
-
{{ item.url }} - {{ utils.icon('copy') }} + {{ utils.render_icon('copy') }}
+
@@ -226,32 +225,29 @@

{{ title }}

{{ form.csrf_token }} - {{ wtf.form_field(form.title, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} -
- + {{ wtf.render_field(form.title, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} +
+
-
- +
+
- {{ wtf.form_field(form.attribution, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} - {{ wtf.form_field(form.thumbnail, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} - {{ wtf.form_field(form.tiled, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} + {{ wtf.render_field(form.attribution, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} + {{ wtf.render_field(form.thumbnail, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} + {{ wtf.render_field(form.tiled, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} {{ form.url }} {{ form.name }} {{ form.format }} {{ form.srs }} {{ form.bbox }} - {{ wtf.form_field(form.submit, class="btn btn-primary") }} + {{ wtf.render_field(form.submit, class="btn btn-primary") }} +
{% endblock %} diff --git a/plugins/themes/templates/wmtslayer.html b/src/plugins/themes/templates/wmtslayer.html similarity index 63% rename from plugins/themes/templates/wmtslayer.html rename to src/plugins/themes/templates/wmtslayer.html index 10f96b0..51f2c2c 100644 --- a/plugins/themes/templates/wmtslayer.html +++ b/src/plugins/themes/templates/wmtslayer.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "templates/base.html" %} {% block scripts %} @@ -53,7 +53,8 @@ } $.get(url) - .success(function(data) { + .then(function(data) { + $("#wmts-table").css('display', ''); var parser = new ol.format.WMTSCapabilities(); var capabilities = parser.read(data); $('#capabilities').val(JSON.stringify(capabilities)); @@ -61,28 +62,32 @@ var wmtsLayer = capabilities.Contents.Layer; wmtsLayer.map(layer => { layer.TileMatrixSetLink.map(tms => { - var options = ol.source.WMTS.optionsFromCapabilities(capabilities, {layer: layer.Identifier, matrixSet: tms.TileMatrixSet}); - var row = '
'; - row += ''; - row += ''; - row += ''; - row += ''; - row += ''; - // add hidden td - row += ''; - row += ''; - row += ''; - row += ''; - row += ''; - row += ''; - row += ''; - row += ''; - $('#wmts-table > tbody:last-child').append(row); + try { + var options = ol.source.WMTS.optionsFromCapabilities(capabilities, {layer: layer.Identifier, matrixSet: tms.TileMatrixSet}); + var row = ''; + row += ''; + row += ''; + row += ''; + row += ''; + row += ''; + // add hidden td + row += ''; + row += ''; + row += ''; + row += ''; + row += ''; + row += ''; + row += ''; + row += ''; + $('#wmts-table > tbody:last-child').append(row); + } catch(e) { + /* pass */ + } }); }); - }) - .error(function() { - alert('Konnte Capabilities nicht laden!'); + },function() { + $("#wmts-table").css('display', 'none'); + alert('Could not read capabilities!'); }) }); @@ -102,20 +107,18 @@ {%- endblock styles %} -{% block title %}{{ title }}{% endblock %} +{% block title %}Add WMTS background layer{% endblock %} {% block container %} -

{{ title }}

+

Add WMTS background layer

-
- - - - +
+ +
-
+
@@ -132,9 +135,9 @@

{{ title }}

{{ form.csrf_token }} {{ form.capabilities }} - {{ wtf.form_field(form.title, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} - {{ wtf.form_field(form.attribution, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} - {{ wtf.form_field(form.thumbnail, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} + {{ wtf.render_field(form.title, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} + {{ wtf.render_field(form.attribution, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} + {{ wtf.render_field(form.thumbnail, form_type="horizontal", horizontal_columns=('sm', 2, 10)) }} {{ form.url }} {{ form.name }} {{ form.style }} @@ -146,7 +149,8 @@

{{ title }}

{{ form.resolutions }} {{ form.requestEncoding }} {{ form.tileSize }} - {{ wtf.form_field(form.submit, class="btn btn-primary") }} + {{ wtf.render_field(form.submit, class="btn btn-primary") }} + {% endblock %} diff --git a/src/plugins/themes/templates/xyzlayer.html b/src/plugins/themes/templates/xyzlayer.html new file mode 100644 index 0000000..c90f1f1 --- /dev/null +++ b/src/plugins/themes/templates/xyzlayer.html @@ -0,0 +1,26 @@ +{% import "bootstrap5/form.html" as wtf %} +{% extends "templates/base.html" %} + +{%- block styles %} + {{ super() }} + +{%- endblock styles %} + +{% block title %}Add XYZ background layer{% endblock %} +{% block container %} +

Add XYZ background layer

+ +
+
+ {{ form.csrf_token }} + {{ wtf.render_field(form.url, placeholder="https://tile.openstreetmap.org/{z}/{x}/{y}.png", form_type="horizontal") }} + {{ wtf.render_field(form.name, form_type="horizontal") }} + {{ wtf.render_field(form.title, form_type="horizontal") }} + {{ wtf.render_field(form.attribution, form_type="horizontal") }} + {{ wtf.render_field(form.crs, form_type="horizontal") }} + {{ wtf.render_field(form.thumbnail, form_type="horizontal") }} + {{ wtf.render_field(form.submit, class="btn btn-primary") }} + + +
+{% endblock %} diff --git a/plugins/themes/utils/__init__.py b/src/plugins/themes/utils/__init__.py similarity index 100% rename from plugins/themes/utils/__init__.py rename to src/plugins/themes/utils/__init__.py diff --git a/plugins/themes/utils/themes.py b/src/plugins/themes/utils/themes.py similarity index 100% rename from plugins/themes/utils/themes.py rename to src/plugins/themes/utils/themes.py diff --git a/schemas/qwc-admin-gui.json b/src/schemas/qwc-admin-gui.json similarity index 100% rename from schemas/qwc-admin-gui.json rename to src/schemas/qwc-admin-gui.json diff --git a/server.py b/src/server.py similarity index 99% rename from server.py rename to src/server.py index 9bf5f35..51fc022 100644 --- a/server.py +++ b/src/server.py @@ -10,7 +10,7 @@ from flask import abort, Flask, json, redirect, render_template, request, \ Response, stream_with_context, jsonify, send_from_directory -from flask_bootstrap import Bootstrap +from flask_bootstrap import Bootstrap5 from flask_wtf.csrf import CSRFProtect from flask_mail import Mail @@ -45,7 +45,7 @@ # enable CSRF protection CSRFProtect(app) # load Bootstrap extension -Bootstrap(app) +Bootstrap5(app) # Setup mailer diff --git a/server.wsgi b/src/server.wsgi similarity index 100% rename from server.wsgi rename to src/server.wsgi diff --git a/src/static/css/application.css b/src/static/css/application.css new file mode 100644 index 0000000..e752c78 --- /dev/null +++ b/src/static/css/application.css @@ -0,0 +1,33 @@ +:root { + --bs-body-font-size: 14px; +} + +html, body { + height: 100%; +} + +body { + padding-top: 70px; + --bs-body-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + --bs-body-font-size: 14px; +} + +.btn { + --bs-btn-font-size: 14px; +} + +.nav-link { + --bs-nav-link-font-size: 14px; +} + +.table { + font-size: 14px; +} + +form { + margin-bottom: 0; +} + +input:invalid { + background-color: #FFAAAA; +} diff --git a/static/css/bootstrap-chosen.css b/src/static/css/bootstrap-chosen.css similarity index 100% rename from static/css/bootstrap-chosen.css rename to src/static/css/bootstrap-chosen.css diff --git a/static/css/multi-select.css b/src/static/css/multi-select.css similarity index 100% rename from static/css/multi-select.css rename to src/static/css/multi-select.css diff --git a/static/img/chosen-sprite.png b/src/static/img/chosen-sprite.png similarity index 100% rename from static/img/chosen-sprite.png rename to src/static/img/chosen-sprite.png diff --git a/static/img/chosen-sprite@2x.png b/src/static/img/chosen-sprite@2x.png similarity index 100% rename from static/img/chosen-sprite@2x.png rename to src/static/img/chosen-sprite@2x.png diff --git a/static/img/switch.png b/src/static/img/switch.png similarity index 100% rename from static/img/switch.png rename to src/static/img/switch.png diff --git a/static/js/ace/ace.js b/src/static/js/ace/ace.js similarity index 100% rename from static/js/ace/ace.js rename to src/static/js/ace/ace.js diff --git a/static/js/ace/ext-searchbox.js b/src/static/js/ace/ext-searchbox.js similarity index 100% rename from static/js/ace/ext-searchbox.js rename to src/static/js/ace/ext-searchbox.js diff --git a/static/js/ace/mode-json.js b/src/static/js/ace/mode-json.js similarity index 100% rename from static/js/ace/mode-json.js rename to src/static/js/ace/mode-json.js diff --git a/static/js/ace/worker-json.js b/src/static/js/ace/worker-json.js similarity index 100% rename from static/js/ace/worker-json.js rename to src/static/js/ace/worker-json.js diff --git a/static/js/chosen.jquery.min.js b/src/static/js/chosen.jquery.min.js similarity index 100% rename from static/js/chosen.jquery.min.js rename to src/static/js/chosen.jquery.min.js diff --git a/static/js/jquery.multi-select.js b/src/static/js/jquery.multi-select.js similarity index 100% rename from static/js/jquery.multi-select.js rename to src/static/js/jquery.multi-select.js diff --git a/src/templates/base.html b/src/templates/base.html new file mode 100644 index 0000000..178cf83 --- /dev/null +++ b/src/templates/base.html @@ -0,0 +1,119 @@ +{% import "bootstrap5/utils.html" as utils %} + + + + + {% block head %} + {% block title %}{% endblock title %} - {{ admin_gui_title }} + + + + + {{ bootstrap.load_css() }} + + {% block styles %}{% endblock %} + + + {{ bootstrap.load_js() }} + + + + + + + + + {% endblock %} + + + + {% block navbar %} + + {% endblock %} + + + {% block content %} +
+ {{ utils.render_messages() }} + + {% block container %} + {% endblock %} +
+ {% endblock %} + + + {% block scripts %} + {% endblock %} + + diff --git a/src/templates/base_index.html b/src/templates/base_index.html new file mode 100644 index 0000000..8b5bec1 --- /dev/null +++ b/src/templates/base_index.html @@ -0,0 +1,192 @@ +{% extends "templates/base.html" %} + +{%- macro sortable_column(label, new_sort) -%} + {%- set params = {} -%} + {%- if pagination -%} + {# get any filter params #} + {%- set params = pagination['params'] or {} -%} + {%- endif -%} + + {%- set icon = '' -%} + {%- if sort == new_sort -%} + {# append sort direction suffix #} + {%- set new_sort = '%s-' % new_sort if sort_asc else new_sort -%} + {# select sort direction icon #} + {%- set icon = '▲' if sort_asc else '▼' -%} + {%- endif -%} + + {# override sort param #} + {%- do params.update({'sort': new_sort}) -%} + + {{ label }}{{ icon | safe }} +{%- endmacro -%} + +{% block title %}Resources{% endblock %} +{% block container %} +

{{ self.title() }}

+ + {% block buttons %} +
+ + {{ utils.render_icon('plus-lg') }} {% block new_resource_label %}New{% endblock %} + + +
+
+
+ + +
+ +
+ {% block extra_buttons %}{% endblock %} +
+ {% endblock %} + + {% block pagination %} + {% if pagination %} + {% set params = pagination['params'] or {} %} + {% set page = pagination['page'] %} + {% set num_pages = pagination['num_pages'] %} + {% set per_page = params['per_page'] %} + {% if per_page == pagination['per_page_default'] %} + {# clear default per_page value #} + {% set per_page = none %} + {% endif %} + + {% set start_page = 1 %} + {% set end_page = num_pages %} + {% set num_page_buttons = 5 %} + {% if num_pages > num_page_buttons %} + {% set start_page = [page - 2, 1] | max %} + {% set end_page = start_page + num_page_buttons - 1 %} + {% if end_page > num_pages %} + {% set end_page = num_pages %} + {% set start_page = end_page - num_page_buttons + 1 %} + {% endif %} + {% endif %} + +
+ + + {% if pagination['per_page_options'] %} + + {% endif %} +
+ + {% endif %} + {% endblock %} + + {% block table %} + + + + {% block table_headers %} + + {% endblock %} + + + + + {% for resource in resources %} + + {% block resource_fields scoped %} + + {% endblock %} + + + {% endfor %} + +
ID
{{ resource.id }} + + {{ utils.render_icon('pencil') }} Edit + + {% if endpoint_suffix == "resource" %} + + {{ utils.render_icon('plus-lg') }} New Permission + + {% if resource['type'] == 'map' %} + + {{ utils.render_icon('plus-lg') }} Import Resources + + {% endif %} + {% endif %} +
+ + + +
+
+ {% endblock %} +{% endblock %} diff --git a/templates/groups/form.html b/src/templates/groups/form.html similarity index 64% rename from templates/groups/form.html rename to src/templates/groups/form.html index bde8414..3c6275e 100644 --- a/templates/groups/form.html +++ b/src/templates/groups/form.html @@ -1,4 +1,4 @@ -{% import "bootstrap/wtf.html" as wtf %} +{% import "bootstrap5/form.html" as wtf %} {% extends "templates/base.html" %} {% block scripts %} @@ -34,11 +34,12 @@

{{ title }}

{% endif %} {{ form.csrf_token }} - {{ wtf.form_field(form.name, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.description, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.users, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.roles, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.name, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.description, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.users, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} + {{ wtf.render_field(form.roles, form_type="horizontal", horizontal_columns=('sm', 2, 5)) }} - {{ wtf.form_field(form.submit, class="col-sm-offset-2 btn btn-primary") }} + {{ wtf.render_field(form.submit, class="col-sm-offset-2 btn btn-primary") }} + {% endblock %} diff --git a/templates/groups/index.html b/src/templates/groups/index.html similarity index 100% rename from templates/groups/index.html rename to src/templates/groups/index.html diff --git a/templates/home.html b/src/templates/home.html similarity index 83% rename from templates/home.html rename to src/templates/home.html index 76bc783..8bf5ad6 100644 --- a/templates/home.html +++ b/src/templates/home.html @@ -16,8 +16,8 @@ var button = $(buttonSelector); button.click(function() { clearAlert(alertSelector); - button.prop("disabled", true); - button.css("cursor", 'wait'); + button.attr("disabled", true); + $(document.body).css("cursor", 'wait'); // call Admin GUI service $.post( @@ -27,11 +27,11 @@ } ).done(function(data, status) { button.prop("disabled", false); - button.css("cursor", ''); + $(document.body).css("cursor", ''); // show response var html = ''; - html += '
'; + html += '