diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/Cobrands/Barnet/Util.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/Bing.pm | 71 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/BingOL.pm | 71 | ||||
-rw-r--r-- | perllib/Page.pm | 6 |
4 files changed, 143 insertions, 7 deletions
diff --git a/perllib/Cobrands/Barnet/Util.pm b/perllib/Cobrands/Barnet/Util.pm index e59e9118f..32973c10c 100644 --- a/perllib/Cobrands/Barnet/Util.pm +++ b/perllib/Cobrands/Barnet/Util.pm @@ -81,7 +81,7 @@ sub council_check { $url .= 'alert' if $context eq 'alert'; $url .= '?pc=' . URI::Escape::uri_escape_utf8($q->param('pc')) if $q->param('pc'); my $error_msg = "That location is not covered by Barnet. -Please visit <a href='$url'>the main FixMyStreet site</a>."; +Please visit <a href=\"$url\">the main FixMyStreet site</a>."; return (0, $error_msg); } diff --git a/perllib/FixMyStreet/Map/Bing.pm b/perllib/FixMyStreet/Map/Bing.pm new file mode 100644 index 000000000..8446a10fd --- /dev/null +++ b/perllib/FixMyStreet/Map/Bing.pm @@ -0,0 +1,71 @@ +#!/usr/bin/perl +# +# FixMyStreet:Map::Bing +# Bing maps on FixMyStreet. +# +# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved. +# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ + +package FixMyStreet::Map; + +use strict; +use mySociety::GeoUtil; +use mySociety::Web qw(ent); + +sub header_js { + return ' +<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script> +<script type="text/javascript" src="/js/map-bing.js"></script> +'; +} + +# 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} ||= ''; + + foreach my $pin (@{$params{pins}}) { + } + + my $out = FixMyStreet::Map::header($q, $params{type}); + my ($lat, $lon) = mySociety::GeoUtil::national_grid_to_wgs84($params{easting}, $params{northing}, 'G'); + my $copyright = _('Map contains Ordnance Survey data © Crown copyright and database right 2010.'); + $out .= <<EOF; +<script type="text/javascript"> +var fixmystreet = { + 'lat': $lat, + 'lon': $lon +} +</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; +} + +sub display_map_end { + my ($type) = @_; + my $out = '</div>'; + $out .= '</form>' if ($type); + return $out; +} + +sub display_pin { +} + +sub map_pins { +} + +1; diff --git a/perllib/FixMyStreet/Map/BingOL.pm b/perllib/FixMyStreet/Map/BingOL.pm new file mode 100644 index 000000000..3939a710f --- /dev/null +++ b/perllib/FixMyStreet/Map/BingOL.pm @@ -0,0 +1,71 @@ +#!/usr/bin/perl +# +# FixMyStreet:Map::Bing +# Bing maps on FixMyStreet. +# +# Copyright (c) 2010 UK Citizens Online Democracy. All rights reserved. +# Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ + +package FixMyStreet::Map; + +use strict; +use mySociety::Web qw(ent); + +sub header_js { + return ' +<!-- <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=en-GB"></script> --> +<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script> +<script type="text/javascript" src="/js/map-bing-ol.js"></script> +<script type="text/javascript" src="/js/OpenLayers.Projection.OrdnanceSurvey.js"></script> +'; +} + +# 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} ||= ''; + + foreach my $pin (@{$params{pins}}) { + } + + my $out = FixMyStreet::Map::header($q, $params{type}); + my $copyright = _('Map contains Ordnance Survey data © Crown copyright and database right 2010. Microsoft'); + $out .= <<EOF; +<script type="text/javascript"> +var fixmystreet = { + 'easting': $params{easting}, + 'northing': $params{northing} +} +</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; +} + +sub display_map_end { + my ($type) = @_; + my $out = '</div>'; + $out .= '</form>' if ($type); + return $out; +} + +sub display_pin { +} + +sub map_pins { +} + +1; diff --git a/perllib/Page.pm b/perllib/Page.pm index 1b94f5c2b..917fc6991 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -33,7 +33,6 @@ use mySociety::EvEl; use mySociety::Locale; use mySociety::MaPit; use mySociety::TempFiles; -use mySociety::Tracking; use mySociety::WatchUpdate; use mySociety::Web qw(ent); @@ -315,7 +314,6 @@ sub header ($%) { =cut sub footer { my ($q, %params) = @_; - my $extra = $params{extra}; if ($q->{site} ne 'fixmystreet') { my $template = template($q, %params) . '-footer'; @@ -330,8 +328,6 @@ sub footer { my $pc = $q->param('pc') || ''; $pc = "?pc=" . ent($pc) if $pc; - $extra = $q->{scratch} if $q->{scratch}; # Overrides - my $track = mySociety::Tracking::code($q, $extra); my $piwik = ""; if (mySociety::Config::get('BASE_URL') eq "http://www.fixmystreet.com") { @@ -375,8 +371,6 @@ $orglogo <p id="footer">$creditline</p> -$track - $piwik </body> |