Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemention of new WebComponent header #257

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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(){
Expand Down Expand Up @@ -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");
Expand Down
3 changes: 2 additions & 1 deletion web/src/main/webapp/xslt/base-layout.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
title="{concat($env/system/site/name, ' - ', $env/system/site/organization)}"/>

<xsl:call-template name="css-load"/>
<script src="{$headerScript}"></script>
</head>


Expand All @@ -68,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']">
<iframe src="{$headerUrl}?active=geonetwork" style="width:100%;height:{$headerHeight}px;border:none;overflow:hidden;" scrolling="no" frameborder="0"></iframe>
<geor-header active-app="geonetwork" legacy-header="{$useLegacyHeader}" legacy-url="{$headerUrl}" style="width:100%;height:{$headerHeight}px;border:none;"></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 @@ -35,6 +35,8 @@

<xsl:variable name="headerUrl" select="util:getGeorchestraHeaderUrl()"/>
<xsl:variable name="headerHeight" select="util:getGeorchestraHeaderHeight()"/>
<xsl:variable name="useLegacyHeader" select="util:getGeorchestraUseLegacyHeader()"/>
<xsl:variable name="headerScript" select="util:getGeorchestraHeaderScript()"/>

<!--
-->
Expand Down
Loading