function execute() { global $wgOut, $wgOpenLayersScript, $wgWikiMapsJS, $wgArticlePath; $wgOut->disable(); echo ' <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> #map { width: 100%; height: 100%; border: 1px solid black; } #popup_contentDiv { width:80%; height:80%; border: 1px solid blue; position: fixed; background: papayawhip; } small.popup { margin-top: 0em; } ul.popup { margin-top: 0em; } div.displaytitle { border-bottom: solid 1px silver; margin-bottom:6px; } </style> <script src="' . $wgOpenLayersScript . '"></script> <script src="' . $wgWikiMapsJS . '"></script> <script type="text/javascript"> var wgFullscreen = true; var wgServer="' . $wgServer . '"; var wgArticlePath="' . $wgArticlePath . '"; ' . exportWikiMapsGlobals() . ' </script> </head> <body onload="WikiMapsInit();"> <div id="map"></div> <div id="selectbox" style="display:none;position: absolute; top:10em; left:10em; width:16em;background:#02048C;color: white;"> <div id="close" style="float:right; background:grey; color:black;font-size:small;margin:1px;padding-left:3px; padding-right:3px;pointer:hand;">X</div> <span style="margin-left:3px;">Result</span> <div id="selectboxbody" style="background:white; margin:1px; padding:3px; color:black;"></div> </div> </body> </html> '; }
/** * Called whenever a <geo> needs to be parsed * * Return markup, but also a pointer to Map sources */ function parseGeo($text, $params, &$parser) { global $action, $GeoserverParameters, $wgWikiMapsJS; $latpat = '(-?[0-9.]*) *(([0-9.]+) *([0-9.]+)?)? *([NS])'; $lonpat = '(-?[0-9.]*) *(([0-9.]+) *([0-9.]+)?)? *([EW])'; $featcodepat = '(([AHLPRSTUV])\\.([A-Z.]*))?'; $populationpat = '([0-9]*)?'; $showmappat = '(showmap)?'; preg_match("/\\s*{$latpat}\\s*{$lonpat}\\s*{$featcodepat}\\s*{$populationpat}\\s*{$showmappat}/", $text, $matches); $GeoserverParameters["lat"] = ($matches[5] == 'S' ? -1 : 1) * ($matches[1] + $matches[3] / 60.0 + $matches[4] / 3600); $GeoserverParameters["lon"] = ($matches[10] == 'W' ? -1 : 1) * ($matches[6] + $matches[8] / 60.0 + $matches[9] / 3600); $GeoserverParameters["type_major"] = $matches[12]; $GeoserverParameters["type_minor"] = $matches[13]; $GeoserverParameters["population"] = $matches[14]; $r = ''; if ($matches[15]) { // that's the "showmap" flag global $wgOut, $wgOpenLayersScript, $wgWikiMapsIcon; $defaultZoom = 10; $majorMinor = $GeoserverParameters["type_major"] . $GeoserverParameters["type_minor"]; if ($majorMinor == 'PPPL') { // populated place $defaultZoom = 8; } elseif ($majorMinor == 'PPPLC') { // capital city $defaultZoom = 6; } $r = '<script src="' . $wgOpenLayersScript . '"></script> <script src="' . $wgWikiMapsJS . '"></script> <script type="text/javascript"> addOnloadHook(WikiMapsInit); var WikiMapsLon = ' . $GeoserverParameters["lon"] . '; var WikiMapsLat = ' . $GeoserverParameters["lat"] . '; var WikiMapsMajor = "' . $GeoserverParameters["type_major"] . '"; var WikiMapsMinor = "' . $GeoserverParameters["type_minor"] . '"; var WikiMapsZoom = ' . $defaultZoom . '; ' . exportWikiMapsGlobals() . ' </script> <div id="wikimaps"><div class="wikimapslabel" >Map</div><div class="wikimapslabel" id="wikimapsfullscreen">Fullscreen</div><br /><div id="map" style="width:300px; height:300px;"></div><div id="selectbox" style="display:none;XXposition: absolute; XXtop:10em; XXleft:10em; width:300px;background:#02048C;color: white; padding-bottom:1px;"><div id="close" style="float:right; background:grey; color:black;font-size:small;margin:1px;padding-left:3px; padding-right:3px;pointer:hand;">X</div><span style="margin-left:3px;">Result</span><div id="selectboxbody" style="background:white; margin:1px; padding:3px; color:black;"></div></div></div>'; } return $r; }