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

Revision: 67259
Author:   jeroendedauw
Date:     2010-06-02 22:34:48 +0000 (Wed, 02 Jun 2010)

Log Message:
-----------
Changes for 0.6.1 - Partially fixed point meta data bug

Modified Paths:
--------------
    trunk/extensions/Maps/Features/DisplayPoint/Maps_BasePointMap.php
    trunk/extensions/Maps/Features/DisplayPoint/Maps_DisplayPoint.php
    trunk/extensions/Maps/Maps_Mapper.php

Modified: trunk/extensions/Maps/Features/DisplayPoint/Maps_BasePointMap.php
===================================================================
--- trunk/extensions/Maps/Features/DisplayPoint/Maps_BasePointMap.php   
2010-06-02 22:12:23 UTC (rev 67258)
+++ trunk/extensions/Maps/Features/DisplayPoint/Maps_BasePointMap.php   
2010-06-02 22:34:48 UTC (rev 67259)
@@ -95,9 +95,9 @@
                                'type' => array( 'string', 'list', ';' ),
                                'aliases' => array( 'coords', 'location', 
'locations', 'address', 'addresses' ),
                                'criteria' => array(
-                                       'are_locations' => array()
+                                       'are_locations' => array( '~' )
                                ),
-                               'output-type' => 'coordinateSets',
+                               'output-type' => 'geoPoints',
                        ),
                );
        }

Modified: trunk/extensions/Maps/Features/DisplayPoint/Maps_DisplayPoint.php
===================================================================
--- trunk/extensions/Maps/Features/DisplayPoint/Maps_DisplayPoint.php   
2010-06-02 22:12:23 UTC (rev 67258)
+++ trunk/extensions/Maps/Features/DisplayPoint/Maps_DisplayPoint.php   
2010-06-02 22:34:48 UTC (rev 67259)
@@ -54,6 +54,7 @@
        public static $parameters = array();
        
        public static function initialize() {
+               Validator::addOutputFormat( 'geoPoints', array( __CLASS__, 
'formatGeoPoints' ) );
        }
        
        /**
@@ -68,4 +69,20 @@
                return MapsParserFunctions::getMapHtml( $parser, $args, 
'display_point' );
        }
        
+       /**
+        * Formats a set of points that can have meta data provided.
+        * 
+        * @param string $locations
+        * @param string $name The name of the parameter.
+        * @param array $parameters Array containing data about the so far 
handled parameters.
+        * 
+        * FIXME: hold into acount meta data
+        */             
+       public static function formatGeoPoints( &$locations, $name, array 
$parameters ) {
+               $locations = (array)$locations;
+               foreach ( $locations as &$location ) {
+                       self::formatLocation( $location, $name, $parameters );
+               }
+       }       
+       
 }
\ No newline at end of file

Modified: trunk/extensions/Maps/Maps_Mapper.php
===================================================================
--- trunk/extensions/Maps/Maps_Mapper.php       2010-06-02 22:12:23 UTC (rev 
67258)
+++ trunk/extensions/Maps/Maps_Mapper.php       2010-06-02 22:34:48 UTC (rev 
67259)
@@ -25,7 +25,6 @@
 
                Validator::addOutputFormat( 'mapdimension', array( __CLASS__, 
'setMapDimension' ) );
                Validator::addOutputFormat( 'coordinateSet', array( __CLASS__, 
'formatLocation' ) );
-               Validator::addOutputFormat( 'coordinateSets', array( __CLASS__, 
'formatLocations' ) );
        }
        
        /**
@@ -37,7 +36,12 @@
         * 
         * @return boolean
         */
-       public static function isLocation( $location, $name, array $parameters 
) {
+       public static function isLocation( $location, $name, array $parameters, 
$metaDataSeperator = false ) {
+               if ( $metaDataSeperator ) {
+                       $parts = explode( $metaDataSeperator, $location );
+                       $location = $parts[0];
+               }
+               
                if ( self::geocoderIsAvailable() ) {
                        return MapsGeocoder::isLocation( $location, 
$parameters['geoservice']['value'], $parameters['service']['value'] );
                } else {
@@ -54,10 +58,10 @@
         * 
         * @return boolean
         */     
-       public static function areLocations( $locations, $name, array 
$parameters ) {
+       public static function areLocations( $locations, $name, array 
$parameters, $metaDataSeperator = false ) {
                $locations = (array)$locations;
                foreach ( $locations as $location ) {
-                       if ( !self::isLocation( $location, $name, $parameters ) 
) {
+                       if ( !self::isLocation( $location, $name, $parameters, 
$metaDataSeperator ) ) {
                                return false;
                        }
                }
@@ -80,20 +84,6 @@
        }
 
        /**
-        * Formats a set of locations to coordinate sets in a certain 
representation.
-        * 
-        * @param string $locations
-        * @param string $name The name of the parameter.
-        * @param array $parameters Array containing data about the so far 
handled parameters.
-        */             
-       public static function formatLocations( &$locations, $name, array 
$parameters ) {
-               $locations = (array)$locations;
-               foreach ( $locations as &$location ) {
-                       self::formatLocation( $location, $name, $parameters );
-               }
-       }
-
-       /**
         * Returns a valid service. When an invalid service is provided, the 
default one will be returned.
         * Aliases are also chancged into the main service names @see 
MapsMapper::getMainServiceName().
         *



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to