You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2021/05/30 04:33:30 UTC

[ofbiz-framework] branch release18.12 updated (847a400 -> ad58224)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a change to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git.


    from 847a400  Fixed: Display rather than edit the From Date field of a Product Config Item Content when updating the content.
     new 7778b76  Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
     new 81654fc  Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
     new ad58224  Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 framework/common/config/CommonUiLabels.xml            |  4 ++++
 framework/common/config/general.properties            |  9 ++++++---
 themes/common-theme/template/includes/GeoLocation.ftl | 19 ++++++++++++-------
 3 files changed, 22 insertions(+), 10 deletions(-)

[ofbiz-framework] 03/03: Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit ad5822461412e8caa2daa1a152c8c15fa9afe708
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Sun May 30 06:22:24 2021 +0200

    Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
    
    Fixes the call to the Google API key
    
    Thanks to Daniel
---
 themes/common-theme/template/includes/GeoLocation.ftl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/themes/common-theme/template/includes/GeoLocation.ftl b/themes/common-theme/template/includes/GeoLocation.ftl
index d265a88..908e586 100644
--- a/themes/common-theme/template/includes/GeoLocation.ftl
+++ b/themes/common-theme/template/includes/GeoLocation.ftl
@@ -46,7 +46,7 @@ under the License.
           <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>
+          <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 ===========================-->

[ofbiz-framework] 02/03: Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 81654fc155c2d6d54914b4daf731525271be71ad
Author: Jacques Le Roux <ja...@les7arts.com>
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 e840487..d265a88 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>
@@ -178,7 +183,3 @@ under the License.
 <#else>
   <h2>${uiLabelMap.CommonNoGeolocationAvailable}</h2>
 </#if>
-
-<#if !googleApiKey?has_content>
-  <h2>${uiLabelMap.CommonNoGoogleAPIkeyAvailable}</h2>
-</#if>

[ofbiz-framework] 01/03: Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)

Posted by jl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit 7778b7692db43d34967bdd80c89c6fb104e01966
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Sat May 29 12:06:16 2021 +0200

    Improved: Allow to pass a Google API key for geolocation (OFBIZ-12247)
    
    This is related to this question from Daniel at
    https://github.com/apache/ofbiz-framework/pull/220
    
    I couldn't figure out how to configure OFBiz with my Google API key so ended up
    temporarily patching
    themes/common-theme/template/includes/GeoLocation.ftl line 44 with my key.
    Line 44 looked similar to:
    <script src="https://maps.googleapis.com/maps/api/js?key=secret_google_api_key" type="application/javascript"></script>
    
    Is there a way to configure ofbiz with the API key?
    
    Disclaimer: w/o a not free "Google API key" I was not able to test, will ask
    Daniel...
    
    Conflicts handled by hand
      framework/common/config/general.properties
---
 framework/common/config/CommonUiLabels.xml            |  4 ++++
 framework/common/config/general.properties            |  9 ++++++---
 themes/common-theme/template/includes/GeoLocation.ftl | 18 +++++++++++-------
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/framework/common/config/CommonUiLabels.xml b/framework/common/config/CommonUiLabels.xml
index 97df8b7..e0cdccd 100644
--- a/framework/common/config/CommonUiLabels.xml
+++ b/framework/common/config/CommonUiLabels.xml
@@ -7559,6 +7559,10 @@
         <value xml:lang="zh">没有可用的地理位置(作为演示,你可以使用演示客户会员资料)</value>
         <value xml:lang="zh-TW">沒有可用的地理位置(若作為Demo,你可以使用 DemoCustomer 團體相關資料)</value>
     </property>
+    <property key="CommonNoGoogleAPIkeyAvailable">
+        <value xml:lang="en">No Google API key Available</value>
+        <value xml:lang="fr">Aucune clef d'API Google disponible</value>
+    </property>
     <property key="CommonNoOptions">
         <value xml:lang="ar">لا يوجد خيار: _NA_</value>
         <value xml:lang="cs">Žádné volby: _NA_</value>
diff --git a/framework/common/config/general.properties b/framework/common/config/general.properties
index 40976b5..37e3db5 100644
--- a/framework/common/config/general.properties
+++ b/framework/common/config/general.properties
@@ -77,7 +77,7 @@ usps.address.match=(^.*?p[\\. ]*o[\\. ]*box.*$)|(^.*?post.*?office.*?box.*$)|((^
 defaultFromEmailAddress=ofbiztest@example.com
 
 # -- The default domainname used in the notification emails links
-# as 'baseUrl' and 'baseSecureUrl' are set in the url.properties file. 
+# as 'baseUrl' and 'baseSecureUrl' are set in the url.properties file.
 
 # -- mail notifications enabled (Y|N)
 mail.notifications.enabled=N
@@ -131,8 +131,11 @@ mail.spam.value=YES
 # -- HTTP JSON settings
 http.json.xssi.prefix=//
 
-# -- Save Entity Sync Remove Info. This is used in the context of Entity Sync, doc currently updated, WIP at OFBIZ-10390...  
-saveEntitySyncRemoveInfo=false 
+# -- Save Entity Sync Remove Info. This is used in the context of Entity Sync, doc currently updated, WIP at OFBIZ-10390...
+saveEntitySyncRemoveInfo=false
 
 # -- Y if you want to display the multi-tenant textbox in the login page and install specify components which related to each tenant
 multitenant=N
+
+# -- Google API key, by default none, this is not free
+googleApiKey=
\ No newline at end of file
diff --git a/themes/common-theme/template/includes/GeoLocation.ftl b/themes/common-theme/template/includes/GeoLocation.ftl
index 33d98cf..e840487 100644
--- a/themes/common-theme/template/includes/GeoLocation.ftl
+++ b/themes/common-theme/template/includes/GeoLocation.ftl
@@ -31,19 +31,19 @@ under the License.
     <#assign center = geoChart.points[0]>
     <#assign zoom = 15> <#-- 0=World, 19=max zoom in -->
   <#else>
-  <#-- hardcoded in GEOPT_ADDRESS_GOOGLE, simpler -->
+    <#-- hardcoded in GEOPT_ADDRESS_GOOGLE, simpler -->
   </#if>
 
 <#-- ================================= Google Maps Init ======================================-->
-  <#if geoChart.dataSourceId?has_content>
+  <#assign googleApiKey = Static["org.apache.ofbiz.entity.util.EntityUtilProperties"].getPropertyValue("general", "googleApiKey", delegator)>
+  <#if geoChart.dataSourceId?has_content && googleApiKey?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 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?sensor=false" type="application/javascript"></script>
+      </div>
+      <script src="https://maps.googleapis.com/maps/api/js?key=googleApiKey" type="application/javascript"></script>
     </#if>
-
   <#-- ========================== Here we go with different types of maps renderer ===========================-->
     <#if "GEOPT_GOOGLE" == geoChart.dataSourceId>
     <script type="application/javascript">
@@ -178,3 +178,7 @@ under the License.
 <#else>
   <h2>${uiLabelMap.CommonNoGeolocationAvailable}</h2>
 </#if>
+
+<#if !googleApiKey?has_content>
+  <h2>${uiLabelMap.CommonNoGoogleAPIkeyAvailable}</h2>
+</#if>