From 13098b6381416919b3e36fc3f558ca50f58fa854 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 24 Feb 2011 14:01:49 +0000 Subject: No need for all pins yet (does nothing <6 months), hide pins using OL JS if present; permalink. --- perllib/FixMyStreet/Map/OSM/CycleMap.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perllib/FixMyStreet/Map/OSM/CycleMap.pm') diff --git a/perllib/FixMyStreet/Map/OSM/CycleMap.pm b/perllib/FixMyStreet/Map/OSM/CycleMap.pm index 01c51acf4..87884d459 100644 --- a/perllib/FixMyStreet/Map/OSM/CycleMap.pm +++ b/perllib/FixMyStreet/Map/OSM/CycleMap.pm @@ -35,7 +35,7 @@ sub display_map { } my $out = FixMyStreet::Map::header($q, $params{type}); - my $copyright = _('Map © OpenStreetMap and contributors, CC-BY-SA'); + my $copyright = _('Map © OpenStreetMap and contributors, CC-BY-SA'); $out .= < var fixmystreet = { -- cgit v1.2.3 From c56f704e998b418aa3f11d5e3b6b86d6c7ce40e6 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 9 Mar 2011 22:21:04 +0000 Subject: Fixes to other map types to work with lat/lon. Split OSM JavaScript into core OpenLayers bits and OSM config bit. --- perllib/FixMyStreet/Map/OSM/CycleMap.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'perllib/FixMyStreet/Map/OSM/CycleMap.pm') diff --git a/perllib/FixMyStreet/Map/OSM/CycleMap.pm b/perllib/FixMyStreet/Map/OSM/CycleMap.pm index 87884d459..0a6e216c8 100644 --- a/perllib/FixMyStreet/Map/OSM/CycleMap.pm +++ b/perllib/FixMyStreet/Map/OSM/CycleMap.pm @@ -14,8 +14,8 @@ use mySociety::Web qw(ent); sub header_js { return ' + - '; } @@ -31,16 +31,23 @@ sub display_map { $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 © OpenStreetMap and contributors, CC-BY-SA'); $out .= < + -- cgit v1.2.3 From 21c9779d0aa2a1045d91d0e70968e81f03587678 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 23 Mar 2011 16:58:54 +0000 Subject: Allow map change in URL. --- perllib/FixMyStreet/Map/OSM/CycleMap.pm | 68 ++------------------------------- 1 file changed, 4 insertions(+), 64 deletions(-) (limited to 'perllib/FixMyStreet/Map/OSM/CycleMap.pm') diff --git a/perllib/FixMyStreet/Map/OSM/CycleMap.pm b/perllib/FixMyStreet/Map/OSM/CycleMap.pm index 0a6e216c8..06b07ae20 100644 --- a/perllib/FixMyStreet/Map/OSM/CycleMap.pm +++ b/perllib/FixMyStreet/Map/OSM/CycleMap.pm @@ -6,73 +6,13 @@ # Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ -package FixMyStreet::Map; +package FixMyStreet::Map::OSM::CycleMap; +use base 'FixMyStreet::Map::OSM'; use strict; -use mySociety::Web qw(ent); -sub header_js { - return ' - - - -'; -} - -# display_map Q 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 -# PINS is array of pins to show, location and colour -# PRE/POST are HTML to show above/below map -sub display_map { - my ($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 © OpenStreetMap and contributors, CC-BY-SA'); - $out .= < - - -
- $params{pre} -
- - $params{post} -
-
-EOF - return $out; -} - -sub display_map_end { - my ($type) = @_; - my $out = '
'; - $out .= '' if ($type); - return $out; -} - -sub display_pin { -} - -sub map_pins { +sub map_type { + return 'OpenLayers.Layer.OSM.CycleMap'; } 1; -- cgit v1.2.3