Author: mbrohl
Date: Sat Dec 8 08:05:52 2018 New Revision: 1848436 URL: http://svn.apache.org/viewvc?rev=1848436&view=rev Log: Fixed: Update and fix openstreetmap.org integration. (OFBIZ-10553) Manual backport because of the renamed paths. Added: ofbiz/ofbiz-framework/branches/release17.12/themes/common/webapp/common/js/plugins/OpenLayers-5.3.0.css - copied unchanged from r1847711, ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/plugins/OpenLayers-5.3.0.css ofbiz/ofbiz-framework/branches/release17.12/themes/common/webapp/common/js/plugins/OpenLayers-5.3.0.js - copied unchanged from r1847711, ofbiz/ofbiz-framework/trunk/themes/common-theme/webapp/common/js/plugins/OpenLayers-5.3.0.js Removed: ofbiz/ofbiz-framework/branches/release17.12/themes/common/webapp/common/js/plugins/OpenLayers-2.13.1-modified-for-CSP-.js Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/includes/GeoLocation.ftl ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/CommonScreens.xml ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/Theme.xml Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/includes/GeoLocation.ftl URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/includes/GeoLocation.ftl?rev=1848436&r1=1848435&r2=1848436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/includes/GeoLocation.ftl (original) +++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/template/includes/GeoLocation.ftl Sat Dec 8 08:05:52 2018 @@ -113,33 +113,64 @@ under the License. }); </script> <#elseif "GEOPT_OSM" == geoChart.dataSourceId> - <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()); - var zoom = ${zoom}; - var center = new OpenLayers.LonLat(${center.lon},${center.lat}) - .transform(new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984 - map.getProjectionObject() // to Spherical Mercator Projection - ); - var markers = new OpenLayers.Layer.Markers("Markers"); - map.addLayer(markers); +<div id="${id}" class="map" style="border:1px solid #979797; background-color:#e5e3df; width:${geoChart.width}; height:${geoChart.height}; margin:2em auto;"></div> + <script type="application/javascript"> + var iconFeatures=[]; + <#if geoChart.points?has_content> - <#list geoChart.points as point> - markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(${point.lon},${point.lat}).transform( - new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()))); - </#list> + <#list geoChart.points as point> + iconFeatures.push( + new ol.Feature({ + geometry: new ol.geom.Point(ol.proj.transform([${point.lon},${point.lat}], + 'EPSG:4326', 'EPSG:900913')) + }) + ); + </#list> </#if> - map.addControl(new OpenLayers.Control.PanZoomBar()); - map.addControl(new OpenLayers.Control.NavToolbar()); - map.setCenter(center, zoom); - var newBound = markers.getDataExtent(); - map.zoomToExtent(newBound); + var vectorSource = new ol.source.Vector({ + features: iconFeatures + }); + + var iconStyle = new ol.style.Style({ + image: new ol.style.Icon(({ + anchor: [0.5, 25], + anchorXUnits: 'fraction', + anchorYUnits: 'pixels', + opacity: 0.75, + src: '<@ofbizContentUrl>/images/img/marker.png</@ofbizContentUrl>' + })) + }); + + var vectorLayer = new ol.layer.Vector({ + source: vectorSource, + style: iconStyle + }); + + var map = new ol.Map({ + target: '${id}', + layers: [ + new ol.layer.Tile({ + source: new ol.source.OSM() + }), + vectorLayer + ], + view: new ol.View({ + center: ol.proj.fromLonLat([${center.lon}, ${center.lat}]), + zoom: ${zoom} + }), + controls: [ + new ol.control.Zoom(), + new ol.control.ZoomSlider(), + new ol.control.ZoomToExtent(), + new ol.control.OverviewMap(), + new ol.control.ScaleLine(), + new ol.control.FullScreen() + ] + }); + + // fit to show all markers (optional) + map.getView().fit(vectorSource.getExtent(), map.getSize()); </script> </#if> </#if> Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/CommonScreens.xml?rev=1848436&r1=1848435&r2=1848436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/CommonScreens.xml (original) +++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/CommonScreens.xml Sat Dec 8 08:05:52 2018 @@ -444,7 +444,7 @@ under the License. <set field="layoutSettings.styleSheets[+0]" value="/common/js/jquery/ui/jquery-ui-1.12.1.min.css" global="true" /> <set field="layoutSettings.styleSheets[+0]" value="/common/js/jquery/plugins/datetimepicker/jquery-ui-timepicker-addon-1.6.3.min.css" global="true" /> - <set field="layoutSettings.javaScripts[]" value="/common/js/plugins/OpenLayers-2.13.1-modified-for-CSP-.js" global="true" /> + <set field="layoutSettings.javaScripts[]" value="/common/js/plugins/OpenLayers-5.3.0.js" global="true" /> <set field="layoutSettings.javaScripts[]" value="/common/js/util/OfbizUtil.js" global="true"/> <set field="layoutSettings.javaScripts[]" value="/common/js/util/fieldlookup.js" global="true"/> <!-- The default (global) shortcut icon --> Modified: ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/Theme.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/Theme.xml?rev=1848436&r1=1848435&r2=1848436&view=diff ============================================================================== --- ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/Theme.xml (original) +++ ofbiz/ofbiz-framework/branches/release17.12/themes/common/widget/Theme.xml Sat Dec 8 08:05:52 2018 @@ -67,7 +67,7 @@ under the License. <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/mask/jquery.mask-1.14.13.min.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/jeditable/jquery.jeditable-1.7.3.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/validate/jquery.validate.min.js"/> - <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/plugins/OpenLayers-2.13.1-modified-for-CSP-.js"/> + <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/plugins/OpenLayers-5.3.0.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/jquery/plugins/elrte-1.3/js/elrte.min.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/util/OfbizUtil.js"/> <property name="VT_HDR_JAVASCRIPT['add']" value="/common/js/util/fieldlookup.js"/> |
Free forum by Nabble | Edit this page |