svn commit: r735404 - in /ofbiz/trunk: applications/accounting/entitydef/ applications/ecommerce/data/ applications/party/ applications/party/data/ applications/party/entitydef/ applications/party/src/org/ofbiz/party/party/ applications/party/webapp/pa...

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

svn commit: r735404 - in /ofbiz/trunk: applications/accounting/entitydef/ applications/ecommerce/data/ applications/party/ applications/party/data/ applications/party/entitydef/ applications/party/src/org/ofbiz/party/party/ applications/party/webapp/pa...

jleroux@apache.org
Author: jleroux
Date: Sun Jan 18 01:09:32 2009
New Revision: 735404

URL: http://svn.apache.org/viewvc?rev=735404&view=rev
Log:
A 1st commit for "Add geolocation to data model" (https://issues.apache.org/jira/browse/OFBIZ-1923) OFBIZ-1923

Added:
    ofbiz/trunk/applications/party/data/PartyGeoPointData.xml
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GeoLocation.groovy
    ofbiz/trunk/applications/party/webapp/partymgr/party/geolocation.ftl
    ofbiz/trunk/framework/images/webapp/images/googlemap.js
Modified:
    ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
    ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml
    ofbiz/trunk/applications/party/entitydef/entitymodel.xml
    ofbiz/trunk/applications/party/ofbiz-component.xml
    ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml
    ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml
    ofbiz/trunk/applications/product/entitydef/entitymodel.xml
    ofbiz/trunk/framework/common/config/CommonUiLabels.xml
    ofbiz/trunk/framework/common/data/CommonTypeData.xml
    ofbiz/trunk/framework/common/entitydef/entitymodel.xml
    ofbiz/trunk/framework/common/widget/CommonScreens.xml

Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Sun Jan 18 01:09:32 2009
@@ -999,6 +999,48 @@
         </relation>
     </entity>
 
+    <entity entity-name="FixedAssetGeoPoint" package-name="org.ofbiz.accounting.fixedasset" title="Fixed Asset Geo Location with history">
+        <field name="fixedAssetId" type="id-ne"></field>
+        <field name="geoPointId" type="id-ne"></field>
+        <field name="fromDate" type="date-time"></field>
+        <field name="thruDate" type="date-time"></field>
+        <prim-key field="fixedAssetId"/>
+        <prim-key field="geoPointId"/>
+        <prim-key field="fromDate"/>
+        <relation type="one" fk-name="FXDASTGEOPT_FXDAST" rel-entity-name="FixedAsset">
+            <key-map field-name="fixedAssetId"/>
+        </relation>
+        <relation type="one" fk-name="FXDASTGEOPT_GEOPT" rel-entity-name="GeoPoint">
+            <key-map field-name="geoPointId"/>
+        </relation>
+    </entity>
+  
+    <view-entity entity-name="FixedAssetAndGeoPoint" package-name="org.ofbiz.accounting.fixedasset" title="Fixed Asset and Geo Point View Entity">
+      <member-entity entity-alias="FA" entity-name="FixedAsset"/>
+      <member-entity entity-alias="FAGPT" entity-name="FixedAssetGeoPoint"/>
+      <member-entity entity-alias="GPT" entity-name="GeoPoint"/>
+      <alias-all entity-alias="GPT"/>    
+      <alias entity-alias="FA" name="fixedAssetId"/>
+      <alias entity-alias="FAGPT" name="fromDate"/>
+      <alias entity-alias="FAGPT" name="thruDate"/>
+      <view-link entity-alias="FA" rel-entity-alias="FAGPT">
+        <key-map field-name="fixedAssetId"/>
+      </view-link>
+      <view-link entity-alias="FAGPT" rel-entity-alias="GPT">
+          <key-map field-name="geoPointId"/>
+      </view-link>
+      <relation type="many" rel-entity-name="FixedAssetGeoPoint">
+        <key-map field-name="fixedAssetId"/>
+        <key-map field-name="geoPointId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="FixedAsset">
+        <key-map field-name="fixedAssetId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="GeoPoint">
+        <key-map field-name="geoPointId"/>
+      </relation>
+    </view-entity>  
+  
   <entity entity-name="AccommodationClass"
     package-name="org.ofbiz.accounting.fixedasset"
     title="Accommodation Class">

Modified: ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml (original)
+++ ofbiz/trunk/applications/ecommerce/data/DemoOrderPeopleData.xml Sun Jan 18 01:09:32 2009
@@ -119,9 +119,10 @@
     <UserLogin partyId="DemoCustomer" userLoginId="DemoCustomer"/>
     <PartyRole partyId="DemoCustomer" roleTypeId="CUSTOMER"/>
     <PartyRole partyId="DemoCustomer" roleTypeId="BILL_TO_CUSTOMER"/>
+    <PartyGeoPoint partyId="DemoCustomer" geoPointId="9000" fromDate="2009-01-09 00:00:00.000"/>    
     
     <ContactMech contactMechId="9015" contactMechTypeId="POSTAL_ADDRESS"/>
-    <PostalAddress contactMechId="9015" toName="Demo Customer" address1="2004 Factory Blvd" city="Orem" stateProvinceGeoId="UT" postalCode="84057" countryGeoId="USA"/>
+    <PostalAddress contactMechId="9015" toName="Demo Customer" address1="2004 Factory Blvd" city="Orem" stateProvinceGeoId="UT" postalCode="84057" countryGeoId="USA" geoPointId="9000"/>    
     <PartyContactMech partyId="DemoCustomer" contactMechId="9015" fromDate="2001-05-13 00:00:00.000" allowSolicitation="Y"/>
     <PartyContactMechPurpose partyId="DemoCustomer" contactMechId="9015" contactMechPurposeTypeId="BILLING_LOCATION" fromDate="2001-05-13 00:00:00.000"/>
     <PartyContactMechPurpose partyId="DemoCustomer" contactMechId="9015" contactMechPurposeTypeId="SHIPPING_LOCATION" fromDate="2001-05-13 00:00:00.000"/>

Added: ofbiz/trunk/applications/party/data/PartyGeoPointData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/data/PartyGeoPointData.xml?rev=735404&view=auto
==============================================================================
--- ofbiz/trunk/applications/party/data/PartyGeoPointData.xml (added)
+++ ofbiz/trunk/applications/party/data/PartyGeoPointData.xml Sun Jan 18 01:09:32 2009
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<entity-engine-xml>    
+    <GeoPoint comment="GeoPoint for DemoCustomer"
+        geoPointId="9000"
+        dataSourceId="GEOPT_GOOGLE"
+        latitude="40.297264"
+        longitude="-111.696625"
+        elevation="4756"
+        uomId="LEN_ft"
+        information="A testing GeoPoint for contactMechId=9015 (DemoCustomer)"
+    />    
+</entity-engine-xml>

Modified: ofbiz/trunk/applications/party/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/entitydef/entitymodel.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/party/entitydef/entitymodel.xml Sun Jan 18 01:09:32 2009
@@ -1150,6 +1150,7 @@
       <field name="stateProvinceGeoId" type="id"></field>
       <field name="countyGeoId" type="id"></field>
       <field name="postalCodeGeoId" type="id"></field>
+      <field name="geoPointId" type="id"></field>
       <prim-key field="contactMechId"/>
       <relation type="one" fk-name="POST_ADDR_CMECH" rel-entity-name="ContactMech">
         <key-map field-name="contactMechId"/>
@@ -1166,6 +1167,9 @@
       <relation type="one" fk-name="POST_ADDR_PCGEO" title="PostalCode" rel-entity-name="Geo">
         <key-map field-name="postalCodeGeoId" rel-field-name="geoId"/>
       </relation>
+      <relation type="one" fk-name="POST_ADDR_GEOPT" title="Geo Point" rel-entity-name="GeoPoint">
+        <key-map field-name="geoPointId"/>
+      </relation>
       <index name="ADDRESS1_IDX">
         <index-field name="address1"/>
       </index>
@@ -2639,4 +2643,48 @@
         <key-map field-name="partyId"/>
       </view-link>
     </view-entity>
+    <entity entity-name="PartyGeoPoint"
+        package-name="org.ofbiz.party.party"
+        title="Party Geo Location with history">
+      <field name="partyId" type="id-ne"></field>
+      <field name="geoPointId" type="id-ne"></field>
+      <field name="fromDate" type="date-time"></field>
+      <field name="thruDate" type="date-time"></field>
+      <prim-key field="partyId"/>
+      <prim-key field="geoPointId"/>
+      <prim-key field="fromDate"/>
+      <relation type="one" fk-name="PARTYGEOPT_PARTY" rel-entity-name="Party">
+          <key-map field-name="partyId"/>
+      </relation>
+      <relation type="one" fk-name="PARTYGEOPT_GEOPT" rel-entity-name="GeoPoint">
+          <key-map field-name="geoPointId"/>
+      </relation>
+    </entity>
+    <view-entity entity-name="PartyAndGeoPoint"
+        package-name="org.ofbiz.party.party"
+        title="Party and Geo Point View Entity">
+      <member-entity entity-alias="PTY" entity-name="Party"/>
+      <member-entity entity-alias="PGPT" entity-name="PartyGeoPoint"/>
+      <member-entity entity-alias="GPT" entity-name="GeoPoint"/>
+      <alias-all entity-alias="GPT"/>    
+      <alias entity-alias="PTY" name="partyId"/>
+      <alias entity-alias="PGPT" name="fromDate"/>
+      <alias entity-alias="PGPT" name="thruDate"/>
+      <view-link entity-alias="PTY" rel-entity-alias="PGPT">
+        <key-map field-name="partyId"/>
+      </view-link>
+      <view-link entity-alias="PGPT" rel-entity-alias="GPT">
+        <key-map field-name="geoPointId"/>
+      </view-link>
+      <relation type="many" rel-entity-name="PartyGeoPoint">
+        <key-map field-name="partyId"/>
+        <key-map field-name="geoPointId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="Party">
+        <key-map field-name="partyId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="GeoPoint">
+        <key-map field-name="geoPointId"/>
+      </relation>
+    </view-entity>
 </entitymodel>

Modified: ofbiz/trunk/applications/party/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/ofbiz-component.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/party/ofbiz-component.xml Sun Jan 18 01:09:32 2009
@@ -29,6 +29,7 @@
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/PartyTypeData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/PartySecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/PartyGeoPointData.xml"/>
     <entity-resource type="data" reader-name="seed-initial" loader="main" location="data/ScheduledJobs.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services_view.xml"/>

Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java (original)
+++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyWorker.java Sun Jan 18 01:09:32 2009
@@ -125,6 +125,20 @@
         }
     }
 
