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

Revision: 73733
Author:   jeroendedauw
Date:     2010-09-25 08:04:29 +0000 (Sat, 25 Sep 2010)

Log Message:
-----------
Changes for 0.7 - Follow up to changes in Validator

Modified Paths:
--------------
    trunk/extensions/Maps/Maps_Settings.php
    trunk/extensions/Maps/includes/Maps_MappingService.php
    trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php
    trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php
    trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php
    
trunk/extensions/Maps/includes/services/GoogleMaps/CriterionGoogleOverlay.php
    trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php

Modified: trunk/extensions/Maps/Maps_Settings.php
===================================================================
--- trunk/extensions/Maps/Maps_Settings.php     2010-09-25 07:37:37 UTC (rev 
73732)
+++ trunk/extensions/Maps/Maps_Settings.php     2010-09-25 08:04:29 UTC (rev 
73733)
@@ -219,10 +219,8 @@
                'height' => array( 50, 1000, 1, 100 ),
        );
        
-       # Strings. The default coordinates for the map. Must be in floating 
point
-       # notation. This value will only be used when the user does not provide 
one.
-       $egMapsMapLat = '1';
-       $egMapsMapLon = '1';
+       # String. The default centre for maps. Can be either a set of 
coordinates or an address.
+       $egMapsDefaultMapCentre = '0, 0';
        
        # Strings. The default content for all pop-ups. This value will only be 
used
        # when the user does not provide one.

Modified: trunk/extensions/Maps/includes/Maps_MappingService.php
===================================================================
--- trunk/extensions/Maps/includes/Maps_MappingService.php      2010-09-25 
07:37:37 UTC (rev 73732)
+++ trunk/extensions/Maps/includes/Maps_MappingService.php      2010-09-25 
08:04:29 UTC (rev 73733)
@@ -1,24 +1,14 @@
 <?php
 
 /**
- * File holding the MapsMappingService class.
- *
- * @file Maps_MappingService.php
- * @ingroup Maps
- *
- * @author Jeroen De Dauw
- */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-       die( 'Not an entry point.' );
-}
-
-/**
  * Base class for mapping services. Deriving classes hold mapping service 
specific 
  * information and functionality, which can be used by any mapping feature.
  * 
  * @since 0.6.3
  * 
+ * @file Maps_MappingService.php
+ * @ingroup Maps
+ * 
  * @author Jeroen De Dauw
  */
 abstract class MapsMappingService implements iMappingService {

Modified: trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php
===================================================================
--- trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php  
2010-09-25 07:37:37 UTC (rev 73732)
+++ trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php  
2010-09-25 08:04:29 UTC (rev 73733)
@@ -23,24 +23,14 @@
        protected $feature;
        
        /**
-        * Adittional parameter definitions to load.
-        * 
-        * @since 0.7
-        * 
-        * @var array of Parameter
-        */
-       protected $serviceParams;
-       
-       /**
         * Constructor.
         * 
         * @since 0.7
         */
-       public function __construct( $feature, array $serviceParams = array() ) 
{
+       public function __construct( $feature ) {
                parent::__construct();
                
                $this->feature = $feature;
-               $this->serviceParams = $serviceParams;
        }
        
        /**
@@ -50,10 +40,13 @@
         */     
        public function doManipulation( &$value, array &$parameters ) {
                // Make sure the service is valid.
-               $value = MapsMappingService::getValidServiceName( $value, 
$this->feature );
+               $value = MapsMappingServices::getValidServiceName( $value, 
$this->feature );
                
+               // Get the service object so the service specific parameters 
can be retrieved.
+               $serviceObject = MapsMappingServices::getServiceInstance( 
$value );
+               
                // Add the service specific service parameters.
-               $parameters = array_merge( $parameters, $this->serviceParams );
+               $parameters = array_merge( $parameters, 
$serviceObject->getParameterInfo() );
        }
        
 }
\ No newline at end of file

Modified: trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php
===================================================================
--- trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php      
2010-09-25 07:37:37 UTC (rev 73732)
+++ trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php      
2010-09-25 08:04:29 UTC (rev 73733)
@@ -62,6 +62,7 @@
                $params = MapsMapper::getCommonParameters();
                
                $params['mappingservice']->default = 
$egMapsDefaultServices['display_map'];
+               $params['mappingservice']->addManipulations( new 
MapsParamService( 'display_map' ) );
                
                $params['coordinates'] = new Parameter( 'coordinates' );
                $params['coordinates']->addAliases( 'coords', 'location', 
'address' );

Modified: trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php
===================================================================
--- trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php    
2010-09-25 07:37:37 UTC (rev 73732)
+++ trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php    
2010-09-25 08:04:29 UTC (rev 73733)
@@ -92,6 +92,7 @@
                $params = MapsMapper::getCommonParameters();
                
                $params['mappingservice']->default = 
$egMapsDefaultServices['display_point'];
+               $params['mappingservice']->addManipulations( new 
MapsParamService( 'display_point' ) );
                
                $params['coordinates'] = new Parameter( 'coordinates' );
                $params['coordinates']->addAliases( 'coords', 'location', 
'address', 'addresses', 'locations' );
@@ -102,13 +103,12 @@
                $params['centre'] = new Parameter(
                        'centre',
                        Parameter::TYPE_STRING,
-                       '', // TODO
+                       $egMapsDefaultMapCentre,
                        array( 'center' ),
                        array(
                                new CriterionIsLocation(),
                        )                       
                );
-               
                $params['centre']->lowerCaseValue = false;
                
                $params['title'] = new Parameter(
@@ -116,7 +116,6 @@
                        Parameter::TYPE_STRING,
                        $egMapsDefaultTitle
                );
-               
                $params['title']->lowerCaseValue = false;
                
                $params['label'] = new Parameter(
@@ -125,7 +124,6 @@
                        $egMapsDefaultLabel,
                        array( 'text' )
                );
-               
                $params['label']->lowerCaseValue = false;
                
                $params['icon'] = new Parameter(
@@ -137,7 +135,6 @@
                                New CriterionNotEmpty()
                        )
                );      
