Skip to content

Commit

Permalink
feat: implement new header
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Nov 11, 2023
1 parent 9c06a6e commit fa3cc42
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
7 changes: 6 additions & 1 deletion src/web/core/src/main/java/applicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -491,5 +491,10 @@
<bean id="georchestraHeaderUrl" class="java.lang.String" factory-method="valueOf">
<constructor-arg value="${georchestra.headerUrl:/header/}" />
</bean>

<bean id="georchestraHeaderScript" class="java.lang.String" factory-method="valueOf">
<constructor-arg value="${georchestra.headerScript:https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js}" />
</bean>
<bean id="georchestraLegacyHeader" class="java.lang.String" factory-method="valueOf">
<constructor-arg value="${georchestra.useLegacyHeader:false}" />
</bean>
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,39 @@

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() {
return (GeoServerApplication) getApplication();
}

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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</wicket:head>
<body>
<div id="go_head">
<iframe wicket:id="georchestraIframe" scrolling="no" frameborder="0"></iframe>
<geor-header wicket:id="georchestraIframe"></geor-header>
</div>
<div id="main">
<div class="wrap selfclear">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HeaderContribution> cssContribs =
getGeoServerApplication().getBeansOfType(HeaderContribution.class);
for (HeaderContribution csscontrib : cssContribs) {
Expand Down

0 comments on commit fa3cc42

Please sign in to comment.