aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2013-08-24 15:42:13 +0100
committerChristopher Baines <mail@cbaines.net>2017-10-31 20:32:45 +0000
commit2314d8db726d19d956e006e7c99f04be1b38a8f0 (patch)
tree46342d64ad0fcc0180a8fc42bacf6d01cad54c92
parent354e50112b53bc8a7a16f0338e15e2ba081e62ce (diff)
downloadikiwiki-2314d8db726d19d956e006e7c99f04be1b38a8f0.tar
ikiwiki-2314d8db726d19d956e006e7c99f04be1b38a8f0.tar.gz
Pass the layers given in the OSM directive through
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 a5af4ed21..9df53f76e 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};
$name=~s/'//g; # $name comes from user input
return "mapsetup('mapdiv-$name', " . to_json(\%options) . ");";