This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository
https://gitbox.apache.org/repos/asf/ofbiz-framework.gitThe following commit(s) were added to refs/heads/trunk by this push:
new de5d1f8 Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
de5d1f8 is described below
commit de5d1f8fc4619772f066eafb86b9fe028c5f0cfb
Author: Jacques Le Roux <
[hidden email]>
AuthorDate: Sat May 29 12:52:18 2021 +0200
Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
Better way to handle a missing Google API key
---
.../common-theme/template/includes/GeoLocation.ftl | 23 +++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/themes/common-theme/template/includes/GeoLocation.ftl b/themes/common-theme/template/includes/GeoLocation.ftl
index e66c5c5..e56e818 100644
--- a/themes/common-theme/template/includes/GeoLocation.ftl
+++ b/themes/common-theme/template/includes/GeoLocation.ftl
@@ -35,14 +35,19 @@ under the License.
</#if>
<#-- ================================= Google Maps Init ======================================-->
- <#assign googleApiKey = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValue("general", "googleApiKey", delegator)>
- <#if geoChart.dataSourceId?has_content && googleApiKey?has_content>
+ <#if geoChart.dataSourceId?has_content>
<#if "GOOGLE" == geoChart.dataSourceId?substring(geoChart.dataSourceId?length-6 , geoChart.dataSourceId?length)>
- <div id="${id}"
- style="border:1px solid #979797; background-color:#e5e3df; width:${geoChart.width}; height:${geoChart.height}; margin:2em auto;">
- <div style="padding:1em; color:gray;">${uiLabelMap.CommonLoading}</div>
- </div>
- <script src="
https://maps.googleapis.com/maps/api/js?key=googleApiKey" type="application/javascript"></script>
+ <#assign googleApiKey = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValue("general", "googleApiKey", delegator)>
+ <div id="${id}"
+ style="border:1px solid #979797; background-color:#e5e3df; width:${geoChart.width}; height:${geoChart.height}; margin:2em auto;">
+ <div style="padding:1em; color:gray;">${uiLabelMap.CommonLoading}</div>
+ </div>
+ <#if !googleApiKey?has_content>
+ <h2>${uiLabelMap.CommonNoGoogleAPIkeyAvailable}</h2>
+ <script src="
https://maps.googleapis.com/maps/api/js" type="application/javascript"></script>
+ <#else>
+ <script src="
https://maps.googleapis.com/maps/api/js?key=googleApiKey" type="application/javascript"></script>
+ </#if>
</#if>
<#-- ========================== Here we go with different types of maps renderer ===========================-->
<#if "GEOPT_GOOGLE" == geoChart.dataSourceId>
@@ -181,7 +186,3 @@ under the License.
<#else>
<h2>${uiLabelMap.CommonNoGeolocationAvailable}</h2>
</#if>
-
-<#if !googleApiKey?has_content>
- <h2>${uiLabelMap.CommonNoGoogleAPIkeyAvailable}</h2>
-</#if>