]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
properly link to javascript underlay
authorAntoine Beaupré <anarcat@koumbit.org>
Sat, 3 Mar 2012 20:38:01 +0000 (15:38 -0500)
committerAntoine Beaupré <anarcat@koumbit.org>
Sat, 3 Mar 2012 20:38:01 +0000 (15:38 -0500)
IkiWiki/Plugin/osm.pm

index e85d4be62d049b6567f09b0f479ae788c7213aa6..d8db01dbb7b5d1111c99dadad427319af81559ca 100644 (file)
@@ -529,7 +529,7 @@ sub include_javascript ($) {
                }
        }
        if ($loader) {
-               return embed_map_code() . "<script type=\"text/javascript\" charset=\"utf-8\">$loader</script>";
+               return embed_map_code($page) . "<script type=\"text/javascript\" charset=\"utf-8\">$loader</script>";
        }
        else {
                return '';
@@ -553,16 +553,17 @@ sub cgi($) {
        print ("\r\n");
        print "<html><body>";
        print "<div id=\"mapdiv-$map\"></div>";
-       print embed_map_code($map);
+       print embed_map_code();
        print "<script type=\"text/javascript\" charset=\"utf-8\">mapsetup( 'mapdiv-$map', { 'map': '$map', 'lat': urlParams['lat'], 'lon': urlParams['lon'], 'zoom': urlParams['zoom'], 'fullscreen': 1, 'editable': 1, 'format': '" . prefered_format() . "'});</script>";
        print "</body></html>";
 
        exit 0;
 }
 
-sub embed_map_code() {
+sub embed_map_code(;$) {
+       my $page=shift;
        return '<script src="http://www.openlayers.org/api/OpenLayers.js" type="text/javascript" charset="utf-8"></script>'.
-               '<script src="'.urlto("ikiwiki/osm.js", $from).
+               '<script src="'.urlto("ikiwiki/osm.js", $page).
                '" type="text/javascript" charset="utf-8"></script>'."\n";
 }