diff options
author | Matthew Somerville <matthew@fury.ukcod.org.uk> | 2011-03-08 11:32:33 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@fury.ukcod.org.uk> | 2011-03-08 11:32:33 +0000 |
commit | 2532b04b72f6de69f0cf801630f4008a0fc35405 (patch) | |
tree | 9cb266d85c5faf4b1e8e02f1ba0d37e2fb2a32b9 | |
parent | 4783286565ad46986023a8cb16da07bbbb2c30b5 (diff) |
Store report ID on loop, as otherwise closure uses last value.
-rw-r--r-- | perllib/Page.pm | 15 | ||||
-rw-r--r-- | web/js/map-OpenStreetMap.js | 6 |
2 files changed, 13 insertions, 8 deletions
diff --git a/perllib/Page.pm b/perllib/Page.pm index 0aa06102d..130b5b301 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -672,13 +672,14 @@ sub mapit_check_error { return _('That postcode was not recognised, sorry.') if $location->{code} =~ /^4/; return $location->{error}; } - return if mySociety::Config::get('COUNTRY') eq 'NO'; - my $island = $location->{coordsyst}; - if (!$island) { - return _("Sorry, that appears to be a Crown dependency postcode, which we don't cover."); - } - if ($island eq 'I') { - return _("We do not cover Northern Ireland, I'm afraid, as our licence doesn't include any maps for the region."); + if (mySociety::Config::get('COUNTRY') eq 'GB') { + my $island = $location->{coordsyst}; + if (!$island) { + return _("Sorry, that appears to be a Crown dependency postcode, which we don't cover."); + } + if ($island eq 'I') { + return _("We do not cover Northern Ireland, I'm afraid, as our licence doesn't include any maps for the region."); + } } return 0; } diff --git a/web/js/map-OpenStreetMap.js b/web/js/map-OpenStreetMap.js index 911d49d57..4f5bf6fdf 100644 --- a/web/js/map-OpenStreetMap.js +++ b/web/js/map-OpenStreetMap.js @@ -60,7 +60,11 @@ YAHOO.util.Event.onContentReady('map', function() { ); var marker = new OpenLayers.Marker(loc, icon); if (pin[3]) { - marker.events.register('click', marker, function(evt) { window.location = '/report/' + pin[3]; OpenLayers.Event.stop(evt); }); + marker.id = pin[3]; + marker.events.register('click', marker, function(evt) { + window.location = '/report/' + this.id; + OpenLayers.Event.stop(evt); + }); } fixmystreet.markers.addMarker(marker); } |