svn commit: r893277 - in /ofbiz/trunk/framework: common/webcommon/includes/geolocation.ftl example/config/ExampleUiLabels.xml example/webapp/example/WEB-INF/controller.xml example/widget/example/ExampleMenus.xml example/widget/example/ExampleScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r893277 - in /ofbiz/trunk/framework: common/webcommon/includes/geolocation.ftl example/config/ExampleUiLabels.xml example/webapp/example/WEB-INF/controller.xml example/widget/example/ExampleMenus.xml example/widget/example/ExampleScreens.xml

erwan
Author: erwan
Date: Tue Dec 22 19:11:53 2009
New Revision: 893277

URL: http://svn.apache.org/viewvc?rev=893277&view=rev
Log:
Complement of rev 892579, adding geolocation by address. An example screen is visible at
<OFBiz instance>/example/control/ExampleGeoLocationAddress
This also closes JIRA-2930

Modified:
    ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl
    ofbiz/trunk/framework/example/config/ExampleUiLabels.xml
    ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml
    ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml
    ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml

Modified: ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl?rev=893277&r1=893276&r2=893277&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl Tue Dec 22 19:11:53 2009
@@ -34,14 +34,33 @@
               map.setCenter(new GLatLng(37.4419, -122.1419), 12);
             </#if>
             map.setUIToDefault();
-            <#list geoChart.points as point>            
-              map.addOverlay(new GMarker(new GLatLng(${point.lat?c}, ${point.lon?c})));            
+            <#list geoChart.points as point>
+              map.addOverlay(new GMarker(new GLatLng(${point.lat?c}, ${point.lon?c})));
             </#list>
           }
         </script>
       <#elseif  geoChart.dataSourceId == "GEOPT_YAHOO">
       <#elseif  geoChart.dataSourceId == "GEOPT_MICROSOFT">
       <#elseif  geoChart.dataSourceId == "GEOPT_MAPTP">
+      <#elseif  geoChart.dataSourceId == "GEOPT_ADDRESS_GOOGLE">
+        <div id="<#if geoChart.id?has_content>${geoChart.id}<#else>map_canvas</#if>" style="border:1px solid #979797; background-color:#e5e3df; width:${geoChart.width}px; height:${geoChart.height}px; margin:2em auto;">
+          <div style="padding:1em; color:gray;">${uiLabelMap.CommonLoading}</div>
+        </div>
+        <#assign defaultUrl = "https." + request.getServerName()>
+        <#assign defaultGogleMapKey = Static["org.ofbiz.base.util.UtilProperties"].getPropertyValue("general.properties", defaultUrl)>
+        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=${defaultGogleMapKey}" type="text/javascript"></script>
+        <script type="text/javascript">
+          if (GBrowserIsCompatible()) {
+            var geocoder = new GClientGeocoder();
+            var map = new GMap2(document.getElementById("<#if geoChart.id?has_content>${geoChart.id}<#else>map_canvas</#if>"));
+            geocoder.getLatLng("${pointAddress}", function(point) {
+              if (!point) { alert("Address not found");}
+              map.setUIToDefault();
+              map.setCenter(point, 13);
+              map.addOverlay(new GMarker(point));
+            });
+          }
+        </script>
       </#if>
     </#if>
 <#else>

Modified: ofbiz/trunk/framework/example/config/ExampleUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/config/ExampleUiLabels.xml?rev=893277&r1=893276&r2=893277&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/config/ExampleUiLabels.xml (original)
+++ ofbiz/trunk/framework/example/config/ExampleUiLabels.xml Tue Dec 22 19:11:53 2009
@@ -489,6 +489,10 @@
         <value xml:lang="th">ข้อผิดพลาดในส่วนของความปลอดภัย: ในการรัน ${resourceDescription} คุณต้องได้รับอนุญาตจาก EXAMPLE_${mainAction} หรือ EXAMPLE_ADMIN ก่อน</value>
         <value xml:lang="zh">安全错误: 要运行${methodShortDescription},你必须具有EXAMPLE${securityAction}或EXAMPLE_ADMIN权限</value>
     </property>
