From 2ec3bc4a0ad8d17754edf224a4afc1f703e045ee Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Fri, 10 Nov 2023 12:39:23 +0100 Subject: [PATCH] feat: implement new header https://github.com/georchestra/georchestra/pull/4065 --- .../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 ea9cc2e2ca..ea0f1b6877 100644 --- a/core/src/main/java/org/fao/geonet/util/XslUtil.java +++ b/core/src/main/java/org/fao/geonet/util/XslUtil.java @@ -264,6 +264,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(){ @@ -298,6 +300,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 b99bcee987..98bbb5b095 100644 --- a/web/src/main/webapp/xslt/base-layout.xsl +++ b/web/src/main/webapp/xslt/base-layout.xsl @@ -60,6 +60,7 @@ title="{concat($env/system/site/name, ' - ', $env/system/site/organization)}"/> + @@ -68,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 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 @@ + +