Index: trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsQP.php |
— | — | @@ -24,26 +24,18 @@ |
25 | 25 | protected function setQueryPrinterSettings() { |
26 | 26 | global $egMapsYahooMapsZoom, $egMapsYahooMapsPrefix; |
27 | 27 | |
28 | | - $this->elementNamePrefix = $egMapsYahooMapsPrefix; |
29 | | - |
30 | 28 | $this->defaultZoom = $egMapsYahooMapsZoom; |
31 | 29 | } |
32 | 30 | |
33 | 31 | /** |
34 | | - * @see SMMapPrinter::doMapServiceLoad() |
| 32 | + * @see SMMapPrinter::addSpecificMapHTML() |
35 | 33 | */ |
36 | | - protected function doMapServiceLoad() { |
37 | | - global $egYahooMapsOnThisPage; |
| 34 | + protected function addSpecificMapHTML() { |
| 35 | + global $egMapsYahooMapsPrefix, $egYahooMapsOnThisPage; |
38 | 36 | |
39 | 37 | $egYahooMapsOnThisPage++; |
| 38 | + $mapName = $egMapsYahooMapsPrefix . '_' . $egYahooMapsOnThisPage; |
40 | 39 | |
41 | | - $this->elementNr = $egYahooMapsOnThisPage; |
42 | | - } |
43 | | - |
44 | | - /** |
45 | | - * @see SMMapPrinter::addSpecificMapHTML() |
46 | | - */ |
47 | | - protected function addSpecificMapHTML() { |
48 | 40 | // TODO: refactor up like done in maps with display point |
49 | 41 | $markerItems = array(); |
50 | 42 | |
— | — | @@ -59,7 +51,7 @@ |
60 | 52 | $this->output .= Html::element( |
61 | 53 | 'div', |
62 | 54 | array( |
63 | | - 'id' => $this->mapName, |
| 55 | + 'id' => $mapName, |
64 | 56 | 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;", |
65 | 57 | ), |
66 | 58 | wfMsg( 'maps-loading-map' ) |
— | — | @@ -69,7 +61,7 @@ |
70 | 62 | addOnloadHook( |
71 | 63 | function() { |
72 | 64 | initializeYahooMap( |
73 | | - '$this->mapName', |
| 65 | + '$mapName', |
74 | 66 | $this->centreLat, |
75 | 67 | $this->centreLon, |
76 | 68 | $this->zoom, |
Index: trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersQP.php |
— | — | @@ -23,29 +23,19 @@ |
24 | 24 | * @see SMMapPrinter::setQueryPrinterSettings() |
25 | 25 | */ |
26 | 26 | protected function setQueryPrinterSettings() { |
27 | | - global $egMapsOpenLayersZoom, $egMapsOpenLayersPrefix; |
28 | | - |
29 | | - $this->elementNamePrefix = $egMapsOpenLayersPrefix; |
| 27 | + global $egMapsOpenLayersZoom; |
30 | 28 | $this->defaultZoom = $egMapsOpenLayersZoom; |
31 | 29 | } |
32 | | - |
33 | | - /** |
34 | | - * @see SMMapPrinter::doMapServiceLoad() |
35 | | - */ |
36 | | - protected function doMapServiceLoad() { |
37 | | - global $egOpenLayersOnThisPage; |
38 | | - |
39 | | - $egOpenLayersOnThisPage++; |
40 | | - |
41 | | - $this->elementNr = $egOpenLayersOnThisPage; |
42 | | - } |
43 | 30 | |
44 | 31 | /** |
45 | 32 | * @see SMMapPrinter::addSpecificMapHTML() |
46 | 33 | */ |
47 | 34 | protected function addSpecificMapHTML() { |
48 | | - global $wgLang; |
| 35 | + global $wgLang, $egMapsOpenLayersPrefix, $egOpenLayersOnThisPage; |
49 | 36 | |
| 37 | + $egOpenLayersOnThisPage++; |
| 38 | + $mapName = $egMapsOpenLayersPrefix . '_' . $egOpenLayersOnThisPage; |
| 39 | + |
50 | 40 | // TODO: refactor up like done in maps with display point |
51 | 41 | $markerItems = array(); |
52 | 42 | |
— | — | @@ -61,7 +51,7 @@ |
62 | 52 | $this->output .= Html::element( |
63 | 53 | 'div', |
64 | 54 | array( |
65 | | - 'id' => $this->mapName, |
| 55 | + 'id' => $mapName, |
66 | 56 | 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;", |
67 | 57 | ), |
68 | 58 | wfMsg( 'maps-loading-map' ) |
— | — | @@ -75,7 +65,7 @@ |
76 | 66 | addOnloadHook( |
77 | 67 | function() { |
78 | 68 | initOpenLayer( |
79 | | - '$this->mapName', |
| 69 | + '$mapName', |
80 | 70 | $this->centreLat, |
81 | 71 | $this->centreLon, |
82 | 72 | $this->zoom, |
Index: trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsQP.php |
— | — | @@ -24,10 +24,8 @@ |
25 | 25 | * @see SMMapPrinter::setQueryPrinterSettings() |
26 | 26 | */ |
27 | 27 | protected function setQueryPrinterSettings() { |
28 | | - global $egMapsGoogleMapsZoom, $egMapsGoogleMapsPrefix, $egMapsGMapOverlays; |
| 28 | + global $egMapsGoogleMapsZoom, $egMapsGMapOverlays; |
29 | 29 | |
30 | | - $this->elementNamePrefix = $egMapsGoogleMapsPrefix; |
31 | | - |
32 | 30 | $this->defaultZoom = $egMapsGoogleMapsZoom; |
33 | 31 | |
34 | 32 | $this->specificParameters = array( |
— | — | @@ -42,21 +40,15 @@ |
43 | 41 | } |
44 | 42 | |
45 | 43 | /** |
46 | | - * @see SMMapPrinter::doMapServiceLoad() |
| 44 | + * @see SMMapPrinter::addSpecificMapHTML() |
47 | 45 | */ |
48 | | - protected function doMapServiceLoad() { |
49 | | - global $egGoogleMapsOnThisPage; |
| 46 | + protected function addSpecificMapHTML() { |
| 47 | + global $egMapsGoogleMapsPrefix, $egGoogleMapsOnThisPage; |
50 | 48 | |
51 | 49 | $egGoogleMapsOnThisPage++; |
| 50 | + $mapName = $egMapsGoogleMapsPrefix . '_' . $egGoogleMapsOnThisPage; |
52 | 51 | |
53 | | - $this->elementNr = $egGoogleMapsOnThisPage; |
54 | | - } |
55 | | - |
56 | | - /** |
57 | | - * @see SMMapPrinter::addSpecificMapHTML() |
58 | | - */ |
59 | | - protected function addSpecificMapHTML() { |
60 | | - $this->mService->addOverlayOutput( $this->output, $this->mapName, $this->overlays, $this->controls ); |
| 52 | + $this->mService->addOverlayOutput( $this->output, $mapName, $this->overlays, $this->controls ); |
61 | 53 | |
62 | 54 | // TODO: refactor up like done in maps with display point |
63 | 55 | $markerItems = array(); |
— | — | @@ -72,7 +64,7 @@ |
73 | 65 | $this->output .= Html::element( |
74 | 66 | 'div', |
75 | 67 | array( |
76 | | - 'id' => $this->mapName, |
| 68 | + 'id' => $mapName, |
77 | 69 | 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;", |
78 | 70 | ), |
79 | 71 | wfMsg( 'maps-loading-map' ) |
— | — | @@ -81,7 +73,7 @@ |
82 | 74 | $this->mService->addDependency( Html::inlineScript( <<<EOT |
83 | 75 | addOnloadHook( |
84 | 76 | function() { |
85 | | - initializeGoogleMap('$this->mapName', |
| 77 | + initializeGoogleMap('$mapName', |
86 | 78 | { |
87 | 79 | lat: $this->centreLat, |
88 | 80 | lon: $this->centreLon, |
Index: trunk/extensions/SemanticMaps/SemanticMaps.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | |
37 | 37 | // Only initialize the extension when all dependencies are present. |
38 | 38 | if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) { |
39 | | - define( 'SM_VERSION', '0.6.4 a9' ); |
| 39 | + define( 'SM_VERSION', '0.6.4 a10' ); |
40 | 40 | |
41 | 41 | $useExtensionPath = version_compare( $wgVersion, '1.16', '>=' ) && isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath; |
42 | 42 | $smgScriptPath = ( $useExtensionPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/SemanticMaps'; |
Index: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php |
— | — | @@ -33,11 +33,6 @@ |
34 | 34 | */ |
35 | 35 | protected abstract function setQueryPrinterSettings(); |
36 | 36 | |
37 | | - /** |
38 | | - * Map service specific map count and loading of dependencies. |
39 | | - */ |
40 | | - protected abstract function doMapServiceLoad(); |
41 | | - |
42 | 37 | protected abstract function getServiceName(); |
43 | 38 | |
44 | 39 | /** |
— | — | @@ -90,10 +85,6 @@ |
91 | 86 | |
92 | 87 | // Only create a map when there is at least one result. |
93 | 88 | if ( count( $this->mLocations ) > 0 || $this->forceshow ) { |
94 | | - $this->doMapServiceLoad(); |
95 | | - |
96 | | - $this->setMapName(); |
97 | | - |
98 | 89 | $this->setZoom(); |
99 | 90 | |
100 | 91 | $this->setCentre(); |
— | — | @@ -304,7 +295,7 @@ |
305 | 296 | * Sets the zoom level to the provided value, or when not set, to the default. |
306 | 297 | */ |
307 | 298 | private function setZoom() { |
308 | | - if ( strlen( $this->zoom ) < 1 ) { |
| 299 | + if ( $this->zoom == '' ) { |
309 | 300 | if ( count( $this->mLocations ) > 1 ) { |
310 | 301 | $this->zoom = 'null'; |
311 | 302 | } |
— | — | @@ -320,7 +311,7 @@ |
321 | 312 | */ |
322 | 313 | private function setCentre() { |
323 | 314 | // If a centre value is set, use it. |
324 | | - if ( strlen( $this->centre ) > 0 ) { |
| 315 | + if ( $this->centre != '' ) { |
325 | 316 | // Geocode and convert if required. |
326 | 317 | $centre = MapsGeocoder::attemptToGeocode( $this->centre, $this->geoservice, $this->mService->getName() ); |
327 | 318 | |
— | — | @@ -347,16 +338,19 @@ |
348 | 339 | } |
349 | 340 | |
350 | 341 | /** |
351 | | - * Sets the $mapName field, using the $elementNamePrefix and $elementNr. |
| 342 | + * Returns the internationalized name of the mapping service. |
| 343 | + * |
| 344 | + * @return string |
352 | 345 | */ |
353 | | - protected function setMapName() { |
354 | | - $this->mapName = $this->elementNamePrefix . '_' . $this->elementNr; |
355 | | - } |
356 | | - |
357 | 346 | public final function getName() { |
358 | 347 | return wfMsg( 'maps_' . $this->mService->getName() ); |
359 | 348 | } |
360 | 349 | |
| 350 | + /** |
| 351 | + * Returns a list of parameter information, for usage by Special:Ask and others. |
| 352 | + * |
| 353 | + * @return array |
| 354 | + */ |
361 | 355 | public function getParameters() { |
362 | 356 | global $egMapsMapWidth, $egMapsMapHeight; |
363 | 357 | |