http://www.mediawiki.org/wiki/Special:Code/MediaWiki/69059

Revision: 69059
Author:   jeroendedauw
Date:     2010-07-05 17:04:45 +0000 (Mon, 05 Jul 2010)

Log Message:
-----------
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
    trunk/extensions/SemanticMaps/SemanticMaps.php

Modified: trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php
===================================================================
--- trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php      
2010-07-05 16:47:59 UTC (rev 69058)
+++ trunk/extensions/SemanticMaps/Features/QueryPrinters/SM_MapPrinter.php      
2010-07-05 17:04:45 UTC (rev 69059)
@@ -315,10 +315,24 @@
                        // Geocode and convert if required.
                        $centre = MapsGeocoder::attemptToGeocode( 
$this->centre, $this->geoservice, $this->mService->getName() );
                        
-                       $this->centreLat = $centre['lat'];
-                       $this->centreLon = $centre['lon'];
+                       if ( $centre ) {
+                               $this->centreLat = $centre['lat'];
+                               $this->centreLon = $centre['lon'];              
                
+                       }
+                       else {
+                               $this->setCentreDefault();
+                       }
                }
-               elseif ( count( $this->mLocations ) > 1 ) {
+               else {
+                       $this->setCentreDefault();
+               }
+       }
+       
+       /**
+        * Figures out the default value for the centre. 
+        */
+       private function setCentreDefault() {
+               if ( count( $this->mLocations ) > 1 ) {
                        // 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.     
                
                        $this->centreLat = 'null';
                        $this->centreLon = 'null';
@@ -334,7 +348,7 @@
                        
                        $this->centreLat = $egMapsMapLat;
                        $this->centreLon = $egMapsMapLon;
-               }
+               }               
        }
        
        /**

Modified: trunk/extensions/SemanticMaps/SemanticMaps.php
===================================================================
--- trunk/extensions/SemanticMaps/SemanticMaps.php      2010-07-05 16:47:59 UTC 
(rev 69058)
+++ trunk/extensions/SemanticMaps/SemanticMaps.php      2010-07-05 17:04:45 UTC 
(rev 69059)
@@ -35,7 +35,7 @@
 
 // Only initialize the extension when all dependencies are present.
 if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) {
-       define( 'SM_VERSION', '0.6.4 a10' );
+       define( 'SM_VERSION', '0.6.4 a11' );
 
        $useExtensionPath = version_compare( $wgVersion, '1.16', '>=' ) && 
isset( $wgExtensionAssetsPath ) && $wgExtensionAssetsPath;
        $smgScriptPath  = ( $useExtensionPath ? $wgExtensionAssetsPath : 
$wgScriptPath . '/extensions' ) . '/SemanticMaps';     



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to