Commit 6e3b48d3 authored by Arthur Bogaart's avatar Arthur Bogaart

ESSENTIALS-1017 Align googlemaps JSP with Freemarker template

parent e41622ba
<%@ include file="/WEB-INF/jsp/include/imports.jsp" %>
<%--@elvariable id="componentId" type="java.lang.String"--%>
<%--@elvariable id="cparam" type="org.onehippo.cms7.essentials.components.info.EssentialsGoogleMapsComponentInfo"--%>
<c:choose>
<c:when test="${not empty requestScope.cparam.apiKey}">
<c:set var="mapsUrl">https://maps.googleapis.com/maps/api/js?key=${fn:escapeXml(requestScope.cparam.apiKey)}</c:set>
</c:when>
<c:otherwise>
<c:set var="mapsUrl">https://maps.googleapis.com/maps/api/js</c:set>
</c:otherwise>
</c:choose>
<hst:headContribution keyHint="api" category="htmlHead">
<script type="text/javascript" src="${mapsUrl}"></script>
<div id="map-canvas-${componentId}" style="width: ${requestScope.cparam.width}px; height: ${requestScope.cparam.height}px;"></div>
<hst:headContribution category="htmlBodyEnd">
<script type="text/javascript">
if (!window.HEGM) {
window.HEGM = [];
}
window.HEGM.push(function() {
initGoogleMap('map-canvas-${componentId}', '${fn:escapeXml(requestScope.cparam.address)}', ${requestScope.cparam.longitude}, ${requestScope.cparam.latitude}, ${requestScope.cparam.zoomFactor}, '${requestScope.cparam.mapType}');
});
</script>
</hst:headContribution>
<hst:headContribution keyHint="maps" category="htmlHead">
<hst:webfile path="/js/essentials-google-maps.js" var="customMapsJSUrl" />
<script type="text/javascript" src="${customMapsJSUrl}"></script>
<hst:headContribution keyHint="essentials-google-maps" category="htmlBodyEnd">
<hst:webfile path="/js/essentials-google-maps.js" var="essentialsGoogleMapsJs" />
<script type="text/javascript" src="${essentialsGoogleMapsJs}"></script>
</hst:headContribution>
<hst:headContribution keyHint="initializeGoogleMaps" category="htmlBodyEnd">
<script type="text/javascript">
initializeGoogleMaps("${fn:escapeXml(requestScope.cparam.address)}", ${requestScope.cparam.longitude}, ${requestScope.cparam.latitude}, ${requestScope.cparam.zoomFactor}, "${requestScope.cparam.mapType}");
</script>
<hst:headContribution keyHint="google-maps-api" category="htmlBodyEnd">
<c:choose>
<c:when test="${not empty requestScope.cparam.apiKey}">
<c:set var="mapsUrl">https://maps.googleapis.com/maps/api/js?key=${fn:escapeXml(requestScope.cparam.apiKey)}&callback=initGoogleMaps</c:set>
</c:when>
<c:otherwise>
<c:set var="mapsUrl">https://maps.googleapis.com/maps/api/js?callback=initGoogleMaps</c:set>
</c:otherwise>
</c:choose>
<script type="text/javascript" src="${mapsUrl}" async="async" defer="defer"></script>
</hst:headContribution>
<c:if test="${requestScope.cmsrequest}">
<script type="text/javascript">
initializeGoogleMaps("${fn:escapeXml(requestScope.cparam.address)}", ${requestScope.cparam.longitude}, ${requestScope.cparam.latitude}, ${requestScope.cparam.zoomFactor}, "${requestScope.cparam.mapType}");
</script>
<c:if test="${editMode}">
<script type="text/javascript">
if (window.initGoogleMap) {
initGoogleMap('map-canvas-${componentId}', '${fn:escapeXml(requestScope.cparam.address)}', ${requestScope.cparam.longitude}, ${requestScope.cparam.latitude}, ${requestScope.cparam.zoomFactor}, '${requestScope.cparam.mapType}');
}
</script>
</c:if>
<div id="map-canvas" style="width: ${requestScope.cparam.width}px; height: ${requestScope.cparam.height}px;"></div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment