From 7d78248e97f245e08e2f76b7d808b77fec1097cb Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Mon, 23 Dec 2024 18:10:41 +0100 Subject: [PATCH] feat: use header config file --- .../java/org/fao/geonet/util/XslUtil.java | 61 ++++--------------- web/src/main/webapp/xslt/base-layout.xsl | 2 +- .../webapp/xslt/common/base-variables.xsl | 6 +- 3 files changed, 16 insertions(+), 53 deletions(-) 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 f48f0a1dcb..b8515aa26c 100644 --- a/core/src/main/java/org/fao/geonet/util/XslUtil.java +++ b/core/src/main/java/org/fao/geonet/util/XslUtil.java @@ -274,30 +274,11 @@ public static MultiPolygon toMultiPolygon(Geometry geometry) { private static final char CS_WKT = ' '; private static ThreadLocal allowScripting = new InheritableThreadLocal(); - private static String headerUrl; private static String headerHeight; - private static String useLegacyHeader; private static String headerScript; - private static String logoUrl; + private static String headerConfigFile; private static String georchestraStylesheet; - - public static String getGeorchestraHeaderUrl(){ - - if(XslUtil.headerUrl == null) { - - // Set default value - XslUtil.headerUrl = "/header/"; - - // Load value from datadir - Properties properties = XslUtil.loadDatadirProperties(); - if (properties.containsKey("headerUrl")) - XslUtil.headerUrl = properties.getProperty("headerUrl"); - } - - return XslUtil.headerUrl; - } - public static String getGeorchestraHeaderHeight(){ if(XslUtil.headerHeight == null) { @@ -314,22 +295,6 @@ 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) { @@ -346,36 +311,36 @@ public static String getGeorchestraHeaderScript(){ return XslUtil.headerScript; } - public static String getGeorchestraHeaderLogo(){ + public static String getGeorchestraHeaderStylesheet(){ - if(XslUtil.logoUrl == null) { + if(XslUtil.georchestraStylesheet == null) { // Set default value - XslUtil.logoUrl = "https://www.georchestra.org/public/georchestra-logo.svg"; + XslUtil.georchestraStylesheet = ""; // Load value from datadir Properties properties = XslUtil.loadDatadirProperties(); - if (properties.containsKey("logoUrl")) - XslUtil.logoUrl = properties.getProperty("logoUrl"); + if (properties.containsKey("georchestraStylesheet")) + XslUtil.georchestraStylesheet = properties.getProperty("georchestraStylesheet"); } - return XslUtil.logoUrl; + return XslUtil.georchestraStylesheet; } - public static String getGeorchestraHeaderStylesheet(){ + public static String getGeorchestraHeaderConfigFile(){ - if(XslUtil.georchestraStylesheet == null) { + if(XslUtil.headerConfigFile == null) { // Set default value - XslUtil.georchestraStylesheet = ""; + XslUtil.headerConfigFile = ""; // Load value from datadir Properties properties = XslUtil.loadDatadirProperties(); - if (properties.containsKey("georchestraStylesheet")) - XslUtil.georchestraStylesheet = properties.getProperty("georchestraStylesheet"); + if (properties.containsKey("headerConfigFile")) + XslUtil.headerConfigFile = properties.getProperty("headerConfigFile"); } - return XslUtil.georchestraStylesheet; + return XslUtil.headerConfigFile; } private static Properties loadProperties(File path, Properties prop) throws IOException { diff --git a/web/src/main/webapp/xslt/base-layout.xsl b/web/src/main/webapp/xslt/base-layout.xsl index d5018c3951..55a3aa5b9d 100644 --- a/web/src/main/webapp/xslt/base-layout.xsl +++ b/web/src/main/webapp/xslt/base-layout.xsl @@ -99,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 f0494b372a..1330b6eecd 100644 --- a/web/src/main/webapp/xslt/common/base-variables.xsl +++ b/web/src/main/webapp/xslt/common/base-variables.xsl @@ -33,12 +33,10 @@ - - - - + +