+    public static GenericValue findPartyLatestGeoPoint(String partyId, GenericDelegator delegator) {
+        try {
+            List<GenericValue> gptList = delegator.findByAnd("PartyAndGeoPoint", UtilMisc.toMap("partyId", partyId), UtilMisc.toList("-fromDate"));
+            if (UtilValidate.isNotEmpty(gptList)) {
+                gptList = EntityUtil.filterByDate(gptList);
+                return EntityUtil.getFirst(gptList);
+            }
+            return null;
+        } catch (GenericEntityException e) {
+            Debug.logError(e, "Error while finding latest GeoPoint for party with ID [" + partyId + "] " + e.toString(), module);
+            return null;
+        }
+    }
+
     public static GenericValue findPartyLatestPostalAddress(String partyId, GenericDelegator delegator) {
         GenericValue pcm = findPartyLatestContactMech(partyId, "POSTAL_ADDRESS", delegator);
         if (pcm != null) {
@@ -137,6 +151,22 @@
         return null;
     }
 
+    public static GenericValue findPartyLatestPostalAddressGeoPoint(String partyId, GenericDelegator delegator) {
+        GenericValue latestPostalAddress = findPartyLatestPostalAddress(partyId, delegator);
+        if (latestPostalAddress  != null) {
+            try {
+                GenericValue latestGeoPoint =  latestPostalAddress.getRelatedOne("GeoPoint");
+                if (latestGeoPoint  != null) {
+                    return latestGeoPoint;
+                }
+                return null;
+            } catch (GenericEntityException e) {
+                Debug.logError(e, "Error while finding latest GeoPoint for party with ID [" + partyId + "]: " + e.toString(), module);
+            }
+        }
+        return null;
+    }
+
     public static GenericValue findPartyLatestTelecomNumber(String partyId, GenericDelegator delegator) {
         GenericValue pcm = findPartyLatestContactMech(partyId, "TELECOM_NUMBER", delegator);
         if (pcm != null) {

Added: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GeoLocation.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GeoLocation.groovy?rev=735404&view=auto
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GeoLocation.groovy (added)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GeoLocation.groovy Sun Jan 18 01:09:32 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.party.party.PartyWorker;
+
+partyId = parameters.partyId ?: parameters.party_id;
+userLoginId = parameters.userlogin_id ?: parameters.userLoginId;
+
+if (!partyId && userLoginId) {
+    thisUserLogin = delegator.findByPrimaryKey("UserLogin", [userLoginId : userLoginId]);
+    if (thisUserLogin) {
+        partyId = thisUserLogin.partyId;
+    }
+}
+context.partyId = partyId;
+
+latestGeoPoint = PartyWorker.findPartyLatestGeoPoint(partyId, delegator);
+context.latestGeoPoint = latestGeoPoint;
+
+if (latestGeoPoint.uomId) {
+    elevationUom = delegator.findOne("Uom", [uomId : latestGeoPoint.uomId], false);
+    context.elevationUomAbbr = elevationUom.abbreviation;
+}
+
\ No newline at end of file

Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/controller.xml Sun Jan 18 01:09:32 2009
@@ -1102,7 +1102,7 @@
     <request-map uri="LookupEmploymentApp"><security auth="true" https="true"/><response name="success" type="view" value="LookupEmploymentApp"/></request-map>
     <request-map uri="LookupEmplPosition"><security auth="true" https="true"/><response name="success" type="view" value="LookupEmplPosition"/></request-map>
     
-    <!-- Financail History Report-->
+    <!-- Financial History Report-->
     <request-map uri="PartyFinancialHistory">
          <security https="true" auth="true"/>
          <response name="success" type="view" value="PartyFinancialHistory"/>
@@ -1120,6 +1120,14 @@
         <response name="success" type="view" value="Preferences"/>
         <response name="error" type="view" value="Preferences"/>
     </request-map>
+
+    <!-- GeoLocation-->
+    <request-map uri="PartyGeoLocation">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="PartyGeoLocation"/>
+        <response name="error" type="view" value="viewprofile"/>
+    </request-map>
+    
     <!-- end of request mappings -->
         
     <!-- View Mappings -->
@@ -1234,5 +1242,6 @@
     <view-map name="EditEmploymentApps" type="screen" page="component://humanres/widget/EmploymentAppScreens.xml#EditEmploymentApps"/>
     <view-map name="PartyFinancialHistory" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#PartyFinancialHistory"/>
     <view-map name="Preferences" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#Preferences"/>
+    <view-map name="PartyGeoLocation" type="screen" page="component://party/widget/partymgr/PartyScreens.xml#PartyGeoLocation"/>
     <!-- end of view mappings -->
 </site-conf>

Added: ofbiz/trunk/applications/party/webapp/partymgr/party/geolocation.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/geolocation.ftl?rev=735404&view=auto
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/party/geolocation.ftl (added)
+++ ofbiz/trunk/applications/party/webapp/partymgr/party/geolocation.ftl Sun Jan 18 01:09:32 2009
@@ -0,0 +1,48 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<#if latestGeoPoint?has_content>
+  <#if latestGeoPoint.latitude?has_content && latestGeoPoint.longitude?has_content>
+    ${uiLabelMap.CommonLatitude}${latestGeoPoint.latitude}<br>
+    ${uiLabelMap.CommonLongitude}${latestGeoPoint.longitude}
+    <#if latestGeoPoint.elevation?has_content>
+      <br>${uiLabelMap.CommonElevation}${latestGeoPoint.elevation} ${elevationUomAbbr}
+    </#if>  
+    <#if latestGeoPoint.dataSourceId?has_content>        
+      <#if latestGeoPoint.dataSourceId == "GEOPT_GOOGLE">
+        <div id="map" style="border:1px solid #979797; background-color:#e5e3df; width:400px; height:300px; 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">
+          loadGoogleMap("${latestGeoPoint.latitude}",
+                        "${latestGeoPoint.longitude}",
+                        "<@ofbizUrl>viewprofile?partyId=${partyId}</@ofbizUrl>",
+                        "${uiLabelMap.PartyProfile} ${uiLabelMap.CommonOf} ${partyId}")
+        </script>          
+      <#elseif  latestGeoPoint.dataSourceId == "GEOPT_YAHOO">            
+      <#elseif  latestGeoPoint.dataSourceId == "GEOPT_MICROSOFT">      
+      <#elseif  latestGeoPoint.dataSourceId == "GEOPT_MAPTP">      
+      </#if>  
+    </#if>  
+  </#if>  
+</#if>

Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml Sun Jan 18 01:09:32 2009
@@ -79,6 +79,9 @@
             </condition>
             <link target="PartyFinancialHistory?partyId=${partyId}"/>
         </menu-item>
+        <menu-item name="PartyGeoLocation" title="${uiLabelMap.CommonGeoLocation}">
+            <link target="PartyGeoLocation?partyId=${partyId}"/>
+        </menu-item>
     </menu>
     <menu name="ProfileSubTabBar" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"
           menu-container-style="button-bar button-style-2">

Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml Sun Jan 18 01:09:32 2009
@@ -1155,12 +1155,30 @@
             <widgets>
                 <decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
-                            <screenlet title="${uiLabelMap.CommonPreferences}" >
-                                <include-form name="ListPreference" location="component://party/webapp/partymgr/party/PartyForms.xml"/>
-                            </screenlet>
+                        <screenlet title="${uiLabelMap.CommonPreferences}" >
+                            <include-form name="ListPreference" location="component://party/webapp/partymgr/party/PartyForms.xml"/>
+                        </screenlet>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
         </section>
     </screen>
+    <screen name="PartyGeoLocation">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleViewPartyGeoLocation"/>
+                <set field="partyId"  from-field="parameters.partyId"/>
+                <script location="component://party/webapp/partymgr/WEB-INF/actions/party/GeoLocation.groovy"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <platform-specific>
+                            <html><html-template location="component://party/webapp/partymgr/party/geolocation.ftl"/></html>
+                        </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>    
 </screens>
\ No newline at end of file

Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Sun Jan 18 01:09:32 2009
@@ -902,6 +902,47 @@
         <field name="description" type="description"></field>
         <prim-key field="containerTypeId"/>
     </entity>
+    <entity entity-name="ContainerGeoPoint" package-name="org.ofbiz.product.facility" title="Container Geo Location with history">
+      <field name="containerId" type="id-ne"></field>
+      <field name="geoPointId" type="id-ne"></field>
+      <field name="fromDate" type="date-time"></field>
+      <field name="thruDate" type="date-time"></field>
+      <prim-key field="containerId"/>
+      <prim-key field="geoPointId"/>
+      <prim-key field="fromDate"/>
+      <relation type="one" fk-name="CONTNRGEOPT_CONTNR" rel-entity-name="Container">
+        <key-map field-name="containerId"/>
+      </relation>
+      <relation type="one" fk-name="CONTNRGEOPT_GEOPT" rel-entity-name="GeoPoint">
+        <key-map field-name="geoPointId"/>
+      </relation>
+    </entity>
+    <view-entity entity-name="ContainerAndGeoPoint" package-name="org.ofbiz.product.facility"  title="Container and Geo Point View Entity">
+      <member-entity entity-alias="CT" entity-name="Container"/>
+      <member-entity entity-alias="CTGPT" entity-name="ContainerGeoPoint"/>
+      <member-entity entity-alias="GPT" entity-name="GeoPoint"/>
+      <alias-all entity-alias="GPT"/>    
+      <alias entity-alias="CT" name="containerId"/>
+      <alias entity-alias="CTGPT" name="fromDate"/>
+      <alias entity-alias="CTGPT" name="thruDate"/>
+      <view-link entity-alias="CT" rel-entity-alias="CTGPT">
+        <key-map field-name="containerId"/>
+      </view-link>
+      <view-link entity-alias="CTGPT" rel-entity-alias="GPT">
+        <key-map field-name="geoPointId"/>
+      </view-link>
+      <relation type="many" rel-entity-name="ContainerGeoPoint">
+        <key-map field-name="containerId"/>
+        <key-map field-name="geoPointId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="Container">
+        <key-map field-name="containerId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="GeoPoint">
+        <key-map field-name="geoPointId"/>
+      </relation>
+    </view-entity>
+  
     <entity entity-name="Facility" package-name="org.ofbiz.product.facility" title="Facility Entity">
         <field name="facilityId" type="id-ne"></field>
         <field name="facilityTypeId" type="id"></field>
@@ -917,6 +958,7 @@
         <field name="closedDate" type="date-time"></field>
         <field name="description" type="description"></field>
         <field name="defaultWeightUomId" type="id"></field>
+        <field name="geoPointId" type="id"></field>
         <prim-key field="facilityId"/>
         <relation type="one" fk-name="FACILITY_FCTYP" rel-entity-name="FacilityType">
             <key-map field-name="facilityTypeId"/>
@@ -943,6 +985,9 @@
         <relation type="many" rel-entity-name="FacilityTypeAttr">
             <key-map field-name="facilityTypeId"/>
         </relation>
+        <relation type="one" fk-name="FACILITY_GEOPT" title="Geo Point" rel-entity-name="GeoPoint">
+          <key-map field-name="geoPointId"/>
+        </relation>
     </entity>
     <view-entity entity-name="FacilityAndContactMech" package-name="org.ofbiz.product.facility" title="Facility and Contact Mech View Entity">
         <member-entity entity-alias="FA" entity-name="Facility"/>
@@ -1138,6 +1183,53 @@
             <key-map field-name="locationTypeEnumId" rel-field-name="enumId"/>
         </relation>
     </entity>
+    <entity entity-name="FacilityLocationGeoPoint" package-name="org.ofbiz.product.facility" title="Facility Location Geo Location with history">
+        <field name="facilityId" type="id-ne"></field>
+        <field name="locationSeqId" type="id-ne"></field>
+        <field name="geoPointId" type="id-ne"></field>
+        <field name="fromDate" type="date-time"></field>
+        <field name="thruDate" type="date-time"></field>
+        <prim-key field="facilityId"/>
+        <prim-key field="locationSeqId"/>
+        <prim-key field="geoPointId"/>
+        <prim-key field="fromDate"/>
+        <relation type="one" fk-name="FACLOCGEOPT_FACLOC" rel-entity-name="FacilityLocation">
+            <key-map field-name="facilityId"/>
+            <key-map field-name="locationSeqId"/>
+        </relation>
+        <relation type="one" fk-name="FACLOCGEOPT_GEOPT" rel-entity-name="GeoPoint">
+            <key-map field-name="geoPointId"/>
+        </relation>
+    </entity>
+    <view-entity entity-name="FacilityLocationAndGeoPoint" package-name="org.ofbiz.product.facility"  title="Facility Location and Geo Point View Entity">
+      <member-entity entity-alias="FL" entity-name="FacilityLocation"/>
+      <member-entity entity-alias="FLGPT" entity-name="FacilityLocationGeoPoint"/>
+      <member-entity entity-alias="GPT" entity-name="GeoPoint"/>
+      <alias-all entity-alias="GPT"/>    
+      <alias entity-alias="FL" name="facilityId"/>
+      <alias entity-alias="FL" name="locationSeqId"/>
+      <alias entity-alias="FLGPT" name="fromDate"/>
+      <alias entity-alias="FLGPT" name="thruDate"/>
+      <view-link entity-alias="FL" rel-entity-alias="FLGPT">
+        <key-map field-name="facilityId"/>
+        <key-map field-name="locationSeqId"/>
+      </view-link>
+      <view-link entity-alias="FLGPT" rel-entity-alias="GPT">
+        <key-map field-name="geoPointId"/>
+      </view-link>
+      <relation type="many" rel-entity-name="FacilityLocationGeoPoint">
+        <key-map field-name="facilityId"/>
+        <key-map field-name="locationSeqId"/>
+        <key-map field-name="geoPointId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="FacilityLocation">
+        <key-map field-name="facilityId"/>
+        <key-map field-name="locationSeqId"/>
+      </relation>
+      <relation type="one-nofk" rel-entity-name="GeoPoint">
+        <key-map field-name="geoPointId"/>
+      </relation>
+    </view-entity>  
     <entity entity-name="FacilityParty" package-name="org.ofbiz.product.facility" title="Facility Party Entity">
         <field name="facilityId" type="id"></field>
         <field name="partyId" type="id"></field>

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Sun Jan 18 01:09:32 2009
@@ -1875,6 +1875,10 @@
         <value xml:lang="zh">元素找到了</value>
         <value xml:lang="zh_CN">没找到</value>
     </property>
+    <property key="CommonElevation">
+        <value xml:lang="en">Elevation: </value>
+        <value xml:lang="fr">Elévation : </value>
+    </property>    
     <property key="CommonEmail">
         <value xml:lang="ar">البريد الإلكتروني</value>
         <value xml:lang="de">E-Mail</value>
@@ -2686,6 +2690,10 @@
         <value xml:lang="ru">Geo</value>
         <value xml:lang="th">Geo</value>
     </property>
+    <property key="CommonGeoLocation">
+        <value xml:lang="en">Geolocation</value>
+        <value xml:lang="fr">Géolocalisation</value>
+    </property>            
     <property key="CommonGeos">
         <value xml:lang="de">Geo</value>
         <value xml:lang="en">Geos</value>
@@ -3229,6 +3237,10 @@
         <value xml:lang="zh">最后更新</value>
         <value xml:lang="zh_CN">最后更新</value>
     </property>
+    <property key="CommonLatitude">
+        <value xml:lang="en">Latitude: </value>
+        <value xml:lang="fr">Latitude : </value>
+    </property>
     <property key="CommonLessThan">
         <value xml:lang="de">weniger als</value>
         <value xml:lang="en">less than</value>
@@ -3298,6 +3310,10 @@
         <value xml:lang="zh">全部列表</value>
         <value xml:lang="zh_CN">所有列表</value>
     </property>
+    <property key="CommonLoading">
+        <value xml:lang="en">Loading...</value>
+        <value xml:lang="fr">Chargement...</value>
+    </property>
     <property key="CommonLocalisation">
         <value xml:lang="en">Localisation</value>
         <value xml:lang="es">Opciones locales</value>
@@ -3355,6 +3371,10 @@
         <value xml:lang="zh">退出</value>
         <value xml:lang="zh_CN">注销</value>
     </property>
+    <property key="CommonLongitude">
+        <value xml:lang="en">Longitude: </value>
+        <value xml:lang="fr">Longitude : </value>
+    </property>
     <property key="CommonLookup">
         <value xml:lang="ar">البحث</value>
         <value xml:lang="de">Ansehen</value>
@@ -3401,6 +3421,10 @@
         <value xml:lang="th">เพศชาย</value>
         <value xml:lang="zh">男</value>
     </property>
+    <property key="CommonManagePortalPages">
+        <value xml:lang="en">Manage Portal Pages...</value>
+        <value xml:lang="it">Gestione pagine...</value>
+    </property>
     <property key="CommonManager">
         <value xml:lang="ar">مدير</value>
         <value xml:lang="de">Manager</value>
@@ -5462,6 +5486,60 @@
         <value xml:lang="zh">安全</value>
         <value xml:lang="zh_CN">安全</value>
     </property>
+    <property key="CommonSegmentGroupGeoAbbr">
+        <value xml:lang="en">Abbreviation</value>
+        <value xml:lang="es">Abreviación</value>
+        <value xml:lang="fr">Abbréviation</value>
+        <value xml:lang="it">Abbreviazione</value>
+        <value xml:lang="ro">Abreviere</value>
+        <value xml:lang="th">ชื่อย่อ</value>
+        <value xml:lang="zh">缩写</value>
+    </property>
+    <property key="CommonSegmentGroupGeoCode">
+        <value xml:lang="en">Code</value>
+        <value xml:lang="es">Código</value>
+        <value xml:lang="fr">Code</value>
+        <value xml:lang="it">Codice</value>
+        <value xml:lang="ro">Cod</value>
+        <value xml:lang="th">รหัส</value>
+        <value xml:lang="zh">代码</value>
+    </property>
+    <property key="CommonSegmentGroupGeoId">
+        <value xml:lang="en">Geo ID</value>
+        <value xml:lang="es">Código ubicación</value>
+        <value xml:lang="fr">Réf. de zone géographique</value>
+        <value xml:lang="it">Codice Geografia</value>
+        <value xml:lang="ro">Cod Geografie</value>
+        <value xml:lang="th">รหัสโครงสร้าง</value>
+        <value xml:lang="zh">地理标识</value>
+    </property>
+    <property key="CommonSegmentGroupGeoName">
+        <value xml:lang="en">Name</value>
+        <value xml:lang="es">Nombre</value>
+        <value xml:lang="fr">Nom</value>
+        <value xml:lang="it">Nome</value>
+        <value xml:lang="ro">Nome</value>
+        <value xml:lang="th">ชื่อ</value>
+        <value xml:lang="zh">名称</value>
+    </property>
+    <property key="CommonSegmentGroupGeoSecCode">
+        <value xml:lang="en">Secondary Code</value>
+        <value xml:lang="es">Código secundario</value>
+        <value xml:lang="fr">Code secondaire</value>
+        <value xml:lang="it">Codice Secondario</value>
+        <value xml:lang="ro">Cod Secundar</value>
+        <value xml:lang="th">รหัสที่สอง</value>
+        <value xml:lang="zh">第二代码</value>
+    </property>
+    <property key="CommonSegmentGroupGeoTypeId">
+        <value xml:lang="en">Geo Type ID</value>
+        <value xml:lang="es">Tipo de ubicación</value>
+        <value xml:lang="fr">Réf. de type de zone géographique</value>
+        <value xml:lang="it">Tipo Geografia</value>
+        <value xml:lang="ro">Tip Geografie</value>
+        <value xml:lang="th">รหัสประเภทโครงสร้าง</value>
+        <value xml:lang="zh">地理类型标识</value>
+    </property>
     <property key="CommonSelect">
         <value xml:lang="ar">إختر</value>
         <value xml:lang="de">Auswählen</value>
@@ -5527,10 +5605,6 @@
         <value xml:lang="en">Select Portal Page...</value>
         <value xml:lang="it">Seleziona pagina...</value>
     </property>
-    <property key="CommonManagePortalPages">
-        <value xml:lang="en">Manage Portal Pages...</value>
-        <value xml:lang="it">Gestione pagine...</value>
-    </property>
     <property key="CommonSelected">
         <value xml:lang="ar">مختارة</value>
         <value xml:lang="de">ausgewählt</value>

Modified: ofbiz/trunk/framework/common/data/CommonTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/data/CommonTypeData.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/data/CommonTypeData.xml (original)
+++ ofbiz/trunk/framework/common/data/CommonTypeData.xml Sun Jan 18 01:09:32 2009
@@ -40,7 +40,9 @@
     <DataSourceType dataSourceTypeId="GEOPOINT_SUPPLIER" description="Name of GeoPoints publisher"/>
     <DataSource dataSourceId="GEOPT_GOOGLE" dataSourceTypeId="GEOPOINT_SUPPLIER" description="Google as GeoPoint supplier"/>
     <DataSource dataSourceId="GEOPT_YAHOO" dataSourceTypeId="GEOPOINT_SUPPLIER" description="Yahoo as GeoPoint supplier"/>
-        
+    <DataSource dataSourceId="GEOPT_MICROSOFT" dataSourceTypeId="GEOPOINT_SUPPLIER" description="Microsoft as GeoPoint supplier"/>
+    <DataSource dataSourceId="GEOPT_MAPTP" dataSourceTypeId="GEOPOINT_SUPPLIER" description="MapTP a GeoPoint supplier"/>
+    
     <StatusType statusTypeId="_NA_" description="Not Applicable"/>
     <StatusItem statusId="_NA_" statusTypeId="_NA_" statusCode="_NA_" sequenceId="0" description="Not Applicable"/>
 

Modified: ofbiz/trunk/framework/common/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/entitydef/entitymodel.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/common/entitydef/entitymodel.xml Sun Jan 18 01:09:32 2009
@@ -156,6 +156,7 @@
       <field name="geoCode" type="short-varchar"></field>
       <field name="geoSecCode" type="short-varchar"></field>
       <field name="abbreviation" type="short-varchar"></field>
+      <field name="wellKnownText" type="very-long"></field>
       <prim-key field="geoId"/>
       <relation type="one" fk-name="GEO_TO_TYPE" rel-entity-name="GeoType">
         <key-map field-name="geoTypeId"/>
@@ -205,7 +206,24 @@
         <key-map field-name="parentTypeId" rel-field-name="geoTypeId"/>
       </relation>
     </entity>
-
+  <entity entity-name="GeoPoint" package-name="org.ofbiz.common.geo" default-resource-name="CommonEntityLabels"
+    title="Geographic Location">
+    <field name="geoPointId" type="id-ne"></field>
+    <field name="dataSourceId" type="id"></field>
+    <field name="latitude" type="floating-point" not-null="true"></field>
+    <field name="longitude" type="floating-point" not-null="true"></field>
+    <field name="elevation" type="floating-point"></field>
+    <field name="uomId" type="id"><description>We need an UOM for elevation (feet, meters, etc.)</description></field>
+    <field name="information" type="comment"><description>To enter any related information</description></field>
+    <prim-key field="geoPointId"/>
+    <relation type="one" fk-name="GEOPOINT_DTSRC" rel-entity-name="DataSource">
+      <key-map field-name="dataSourceId"/>
+    </relation>
+    <relation type="one" fk-name="GPT_TYPE_UOM" rel-entity-name="Uom">
+      <key-map field-name="uomId"/>
+    </relation>    
+  </entity>
+    
   <!-- ========================================================= -->
   <!-- org.ofbiz.common.keyword -->
   <!-- ========================================================= -->

Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=735404&r1=735403&r2=735404&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Jan 18 01:09:32 2009
@@ -119,6 +119,7 @@
                 <set field="layoutSettings.javaScripts[]" value="/images/selectall.js" global="true"/>
                 <set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/>
                 <set field="layoutSettings.javaScripts[]" value="/images/calendar_date_select.js" global="true"/>
+                <set field="layoutSettings.javaScripts[]" value="/images/googlemap.js" global="true"/>
                 <set field="layoutSettings.commonHeaderImageLinkUrl" from-field="layoutSettings.commonHeaderImageLinkUrl" default-value="main" global="true"/>
                 <service service-name="getUserPreferenceGroup" result-map-name="prefResult">
                     <field-map field-name="userPrefGroupTypeId" value="GLOBAL_PREFERENCES"/>

Added: ofbiz/trunk/framework/images/webapp/images/googlemap.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/images/webapp/images/googlemap.js?rev=735404&view=auto
==============================================================================
--- ofbiz/trunk/framework/images/webapp/images/googlemap.js (added)
+++ ofbiz/trunk/framework/images/webapp/images/googlemap.js Sun Jan 18 01:09:32 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// A basic Google Map function to render a marker centered on a map with little text(s) and optionnal link(s) within...
+
+function loadGoogleMap(lat,lgt, link1, text1, link2, text2) {
+    if (GBrowserIsCompatible()) {
+        lat = lat.replace(",","."); // For decimals separator, in French for instance, please add more if needed
+        lgt = lgt.replace(",","."); // For decimals separator, in French for instance, please add more if needed
+        map = new GMap2(document.getElementById("map"));
+        map.setCenter(new GLatLng(lat, lgt), 13);        
+        marker = new GMarker(new GLatLng(lat, lgt));
+        map.setCenter(new GLatLng(lat, lgt), 13);
+        map.addControl(new GSmallMapControl());
+        map.addOverlay(marker);
+        info1 = typeof(link1)!="undefined" && typeof(text1)!="undefined";
+        info2 = typeof(link2)!="undefined" && typeof(text2)!="undefined";
+        html = '<div style="width:210px; padding-right:10px;">';
+        if (info1 || info2) {
+            if (info1) {
+                html = html + '<a href=' + link1 + '>' + text1 + '</a>';
+            }
+            if (info2) {
+                html = html + '<a href=' + link2 + '>' + text2 + '</a>';
+            }
+            html = html + '.</div>';
+        } else {
+            html = html + 'No specific information.</div>';
+        }
+        marker.openInfoWindowHtml(html);        
+    }
+}
\ No newline at end of file