tg-prepare 1.1.0__py3-none-any.whl → 2.1.0b2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tg-prepare might be problematic. Click here for more details.
- {tg_prepare-1.1.0.dist-info → tg_prepare-2.1.0b2.dist-info}/METADATA +3 -3
- tg_prepare-2.1.0b2.dist-info/RECORD +78 -0
- {tg_prepare-1.1.0.dist-info → tg_prepare-2.1.0b2.dist-info}/WHEEL +1 -1
- tg_prepare-2.1.0b2.dist-info/projects/.secret_key +1 -0
- tgp_backend/__init__.py +3 -4
- tgp_backend/config.py +31 -0
- tgp_backend/directories.py +6 -8
- tgp_backend/nextcloud.py +40 -19
- tgp_backend/project.py +172 -45
- tgp_backend/session_manager.py +47 -0
- tgp_backend/util.py +73 -25
- tgp_ui/app.py +43 -335
- tgp_ui/routes/__init__.py +0 -0
- tgp_ui/routes/collection.py +272 -0
- tgp_ui/routes/data.py +228 -0
- tgp_ui/routes/project.py +102 -0
- tgp_ui/routes/publication.py +129 -0
- tgp_ui/routes/tabs.py +34 -0
- tgp_ui/routes/views.py +62 -0
- tgp_ui/static/css/bootstrap.min.css.map +1 -0
- tgp_ui/static/css/navbar.css +92 -0
- tgp_ui/static/img/favicon.ico +0 -0
- tgp_ui/static/img/textgrid-logo.svg +1 -0
- tgp_ui/static/js/collectionManager.js +60 -0
- tgp_ui/static/js/fileManager.js +186 -0
- tgp_ui/static/js/main.js +32 -485
- tgp_ui/static/js/modalManager.js +105 -0
- tgp_ui/static/js/navbarManager.js +151 -0
- tgp_ui/static/js/projectManager.js +60 -0
- tgp_ui/static/js/require.js +5 -0
- tgp_ui/static/js/sidebarManager.js +32 -0
- tgp_ui/static/js/tabManager.js +79 -0
- tgp_ui/templates/details/empty_container.html +16 -0
- tgp_ui/templates/details/manage_collection.html +205 -0
- tgp_ui/templates/includes/set_session_id_form.html +16 -0
- tgp_ui/templates/includes/upload_form.html +131 -0
- tgp_ui/templates/layout.html +9 -48
- tgp_ui/templates/macros.html +79 -72
- tgp_ui/templates/modal/delete_project.html +25 -0
- tgp_ui/templates/modal/empty_container.html +9 -0
- tgp_ui/templates/modal/file_explorer_content.html +34 -0
- tgp_ui/templates/modal/file_explorer_main.html +22 -0
- tgp_ui/templates/modal/file_explorer_nextcloud.html +27 -0
- tgp_ui/templates/modal/github_modal.html +29 -0
- tgp_ui/templates/modal/nextcloud_login.html +48 -0
- tgp_ui/templates/modal/tei_explorer.html +58 -0
- tgp_ui/templates/modal/xpath_parser.html +52 -0
- tgp_ui/templates/project_main.html +36 -0
- tgp_ui/templates/project_navbar.html +81 -0
- tgp_ui/templates/{projects.html → projects_main.html} +13 -28
- tgp_ui/templates/tab_final_upload.html +29 -0
- tgp_ui/templates/tabs/check_result.html +90 -0
- tgp_ui/templates/tabs/edit_project.html +113 -0
- tgp_ui/templates/tabs/empty_container.html +12 -0
- tgp_ui/templates/tabs/import_data.html +138 -0
- tgp_ui/templates/tabs/manage_collections.html +88 -0
- tgp_ui/templates/tabs/select_directories.html +41 -0
- tgp_ui/templates/tabs/upload.html +42 -0
- tgp_ui/templates/tabs/validate_metadata.html +227 -0
- tg_prepare-1.1.0.dist-info/RECORD +0 -39
- tgp_ui/templates/collection.html +0 -194
- tgp_ui/templates/file_upload.html +0 -24
- tgp_ui/templates/nxc_file_tree.html +0 -33
- tgp_ui/templates/project.html +0 -26
- tgp_ui/templates/storage.html +0 -49
- tgp_ui/templates/tei_explorer.html +0 -48
- tgp_ui/templates/xpath_parser_modal_content.html +0 -37
- {tg_prepare-1.1.0.dist-info → tg_prepare-2.1.0b2.dist-info}/entry_points.txt +0 -0
- {tg_prepare-1.1.0.dist-info → tg_prepare-2.1.0b2.dist-info}/licenses/LICENSE +0 -0
- {tg_prepare-1.1.0.dist-info → tg_prepare-2.1.0b2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2023-2025 TU-Dresden (ZIH)
|
|
3
|
+
# ralf.klammer@tu-dresden.de
|
|
4
|
+
# moritz.wilhelm@tu-dresden.de
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
from flask import Blueprint, render_template, request
|
|
9
|
+
from flask_json import json_response
|
|
10
|
+
|
|
11
|
+
from tgp_backend.project import Project, TGProject
|
|
12
|
+
|
|
13
|
+
log = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
publication_routes = Blueprint("publication", __name__)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@publication_routes.route(
|
|
19
|
+
"/tab-prepare-upload/<string:projectname>", methods=["GET"]
|
|
20
|
+
)
|
|
21
|
+
def tab_upload(projectname):
|
|
22
|
+
project = Project(projectname)
|
|
23
|
+
|
|
24
|
+
return render_template(
|
|
25
|
+
"tabs/upload.html",
|
|
26
|
+
project=project,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# ***TAB CHECK RESULTS***
|
|
31
|
+
# ***********************
|
|
32
|
+
@publication_routes.route(
|
|
33
|
+
"/tab-check-result/<string:projectname>", methods=["GET"]
|
|
34
|
+
)
|
|
35
|
+
def tab_check_result(projectname):
|
|
36
|
+
# Erstelle das Project-Objekt
|
|
37
|
+
project = Project(projectname)
|
|
38
|
+
|
|
39
|
+
# Übergib das Project-Objekt an das Template
|
|
40
|
+
return render_template(
|
|
41
|
+
"tabs/check_result.html",
|
|
42
|
+
project=project, # Das Project-Objekt wird hier übergeben
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class TGProjectHandler:
|
|
47
|
+
def __init__(self, projectname, instance):
|
|
48
|
+
self.project = Project(projectname)
|
|
49
|
+
self.tg_project = self.project.get_tgp(instance)
|
|
50
|
+
self.instance = instance
|
|
51
|
+
|
|
52
|
+
def _render_template(self):
|
|
53
|
+
return render_template(
|
|
54
|
+
"includes/upload_form.html",
|
|
55
|
+
project=self.project,
|
|
56
|
+
instance=self.instance,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def save_session_id(self, session_id):
|
|
60
|
+
self.tg_project.tg_session_id = session_id
|
|
61
|
+
return self._render_template()
|
|
62
|
+
|
|
63
|
+
def save_tg_project_id(self, tg_project_id):
|
|
64
|
+
self.tg_project.tg_project_id = tg_project_id
|
|
65
|
+
return self._render_template()
|
|
66
|
+
|
|
67
|
+
def delete_tg_project(self, tg_project_id):
|
|
68
|
+
self.tg_project.delete_tg_project(tg_project_id)
|
|
69
|
+
return self._render_template()
|
|
70
|
+
|
|
71
|
+
def create_tg_project(self, tg_projectname):
|
|
72
|
+
self.tg_project.create_tg_project(tg_projectname)
|
|
73
|
+
return self._render_template()
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@publication_routes.route(
|
|
77
|
+
"/save_session_id/<string:projectname>/<string:instance>", methods=["POST"]
|
|
78
|
+
)
|
|
79
|
+
def save_session_id(projectname, instance):
|
|
80
|
+
return TGProjectHandler(projectname, instance).save_session_id(
|
|
81
|
+
request.form.get("tg_auth_session_id")
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@publication_routes.route(
|
|
86
|
+
"/save_tg_project_id/<string:projectname>/<string:instance>/<string:tg_project_id>",
|
|
87
|
+
methods=["POST"],
|
|
88
|
+
)
|
|
89
|
+
def save_tg_project_id(projectname, instance, tg_project_id):
|
|
90
|
+
return TGProjectHandler(projectname, instance).save_tg_project_id(
|
|
91
|
+
tg_project_id
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@publication_routes.route(
|
|
96
|
+
"/delete_tg_project_id/<string:projectname>/<string:instance>/<string:tg_project_id>",
|
|
97
|
+
methods=["POST"],
|
|
98
|
+
)
|
|
99
|
+
def delete_tg_project_id(projectname, instance, tg_project_id):
|
|
100
|
+
return TGProjectHandler(projectname, instance).delete_tg_project(
|
|
101
|
+
tg_project_id
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
@publication_routes.route(
|
|
106
|
+
"/create_tg_project/<string:projectname>/<string:instance>",
|
|
107
|
+
methods=["POST"],
|
|
108
|
+
)
|
|
109
|
+
def create_tg_project(projectname, instance):
|
|
110
|
+
return TGProjectHandler(projectname, instance).create_tg_project(
|
|
111
|
+
request.form.get("tg_projectname")
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@publication_routes.route(
|
|
116
|
+
"/upload_project/<string:projectname>/<string:instance>", methods=["POST"]
|
|
117
|
+
)
|
|
118
|
+
def upload_project(projectname, instance):
|
|
119
|
+
TGProject(projectname, instance).upload_tg_project()
|
|
120
|
+
return json_response(response="OK")
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# @publication_routes.route(
|
|
124
|
+
# "/get_tg_project_hits/<string:projectname>/<string:instance>/<string:tg_project_id>",
|
|
125
|
+
# methods=["GET"],
|
|
126
|
+
# )
|
|
127
|
+
# def get_tg_project_hits(projectname, instance, tg_project_id):
|
|
128
|
+
# hits = TGProject(projectname, instance).get_tg_project_hits(tg_project_id)
|
|
129
|
+
# return json_response(response="OK", hits=hits)
|
tgp_ui/routes/tabs.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2023-2025 TU-Dresden (ZIH)
|
|
3
|
+
# ralf.klammer@tu-dresden.de
|
|
4
|
+
# moritz.wilhelm@tu-dresden.de
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
from flask import Blueprint, session
|
|
9
|
+
from flask_json import json_response
|
|
10
|
+
|
|
11
|
+
log = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
tab_manager = Blueprint("tab_manager", __name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@tab_manager.route("/get_last_tab/<string:projectname>", methods=["GET"])
|
|
17
|
+
def get_last_tab(projectname):
|
|
18
|
+
|
|
19
|
+
tabname = session.get(f"last_tab_{projectname}", None)
|
|
20
|
+
|
|
21
|
+
return json_response(status=200, initial_tab=tabname or "tab-edit-project")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@tab_manager.route(
|
|
25
|
+
"/set_last_tab/<string:projectname>/<string:tabname>", methods=["POST"]
|
|
26
|
+
)
|
|
27
|
+
def set_last_tab(projectname, tabname):
|
|
28
|
+
|
|
29
|
+
if tabname:
|
|
30
|
+
session[f"last_tab_{projectname}"] = tabname
|
|
31
|
+
return json_response(
|
|
32
|
+
response="OK",
|
|
33
|
+
message=f"Last tab for project '{projectname}' set to '{tabname}'",
|
|
34
|
+
)
|
tgp_ui/routes/views.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Copyright (C) 2023-2025 TU-Dresden (ZIH)
|
|
3
|
+
# ralf.klammer@tu-dresden.de
|
|
4
|
+
# moritz.wilhelm@tu-dresden.de
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
from flask import Blueprint, render_template, request, session
|
|
9
|
+
|
|
10
|
+
from tgp_backend.project import Project
|
|
11
|
+
|
|
12
|
+
log = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
main_views = Blueprint("views", __name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# favored route
|
|
18
|
+
@main_views.route("/overview", methods=["GET", "POST"])
|
|
19
|
+
# additional routes for compatibility
|
|
20
|
+
@main_views.route("/", methods=["GET"])
|
|
21
|
+
@main_views.route("/project", methods=["GET", "POST"])
|
|
22
|
+
@main_views.route("/projects", methods=["GET", "POST"])
|
|
23
|
+
def overview():
|
|
24
|
+
return render_template("projects_main.html", sub_title="Projects Overview")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@main_views.route("/project/<string:projectname>", methods=["GET", "POST"])
|
|
28
|
+
def project_view(projectname=None):
|
|
29
|
+
return render_template(
|
|
30
|
+
"project_main.html",
|
|
31
|
+
user=session.get("user", "-"),
|
|
32
|
+
current_project=projectname,
|
|
33
|
+
project=Project(projectname),
|
|
34
|
+
tab=request.args.get("tab"),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@main_views.route("/modal/container", methods=["GET"])
|
|
39
|
+
def modal_container():
|
|
40
|
+
"""
|
|
41
|
+
Render a modal spinner template.
|
|
42
|
+
This is used to show a loading spinner while processing requests.
|
|
43
|
+
"""
|
|
44
|
+
return render_template("modal/empty_container.html")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@main_views.route("/tabs/container", methods=["GET"])
|
|
48
|
+
def tab_container():
|
|
49
|
+
"""
|
|
50
|
+
Render a tab spinner template.
|
|
51
|
+
This is used to show a loading spinner while processing requests.
|
|
52
|
+
"""
|
|
53
|
+
return render_template("tabs/empty_container.html")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@main_views.route("/details/container", methods=["GET"])
|
|
57
|
+
def details_container():
|
|
58
|
+
"""
|
|
59
|
+
Render a details spinner template.
|
|
60
|
+
This is used to show a loading spinner while processing requests.
|
|
61
|
+
"""
|
|
62
|
+
return render_template("details/empty_container.html", show_spinner=True)
|