Skip to content

Commit

Permalink
Merge pull request #271 from georchestra/themable-header
Browse files Browse the repository at this point in the history
Themable Webcomponent header
  • Loading branch information
f-necas authored Dec 19, 2023
2 parents 38c57c0 + 4225c8e commit 81752f5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
34 changes: 34 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 @@ -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(){
Expand Down Expand Up @@ -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");
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 @@ -69,7 +69,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;"></geor-header>
<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>

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

Expand Down
2 changes: 2 additions & 0 deletions web/src/main/webapp/xslt/common/base-variables.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<xsl:variable name="headerHeight" select="util:getGeorchestraHeaderHeight()"/>
<xsl:variable name="useLegacyHeader" select="util:getGeorchestraUseLegacyHeader()"/>
<xsl:variable name="headerScript" select="util:getGeorchestraHeaderScript()"/>
<xsl:variable name="logoUrl" select="util:getGeorchestraHeaderLogo()"/>
<xsl:variable name="georchestraStylesheet" select="util:getGeorchestraHeaderStylesheet()"/>

<!--
-->
Expand Down

0 comments on commit 81752f5

Please sign in to comment.