Skip to content
Snippets Groups Projects
Commit 61bdb2ac authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

ENH/FIX: allow custom css and fix rendering of static html created by the crawler

parent d41c566b
No related branches found
No related tags found
2 merge requests!112Release 0.12.0,!108F css
Pipeline #52886 passed
...@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## ## [Unreleased] ##
### Added ### ### Added ###
- Possibility to configure custom CSS to be used in static HTML sites created
by the crawler
### Changed ### ### Changed ###
...@@ -15,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -15,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed ### ### Removed ###
### Fixed ### ### Fixed ###
- Rendering of entities in static HTML sites created by the crawler.
### Security ### ### Security ###
......
...@@ -518,6 +518,12 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) ...@@ -518,6 +518,12 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3]))
""" """
from xml.sax.saxutils import escape from xml.sax.saxutils import escape
caosdb_config = db.configuration.get_config()
if ("advancedtools" in caosdb_config and "crawler.customcssfile" in
caosdb_config["advancedtools"]):
cssfile = caosdb_config["advancedtools"]["crawler.customcssfile"]
else:
cssfile = None
# TODO move path related stuff to sss_helper # TODO move path related stuff to sss_helper
form = """ form = """
<html> <html>
...@@ -526,21 +532,17 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) ...@@ -526,21 +532,17 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3]))
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Crawler</title> <title>Crawler</title>
<link rel="stylesheet" href="{url}/webinterface/css/webcaosdb.css"/>
<link rel="stylesheet" href="{url}/webinterface/css/bootstrap.css"> <link rel="stylesheet" href="{url}/webinterface/css/bootstrap.css">
<script src="{url}/webinterface/js/jquery.js"></script> <link rel="stylesheet" href="{url}/webinterface/css/webcaosdb.css"/>
<script src="{url}/webinterface/js/utif.js"></script> <link rel="stylesheet" href="{url}/webinterface/css/linkahead.css"/>
<script src="{url}/webinterface/js/loglevel.js"></script> <link rel="stylesheet" href="{url}/webinterface/css/dropzone.css">
<script src="{url}/webinterface/js/bootstrap.js"></script> <link rel="stylesheet" href="{url}/webinterface/css/tour.css">
<script src="{url}/webinterface/js/ext_table_preview.js"></script> <link rel="stylesheet" href="{url}/webinterface/css/leaflet.css">
<script src="{url}/webinterface/js/webcaosdb.js"></script> <link rel="stylesheet" href="{url}/webinterface/css/leaflet-coordinates.css">
<script src="{url}/webinterface/js/plotly.js"></script> <link rel="stylesheet" href="{url}/webinterface/css/bootstrap-select.css">
<script src="{url}/webinterface/js/caosdb.js"></script> <link rel="stylesheet" href="{url}/webinterface/css/bootstrap-icons.css">
<script src="{url}/webinterface/js/state-machine.js"></script> {customcssfile}
<script src="{url}/webinterface/js/showdown.js"></script> <script src="{url}/webinterface/webcaosdb.dist.js"></script>
<script src="{url}/webinterface/js/preview.js"></script>
<script src="{url}/webinterface/js/ext_references.js"></script>
<script src="{url}/webinterface/js/ext_bottom_line.js"></script>
</head> </head>
<body> <body>
<form method="post" action="{url}/scripting"> <form method="post" action="{url}/scripting">
...@@ -582,9 +584,11 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3])) ...@@ -582,9 +584,11 @@ ____________________\n""".format(i+1, len(pending_changes)) + str(el[3]))
</script> </script>
</body> </body>
</html> </html>
""".format(url=db.configuration.get_config()["Connection"]["url"], """.format(url=caosdb_config["Connection"]["url"],
rid=run_id, rid=run_id,
changes=escape("\n".join(changes)), changes=escape("\n".join(changes)),
customcssfile='<link rel="stylesheet" href="{url}/webinterface/css/{customcssfile}"/>'.format(
url=caosdb_config["Connection"]["url"], customcssfile=cssfile) if cssfile else "",
path=path) path=path)
if "SHARED_DIR" in os.environ: if "SHARED_DIR" in os.environ:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment