Feature/dynamic content (#605)

* Added dynamic content options

* Added defaults

* Added sane defaults

* Added IG operation providers for run time installation of IG's

* Refactored conditions for enabling the provider

* Refactoring

* Disable it by default in config as well

* document package install feature

* Added hosting options

* Provided better custom defaults

* Removed double default files

---------

Co-authored-by: Jose Costa Teixeira <jose.a.teixeira@gmail.com>
This commit is contained in:
Jens Kristian Villadsen
2024-02-15 20:02:46 +01:00
committed by GitHub
parent f6671f97c5
commit 9e21d8062e
16 changed files with 310 additions and 144 deletions

View File

@@ -21,21 +21,23 @@
<h3 class="panel-title">About This Server</h3>
</div>
<div class="panel-body">
<p>
This server provides a complete implementation of the FHIR Specification
using a 100% open source software stack.
</p>
<p>
This server is built
from a number of modules of the
<a href="https://github.com/jamesagnew/hapi-fhir/">HAPI FHIR</a>
project, which is a 100% open-source (Apache 2.0 Licensed) Java based
implementation of the FHIR specification.
</p>
<p>
<div id="replacementAbout">
<p>
This server provides a complete implementation of the FHIR Specification
using a 100% open source software stack.
</p>
<p>
This server is built
from a number of modules of the
<a href="https://github.com/hapifhir/hapi-fhir/">HAPI FHIR</a>
project, which is a 100% open-source (Apache 2.0 Licensed) Java based
implementation of the FHIR specification.
</p>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
@@ -55,6 +57,41 @@
</div>
<div th:replace="tmpl-footer :: footer"></div>
</form>
</form>
</body>
</html>
<script>
// Function to check if a file exists using AJAX
function fileExists(filePath, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
callback(xhr.status === 200);
}
};
xhr.open("HEAD", filePath, true);
xhr.send();
}
// Replace content if the replacement exists
fileExists("content/custom/about.html", function(exists) {
if (exists) {
loadFile("content/custom/about.html", function(content) {
var replacementContainer = document.getElementById("replacementAbout");
replacementContainer.innerHTML = content;
});
}
});
// Function to load file content using AJAX
function loadFile(filePath, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(xhr.responseText);
}
};
xhr.open("GET", filePath, true);
xhr.send();
}
</script>

View File

@@ -1,20 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<div th:fragment="banner">
<div class="row">
<div class="col-md-8">
<img src="img/sample-logo.jpg" width="383" alt="Sample Logo" />
</div>
<div class="col-md-4">
<img src="img/hapi_fhir_banner_right.png" align="right" />
</div>
</div>
<!-- Error banner in case anything went wrong -->
<div class="alert alert-danger alert-dismissable" th:if="${errorMsg} != null">
<strong>Warning!</strong>
<p th:text="${errorMsg}"></p>
</div>
<div class="row">
<div class="col-md-8">
<img id="logo" src="img/sample-logo.jpg" width="383" alt="Sample Logo"/>
</div>
<div class="col-md-4">
<img src="img/hapi_fhir_banner_right.png" align="right"/>
</div>
</div>
<script>
const customlogoImageUrl = "content/custom/logo.jpg"; // Custom logo
const defaultLogoImageUrl = "img/sample-logo.jpg"; // Default logo
const logoImageElement = document.getElementById("logo");
// Check if the logo image is available
const logoImg = new Image();
logoImg.src = customlogoImageUrl;
logoImg.onload = function() {
// Logo image is available
logoImageElement.src = customlogoImageUrl;
};
logoImg.onerror = function() {
// Logo image is not available, use the default logo image
logoImageElement.src = defaultLogoImageUrl;
};
</script>
<!-- Error banner in case anything went wrong -->
<div class="alert alert-danger alert-dismissable" th:if="${errorMsg} != null">
<strong>Warning!</strong>
<p th:text="${errorMsg}"></p>
</div>
</div>
</html>

View File

@@ -1,16 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<div th:fragment="banner" class="well">
<p>
This server provides a complete implementation of the FHIR Specification
using a 100% open source software stack.
</p>
<p>
This server is built
from a number of modules of the
<a href="https://github.com/jamesagnew/hapi-fhir/">HAPI FHIR</a>
project, which is a 100% open-source (Apache 2.0 Licensed) Java based
implementation of the FHIR specification.
</p>
<div th:fragment="banner" class="well" >
<script>
console.log('Hello')
// Function to check if a file exists using AJAX
function fileExists(filePath, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
callback(xhr.status === 200);
}
};
xhr.open("HEAD", filePath, true);
xhr.send();
}
// Replace content if static/welcome.html exists
fileExists("content/custom/welcome.html", function(exists) {
if (exists) {
loadFile("content/custom/welcome.html", function(content) {
var replacementContainer = document.getElementById("replacementWelcome");
replacementContainer.innerHTML = content;
});
}
});
// Function to load file content using AJAX
function loadFile(filePath, callback) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
callback(xhr.responseText);
}
};
xhr.open("GET", filePath, true);
xhr.send();
}
</script>
<div class="panel-body">
<div id="replacementWelcome">
<p>
This server provides a complete implementation of the FHIR Specification
using a 100% open source software stack.
</p>
<p>
This server is built
from a number of modules of the
<a href="https://github.com/hapifhir/hapi-fhir/">HAPI FHIR</a>
project, which is a 100% open-source (Apache 2.0 Licensed) Java based
implementation of the FHIR specification.
</p>
</div>
</div>
</div>
</html>
</html>