Skip to content

Commit

Permalink
feat: use header config file
Browse files Browse the repository at this point in the history
fix: header config
  • Loading branch information
f-necas committed Jan 8, 2025
1 parent a3896f4 commit c35dc5b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions core/src/main/java/org/fao/geonet/util/XslUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ public static MultiPolygon toMultiPolygon(Geometry geometry) {
private static String headerScript;
private static String logoUrl;
private static String georchestraStylesheet;
private static String headerConfigFile;


public static String getGeorchestraHeaderUrl(){
Expand Down Expand Up @@ -378,6 +379,22 @@ public static String getGeorchestraHeaderStylesheet(){
return XslUtil.georchestraStylesheet;
}

public static String getGeorchestraHeaderConfigFile(){

if(XslUtil.headerConfigFile == null) {

// Set default value
XslUtil.headerConfigFile = "";

// Load value from datadir
Properties properties = XslUtil.loadDatadirProperties();
if (properties.containsKey("headerConfigFile"))
XslUtil.headerConfigFile = properties.getProperty("headerConfigFile");
}

return XslUtil.headerConfigFile;
}

private static Properties loadProperties(File path, Properties prop) throws IOException {
try(FileInputStream fisProp = new FileInputStream(path)) {
InputStreamReader isrProp = new InputStreamReader(fisProp, "UTF8");
Expand Down
2 changes: 1 addition & 1 deletion web/src/main/webapp/xslt/base-layout.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
and a facet search to get main site information.
-->
<body data-ng-controller="GnCatController" data-ng-class="[isHeaderFixed ? 'gn-header-fixed' : 'gn-header-relative', isLogoInHeader ? 'gn-logo-in-header' : 'gn-logo-in-navbar', isFooterEnabled ? 'gn-show-footer' : 'gn-hide-footer']">
<geor-header active-app="geonetwork" legacy-header="{$useLegacyHeader}" legacy-url="{$headerUrl}" style="width:100%;height:{$headerHeight}px;border:none;" logo-url="{$logoUrl}" stylesheet="{$georchestraStylesheet}"></geor-header>
<geor-header active-app="geonetwork" config-file="{$headerConfigFile}" legacy-header="{$useLegacyHeader}" legacy-url="{$headerUrl}" logo-url="{$logoUrl}" stylesheet="{$georchestraStylesheet}"></geor-header>

<div data-gn-alert-manager=""/>

Expand Down
2 changes: 1 addition & 1 deletion web/src/main/webapp/xslt/common/base-variables.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<xsl:variable name="headerScript" select="util:getGeorchestraHeaderScript()"/>
<xsl:variable name="logoUrl" select="util:getGeorchestraHeaderLogo()"/>
<xsl:variable name="georchestraStylesheet" select="util:getGeorchestraHeaderStylesheet()"/>

<xsl:variable name="headerConfigFile" select="util:getGeorchestraHeaderConfigFile()"/>
<!--
-->
<xsl:variable name="gnUri" select="'http://www.fao.org/geonetwork'"/>
Expand Down

0 comments on commit c35dc5b

Please sign in to comment.