OK, forgot https://issues.apache.org/jira/browse/OFBIZ-5453
Jacques On Tuesday, December 31, 2013 7:11 PM jacques.le.r...@les7arts.com wrote > It seems that geolocation does not work properly in R13.07 (no conflicts) and > R12.04 (2 small conflicts handled, R11.04 had too > much conflicts: not merged) I will check that later > > Jacques > > On Tuesday, December 31, 2013 4:23 PM jler...@apache.org wrote >> Author: jleroux >> Date: Tue Dec 31 15:23:32 2013 >> New Revision: 1554538 >> >> URL: http://svn.apache.org/r1554538 >> Log: >> "Applied fix from trunk for revision: 1554536 " >> ------------------------------------------------------------------------ >> r1554536 | jleroux | 2013-12-31 16:22:21 +0100 (mar. 31 déc. 2013) | 10 >> lignes >> >> This fixes the geolocation in OFBiz, for both Google Maps and OpenLayers. It >> seems few changes, it took me more time than I >> thought. I hope this will last few years again, and it should be easier to >> maintain now. >> >> What I did: >> Upgraded from Google Maps API 2 to 3, which also means removing the keys in >> general.properties. They are no longer needed in >> API-3 (at least for our demo and local test uses), one worry less! >> Refactored Google Maps code in geolocation.ftl: put more things in common, >> simplified code (the API-3 is better from this POV). >> >> For OpenLayers, due to most browsers now rejecting mixed content (HTTP vs >> HTTPS), I had to follow their advice and put >> OpenLayers-2.13.1.js + images and theme(finally not used) in the framework. >> Not a big deal in term of size but again one more lib >> to worry about. Anyway geolocation is not vital for OFBiz. I have also added >> a zoom and navigation widget in maps. Note that IE >> warns about mixed content, but you can bypass it. >> >> While working on editGeoLocation (in Party) I noticed it does not update the >> elevation. I found it was possible >> http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm but I did not >> implement it, lack of time... >> Also I got once a NPE in CallSimpleMapProcessor (when using editGeoLocation) >> but was unable to reproduce (w/o changes before and >> after) >> ------------------------------------------------------------------------ >> >> >> Added: >> >> ofbiz/branches/release13.07/framework/images/webapp/images/OpenLayers-2.13.1.js >> - copied unchanged from r1554536, >> ofbiz/trunk/framework/images/webapp/images/OpenLayers-2.13.1.js >> ofbiz/branches/release13.07/framework/images/webapp/images/img/ >> - copied from r1554536, ofbiz/trunk/framework/images/webapp/images/img/ >> >> ofbiz/branches/release13.07/framework/images/webapp/images/theme.openlayer.unused.ootb/ >> - copied from r1554536, >> ofbiz/trunk/framework/images/webapp/images/theme.openlayer.unused.ootb/ >> Modified: >> ofbiz/branches/release13.07/ (props changed) >> >> ofbiz/branches/release13.07/applications/party/script/org/ofbiz/party/party/PartySimpleEvents.xml >> >> ofbiz/branches/release13.07/applications/party/webapp/partymgr/party/editGeoLocation.ftl >> ofbiz/branches/release13.07/framework/common/config/general.properties >> >> ofbiz/branches/release13.07/framework/common/webcommon/includes/geolocation.ftl >> ofbiz/branches/release13.07/framework/common/widget/CommonScreens.xml >> ofbiz/branches/release13.07/specialpurpose/build.xml >> ofbiz/branches/release13.07/specialpurpose/component-load.xml >> >> Propchange: ofbiz/branches/release13.07/ >> ------------------------------------------------------------------------------ >> Merged /ofbiz/trunk:r1554536 >> >> Modified: >> ofbiz/branches/release13.07/applications/party/script/org/ofbiz/party/party/PartySimpleEvents.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/party/script/org/ofbiz/party/party/PartySimpleEvents.xml?rev=1554538&r1=1554537&r2=1554538&view=diff >> ============================================================================== >> --- >> ofbiz/branches/release13.07/applications/party/script/org/ofbiz/party/party/PartySimpleEvents.xml >> (original) +++ >> ofbiz/branches/release13.07/applications/party/script/org/ofbiz/party/party/PartySimpleEvents.xml >> Tue Dec 31 15:23:32 2013 @@ >> -134,7 +134,7 @@ under the License. <result-to-field >> result-name="geoPointId" field="geoPointId"/> >> </call-service> >> >> - <now-timestamp field="nowTimestamp"/> >> + <now field="nowTimestamp"/> >> <make-value value-field="partyGeoPoint" >> entity-name="PartyGeoPoint"/> >> <set field="partyGeoPoint.partyId" >> from-field="parameters.partyId"/> >> <set field="partyGeoPoint.geoPointId" from-field="geoPointId"/> >> >> Modified: >> ofbiz/branches/release13.07/applications/party/webapp/partymgr/party/editGeoLocation.ftl >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/party/webapp/partymgr/party/editGeoLocation.ftl?rev=1554538&r1=1554537&r2=1554538&view=diff >> ============================================================================== >> --- >> ofbiz/branches/release13.07/applications/party/webapp/partymgr/party/editGeoLocation.ftl >> (original) +++ >> ofbiz/branches/release13.07/applications/party/webapp/partymgr/party/editGeoLocation.ftl >> Tue Dec 31 15:23:32 2013 @@ -17,95 >> +17,106 @@ specific language governing permissions >> under the License. >> --> >> >> -<#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 src="https://maps.googleapis.com/maps/api/js?sensor=false" >> type="text/javascript"></script> >> <script type="text/javascript"> >> function load() { >> - if (GBrowserIsCompatible()) { >> - var map = new GMap2(document.getElementById("map")); >> - map.addControl(new GSmallMapControl()); >> - map.addControl(new GMapTypeControl()); >> - var center = new GLatLng(${latitude?if_exists}, >> ${longitude?if_exists}); >> - map.setCenter(center, 15); >> - geocoder = new GClientGeocoder(); >> - var marker = new GMarker(center, {draggable: true}); >> + var geocoder = new google.maps.Geocoder(); >> + var center = new google.maps.LatLng(${latitude!38}, >> ${longitude!15}); >> + var map = new google.maps.Map(document.getElementById("map"), >> + { center: center, >> + zoom: 15, // 0=World, 19=max zoom in >> + mapTypeId: google.maps.MapTypeId.ROADMAP >> + }); >> + >> + var marker = new google.maps.Marker({ >> + position: center, >> + map: map, >> + draggable: true >> + }); >> + >> + document.getElementById("lat").value = center.lat().toFixed(5); >> + document.getElementById("lng").value = center.lng().toFixed(5); >> + >> + google.maps.event.addListener(marker, "dragend", function() { >> + var point = marker.getPosition(); >> + map.panTo(point); >> + document.getElementById("lat").value = point.lat().toFixed(5); >> + document.getElementById("lng").value = point.lng().toFixed(5); >> + }); >> + >> + >> + google.maps.event.addListener(map, "moveend", function() { >> + map.clearOverlays(); >> + var center = map.getCenter(); >> + var marker = new GMarker(center, {draggable: true}); >> map.addOverlay(marker); >> document.getElementById("lat").value = center.lat().toFixed(5); >> document.getElementById("lng").value = center.lng().toFixed(5); >> - >> - GEvent.addListener(marker, "dragend", function() { >> - var point = marker.getPoint(); >> - map.panTo(point); >> - document.getElementById("lat").value = >> point.lat().toFixed(5); >> - document.getElementById("lng").value = >> point.lng().toFixed(5); >> - }); >> - >> - GEvent.addListener(map, "moveend", function() { >> - map.clearOverlays(); >> - var center = map.getCenter(); >> - var marker = new GMarker(center, {draggable: true}); >> - map.addOverlay(marker); >> - document.getElementById("lat").value = >> center.lat().toFixed(5); >> - document.getElementById("lng").value = >> center.lng().toFixed(5); >> + }); >> >> - GEvent.addListener(marker, "dragend", function() { >> - var point =marker.getPoint(); >> - map.panTo(point); >> - document.getElementById("lat").value = >> point.lat().toFixed(5); >> - document.getElementById("lng").value = >> point.lng().toFixed(5); >> - }); >> - }); >> - } >> + google.maps.event.addListener(marker, "dragend", function() { >> + var point = marker.getPoint(); >> + map.panTo(point); >> + document.getElementById("lat").value = point.lat().toFixed(5); >> + document.getElementById("lng").value = point.lng().toFixed(5); >> + }); >> } >> >> function showAddress(address) { >> - var map = new GMap2(document.getElementById("map")); >> - map.addControl(new GSmallMapControl()); >> - map.addControl(new GMapTypeControl()); >> + var map = new google.maps.Map(document.getElementById("map"), >> + { center: new google.maps.LatLng(${latitude!38}, ${longitude!15}), >> + zoom: 15, // 0=World, 19=max zoom in >> + mapTypeId: google.maps.MapTypeId.ROADMAP >> + }); >> + var geocoder = new google.maps.Geocoder(); >> if (geocoder) { >> - geocoder.getLatLng( >> - address, >> - function(point) { >> - if (!point) { >> - alert(address + " not found"); >> - } else { >> - document.getElementById("lat").value = >> point.lat().toFixed(5); >> - document.getElementById("lng").value = >> point.lng().toFixed(5); >> - map.clearOverlays() >> - map.setCenter(point, 14); >> - var marker = new GMarker(point, {draggable: true}); >> + geocoder.geocode({'address': address}, function(result, status) >> { >> + if (status != google.maps.GeocoderStatus.OK) { >> + >> showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonAddressNotFound}"); >> + } else { >> + var point = result[0].geometry.location; >> + var lat = point.lat().toFixed(5); >> + var lng = point.lng().toFixed(5); >> + document.getElementById("lat").value = lat; >> + document.getElementById("lng").value = lng; >> + //map.clearOverlays() >> + map.setCenter(point, 14); >> + >> + var marker = new google.maps.Marker({ >> + position: new google.maps.LatLng(lat, lng), >> + map: map, >> + draggable: true >> + }); >> + >> + google.maps.event.addListener(marker, "dragend", function() >> { >> + var point = marker.getPosition(); >> + map.panTo(point); >> + document.getElementById("lat").value = >> point.lat().toFixed(5); >> + document.getElementById("lng").value = >> point.lng().toFixed(5); >> + }); >> + >> + google.maps.event.addListener(map, "moveend", function() { >> + //map.clearOverlays(); >> + var center = map.getCenter(); >> + var marker = new google.maps.Marker(center, {draggable: >> true}); >> map.addOverlay(marker); >> - >> - GEvent.addListener(marker, "dragend", function() { >> - var pt = marker.getPoint(); >> - map.panTo(pt); >> - document.getElementById("lat").value = >> pt.lat().toFixed(5); >> - document.getElementById("lng").value = >> pt.lng().toFixed(5); >> - }); >> - >> - GEvent.addListener(map, "moveend", function() { >> - map.clearOverlays(); >> - var center = map.getCenter(); >> - var marker = new GMarker(center, {draggable: true}); >> - map.addOverlay(marker); >> - document.getElementById("lat").value = >> center.lat().toFixed(5); >> - document.getElementById("lng").value = >> center.lng().toFixed(5); >> - >> - GEvent.addListener(marker, "dragend", function() { >> - var pt = marker.getPoint(); >> - map.panTo(pt); >> - document.getElementById("lat").value = >> pt.lat().toFixed(5); >> - document.getElementById("lng").value = >> pt.lng().toFixed(5); >> - }); >> - }); >> - } >> - }); >> + document.getElementById("lat").value = >> center.lat().toFixed(5); >> + document.getElementById("lng").value = >> center.lng().toFixed(5); >> + }); >> + >> + google.maps.event.addListener(marker, "dragend", function() >> { >> + var pt = marker.getPoint(); >> + map.panTo(pt); >> + document.getElementById("lat").value = >> pt.lat().toFixed(5); >> + document.getElementById("lng").value = >> pt.lng().toFixed(5); >> + }); >> + } >> + }); >> } >> } >> </script> >> >> -<body onload="load()" onunload="GUnload()" > >> +<body onload="load()"> >> <center> >> <div align="center" id="map" style="border:1px solid #979797; >> background-color:#e5e3df; width:500px; height:450px; >> margin:2em auto;"><br/></div> <form action="#" >> onsubmit="showAddress(this.address.value); return false"> >> @@ -116,7 +127,7 @@ under the License. >> <form id="updateMapForm" method="post" >> action="<@ofbizUrl>editGeoLocation</@ofbizUrl>"> >> <input type="hidden" name="partyId" >> value="${partyId?if_exists}"/> >> <input type="hidden" name="geoPointId" >> value="${geoPointId?if_exists}"/> >> - <input type="hidden" name="lat" id="lat"/> >> + <input type="hidden" name="lat" id="lat"/> >> <input type="hidden" name="lng" id="lng"/> >> <input type="submit" id="createMapButton" class="smallSubmit" >> value="${uiLabelMap.CommonSubmit}"> >> </form> >> >> Modified: >> ofbiz/branches/release13.07/framework/common/config/general.properties >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/common/config/general.properties?rev=1554538&r1=1554537&r2=1554538&view=diff >> ============================================================================== >> --- >> ofbiz/branches/release13.07/framework/common/config/general.properties >> (original) +++ >> ofbiz/branches/release13.07/framework/common/config/general.properties Tue >> Dec 31 15:23:32 2013 @@ -128,13 +128,6 @@ >> http.upload.max.size=-1 >> mail.spam.name=X-Spam-Flag >> mail.spam.value=YES >> >> -# -- Google Map key (by domain, see >> http://code.google.com/intl/en/apis/maps/signup.html, note that it works for >> http://localhost) >> -https.demo-trunk.ofbiz.apache.org=ABQIAAAAtt0d8djaYFkk8N5LJVcDSBTl26GJHIFzHZYG8GNWSTKWDUTxchRLjgT9hY3-DDYk27lvZS84RH4aiQ >> -https.demo-stable.ofbiz.apache.org=ABQIAAAAtt0d8djaYFkk8N5LJVcDSBR8L_-1UdAfCE2bleqTaEvMtKARZxSrkTzKktKY2_Znm0TRq2DF4YhGPg >> - >> -https.localhost=ABQIAAAAtt0d8djaYFkk8N5LJVcDSBQN-clGH2vvMMwJjYtcwF78UzZgEBTN70S6uIgRoAtXRkADNoesbw5etg >> -http.localhost=ABQIAAAAtt0d8djaYFkk8N5LJVcDSBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxR3euHYk9bpwvdF2Qg1EYO1LQitHA >> - >> # -- 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 >> >> >> Modified: >> ofbiz/branches/release13.07/framework/common/webcommon/includes/geolocation.ftl >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/common/webcommon/includes/geolocation.ftl?rev=1554538&r1=1554537&r2=1554538&view=diff >> ============================================================================== >> --- >> ofbiz/branches/release13.07/framework/common/webcommon/includes/geolocation.ftl >> (original) +++ >> ofbiz/branches/release13.07/framework/common/webcommon/includes/geolocation.ftl >> Tue Dec 31 15:23:32 2013 @@ -17,93 +17,111 @@ >> specific language governing permissions >> under the License. >> --> >> <#if geoChart?has_content> >> + <#-- ================================= Golbal Init >> ======================================--> >> + <#if geoChart.id?has_content> >> + <#assign id = geoChart.id> >> + <#else> >> + <#assign id = "map_canvas"> >> + </#if> >> + >> + <#if geoChart.center?has_content> >> + <#assign center = geoChart.center> >> + <#assign zoom = geoChart.center.zoom> >> + <#elseif geoChart.points?has_content> >> + <#assign center = geoChart.points[0]> >> + <#assign zoom = 15> <#-- 0=World, 19=max zoom in --> >> + <#else> >> + <#-- hardcoded in GEOPT_ADDRESS_GOOGLE, simpler --> >> + </#if> >> + >> + <#-- ================================= Google Maps Init >> ======================================--> >> <#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}; >> height:${geoChart.height}; margin:2em auto;"> + <#if >> geoChart.dataSourceId?substring(geoChart.dataSourceId?length-6 , >> geoChart.dataSourceId?length) == "GOOGLE"> + <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> >> - <#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> >> - <#if geoChart.points?has_content> >> - var latlng = [ >> - <#list geoChart.points as point> >> - new GLatLng(${point.lat?c}, ${point.lon?c})<#if >> point_has_next>,</#if> >> - </#list> >> - ]; >> - var latlngbounds = new GLatLngBounds(); >> - for (var i = 0; i < latlng.length; i++) { >> - latlngbounds.extend(latlng[i]); >> + <script src="https://maps.googleapis.com/maps/api/js?sensor=false" >> type="text/javascript"></script> >> + </#if> >> + >> + <#-- ================================= Here we go with different >> types of maps renderer >> ======================================--> + <#if geoChart.dataSourceId >> == "GEOPT_GOOGLE"> >> + <script type="text/javascript"> >> + function showAllMarkers(map, points) { >> + if (points.length > 1) { >> + var latlngbounds = new google.maps.LatLngBounds(); >> + for (var i = 0; i < latlngs.length; i++) { >> + latlngbounds.extend(latlngs[i]); >> + } >> + map.fitBounds(latlngbounds); >> } >> - map.setCenter(latlngbounds.getCenter(), Math.min (15, >> map.getBoundsZoomLevel(latlngbounds)));//reduce bounds >> zoom level to see all markers >> - <#else> >> - map.setCenter(new GLatLng(0, 0), 1); >> - map.setZoom(15); // 0=World, 19=max zoom in >> - </#if> >> - </#if> >> - <#if geoChart.controlUI?has_content && geoChart.controlUI == >> "small"> >> - map.addControl(new GSmallMapControl()); >> - <#else> >> - map.setUIToDefault(); >> - </#if> >> + } >> + >> + var map = new google.maps.Map(document.getElementById("${id}"), >> <#if geoChart.points?has_content> >> + { center: new google.maps.LatLng(${center.lat?c}, >> ${center.lon?c}), >> + zoom: ${zoom}, >> + mapTypeId: google.maps.MapTypeId.ROADMAP >> + }); >> + <#list geoChart.points as point> >> + var marker_${point_index} = new google.maps.Marker({ >> + position: new google.maps.LatLng(${point.lat?c}, >> ${point.lon?c}), >> + map: map >> + }); >> + <#if point.link?has_content> >> + var infoWindow = new google.maps.InfoWindow(); >> + google.maps.event.addListener(marker_${point_index}, >> "click", function() { >> + infoWindow.setContent(("<div style=\"width:210px; >> padding-right:10px;\"><a >> href=${point.link.url}>${point.link.label}</a></div>")); + >> infoWindow.setPosition(marker_${point_index}.getPosition()); + >> infoWindow.open(map); >> + }); >> + </#if> >> + </#list> >> + var latlngs = [ >> <#list geoChart.points as point> >> - var marker_${point_index} = new GMarker(new >> GLatLng(${point.lat?c}, ${point.lon?c})); >> - map.addOverlay(marker_${point_index}); >> - //map.addOverlay(new GMarker(new GLatLng(${point.lat?c}, >> ${point.lon?c}))); >> - <#if point.link?has_content> >> - GEvent.addListener(marker_${point_index}, "click", >> function() { >> - marker_${point_index}.openInfoWindowHtml("<div >> style=\"width:210px; padding-right:10px;\"><a >> href=${point.link.url}>${point.link.label}</a></div>"); >> - }); >> - </#if> >> + new google.maps.LatLng(${point.lat?c}, >> ${point.lon?c})<#if point_has_next>,</#if> >> </#list> >> + ]; >> + showAllMarkers(map, latlngs); >> </#if> >> - } >> - --></script> >> + </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&v=2&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) { >> showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonAddressNotFound}");} >> - map.setUIToDefault(); >> - map.setCenter(point, 13); >> - map.addOverlay(new GMarker(point)); >> - map.setZoom(15); // 0=World, 19=max zoom in >> + <script type="text/javascript"> >> + var geocoder = new google.maps.Geocoder(); >> + var map = new google.maps.Map(document.getElementById("${id}"), >> + { center: new google.maps.LatLng(38, 15), >> + zoom: 15, // 0=World, 19=max zoom in >> + mapTypeId: google.maps.MapTypeId.ROADMAP >> + }); >> + geocoder.geocode({'address': "${pointAddress}"}, >> function(result, status) { >> + if (status != google.maps.GeocoderStatus.OK) { >> + >> showErrorAlert("${uiLabelMap.CommonErrorMessage2}","${uiLabelMap.CommonAddressNotFound}"); >> + } else { >> + var position = result[0].geometry.location; >> + map.setCenter(position); >> + map.fitBounds(result[0].geometry.viewport); >> + var marker = new google.maps.Marker({ >> + position: position, >> + map: map >> + }); >> + } >> }); >> - } >> - --></script> >> + </script> >> <#elseif geoChart.dataSourceId == "GEOPT_OSM"> >> - <div id="<#if >> geoChart.id?has_content>${geoChart.id}<#else>map_canvas</#if>" >> style="border:1px solid #979797; >> background-color:#e5e3df; width:${geoChart.width}; >> height:${geoChart.height}; margin:2em auto;"> >> - </div> >> - <script src="http://www.openlayers.org/api/OpenLayers.js"></script> >> - <script> >> - map = new OpenLayers.Map("<#if >> geoChart.id?has_content>${geoChart.id}<#else>map_canvas</#if>"); >> + <div id="${id}" style="border:1px solid #979797; >> background-color:#e5e3df; width:${geoChart.width}; >> height:${geoChart.height}; margin:2em auto;"></div> + <#-- due to >> https://github.com/openlayers/openlayers/issues/1025 >> rather use a local version loaded by >> framework/common/widget/CommonScreens.xml --> + <#-- script >> src="//www.openlayers.org/api/OpenLayers.js"></script--> + <script >> type="text/javascript"> >> + map = new OpenLayers.Map("${id}"); >> map.addLayer(new OpenLayers.Layer.OSM()); >> - <#if geoChart.center?has_content> >> - var zoom = ${geoChart.center.zoom}; >> - var center= new >> OpenLayers.LonLat(${geoChart.center.lon?c},${geoChart.center.lat?c}) >> + var zoom = ${zoom}; >> + var center= new >> OpenLayers.LonLat(${center.lon?c},${center.lat?c}) >> .transform(new OpenLayers.Projection("EPSG:4326"), // >> transform from WGS 1984 >> - map.getProjectionObject() // to Spherical Mercator >> Projection >> - ); >> - </#if> >> - var markers = new OpenLayers.Layer.Markers( "Markers" ); >> + map.getProjectionObject() // to Spherical Mercator >> Projection >> + ); >> + var markers = new OpenLayers.Layer.Markers("Markers"); >> map.addLayer(markers); >> <#if geoChart.points?has_content> >> <#list geoChart.points as point> >> @@ -111,8 +129,12 @@ under the License. >> new OpenLayers.Projection("EPSG:4326"), >> map.getProjectionObject()))); >> </#list> >> </#if> >> + map.addControl(new OpenLayers.Control.PanZoomBar()); >> + map.addControl(new OpenLayers.Control.NavToolbar()); >> + >> map.setCenter(center, zoom); >> - map.setZoom(15); // 0=World, 19=max zoom in >> + var newBound = markers.getDataExtent(); >> + map.zoomToExtent(newBound); >> </script> >> </#if> >> </#if> >> >> Modified: >> ofbiz/branches/release13.07/framework/common/widget/CommonScreens.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/common/widget/CommonScreens.xml?rev=1554538&r1=1554537&r2=1554538&view=diff >> ============================================================================== >> --- >> ofbiz/branches/release13.07/framework/common/widget/CommonScreens.xml >> (original) +++ >> ofbiz/branches/release13.07/framework/common/widget/CommonScreens.xml Tue >> Dec 31 15:23:32 2013 @@ -153,6 +153,8 @@ under the >> License. <set field="layoutSettings.javaScripts[+0]" >> value="/images/jquery/jquery-1.8.2.min.js" global="true" /> >> <!-- jQuery CSSs --> >> <set field="layoutSettings.styleSheets[+0]" >> value="/images/jquery/plugins/asmselect/jquery.asmselect-1.0.4a-beta.css" >> global="true" /> + >> + <set field="layoutSettings.javaScripts[]" >> value="/images/OpenLayers-2.13.1.js" global="true" /> >> <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/GooglemapMarkers.js" global="true" /> >> @@ -483,8 +485,7 @@ under the License. >> <!-- jQuery CSSs --> >> <set field="layoutSettings.styleSheets[+0]" >> value="/images/jquery/plugins/asmselect/jquery.asmselect-1.0.4a-beta.css" >> global="true"/> >> >> - >> - >> + <set field="layoutSettings.javaScripts[]" >> value="/images/OpenLayers-2.13.1.js" global="true" /> >> <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/GooglemapSimple.js" global="true"/> >> >> Modified: ofbiz/branches/release13.07/specialpurpose/build.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release13.07/specialpurpose/build.xml?rev=1554538&r1=1554537&r2=1554538&view=diff >> ============================================================================== >> --- >> ofbiz/branches/release13.07/specialpurpose/build.xml (original) +++ >> ofbiz/branches/release13.07/specialpurpose/build.xml Tue Dec >> 31 15:23:32 2013 @@ -21,5 +21,5 @@ >> <project name="OFBiz Special Purpose Applications Build" default="build" >> basedir="."> >> <import file="../macros.xml"/> >> <filelist id="specialpurpose-builds" dir="specialpurpose" >> - files="ecommerce/build.xml"/> >> + files="ecommerce/build.xml,pos/build.xml"/> >> </project> >> >> Modified: ofbiz/branches/release13.07/specialpurpose/component-load.xml >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release13.07/specialpurpose/component-load.xml?rev=1554538&r1=1554537&r2=1554538&view=diff >> ============================================================================== >> --- >> ofbiz/branches/release13.07/specialpurpose/component-load.xml (original) +++ >> ofbiz/branches/release13.07/specialpurpose/component-load.xml Tue Dec 31 >> 15:23:32 2013 @@ -21,4 +21,5 @@ under the License. >> <component-loader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/component-loader.xsd"> >> <load-component component-location="ecommerce"/> >> + <load-component component-location="pos"/> >> </component-loader>