diff options
author | Christopher Baines <cbaines8@gmail.com> | 2013-08-24 15:42:13 +0100 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2013-10-05 20:43:04 +0100 |
commit | 5242d1a6d282aa84d4bf2d19b6dade6a918db78e (patch) | |
tree | 8c50dea66f6e23f9c1f8b6eac1c415d7b628d146 | |
parent | ffa5e046b68b49a5866b3768e3a9bf245fd5aa3d (diff) | |
download | ikiwiki-5242d1a6d282aa84d4bf2d19b6dade6a918db78e.tar ikiwiki-5242d1a6d282aa84d4bf2d19b6dade6a918db78e.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.pm | 11 |
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) . ");"; } |