aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2013-08-24 15:42:13 +0100
committerChristopher Baines <cbaines8@gmail.com>2013-10-02 15:28:18 +0100
commit08bc1023c638e441f840b556d0b725ecec9d1aa5 (patch)
treecbbc010458a846115651f66bb87970c5d4f4ff01
parent8f6dcb54e3f00acf844629e7dff1b172c707fc00 (diff)
downloadikiwiki-osm-layers-patch.tar
ikiwiki-osm-layers-patch.tar.gz
Pass the layers given in the OSM directive throughosm-layers-patch
This commit passes the layers given in the osm directive, defaulting to OSM if none are given, through to the page. As without this, things go wrong in the Javascript, as it tries to work with a null array of layers.
-rw-r--r--IkiWiki/Plugin/osm.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/osm.pm b/IkiWiki/Plugin/osm.pm
index c9650d014..aa117bae2 100644
--- a/IkiWiki/Plugin/osm.pm
+++ b/IkiWiki/Plugin/osm.pm
@@ -138,6 +138,15 @@ sub preprocess {
);
}
+ # Default to just the OSM layer
+ my @layers = [ 'OSM' ];
+
+ # If the user has passed some layers in
+ if (defined $params{layers}) {
+ # Seperate the layers
+ @layers = [ split(/,/, $params{layers}) ];
+ }
+
register_rendered_files($map, $page, $dest);
$pagestate{$page}{'osm'}{$map}{'displays'}{$name} = {
@@ -150,6 +159,7 @@ sub preprocess {
lat => $lat,
lon => $lon,
href => $href,
+ layers => @layers,
google_apikey => $config{'osm_google_apikey'},
};
return "<div id=\"mapdiv-$name\"></div>";
@@ -587,7 +597,6 @@ sub map_setup_code($;@) {
if ($mapurl) {
$options{'mapurl'} = $mapurl;
}
- $options{'layers'} = $config{osm_layers};
return "mapsetup('mapdiv-$name', " . to_json(\%options) . ");";
}