svn commit: r899560 - in /ofbiz/trunk: applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/ applications/accounting/webapp/accounting/fixedasset/ applications/accounting/widget/ applications/party/webapp/partymgr/WEB-INF/actions/party/...

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

svn commit: r899560 - in /ofbiz/trunk: applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/ applications/accounting/webapp/accounting/fixedasset/ applications/accounting/widget/ applications/party/webapp/partymgr/WEB-INF/actions/party/...

erwan
Author: erwan
Date: Fri Jan 15 08:28:51 2010
New Revision: 899560

URL: http://svn.apache.org/viewvc?rev=899560&view=rev
Log:
JIRA-3381 : Update of the geolocation screen in party (https://issues.apache.org/jira/browse/OFBIZ-3381)
The geoChart screen is now used for all the geolocalization calls.

Removed:
    ofbiz/trunk/applications/accounting/webapp/accounting/fixedasset/
    ofbiz/trunk/applications/party/webapp/partymgr/party/partygeolocation.ftl
    ofbiz/trunk/applications/product/webapp/facility/facility/FacilityLocationGeoLocation.ftl
Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
    ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy
    ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy
    ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml
    ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy?rev=899560&r1=899559&r2=899560&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/fixedasset/FixedAssetGeoLocation.groovy Fri Jan 15 08:28:51 2010
@@ -17,15 +17,27 @@
  * under the License.
  */
 
-import org.ofbiz.common.geo.GeoWorker;
+import org.ofbiz.base.util.*;
+import org.ofbiz.common.geo.*;
+import org.ofbiz.entity.*;
 
-fixedAssetId = parameters.fixedAssetId
+fixedAssetId = parameters.fixedAssetId;
+fa = delegator.findByPrimaryKey("FixedAsset", UtilMisc.toMap("fixedAssetId", fixedAssetId));
+uiLabelMap = UtilProperties.getResourceBundleMap("AccountingUiLabels", locale);
 
 if (fixedAssetId) {
     latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "FixedAssetAndGeoPoint", "fixedAssetId", fixedAssetId, null, null);
     context.latestGeoPoint = latestGeoPoint;
-    context.fixedAssetId = fixedAssetId;
 
+    List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
+
+    if (UtilValidate.isNotEmpty(latestGeoPoint) && latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
+        List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "fixedAssetId", fixedAssetId,
+                "link", UtilMisc.toMap("url", "EditFixedAsset?fixedAssetId="+ fixedAssetId, "label", uiLabelMap.AccountingFixedAsset + " " + fa.fixedAssetName)));
+
+        Map geoChart = UtilMisc.toMap("width", "500", "height", "450", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
+        context.geoChart = geoChart;
+    }
     if (latestGeoPoint && latestGeoPoint.elevationUomId) {
         elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
         context.elevationUomAbbr = elevationUom.abbreviation;

Modified: ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml?rev=899560&r1=899559&r2=899560&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/FixedAssetScreens.xml Fri Jan 15 08:28:51 2010
@@ -545,9 +545,10 @@
             <widgets>
                 <decorator-screen name="CommonFixedAssetDecorator" location="${parameters.fixedAssetDecoratorLocation}">
                     <decorator-section name="body">
-                        <platform-specific>
-                            <html><html-template location="component://accounting/webapp/accounting/fixedasset/FixedAssetGeoLocation.ftl"/></html>
-                        </platform-specific>
+                        <label>${uiLabelMap.CommonLatitude} ${latestGeoPoint.latitude}</label>
+                        <label>${uiLabelMap.CommonLongitude} ${latestGeoPoint.longitude}</label>
+                        <label>${uiLabelMap.CommonElevation} ${latestGeoPoint.elevation} ${elevationUomAbbr}</label>
+                        <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy?rev=899560&r1=899559&r2=899560&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyGeoLocation.groovy Fri Jan 15 08:28:51 2010
@@ -17,7 +17,11 @@
  * under the License.
  */
 
-import org.ofbiz.common.geo.GeoWorker;
+import org.ofbiz.common.geo.*;
+import org.ofbiz.base.util.*;
+
+uiLabelMap = UtilProperties.getResourceBundleMap("PartyUiLabels", locale);
+uiLabelMap.addBottomResourceBundle("CommonUiLabels");
 
 partyId = parameters.partyId ?: parameters.party_id;
 userLoginId = parameters.userlogin_id ?: parameters.userLoginId;
@@ -31,9 +35,20 @@
 context.partyId = partyId;
 
 latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "PartyAndGeoPoint", "partyId", partyId, null, null);
-context.latestGeoPoint = latestGeoPoint;
+if (latestGeoPoint) {
+    context.latestGeoPoint = latestGeoPoint;
+
+    List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
+  
+    if (UtilValidate.isNotEmpty(latestGeoPoint) && latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
+        List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "partyId", partyId,
+              "link", UtilMisc.toMap("url", "viewprofile?partyId="+ partyId, "label", uiLabelMap.PartyProfile + " " + uiLabelMap.CommonOf + " " + partyId)));
 
