diff options
-rw-r--r-- | perllib/Cobrands/Fiksgatami/Util.pm | 10 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/OSM.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Tilma/Original.pm | 10 | ||||
-rwxr-xr-x | web/index.cgi | 4 |
4 files changed, 14 insertions, 16 deletions
diff --git a/perllib/Cobrands/Fiksgatami/Util.pm b/perllib/Cobrands/Fiksgatami/Util.pm index 38366f0e1..2abc03d00 100644 --- a/perllib/Cobrands/Fiksgatami/Util.pm +++ b/perllib/Cobrands/Fiksgatami/Util.pm @@ -22,6 +22,16 @@ sub set_lang_and_domain { mySociety::Locale::change(); } +# If lat/lon are present in the URL, OpenLayers will use that to centre the map. +# Need to specify a zoom to stop it defaulting to null/0. +sub url { + my ($self, $url) = @_; + if ($url =~ /lat=/ && $url !~ /zoom=/) { + $url .= ';zoom=2'; + } + return $url; +} + sub enter_postcode_text { my ($self, $q) = @_; return _('Enter a nearby postcode, or street name and area'); diff --git a/perllib/FixMyStreet/Map/OSM.pm b/perllib/FixMyStreet/Map/OSM.pm index 962d0891f..9c506b00a 100644 --- a/perllib/FixMyStreet/Map/OSM.pm +++ b/perllib/FixMyStreet/Map/OSM.pm @@ -117,11 +117,7 @@ sub display_pin { . 'px; left:' . ($px) . 'px; position: absolute;">'; return $out unless $pin->[3]; my $cobrand = Page::get_cobrand($q); - my $url = Cobrand::url($cobrand, NewURL($q, - -retain => 1, -url => '/report/' . $pin->[3], - pc => undef, x => undef, y => undef, sx => undef, sy => undef, - all_pins => undef, no_pins => undef), $q - ); + my $url = Cobrand::url($cobrand, NewURL($q, -url => '/report/' . $pin->[3]), $q); # XXX Would like to include title here in title="" $out = '<a href="' . $url . '">' . $out . '</a>'; return $out; diff --git a/perllib/FixMyStreet/Map/Tilma/Original.pm b/perllib/FixMyStreet/Map/Tilma/Original.pm index 6acdb3f4c..5a7d2a38b 100644 --- a/perllib/FixMyStreet/Map/Tilma/Original.pm +++ b/perllib/FixMyStreet/Map/Tilma/Original.pm @@ -158,15 +158,7 @@ sub display_pin { . 'px; left:' . ($px) . 'px; position: absolute;">'; return $out unless $_ && $_->{id} && $col ne 'blue'; my $cobrand = Page::get_cobrand($q); - my $url = Cobrand::url($cobrand, NewURL($q, -retain => 1, - -url => '/report/' . $_->{id}, - pc => undef, - x => undef, - y => undef, - sx => undef, - sy => undef, - all_pins => undef, - no_pins => undef), $q); + my $url = Cobrand::url($cobrand, NewURL($q, -url => '/report/' . $_->{id}), $q); $out = '<a title="' . ent($_->{title}) . '" href="' . $url . '">' . $out . '</a>'; return $out; } diff --git a/web/index.cgi b/web/index.cgi index 20105bb29..fd6d8a1a3 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -944,7 +944,7 @@ sub display_location { map { Utils::truncate_coordinate($_) } # ( $latitude, $longitude ); - my $url_skip = NewURL($q, -retain=>1, pc => undef, + my $url_skip = NewURL($q, -retain=>1, x => undef, 'y' => undef, latitude => $short_lat, longitude => $short_lon, 'submit_map'=>1, skipped=>1 @@ -969,7 +969,7 @@ sub display_location { map_end => FixMyStreet::Map::display_map_end(1), url_home => Cobrand::url($cobrand, '/', $q), url_rss => $rss_url, - url_email => Cobrand::url($cobrand, NewURL($q, -retain => 1, pc => undef, lat => $short_lat, lon => $short_lon, -url=>'/alert', feed=>"local:$short_lat:$short_lon"), $q), + url_email => Cobrand::url($cobrand, NewURL($q, lat => $short_lat, lon => $short_lon, -url=>'/alert', feed=>"local:$short_lat:$short_lon"), $q), url_skip => $url_skip, email_me => _('Email me new local problems'), rss_alt => _('RSS feed'), |