aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm1
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm9
-rw-r--r--perllib/FixMyStreet/Cobrand/FixMyBarangay.pm4
-rw-r--r--templates/web/default/maps/openlayers.html2
-rw-r--r--web/js/map-OpenLayers.js34
5 files changed, 34 insertions, 16 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index 0901599ed..fc6df20c3 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -203,6 +203,7 @@ sub display_location : Private {
longitude => $short_longitude,
clickable => 1,
pins => \@pins,
+ area => $c->cobrand->areas_on_around,
);
return 1;
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 6ed946801..e7359d33e 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -930,5 +930,14 @@ sub only_authed_can_create {
return 0;
}
+=head2 areas_on_around
+
+If set to an arrayref, will plot those area ID(s) from mapit on all the /around pages.
+
+=cut
+
+sub areas_on_around {
+}
+
1;
diff --git a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
index 8b172e854..51d49242d 100644
--- a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
+++ b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm
@@ -36,5 +36,9 @@ sub only_authed_can_create {
return 1;
}
+sub areas_on_around {
+ return [ 1, 2 ];
+}
+
1;
diff --git a/templates/web/default/maps/openlayers.html b/templates/web/default/maps/openlayers.html
index e815642f1..b75e2bbd8 100644
--- a/templates/web/default/maps/openlayers.html
+++ b/templates/web/default/maps/openlayers.html
@@ -8,7 +8,7 @@
<script type="text/javascript">
var fixmystreet = {
'page': '[% page %]',
- 'area': '[% map.area %]',
+ 'area': [ [% map.area.join(',') %] ],
'all_pins': '[% all_pins %]',
'latitude': [% map.latitude %],
'longitude': [% map.longitude %],
diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js
index 87876a723..544e6e850 100644
--- a/web/js/map-OpenLayers.js
+++ b/web/js/map-OpenLayers.js
@@ -69,22 +69,26 @@ function fms_markers_list(pins, transform) {
}
function fixmystreet_onload() {
- if ( fixmystreet.area ) {
- var area = new OpenLayers.Layer.Vector("KML", {
- strategies: [ new OpenLayers.Strategy.Fixed() ],
- protocol: new OpenLayers.Protocol.HTTP({
- url: "/mapit/area/" + fixmystreet.area + ".kml?simplify_tolerance=0.0001",
- format: new OpenLayers.Format.KML()
- })
- });
- fixmystreet.map.addLayer(area);
- area.events.register('loadend', null, function(a,b,c) {
- var bounds = area.getDataExtent();
- if (bounds) {
- var center = bounds.getCenterLonLat();
- fixmystreet.map.setCenter(center, fixmystreet.map.getZoomForExtent(bounds), false, true);
+ if ( fixmystreet.area.length ) {
+ for (var i=0; i<fixmystreet.area.length; i++) {
+ var area = new OpenLayers.Layer.Vector("KML", {
+ strategies: [ new OpenLayers.Strategy.Fixed() ],
+ protocol: new OpenLayers.Protocol.HTTP({
+ url: "/mapit/area/" + fixmystreet.area[i] + ".kml?simplify_tolerance=0.0001",
+ format: new OpenLayers.Format.KML()
+ })
+ });
+ fixmystreet.map.addLayer(area);
+ if ( fixmystreet.area.length == 1 ) {
+ area.events.register('loadend', null, function(a,b,c) {
+ var bounds = area.getDataExtent();
+ if (bounds) {
+ var center = bounds.getCenterLonLat();
+ fixmystreet.map.setCenter(center, fixmystreet.map.getZoomForExtent(bounds), false, true);
+ }
+ });
}
- });
+ }
}
var pin_layer_style_map = new OpenLayers.StyleMap({