r69059 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69058‎ | r69059 | r69060 >
Date:17:04, 5 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6.4 - fixed bug that made query maps fail when their center address could not be geocoded.
Modified paths:
  • /trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/SemanticMaps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/SemanticMaps.php
@@ -35,7 +35,7 @@
3636
3737 // Only initialize the extension when all dependencies are present.
3838 if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) {
39 - define( 'SM_VERSION', '0.6.4 a10' );
 39+ define( 'SM_VERSION', '0.6.4 a11' );
4040
4141 $useExtensionPath = version_compare( $wgVersion, '1.16', '>=' ) && isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath;
4242 $smgScriptPath = ( $useExtensionPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions' ) . '/SemanticMaps';
Index: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
@@ -315,10 +315,24 @@
316316 // Geocode and convert if required.
317317 $centre = MapsGeocoder::attemptToGeocode( $this->centre, $this->geoservice, $this->mService->getName() );
318318
319 - $this->centreLat = $centre['lat'];
320 - $this->centreLon = $centre['lon'];
 319+ if ( $centre ) {
 320+ $this->centreLat = $centre['lat'];
 321+ $this->centreLon = $centre['lon'];
 322+ }
 323+ else {
 324+ $this->setCentreDefault();
 325+ }
321326 }
322 - elseif ( count( $this->mLocations ) > 1 ) {
 327+ else {
 328+ $this->setCentreDefault();
 329+ }
 330+ }
 331+
 332+ /**
 333+ * Figures out the default value for the centre.
 334+ */
 335+ private function setCentreDefault() {
 336+ if ( count( $this->mLocations ) > 1 ) {
323337 // If centre is not set, and there are multiple points, set the values to null, to be auto determined by the JS of the mapping API.
324338 $this->centreLat = 'null';
325339 $this->centreLon = 'null';
@@ -334,7 +348,7 @@
335349
336350 $this->centreLat = $egMapsMapLat;
337351 $this->centreLon = $egMapsMapLon;
338 - }
 352+ }
339353 }
340354
341355 /**

Status & tagging log