diff options
Diffstat (limited to 'perllib/FixMyStreet/Map/Google.pm')
-rw-r--r-- | perllib/FixMyStreet/Map/Google.pm | 52 |
1 files changed, 8 insertions, 44 deletions
diff --git a/perllib/FixMyStreet/Map/Google.pm b/perllib/FixMyStreet/Map/Google.pm index 35896108b..ceb3a53ed 100644 --- a/perllib/FixMyStreet/Map/Google.pm +++ b/perllib/FixMyStreet/Map/Google.pm @@ -11,53 +11,17 @@ package FixMyStreet::Map::Google; use strict; use mySociety::Web qw(ent); -sub header_js { - return ' -<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> -<script type="text/javascript" src="/js/map-google.js"></script> -'; -} - -# display_map Q PARAMS +# display_map C PARAMS # PARAMS include: -# EASTING, NORTHING for the centre point of the map -# TYPE is 1 if the map is clickable, 2 if clickable and has a form upload, -# 0 if not clickable +# latitude, longitude for the centre point of the map +# CLICKABLE is set if the map is clickable # PINS is array of pins to show, location and colour -# PRE/POST are HTML to show above/below map sub display_map { - my ($self, $q, %params) = @_; - $params{pre} ||= ''; - $params{post} ||= ''; - - my @pins; - foreach my $pin (@{$params{pins}}) { - $pin->[3] ||= ''; - push @pins, "[ $pin->[0], $pin->[1], '$pin->[2]', '$pin->[3]' ]"; - } - my $pins_js = join(",\n", @pins); - - my $out = FixMyStreet::Map::header($q, $params{type}); - my $copyright = _('Map contains Ordnance Survey data © Crown copyright and database right 2010.'); - $out .= <<EOF; -<input type="hidden" name="latitude" id="fixmystreet.latitude" value="$params{latitude}"> -<input type="hidden" name="longitude" id="fixmystreet.longitude" value="$params{longitude}"> -<script type="text/javascript"> -var fixmystreet = { - 'latitude': $params{latitude}, - 'longitude': $params{longitude}, - 'pins': [ $pins_js ] -} -</script> -<div id="map_box"> - $params{pre} - <div id="map"></div> - <p id="copyright">$copyright</p> - $params{post} -</div> -<div id="side"> -EOF - return $out; + my ($self, $c, %params) = @_; + $c->stash->{map} = { + %params, + type => 'google', + }; } 1; |