diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-02-08 13:49:41 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-02-08 13:49:41 +0000 |
commit | d41b500e09fcc5ca348e9f4f6886bfc1b1e50d8b (patch) | |
tree | fe2a7713683d4ac387c17e8536e369052344a837 /web/js | |
parent | e3bce6312ed59ccd462cae69d214efdb1c19cbbc (diff) |
Allow Zurich admin to change location of pin, with confirmation (fixes a1).
Diffstat (limited to 'web/js')
-rw-r--r-- | web/js/map-wmts-zurich.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/web/js/map-wmts-zurich.js b/web/js/map-wmts-zurich.js index 682c62f39..b25a7da41 100644 --- a/web/js/map-wmts-zurich.js +++ b/web/js/map-wmts-zurich.js @@ -10,6 +10,35 @@ $(function(){ $(this).text('Stadtplan'); fixmystreet.map.setBaseLayer(fixmystreet.map.layers[0]); }); + + /* Admin dragging of pin */ + if (fixmystreet.page == 'admin') { + var admin_drag = new OpenLayers.Control.DragFeature( fixmystreet.markers, { + onComplete: function(feature, e) { + var lonlat = feature.geometry.clone(); + lonlat.transform( + fixmystreet.map.getProjectionObject(), + new OpenLayers.Projection("EPSG:4326") + ); + if (window.confirm( 'Richtiger Ort?' ) ) { + // Store new co-ordinates + document.getElementById('fixmystreet.latitude').value = lonlat.y; + document.getElementById('fixmystreet.longitude').value = lonlat.x; + } else { + // Put it back + var lat = document.getElementById('fixmystreet.latitude').value; + var lon = document.getElementById('fixmystreet.longitude').value; + lonlat = new OpenLayers.LonLat(lon, lat).transform( + new OpenLayers.Projection("EPSG:4326"), + fixmystreet.map.getProjectionObject() + ); + fixmystreet.markers.features[0].move(lonlat); + } + } + } ); + fixmystreet.map.addControl( admin_drag ); + admin_drag.activate(); + } }); /* |