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

Revision: 74048
Author:   jeroendedauw
Date:     2010-10-01 01:50:46 +0000 (Fri, 01 Oct 2010)

Log Message:
-----------
Changes for 0.7 - fixed some issues caused by earlier refactoring

Modified Paths:
--------------
    trunk/extensions/Maps/Maps.php
    trunk/extensions/Maps/Maps_Settings.php
    trunk/extensions/Maps/includes/Maps_Mapper.php
    trunk/extensions/Maps/includes/features/Maps_BaseMap.php
    trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php
    trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php
    trunk/extensions/Maps/includes/services/OSM/Maps_OSMDispMap.php

Modified: trunk/extensions/Maps/Maps.php
===================================================================
--- trunk/extensions/Maps/Maps.php      2010-09-30 22:07:11 UTC (rev 74047)
+++ trunk/extensions/Maps/Maps.php      2010-10-01 01:50:46 UTC (rev 74048)
@@ -36,7 +36,7 @@
        echo '<b>Warning:</b> You need to have <a 
href="http://www.mediawiki.org/wiki/Extension:Validator";>Validator</a> 
installed in order to use <a 
href="http://www.mediawiki.org/wiki/Extension:Maps";>Maps</a>.';
 }
 else {
-       define( 'Maps_VERSION', '0.7 alpha-5' );
+       define( 'Maps_VERSION', '0.7 alpha-6' );
 
        // The different coordinate notations.
        define( 'Maps_COORDS_FLOAT', 'float' );

Modified: trunk/extensions/Maps/Maps_Settings.php
===================================================================
--- trunk/extensions/Maps/Maps_Settings.php     2010-09-30 22:07:11 UTC (rev 
74047)
+++ trunk/extensions/Maps/Maps_Settings.php     2010-10-01 01:50:46 UTC (rev 
74048)
@@ -110,21 +110,13 @@
        # Note: The default service needs to be available for the feature you 
set it
        # for, since it's used as a fallback mechanism.
        $egMapsDefaultServices = array(
-               'display_point' => 'googlemaps2',
-               'display_map' => 'googlemaps2'
+               'display_point' => $egMapsDefaultService,
+               'display_map' => $egMapsDefaultService
        );
 
 
-
-# General configuration
-
-       # Boolean. Indicates if minified js files should be used where 
available.
-       # Do not change this value unless you know what you are doing!
-       $egMapsUseMinJs = false;
-
-
        
-# Geocoding services configuration
+# Geocoding
 
        # Array of String. Array containing all the geocoding services that 
will be
        # made available to the user. Currently Maps provides the following 
services:
@@ -143,6 +135,12 @@
        # Boolean. Indicates if geocoders can override the default geoservice 
based on
        # the used mapping service.
        $egMapsUserGeoOverrides = true;
+       
+       # Boolean. Sets if coordinates should be allowed in geocoding calls.
+       $egMapsAllowCoordsGeocoding = true;
+       
+       # Boolean. Sets if geocoded addresses should be stored in a cache.
+       $egMapsEnableGeoCache = true;   
 
 
 
@@ -164,12 +162,6 @@
        # Recommended to be true for Maps_COORDS_DMS and false for 
Maps_COORDS_FLOAT.
        $egMapsCoordinateDirectional = true;
        
-       # Boolean. Sets if coordinates should be allowed in geocoding calls.
-       $egMapsAllowCoordsGeocoding = true;
-       
-       # Boolean. Sets if geocoded addresses should be stored in a cache.
-       $egMapsEnableGeoCache = true;
-       
        # Boolean. Sets if direction labels should be translated to their 
equivalent in the wiki language or not.
        $egMapsInternatDirectionLabels = true;
 
@@ -178,7 +170,7 @@
 # Distance configuration
        
        # Array. A list of units (keys) and how many meters they represent 
(value).
-       # No spaces! If the unit consists out of multple words, just write them 
together.
+       # No spaces! If the unit consists out of multiple words, just write 
them together.
        $egMapsDistanceUnits = array(
                'm' => 1,
                'meter' => 1,
@@ -197,7 +189,7 @@
        # String. The default unit for distances.
        $egMapsDistanceUnit = 'm';
        
-       # Integer. The default limit of fractal digits in a distance.
+       # Integer. The default amount of fractal digits in a distance.
        $egMapsDistanceDecimals = 2;    
        
        

Modified: trunk/extensions/Maps/includes/Maps_Mapper.php
===================================================================
--- trunk/extensions/Maps/includes/Maps_Mapper.php      2010-09-30 22:07:11 UTC 
(rev 74047)
+++ trunk/extensions/Maps/includes/Maps_Mapper.php      2010-10-01 01:50:46 UTC 
(rev 74048)
@@ -95,7 +95,7 @@
        /**
         * Add a JavaScript file out of skins/common, or a given relative path.
         * 
-        * This is a copy of the native function in OutputPage to work around a 
pre 1.16 bug.
+        * This is a copy of the native function in OutputPage to work around a 
pre MW 1.16 bug.
         * Should be used for adding external files, like the Google Maps API.
         * 
         * @param OutputPage $out

Modified: trunk/extensions/Maps/includes/features/Maps_BaseMap.php
===================================================================
--- trunk/extensions/Maps/includes/features/Maps_BaseMap.php    2010-09-30 
22:07:11 UTC (rev 74047)
+++ trunk/extensions/Maps/includes/features/Maps_BaseMap.php    2010-10-01 
01:50:46 UTC (rev 74048)
@@ -102,9 +102,9 @@
        /**
         * Sets the $centreLat and $centreLon fields.
         */
-       private function setCentre() {
+       protected function setCentre() {
                if ( empty( $this->coordinates ) ) { // If centre is not set, 
use the default latitude and longitutde.
-                       $this->setDefaultCentre();
+                       $this->setCentreToDefault();
                }
                else { // If a centre value is set, geocode when needed and use 
it.
                        $this->coordinates = MapsGeocoders::attemptToGeocode( 
$this->coordinates, $this->geoservice, $this->service->getName() );
@@ -115,10 +115,29 @@
                                $this->centreLon = Xml::escapeJsString( 
$this->coordinates['lon'] );
                        }
                        else { // If it's false, the coordinate was invalid, or 
geocoding failed. Either way, the default's should be used.
-                               global $egMapsDefaultMapCentre;
-                               $this->setCentre( $egMapsDefaultMapCentre );
+                               $this->setCentreToDefault();
                        }
                }
        }
        
+       /**
+        * Attempts to set the centreLat and centreLon fields to the Maps 
default.
+        * When this fails (aka the default is not valid), an exception is 
thrown.
+        * 
+        * @since 0.7
+        */
+       protected function setCentreToDefault() {
+               global $egMapsDefaultMapCentre;
+               
+               $centre = MapsGeocoders::attemptToGeocode( 
$egMapsDefaultMapCentre, $this->geoservice, $this->service->getName() );
+               
+               if ( $centre === false ) {
+                       throw new Exception( 'Failed to parse the default 
centre for the map. Please check the value of $egMapsDefaultMapCentre.' );
+               }
+               else {
+                       $this->centreLat = Xml::escapeJsString( $centre['lat'] 
);
+                       $this->centreLon = Xml::escapeJsString( $centre['lon'] 
);                       
+               }
+       }       
+       
 }
\ No newline at end of file

Modified: trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php
===================================================================
--- trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php 
2010-09-30 22:07:11 UTC (rev 74047)
+++ trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php 
2010-10-01 01:50:46 UTC (rev 74048)
@@ -151,6 +151,7 @@
                        $location = MapsCoordinateParser::parseCoordinates( 
$parameters['location'] );
                }
                
+               // TODO
                if ( $location ) {
                        $destination = MapsGeoFunctions::findDestination(
                                $location,

Modified: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php
===================================================================
--- trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php      
2010-09-30 22:07:11 UTC (rev 74047)
+++ trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php      
2010-10-01 01:50:46 UTC (rev 74048)
@@ -59,7 +59,7 @@
                        )                       
                );
                $params['controls']->addManipulations( new 
ParamManipulationImplode( ',', "'" ) );              
-               
+
                $params['type'] = new Parameter(
                        'type',
                        Parameter::TYPE_STRING,

Modified: trunk/extensions/Maps/includes/services/OSM/Maps_OSMDispMap.php
===================================================================
--- trunk/extensions/Maps/includes/services/OSM/Maps_OSMDispMap.php     
2010-09-30 22:07:11 UTC (rev 74047)
+++ trunk/extensions/Maps/includes/services/OSM/Maps_OSMDispMap.php     
2010-10-01 01:50:46 UTC (rev 74048)
@@ -1,23 +1,11 @@
 <?php
 
 /**
- * File holding the MapsOSMDispMap class.
- *
- * @file Maps_OSMDispMap.php
- * @ingroup OSM
- *
- * @author Jeroen De Dauw
- */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-       die( 'Not an entry point.' );
-}
-
-/**
  * Class for handling the display_map parser function with OSM.
  * 
  * @since 0.6.4
  * 
+ * @file Maps_OSMDispMap.php
  * @ingroup OSM
  * 
  * @author Jeroen De Dauw
@@ -32,7 +20,7 @@
        public function addSpecificMapHTML( Parser $parser ) {  
                global $wgOut;
                
-               $wgOut->addHtml( Html::element(
+               $this->output .= Html::element(
                        'iframe',
                        array(
                                'id' => $this->service->getMapId(),
@@ -40,7 +28,7 @@
                                'src' => 
"http://toolserver.org/~kolossos/openlayers/kml-on-ol.php?zoom={$this->zoom}&lat={$this->centreLat}&lon={$this->centreLon}&lang=en"
                        ),
                        wfMsg( 'maps-loading-map' )
-               ) );
+               );
        }
        
 }
\ No newline at end of file



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

Reply via email to