From 8379808911d09041fd861f5cde9e15aebe6051f1 Mon Sep 17 00:00:00 2001 From: f-necas <39771412+f-necas@users.noreply.github.com> Date: Mon, 27 Nov 2023 09:39:53 +0100 Subject: [PATCH] Implement new header in geonetwork 4.2.7 --- .../java/org/fao/geonet/util/XslUtil.java | 34 +++++++++++++++++++ web/src/main/webapp/xslt/base-layout.xsl | 3 +- .../webapp/xslt/common/base-variables.xsl | 2 ++ 3 files changed, 38 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 dd506287aa..2218ee518c 100644 --- a/core/src/main/java/org/fao/geonet/util/XslUtil.java +++ b/core/src/main/java/org/fao/geonet/util/XslUtil.java @@ -285,6 +285,8 @@ public static MultiPolygon toMultiPolygon(Geometry geometry) { private static String headerUrl; private static String headerHeight; + private static String useLegacyHeader; + private static String headerScript; public static String getGeorchestraHeaderUrl(){ @@ -319,6 +321,38 @@ public static String getGeorchestraHeaderHeight(){ return XslUtil.headerHeight; } + public static String getGeorchestraUseLegacyHeader(){ + + if(XslUtil.useLegacyHeader == null) { + + // Set default value + XslUtil.useLegacyHeader = "false"; + + // Load value from datadir + Properties properties = XslUtil.loadDatadirProperties(); + if (properties.containsKey("useLegacyHeader")) + XslUtil.useLegacyHeader = properties.getProperty("useLegacyHeader"); + } + + return XslUtil.useLegacyHeader; + } + + public static String getGeorchestraHeaderScript(){ + + if(XslUtil.headerScript == null) { + + // Set default value + XslUtil.headerScript = "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js"; + + // Load value from datadir + Properties properties = XslUtil.loadDatadirProperties(); + if (properties.containsKey("headerScript")) + XslUtil.headerScript = properties.getProperty("headerScript"); + } + + return XslUtil.headerScript; + } + 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 1566098b0e..94b376bdba 100644 --- a/web/src/main/webapp/xslt/base-layout.xsl +++ b/web/src/main/webapp/xslt/base-layout.xsl @@ -90,6 +90,7 @@ + @@ -98,7 +99,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 f9e9fdee01..91784b90a4 100644 --- a/web/src/main/webapp/xslt/common/base-variables.xsl +++ b/web/src/main/webapp/xslt/common/base-variables.xsl @@ -35,6 +35,8 @@ + +