From 52b3615c72d1ca4a2bab72202bafd90d461b75c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com> Date: Thu, 24 Oct 2024 15:11:28 +0200 Subject: [PATCH] FIX: add missing function --- README.md | 1 + .../caosdb-webui/src/ext/js/box_loan.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c37d2e6..4023965 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,4 @@ TODO ## Integration tests Run `pytest .` in the integration tests folder +## Serverside scripting must be enabled. (pylink.ini in home) diff --git a/loan-custom/caosdb-server/caosdb-webui/src/ext/js/box_loan.js b/loan-custom/caosdb-server/caosdb-webui/src/ext/js/box_loan.js index de85db3..c7dfc6a 100644 --- a/loan-custom/caosdb-server/caosdb-webui/src/ext/js/box_loan.js +++ b/loan-custom/caosdb-server/caosdb-webui/src/ext/js/box_loan.js @@ -29,7 +29,18 @@ function get_formatted_date(split) { return ((new Date(Date.now() - tzoffset)).toISOString()).split(split)[0]; } - +/** + * This function retrieves an html form from the html subdirectory. + * + */ +var getHTMLForm = async function(pageName, variables) { + var site = await connection.get("webinterface/html/forms/" + pageName + ".html", "html"); + var htmltext = site.getElementById("caosdb-form").innerHTML; + var req = /\{([0-9a-z-A-Z_]+)\}/g; + return htmltext.replace(req, (match, p1) => { + return variables[p1] || ""; + }); +} /** * AWI Box Loan, refactored code. -- GitLab