+    <property key="ExamplePointAddress">
+        <value xml:lang="en">Geolocation via address</value>
+        <value xml:lang="fr">Géolocalisation par l'adresse</value>
+    </property>
     <property key="ExamplePortletFirst">
         <value xml:lang="en">Hi, this is a first example of portlet</value>
         <value xml:lang="it">Salve, questo è il primo esempio di portlet</value>

Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml?rev=893277&r1=893276&r2=893277&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml Tue Dec 22 19:11:53 2009
@@ -215,6 +215,7 @@
     <request-map uri="ExampleGeoLocationPointSet2"><security https="true" auth="true"/><response name="success" type="view" value="ExampleGeoLocationPointSet2"/></request-map>
     <request-map uri="ExampleGeoLocationPointSet3"><security https="true" auth="true"/><response name="success" type="view" value="ExampleGeoLocationPointSet3"/></request-map>
     <request-map uri="ExampleGeoLocationPointSet4"><security https="true" auth="true"/><response name="success" type="view" value="ExampleGeoLocationPointSet4"/></request-map>
+    <request-map uri="ExampleGeoLocationAddress"><security https="true" auth="true"/><response name="success" type="view" value="ExampleGeoLocationAddress"/></request-map>
 
     <!-- Birt example Requests -->
     <request-map uri="BirtMain">
@@ -271,6 +272,7 @@
     <view-map name="ExampleGeoLocationPointSet2" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleGeoLocationPointSet2"/>
     <view-map name="ExampleGeoLocationPointSet3" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleGeoLocationPointSet3"/>
     <view-map name="ExampleGeoLocationPointSet4" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleGeoLocationPointSet4"/>
+    <view-map name="ExampleGeoLocationAddress" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleGeoLocationAddress"/>
 
     <!-- Birt example View Mappings -->
     <view-map name="BirtMain" type="screen" page="component://example/widget/example/BirtScreens.xml#main"/>

Modified: ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml?rev=893277&r1=893276&r2=893277&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml Tue Dec 22 19:11:53 2009
@@ -90,12 +90,16 @@
             <link target="ExampleGeoLocationPointSet4">
             </link>
         </menu-item>
+        <menu-item name="ExampleGeoLocationAddress" title="${uiLabelMap.ExamplePointAddress}">
+            <link target="ExampleGeoLocationAddress">
+            </link>
+        </menu-item>
     </menu>
-    
+
     <menu name="BirtTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
         <menu-item name="Report" title="${uiLabelMap.ExampleBirtReport}"><link target="Report"/></menu-item>
         <menu-item name="Export" title="${uiLabelMap.ExampleBirtViewHandler}"><link target="ViewHandler"/></menu-item>
         <menu-item name="Mail" title="${uiLabelMap.ExampleBirtMail}"><link target="Mail"/></menu-item>
     </menu>
-    
+
 </menus>

Modified: ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml?rev=893277&r1=893276&r2=893277&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml Tue Dec 22 19:11:53 2009
@@ -277,5 +277,38 @@
             </widgets>
         </section>
     </screen>
+    <screen name="ExampleGeoLocationAddress">
+        <section>
+            <actions>
+                <set field="headerItem" value="ExampleGeoLocation"/>
+                <set field="tabButtonItem" value="ExampleGeoLocationAddress"/>
+                <set field="geoChart.dataSourceId" value="GEOPT_ADDRESS_GOOGLE"/>
+                <set field="geoChart.width" value="800"/>
+                <set field="geoChart.height" value="500"/>
+
+                <set field="contactMechId" value="9015"/>
+                <entity-one entity-name="PostalAddress" value-field="address"/>
+                <set field="pointAddress" value="${address.address1} ${address.address2} ${address.postalCode} ${address.city} ${address.stateProvinceGeoId} ${address.countryGeoId}"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="pre-body">
+                        <include-menu name="ExampleGeoLocation" location="component://example/widget/example/ExampleMenus.xml"/>
+                    </decorator-section>
+                    <decorator-section name="body">
+                        <section>
+                            <widgets>
+                                <container style="clear" />
+                                <label>Using Google geocoding services may need to register for an individual key. Please visit this website to have more details :</label>
+                                <link target="http://code.google.com/intl/fr/apis/maps/signup.html" url-mode="plain" text="Google Maps API"/>
+                                <label style="h3">Geolocation of DemoCustomer, living at ${pointAddress}</label>
+                                <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 
 </screens>