From fa3cc42b14f1e78b0925d620da33f0ed3e896997 Mon Sep 17 00:00:00 2001 From: Florian Necas Date: Sat, 11 Nov 2023 10:07:46 +0100 Subject: [PATCH] feat: implement new header https://github.com/georchestra/georchestra/pull/4065 --- .../core/src/main/java/applicationContext.xml | 7 ++++++- .../georchestra/GeorchestraHeaderIframe.java | 21 ++++++++----------- .../org/geoserver/web/GeoServerBasePage.html | 2 +- .../org/geoserver/web/GeoServerBasePage.java | 3 +++ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/web/core/src/main/java/applicationContext.xml b/src/web/core/src/main/java/applicationContext.xml index 4bf1e4b190a..4bb5a376d1a 100644 --- a/src/web/core/src/main/java/applicationContext.xml +++ b/src/web/core/src/main/java/applicationContext.xml @@ -491,5 +491,10 @@ - + + + + + + diff --git a/src/web/core/src/main/java/org/georchestra/GeorchestraHeaderIframe.java b/src/web/core/src/main/java/org/georchestra/GeorchestraHeaderIframe.java index 5c480dde480..94ada361a18 100644 --- a/src/web/core/src/main/java/org/georchestra/GeorchestraHeaderIframe.java +++ b/src/web/core/src/main/java/org/georchestra/GeorchestraHeaderIframe.java @@ -2,21 +2,22 @@ import java.util.logging.Logger; import org.apache.wicket.markup.ComponentTag; -import org.apache.wicket.markup.html.link.InlineFrame; -import org.apache.wicket.util.tester.DummyHomePage; +import org.apache.wicket.markup.html.WebComponent; import org.geoserver.web.GeoServerApplication; import org.geotools.util.logging.Logging; -public class GeorchestraHeaderIframe extends InlineFrame { +public class GeorchestraHeaderIframe extends WebComponent { private String headerUrl; private String headerHeight; + private String legacyHeader; private static Logger LOGGER = Logging.getLogger(GeorchestraHeaderIframe.class); private void init() { headerHeight = getGeoServerApplication().getBean("georchestraHeaderHeight").toString(); headerUrl = getGeoServerApplication().getBean("georchestraHeaderUrl").toString(); + legacyHeader = getGeoServerApplication().getBean("georchestraLegacyHeader").toString(); } protected GeoServerApplication getGeoServerApplication() { @@ -24,20 +25,16 @@ protected GeoServerApplication getGeoServerApplication() { } public GeorchestraHeaderIframe(String id) { - super(id, new DummyHomePage()); + super(id); init(); } - @Override - protected CharSequence getURL() { - return this.headerUrl + "?active=geoserver"; - } - @Override protected void onComponentTag(ComponentTag tag) { - tag.put( - "style", - "width:100%;height:" + this.headerHeight + "px;border:none;overflow:hidden;"); + tag.put("style", "width:100%;height:" + this.headerHeight + "px;border:none;"); + tag.put("active-app", "geoserver"); + tag.put("legacy-url", this.headerUrl); + tag.put("legacy-header", this.legacyHeader); super.onComponentTag(tag); } } diff --git a/src/web/core/src/main/java/org/geoserver/web/GeoServerBasePage.html b/src/web/core/src/main/java/org/geoserver/web/GeoServerBasePage.html index 3f3e6196519..9a0473a6373 100644 --- a/src/web/core/src/main/java/org/geoserver/web/GeoServerBasePage.html +++ b/src/web/core/src/main/java/org/geoserver/web/GeoServerBasePage.html @@ -29,7 +29,7 @@
- +
diff --git a/src/web/core/src/main/java/org/geoserver/web/GeoServerBasePage.java b/src/web/core/src/main/java/org/geoserver/web/GeoServerBasePage.java index 9a1d5452081..26fb7871ee9 100644 --- a/src/web/core/src/main/java/org/geoserver/web/GeoServerBasePage.java +++ b/src/web/core/src/main/java/org/geoserver/web/GeoServerBasePage.java @@ -507,6 +507,9 @@ public void renderHead(IHeaderResponse response) { JavaScriptHeaderItem.forReference( new JavaScriptResourceReference( JQueryResourceReference.class, VERSION_3)))); + response.render( + JavaScriptHeaderItem.forUrl( + getGeoServerApplication().getBean("georchestraHeaderScript").toString())); List cssContribs = getGeoServerApplication().getBeansOfType(HeaderContribution.class); for (HeaderContribution csscontrib : cssContribs) {