|
Author: buscob
Date: Sun Dec 20 09:41:03 2009 New Revision: 892579 URL: http://svn.apache.org/viewvc?rev=892579&view=rev Log: Added the geoChart common screen. (OFBIZ-3348) This can be used to show a set of geo points on a Google map. The screen takes as input a geoChart map containing: * dataSourceId -> select the map system to be used (google, yahoo etc.) * width -> map dimensions * height -> map dimensions * center -> the center point of the map * points -> the points array to be showed on the map Several example screens have been also added to the Example application Added: ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml ofbiz/trunk/framework/example/widget/example/CommonScreens.xml ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml Added: ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl?rev=892579&view=auto ============================================================================== --- ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl (added) +++ ofbiz/trunk/framework/common/webcommon/includes/geolocation.ftl Sun Dec 20 09:41:03 2009 @@ -0,0 +1,49 @@ +<#-- +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 geoChart?has_content> + <#if geoChart.dataSourceId?has_content> + <#if geoChart.dataSourceId == "GEOPT_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&v=2&key=${defaultGogleMapKey}" type="text/javascript"></script> + <script type="text/javascript"> + if (GBrowserIsCompatible()) { + var map = new GMap2(document.getElementById("<#if geoChart.id?has_content>${geoChart.id}<#else>map_canvas</#if>")); + <#if geoChart.center?has_content> + map.setCenter(new GLatLng(${geoChart.center.lat?c}, ${geoChart.center.lon?c}), ${geoChart.center.zoom}); + <#else> + 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> + } + </script> + <#elseif geoChart.dataSourceId == "GEOPT_YAHOO"> + <#elseif geoChart.dataSourceId == "GEOPT_MICROSOFT"> + <#elseif geoChart.dataSourceId == "GEOPT_MAPTP"> + </#if> + </#if> +<#else> + <h2>${uiLabelMap.CommonNoGeolocationAvailable}</h2> +</#if> Modified: ofbiz/trunk/framework/common/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/CommonScreens.xml?rev=892579&r1=892578&r2=892579&view=diff ============================================================================== --- ofbiz/trunk/framework/common/widget/CommonScreens.xml (original) +++ ofbiz/trunk/framework/common/widget/CommonScreens.xml Sun Dec 20 09:41:03 2009 @@ -501,4 +501,16 @@ </section> </screen> + <screen name="geoChart"> + <section> + <actions> + <set field="titleProperty" value="PageTitleCommonGeoLocation"/> + </actions> + <widgets> + <platform-specific> + <html><html-template location="component://common/webcommon/includes/geolocation.ftl"/></html> + </platform-specific> + </widgets> + </section> + </screen> </screens> 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=892579&r1=892578&r2=892579&view=diff ============================================================================== --- ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml (original) +++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml Sun Dec 20 09:41:03 2009 @@ -210,6 +210,12 @@ <security https="true" auth="false"/> <response name="success" type="request" value="main"/> </request-map> + + <request-map uri="ExampleGeoLocationPointSet1"><security https="true" auth="true"/><response name="success" type="view" value="ExampleGeoLocationPointSet1"/></request-map> + <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> + <!-- end of request mappings --> <!-- View Mappings --> @@ -237,5 +243,10 @@ <view-map name="printExampleFOPFonts" type="screenfop" page="component://example/widget/example/FormWidgetExampleScreens.xml#printExampleFOPFonts" content-type="application/pdf" encoding="none"/> <view-map name="showHelp" type="screen" page="component://commonext/widget/HelpScreens.xml#ShowHelp"/> <view-map name="ShowDocument" type="screen" page="component://commonext/widget/HelpScreens.xml#showDocument"/> + + <view-map name="ExampleGeoLocationPointSet1" type="screen" page="component://example/widget/example/ExampleScreens.xml#ExampleGeoLocationPointSet1"/> + <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"/> <!-- end of view mappings --> </site-conf> Modified: ofbiz/trunk/framework/example/widget/example/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/CommonScreens.xml?rev=892579&r1=892578&r2=892579&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/CommonScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/CommonScreens.xml Sun Dec 20 09:41:03 2009 @@ -179,6 +179,29 @@ </section> </screen> + <screen name="CommonExampleGeoLocationDecorator"> + <section> + <actions> + <set field="headerItem" value="ExampleGeoLocation"/> + <set field="geoChart.dataSourceId" value="GEOPT_GOOGLE"/> + <set field="geoChart.width" value="600"/> + <set field="geoChart.height" value="500"/> + <set field="geoChart.points" from-field="geoPoints"/> + <set field="geoChart.center" from-field="geoCenter"/> + </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"> + <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="main"> <!-- This is the screen for the Main page in the Example component. A common pattern in OFBiz is to have each component include a Main page as a starting point for Modified: ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml?rev=892579&r1=892578&r2=892579&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml Sun Dec 20 09:41:03 2009 @@ -32,6 +32,10 @@ <parameter param-name="parentPortalPageId" from-field="parameters.parentPortalPageId"/> </link> </menu-item> + <menu-item name="ExampleGeoLocation" title="${uiLabelMap.CommonGeoLocation}"> + <link target="ExampleGeoLocationPointSet1"> + </link> + </menu-item> </menu> <menu name="EditExample" default-selected-style="selected" type="simple" @@ -67,4 +71,22 @@ </menu-item> </menu> + <menu name="ExampleGeoLocation" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml"> + <menu-item name="ExampleGeoLocationPointSet1" title="${uiLabelMap.PointSet1}"> + <link target="ExampleGeoLocationPointSet1"> + </link> + </menu-item> + <menu-item name="ExampleGeoLocationPointSet2" title="${uiLabelMap.PointSet2}"> + <link target="ExampleGeoLocationPointSet2"> + </link> + </menu-item> + <menu-item name="ExampleGeoLocationPointSet3" title="${uiLabelMap.PointSet3}"> + <link target="ExampleGeoLocationPointSet3"> + </link> + </menu-item> + <menu-item name="ExampleGeoLocationPointSet4" title="${uiLabelMap.PointSet4}"> + <link target="ExampleGeoLocationPointSet4"> + </link> + </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=892579&r1=892578&r2=892579&view=diff ============================================================================== --- ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml (original) +++ ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml Sun Dec 20 09:41:03 2009 @@ -25,7 +25,6 @@ <screen name="FindExample"> <section> <actions> - <set field="headerItem" value="Example"/> <set field="titleProperty" value="PageTitleFindExample"/> <set field="exampleCtx" from-field="parameters"/> </actions> @@ -149,4 +148,135 @@ </section> </screen> + <screen name="ExampleGeoLocationPointSet1"> + <section> + <actions> + <set field="tabButtonItem" value="ExampleGeoLocationPointSet1"/> + <set field="geoPoints[+0].lat" value="37,4419" type="Float"/> + <set field="geoPoints[0].lon" value="-122,1419" type="Float"/> + <set field="geoPoints[+1].lat" value="37,4819" type="Float"/> + <set field="geoPoints[1].lon" value="-122,1519" type="Float"/> + <set field="geoPoints[+2].lat" value="37,4719" type="Float"/> + <set field="geoPoints[2].lon" value="-122,1319" type="Float"/> + <set field="geoCenter.lat" value="37,4419" type="Float"/> + <set field="geoCenter.lon" value="-122,1419" type="Float"/> + <set field="geoCenter.zoom" value="13"/> + </actions> + <widgets> + <decorator-screen name="CommonExampleGeoLocationDecorator" location="${parameters.mainDecoratorLocation}"> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="ExampleGeoLocationPointSet2"> + <section> + <actions> + <set field="tabButtonItem" value="ExampleGeoLocationPointSet2"/> + <set field="geoPoints[+0].lat" value="37,4459" type="Float"/> + <set field="geoPoints[0].lon" value="-122,1489" type="Float"/> + <set field="geoPoints[+1].lat" value="37,4829" type="Float"/> + <set field="geoPoints[1].lon" value="-122,1599" type="Float"/> + <set field="geoPoints[+2].lat" value="37,4769" type="Float"/> + <set field="geoPoints[2].lon" value="-122,1219" type="Float"/> + <set field="geoCenter.lat" value="37,4419" type="Float"/> + <set field="geoCenter.lon" value="-122,1419" type="Float"/> + <set field="geoCenter.zoom" value="12"/> + </actions> + <widgets> + <decorator-screen name="CommonExampleGeoLocationDecorator" location="${parameters.mainDecoratorLocation}"> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="ExampleGeoLocationPointSet3"> + <section> + <actions> + <set field="tabButtonItem" value="ExampleGeoLocationPointSet3"/> + <set field="geoPoints[+0].lat" value="37,4379" type="Float"/> + <set field="geoPoints[0].lon" value="-122,1119" type="Float"/> + <set field="geoPoints[+1].lat" value="37,4819" type="Float"/> + <set field="geoPoints[1].lon" value="-122,1519" type="Float"/> + <set field="geoPoints[+2].lat" value="37,4229" type="Float"/> + <set field="geoPoints[2].lon" value="-122,1369" type="Float"/> + <set field="geoCenter.lat" value="37,4419" type="Float"/> + <set field="geoCenter.lon" value="-122,1419" type="Float"/> + <set field="geoCenter.zoom" value="11"/> + </actions> + <widgets> + <decorator-screen name="CommonExampleGeoLocationDecorator" location="${parameters.mainDecoratorLocation}"> + </decorator-screen> + </widgets> + </section> + </screen> + <screen name="ExampleGeoLocationPointSet4"> + <section> + <actions> + <set field="tabButtonItem" value="ExampleGeoLocationPointSet4"/> + <set field="geoChart.dataSourceId" value="GEOPT_GOOGLE"/> + <set field="geoChart.width" value="600"/> + <set field="geoChart.height" value="500"/> + <set field="geoChart.points" from-field="geoPoints"/> + <set field="geoChart.center" from-field="geoCenter"/> + </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> + <section> + <actions> + <set field="geoPoints[+0].lat" value="37,4459" type="Float"/> + <set field="geoPoints[0].lon" value="-122,1489" type="Float"/> + <set field="geoPoints[+1].lat" value="37,4829" type="Float"/> + <set field="geoPoints[1].lon" value="-122,1599" type="Float"/> + <set field="geoPoints[+2].lat" value="37,4769" type="Float"/> + <set field="geoPoints[2].lon" value="-122,1219" type="Float"/> + <set field="geoCenter.lat" value="37,4419" type="Float"/> + <set field="geoCenter.lon" value="-122,1419" type="Float"/> + <set field="geoCenter.zoom" value="12"/> + <set field="geoChart.id" value="chart1"/> + <set field="geoChart.dataSourceId" value="GEOPT_GOOGLE"/> + <set field="geoChart.width" value="600"/> + <set field="geoChart.height" value="500"/> + <set field="geoChart.points" from-field="geoPoints"/> + <set field="geoChart.center" from-field="geoCenter"/> + </actions> + <widgets> + <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/> + </widgets> + </section> + <section> + <actions> + <set field="geoPoints" value=""/> + <set field="geoPoints[+0].lat" value="37,4379" type="Float"/> + <set field="geoPoints[0].lon" value="-122,1119" type="Float"/> + <set field="geoPoints[+1].lat" value="37,4819" type="Float"/> + <set field="geoPoints[1].lon" value="-122,1519" type="Float"/> + <set field="geoPoints[+2].lat" value="37,4229" type="Float"/> + <set field="geoPoints[2].lon" value="-122,1369" type="Float"/> + <set field="geoCenter.lat" value="37,4419" type="Float"/> + <set field="geoCenter.lon" value="-122,1419" type="Float"/> + <set field="geoCenter.zoom" value="11"/> + <set field="geoChart.id" value="chart2"/> + <set field="geoChart.dataSourceId" value="GEOPT_GOOGLE"/> + <set field="geoChart.width" value="800"/> + <set field="geoChart.height" value="500"/> + <set field="geoChart.points" from-field="geoPoints"/> + <set field="geoChart.center" from-field="geoCenter"/> + </actions> + <widgets> + <include-screen name="geoChart" location="component://common/widget/CommonScreens.xml"/> + </widgets> + </section> + </widgets> + </section> + </decorator-section> + </decorator-screen> + </widgets> + </section> + </screen> + </screens> |
| Free forum by Nabble | Edit this page |