-if (latestGeoPoint && latestGeoPoint.elevationUomId) {
-    elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
-    context.elevationUomAbbr = elevationUom.abbreviation;
+        Map geoChart = UtilMisc.toMap("width", "500", "height", "450", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
+        context.geoChart = geoChart;
+    }
+    if (latestGeoPoint && latestGeoPoint.elevationUomId) {
+        elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
+        context.elevationUomAbbr = elevationUom.abbreviation;
+    }
 }

Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml?rev=899560&r1=899559&r2=899560&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml Fri Jan 15 08:28:51 2010
@@ -1069,9 +1069,10 @@
             <widgets>
                 <decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
-                        <platform-specific>
-                            <html><html-template location="component://party/webapp/partymgr/party/partygeolocation.ftl"/></html>
-                        </platform-specific>
+                        <label>${uiLabelMap.CommonLatitude} ${latestGeoPoint.latitude}</label>
+                        <label>${uiLabelMap.CommonLongitude} ${latestGeoPoint.longitude}</label>
+                        <label>${uiLabelMap.CommonElevation} ${latestGeoPoint.elevation} ${elevationUomAbbr}</label>
+                        <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy?rev=899560&r1=899559&r2=899560&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/FacilityLocationGeoLocation.groovy Fri Jan 15 08:28:51 2010
@@ -17,19 +17,32 @@
  * under the License.
  */
 
-import org.ofbiz.common.geo.GeoWorker;
+ import org.ofbiz.base.util.*;
+ import org.ofbiz.common.geo.*;
+ import org.ofbiz.entity.*;
 
 facilityId = parameters.facilityId
 locationSeqId = parameters.locationSeqId
 
+uiLabelMap = UtilProperties.getResourceBundleMap("ProductUiLabels", locale);
+uiLabelMap.addBottomResourceBundle("CommonUiLabels");
+
 if (facilityId && locationSeqId) {
     latestGeoPoint = GeoWorker.findLatestGeoPoint(delegator, "FacilityLocationAndGeoPoint", "facilityId", facilityId, "locationSeqId", locationSeqId)
-    context.latestGeoPoint = latestGeoPoint
-    context.facilityId = facilityId
-    context.locationSeqId = locationSeqId
+    context.latestGeoPoint = latestGeoPoint;
+
+    List geoCenter = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "zoom", "13"));
 
+    if (UtilValidate.isNotEmpty(latestGeoPoint) && latestGeoPoint.containsKey("latitude") && latestGeoPoint.containsKey("longitude")) {
+        List geoPoints = UtilMisc.toList(UtilMisc.toMap("lat", latestGeoPoint.latitude, "lon", latestGeoPoint.longitude, "facilityId", facilityId,
+                "link", UtilMisc.toMap("url", "EditFacilityLocation?facilityId="+ facilityId + "&locationSeqId=" + locationSeqId,
+                "label", uiLabelMap.ProductFacilityLocation  + " " + uiLabelMap.CommonOf + " " + facilityId + "/" + locationSeqId)));
+
+        Map geoChart = UtilMisc.toMap("width", "500", "height", "450", "controlUI" , "small", "dataSourceId", latestGeoPoint.dataSourceId, "points", geoPoints);
+        context.geoChart = geoChart;
+    }
     if (latestGeoPoint && latestGeoPoint.elevationUomId) {
-        elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false)
-        context.elevationUomAbbr = elevationUom.abbreviation
+        elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.elevationUomId], false);
+        context.elevationUomAbbr = elevationUom.abbreviation;
     }
 }
\ No newline at end of file

Modified: ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml?rev=899560&r1=899559&r2=899560&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml Fri Jan 15 08:28:51 2010
@@ -1429,9 +1429,10 @@
             <widgets>
                 <decorator-screen name="CommonFacilityDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
-                        <platform-specific>
-                            <html><html-template location="component://product/webapp/facility/facility/FacilityLocationGeoLocation.ftl"/></html>
-                        </platform-specific>
+                        <label>${uiLabelMap.CommonLatitude} ${latestGeoPoint.latitude}</label>
+                        <label>${uiLabelMap.CommonLongitude} ${latestGeoPoint.longitude}</label>
+                        <label>${uiLabelMap.CommonElevation} ${latestGeoPoint.elevation} ${elevationUomAbbr}</label>
+                        <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl?rev=899560&r1=899559&r2=899560&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl Fri Jan 15 08:28:51 2010
@@ -33,9 +33,18 @@
             <#else>
               map.setCenter(new GLatLng(37.4419, -122.1419), 12);
             </#if>
-            map.setUIToDefault();
+            <#if geoChart.controlUI?has_content && geoChart.controlUI == "small">
+              map.addControl(new GSmallMapControl());
+            <#else>
+              map.setUIToDefault();
+            </#if>
             <#list geoChart.points as point>
+              marker = new GMarker(new GLatLng(${point.lat?c}, ${point.lon?c}));
+              map.addOverlay(marker);
               map.addOverlay(new GMarker(new GLatLng(${point.lat?c}, ${point.lon?c})));
+              <#if point.link?has_content>
+                marker.openInfoWindowHtml("<div style=\"width:210px; padding-right:10px;\"><a href=${point.link.url}>${point.link.label}</a></div>");
+              </#if>
             </#list>
           }
         </script>