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

Revision: 73723
Author:   jeroendedauw
Date:     2010-09-25 06:02:47 +0000 (Sat, 25 Sep 2010)

Log Message:
-----------
Changes for 0.7 - Added Google Maps v3  map type parameter manipulation class

Modified Paths:
--------------
    trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php
    trunk/extensions/Maps/includes/services/GoogleMaps3/GoogleMaps3.php
    trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3.php

Added Paths:
-----------
    trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php

Modified: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php
===================================================================
--- trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php      
2010-09-25 05:54:01 UTC (rev 73722)
+++ trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php      
2010-09-25 06:02:47 UTC (rev 73723)
@@ -205,32 +205,8 @@
                        'searchbar'
                );
        }
-
-       /**
-        * Changes the map type name into the corresponding Google Maps API v2 
identifier.
-        *
-        * @param string $type
-        * 
-        * @return string
-        */
-       public static function setGMapType( &$type, $name, array $parameters ) {
-               $type = self::$mapTypes[$type];
-       }
        
        /**
-        * Changes the map type names into the corresponding Google Maps API v2 
identifiers.
-        * 
-        * @param array $types
-        * 
-        * @return array
-        */
-       public static function setGMapTypes( array &$types, $name, array 
$parameters ) {
-               for ( $i = count( $types ) - 1; $i >= 0; $i-- ) {
-                       $types[$i] = self::$mapTypes[ $types[$i] ];
-               }
-       }
-       
-       /**
         * @see MapsMappingService::getDependencies
         * 
         * @return array

Modified: trunk/extensions/Maps/includes/services/GoogleMaps3/GoogleMaps3.php
===================================================================
--- trunk/extensions/Maps/includes/services/GoogleMaps3/GoogleMaps3.php 
2010-09-25 05:54:01 UTC (rev 73722)
+++ trunk/extensions/Maps/includes/services/GoogleMaps3/GoogleMaps3.php 
2010-09-25 06:02:47 UTC (rev 73723)
@@ -33,8 +33,9 @@
 function efMapsInitGoogleMaps3() {
        global $wgAutoloadClasses;
        
-       $wgAutoloadClasses['MapsGoogleMaps3'] = dirname( __FILE__ ) . 
'/Maps_GoogleMaps3.php';
-       $wgAutoloadClasses['MapsGoogleMaps3DispMap'] = dirname( __FILE__ ) . 
'/Maps_GoogleMaps3DispMap.php';
+       $wgAutoloadClasses['MapsGoogleMaps3']                   = dirname( 
__FILE__ ) . '/Maps_GoogleMaps3.php';
+       $wgAutoloadClasses['MapsGoogleMaps3DispMap']    = dirname( __FILE__ ) . 
'/Maps_GoogleMaps3DispMap.php';
+       $wgAutoloadClasses['MapsParamGMap3Type']                 = dirname( 
__FILE__ ) . '/Maps_ParamGMap3Type.php';
 
        MapsMappingServices::registerService( 'googlemaps3', 'MapsGoogleMaps3' 
);
        $googleMaps = MapsMappingServices::getServiceInstance( 'googlemaps3' ); 

Modified: 
trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3.php
===================================================================
--- trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3.php    
2010-09-25 05:54:01 UTC (rev 73722)
+++ trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3.php    
2010-09-25 06:02:47 UTC (rev 73723)
@@ -1,24 +1,12 @@
 <?php
 
 /**
- * File holding the MapsGoogleMaps3 class.
- *
- * @file Maps_GoogleMaps3.php
- * @ingroup MapsGoogleMaps3
- *
- * @author Jeroen De Dauw
- */
-
-if ( !defined( 'MEDIAWIKI' ) ) {
-       die( 'Not an entry point.' );
-}
-
-/**
  * Class holding information and functionallity specific to Google Maps v3.
  * This infomation and features can be used by any mapping feature. 
  * 
  * @since 0.1
  * 
+ * @file Maps_GoogleMaps3.php
  * @ingroup MapsGoogleMaps3
  * 
  * @author Jeroen De Dauw
@@ -111,7 +99,14 @@
                return '[' . implode( ',', $markerItems ) . ']';
        }       
        
-       protected static $mapTypes = array(
+       /**
+        * List of map types (keys) and their internal values (values). 
+        * 
+        * @since 0.7
+        * 
+        * @var array
+        */
+       public static $mapTypes = array(
                'normal' => 'ROADMAP',
                'roadmap' => 'ROADMAP',
                'satellite' => 'SATELLITE',

Added: 
trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php
===================================================================
--- trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php 
                        (rev 0)
+++ trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php 
2010-09-25 06:02:47 UTC (rev 73723)
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Parameter manipulation ensuring the value is a Google Maps v3 map type.
+ * 
+ * @since 0.7
+ * 
+ * @file Maps_ParamGMap3Type.php
+ * @ingroup Maps
+ * @ingroup ParameterManipulations
+ * @ingroup MapsGoogleMaps3
+ * 
+ * @author Jeroen De Dauw
+ */
+class MapsParamGMap3Type extends ItemParameterManipulation {
+       
+       /**
+        * Constructor.
+        * 
+        * @since 0.7
+        */
+       public function __construct() {
+               parent::__construct();
+       }
+       
+       /**
+        * @see ItemParameterManipulation::doManipulation
+        * 
+        * @since 0.7
+        */     
+       public function doManipulation( &$value, array &$parameters ) {
+               $value = MapsGoogleMaps3::$mapTypes[$value];
+       }
+       
+}
\ No newline at end of file


Property changes on: 
trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php
___________________________________________________________________
Added: svn:eol-style
   + native



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

Reply via email to