OSM Plugin: Possibility to configure where the OpenLayers.js file is
authorGenevieve <gbastien@versatic.net>
Fri, 3 Aug 2012 01:10:42 +0000 (21:10 -0400)
committerJoey Hess <joey@kitenet.net>
Mon, 6 Aug 2012 02:02:01 +0000 (22:02 -0400)
(cherry picked from commit 6f684cd412e6d93f943c1fa5d8dac91caa138be0)

IkiWiki/Plugin/osm.pm

index e96a1283752ff5dfe721d73fd09f22746831413d..6ba2524d81c25538671559fed0dcd19daa092b50 100644 (file)
@@ -60,6 +60,14 @@ sub getsetup () {
                        safe => 0,
                        rebuild => 1,
                },
+               osm_openlayers_url => {
+                       type => "string",
+                       example => "http://www.openlayers.org/api/OpenLayers.js",
+                       description => "Url for the OpenLayers.js file",
+                       safe => 0,
+                       rebuild => 1,
+               },
+
 }
 
 sub register_rendered_files {
@@ -519,7 +527,8 @@ sub cgi($) {
 
 sub embed_map_code(;$) {
        my $page=shift;
-       return '<script src="http://www.openlayers.org/api/OpenLayers.js" type="text/javascript" charset="utf-8"></script>'.
+       my $olurl = $config{osm_openlayers_url} || "http://www.openlayers.org/api/OpenLayers.js";
+       return '<script src="'.$olurl.'" type="text/javascript" charset="utf-8"></script>'.
                '<script src="'.urlto("ikiwiki/osm.js", $page).
                '" type="text/javascript" charset="utf-8"></script>'."\n";
 }