r61697 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61696‎ | r61697 | r61698 >
Date:23:42, 29 January 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.5.3.
* Fixed bugs in OpenLayers form input
Modified paths:
  • /trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFunctions.js (modified) (history)
  • /trunk/extensions/SemanticMaps/SemanticMaps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFunctions.js
@@ -9,16 +9,15 @@
1010
1111 /**
1212 * This function holds spesific functionallity for the Open Layers form input of Semantic Maps
13 - * TODO: Refactor as much code as possible to non specific functions
1413 */
1514 function makeFormInputOpenLayer(mapName, locationFieldName, lat, lon, zoom, marker_lat, marker_lon, layers, controls, height) {
1615 var markers = Array();
1716
1817 // Show a starting marker only if marker coordinates are provided
1918 if (marker_lat != null && marker_lon != null) {
20 - markers.push(getOLMarkerData(marker_lon, marker_lat, '', ''));
21 - }
22 -
 19+ markers.push(getOLMarkerData(marker_lon, marker_lat, '', '', ''));
 20+ }
 21+
2322 // Click event handler for updating the location of the marker
2423 // TODO / FIXME: This will probably cause problems when used for multiple maps on one page.
2524 OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
@@ -45,8 +44,14 @@
4645 },
4746
4847 trigger: function(e) {
49 - replaceMarker(mapName, map.getLonLatFromViewPortPx(e.xy));
50 - document.getElementById(locationFieldName).value = convertLatToDMS(map.getLonLatFromViewPortPx(e.xy).lat)+', '+convertLngToDMS(map.getLonLatFromViewPortPx(e.xy).lon);
 48+ var lonlat = map.getLonLatFromViewPortPx(e.xy);
 49+
 50+ replaceMarker(mapName, lonlat);
 51+
 52+ var proj = new OpenLayers.Projection("EPSG:4326");
 53+ lonlat.transform(map.getProjectionObject(), proj);
 54+
 55+ document.getElementById(locationFieldName).value = convertLatToDMS(lonlat.lat)+', '+convertLngToDMS(lonlat.lon);
5156 }
5257
5358 });
@@ -73,7 +78,7 @@
7479 var markerLayer = map.getLayer('markerLayer');
7580
7681 removeMarkers(markerLayer);
77 - markerLayer.addMarker(getOLMarker(markerLayer, getOLMarkerData(newLocation.lon, newLocation.lat, '', ''), map.getProjectionObject()));
 82+ markerLayer.addMarker(getOLMarker(markerLayer, getOLMarkerData(newLocation.lon, newLocation.lat, '', '', ''), map.getProjectionObject()));
7883
7984 map.panTo(newLocation);
8085 }
Index: trunk/extensions/SemanticMaps/SemanticMaps.php
@@ -35,7 +35,7 @@
3636
3737 // Only initialize the extension when all dependencies are present.
3838 if (defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' )) {
39 - define('SM_VERSION', '0.5.3 a3');
 39+ define('SM_VERSION', '0.5.3 a5');
4040
4141 $smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps';
4242 $smgIP = $IP . '/extensions/SemanticMaps';

Status & tagging log