-
                $params['icon']->lowerCaseValue = false;
                
                return $params;

Modified: 
trunk/extensions/Maps/includes/services/GoogleMaps/CriterionGoogleOverlay.php
===================================================================
--- 
trunk/extensions/Maps/includes/services/GoogleMaps/CriterionGoogleOverlay.php   
    2010-09-25 07:37:37 UTC (rev 73732)
+++ 
trunk/extensions/Maps/includes/services/GoogleMaps/CriterionGoogleOverlay.php   
    2010-09-25 08:04:29 UTC (rev 73733)
@@ -48,4 +48,21 @@
                ;
        }       
        
+       /**
+        * @see ItemParameterCriterion::getItemErrorMessage
+        */     
+       protected function getItemErrorMessage( Parameter $parameter ) {
+               // TODO
+               return wfMsgExt( '', 'parsemag', $parameter->getOriginalName() 
);
+       }
+       
+       /** 
+        * @see ItemParameterCriterion::getListErrorMessage
+        */     
+       protected function getListErrorMessage( Parameter $parameter, array 
$invalidItems ) {
+               global $wgLang;
+               // TODO
+               return wfMsgExt( '', 'parsemag', $wgLang->listToText( 
$invalidItems ), count( $invalidItems ) );
+       }               
+       
 }

Modified: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php
===================================================================
--- trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php      
2010-09-25 07:37:37 UTC (rev 73732)
+++ trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php      
2010-09-25 08:04:29 UTC (rev 73733)
@@ -43,7 +43,7 @@
         * @since 0.5
         */
        protected function initParameterInfo( array &$params ) {
-               global $egMapsGoogleMapsType, $egMapsGoogleMapsTypes, 
$egMapsGoogleAutozoom, $egMapsGMapControls;
+               global $egMapsGoogleMapsType, $egMapsGoogleMapsTypes, 
$egMapsGoogleAutozoom, $egMapsGMapControls, $egMapsGMapOverlays;
                
                //$params['zoom']->addCriterion( new CriterionInRange( 0, 20 ) 
);
                //$params['zoom']->setDefault( self::getDefaultZoom() );



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

Reply via email to