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

Revision: 73484
Author:   jeroendedauw
Date:     2010-09-21 20:30:11 +0000 (Tue, 21 Sep 2010)

Log Message:
-----------
Changes for 0.7 - matching new Validator structure

Modified Paths:
--------------
    trunk/extensions/Maps/includes/Maps_Mapper.php
    trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php

Modified: trunk/extensions/Maps/includes/Maps_Mapper.php
===================================================================
--- trunk/extensions/Maps/includes/Maps_Mapper.php      2010-09-21 20:29:36 UTC 
(rev 73483)
+++ trunk/extensions/Maps/includes/Maps_Mapper.php      2010-09-21 20:30:11 UTC 
(rev 73484)
@@ -160,7 +160,7 @@
                $params['mappingservice'] = new Parameter(
                        'mappingservice', 
                        Parameter::TYPE_STRING,
-                       null,
+                       '', // TODO
                        array( 'service' ),
                        array(
                                new CriterionInArray( 
MapsMappingServices::getAllServiceValues() ),

Modified: trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php
===================================================================
--- trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php 
2010-09-21 20:29:36 UTC (rev 73483)
+++ trunk/extensions/Maps/includes/parserHooks/Maps_Finddestination.php 
2010-09-21 20:30:11 UTC (rev 73484)
@@ -57,49 +57,73 @@
                global $egMapsAvailableServices, $egMapsAvailableGeoServices, 
$egMapsDefaultGeoService, $egMapsAvailableCoordNotations;
                global $egMapsCoordinateNotation, $egMapsAllowCoordsGeocoding, 
$egMapsCoordinateDirectional;     
                
-               return array(
-                       'location' => array(
-                               'required' => true,
-                               'tolower' => false
-                       ),
-                       'bearing' => array(
-                               'type' => 'float',
-                               'required' => true
-                       ),
-                       'distance' => array(
-                               'type' => 'float',
-                               'required' => true
-                       ),
-                       'mappingservice' => array(
-                               'criteria' => array(
-                                       'in_array' => $egMapsAvailableServices
-                               ),
-                               'default' => false
-                       ),
-                       'service' => array(
-                               'criteria' => array(
-                                       'in_array' => 
$egMapsAvailableGeoServices
-                               ),
-                               'default' => $egMapsDefaultGeoService
-                       ),
-                       'format' => array(
-                               'criteria' => array(
-                                       'in_array' => 
$egMapsAvailableCoordNotations
-                               ),
-                               'aliases' => array(
-                                       'notation'
-                               ),
-                               'default' => $egMapsCoordinateNotation
-                       ),
-                       'allowcoordinates' => array(
-                               'type' => 'boolean',
-                               'default' => $egMapsAllowCoordsGeocoding
-                       ),
-                       'directional' => array(
-                               'type' => 'boolean',
-                               'default' => $egMapsCoordinateDirectional
-                       ),
+               $params = array();
+               
+               $params['location'] = new Parameter(
+                       'location',
+                       Parameter::TYPE_STRING,
+                       null,
+                       array(),
+                       array(
+                               new CriterionIsLocation(),
+                       )                       
                );
+
+               $params['location']->lowerCaseValue = false;
+               
+               $params['bearing'] = new Parameter(
+                       'bearing',
+                       Parameter::TYPE_FLOAT
+               );
+               
+               $params['distance'] = new Parameter(
+                       'distance'
+                       // TODO: add distance criterion
+               );
+               
+               $params['mappingservice'] = new Parameter(
+                       'mappingservice', 
+                       Parameter::TYPE_STRING,
+                       '', // TODO
+                       array(),
+                       array(
+                               new CriterionInArray( 
MapsMappingServices::getAllServiceValues() ),
+                       )
+               );
+               
+               $params['geoservice'] = new Parameter(
+                       'geoservice', 
+                       Parameter::TYPE_STRING,
+                       $egMapsDefaultGeoService,
+                       array( 'service' ),
+                       array(
+                               new CriterionInArray( 
$egMapsAvailableGeoServices ),
+                       )
+               );      
+
+               $params['allowcoordinates'] = new Parameter(
+                       'allowcoordinates', 
+                       Parameter::TYPE_BOOLEAN,
+                       $egMapsAllowCoordsGeocoding
+               );                      
+               
+               $params['format'] = new Parameter(
+                       'format',
+                       Parameter::TYPE_STRING,
+                       $egMapsCoordinateNotation,
+                       array( 'notation' ),
+                       array(
+                               new CriterionInArray( 
$egMapsAvailableCoordNotations ),
+                       )                       
+               );              
+               
+               $params['directional'] = new Parameter(
+                       'directional',
+                       Parameter::TYPE_BOOLEAN,
+                       $egMapsCoordinateDirectional                    
+               );                      
+               
+               return $params;
        }
        
        /**



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

Reply via email to