From 7d64e322111c0cc4361b7ef7a0b480ae5f6d5ef7 Mon Sep 17 00:00:00 2001 From: fnecas Date: Fri, 15 Dec 2023 11:55:54 +0100 Subject: [PATCH 1/2] feat: implement themable header --- .../java/org/fao/geonet/util/XslUtil.java | 34 +++++++++++++++++++ web/src/main/webapp/xslt/base-layout.xsl | 2 +- .../webapp/xslt/common/base-variables.xsl | 2 ++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/fao/geonet/util/XslUtil.java b/core/src/main/java/org/fao/geonet/util/XslUtil.java index ea0f1b6877..f375b3079b 100644 --- a/core/src/main/java/org/fao/geonet/util/XslUtil.java +++ b/core/src/main/java/org/fao/geonet/util/XslUtil.java @@ -266,6 +266,8 @@ public static MultiPolygon toMultiPolygon(Geometry geometry) { private static String headerHeight; private static String useLegacyHeader; private static String headerScript; + private static String logoUrl; + private static String georchestraStylesheet; public static String getGeorchestraHeaderUrl(){ @@ -332,6 +334,38 @@ public static String getGeorchestraHeaderScript(){ return XslUtil.headerScript; } + public static String getGeorchestraHeaderLogo(){ + + if(XslUtil.logoUrl == null) { + + // Set default value + XslUtil.logoUrl = "https://www.georchestra.org/public/georchestra-logo.svg"; + + // Load value from datadir + Properties properties = XslUtil.loadDatadirProperties(); + if (properties.containsKey("logoUrl")) + XslUtil.logoUrl = properties.getProperty("logoUrl"); + } + + return XslUtil.logoUrl; + } + + public static String getGeorchestraHeaderStylesheet(){ + + if(XslUtil.georchestraStylesheet == null) { + + // Set default value + XslUtil.georchestraStylesheet = ""; + + // Load value from datadir + Properties properties = XslUtil.loadDatadirProperties(); + if (properties.containsKey("georchestraStylesheet")) + XslUtil.georchestraStylesheet = properties.getProperty("georchestraStylesheet"); + } + + return XslUtil.georchestraStylesheet; + } + private static Properties loadProperties(File path, Properties prop) throws IOException { try(FileInputStream fisProp = new FileInputStream(path)) { InputStreamReader isrProp = new InputStreamReader(fisProp, "UTF8"); diff --git a/web/src/main/webapp/xslt/base-layout.xsl b/web/src/main/webapp/xslt/base-layout.xsl index 98bbb5b095..04429efaa0 100644 --- a/web/src/main/webapp/xslt/base-layout.xsl +++ b/web/src/main/webapp/xslt/base-layout.xsl @@ -69,7 +69,7 @@ and a facet search to get main site information. --> - +
diff --git a/web/src/main/webapp/xslt/common/base-variables.xsl b/web/src/main/webapp/xslt/common/base-variables.xsl index 91784b90a4..f0494b372a 100644 --- a/web/src/main/webapp/xslt/common/base-variables.xsl +++ b/web/src/main/webapp/xslt/common/base-variables.xsl @@ -37,6 +37,8 @@ + + From 4225c8e1114c6e78261f4713952109ac1a55c19b Mon Sep 17 00:00:00 2001 From: f-necas <39771412+f-necas@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:25:07 +0100 Subject: [PATCH 2/2] Update base-layout.xsl --- web/src/main/webapp/xslt/base-layout.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/main/webapp/xslt/base-layout.xsl b/web/src/main/webapp/xslt/base-layout.xsl index 04429efaa0..122cff75d4 100644 --- a/web/src/main/webapp/xslt/base-layout.xsl +++ b/web/src/main/webapp/xslt/base-layout.xsl @@ -69,7 +69,7 @@ and a facet search to get main site information. --> - +