http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73728
Revision: 73728
Author: jeroendedauw
Date: 2010-09-25 06:39:18 +0000 (Sat, 25 Sep 2010)
Log Message:
-----------
Changes for 0.7 - Added Yahoo! Maps map type parameter manipulation class
Modified Paths:
--------------
trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMaps.php
trunk/extensions/Maps/includes/services/YahooMaps/YahooMaps.php
Added Paths:
-----------
trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php
Added: trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php
===================================================================
--- trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php
(rev 0)
+++ trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php
2010-09-25 06:39:18 UTC (rev 73728)
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Parameter manipulation ensuring the value is a Yahoo Maps! map type.
+ *
+ * @since 0.7
+ *
+ * @file Maps_ParamYMapType.php
+ * @ingroup Maps
+ * @ingroup ParameterManipulations
+ * @ingroup MapsYahooMaps
+ *
+ * @author Jeroen De Dauw
+ */
+class MapsParamYMapType extends ItemParameterManipulation {
+
+ /**
+ * Constructor.
+ *
+ * @since 0.7
+ */
+ public function __construct() {
+ parent::__construct();
+ }
+
+ /**
+ * @see ItemParameterManipulation::doManipulation
+ *
+ * @since 0.7
+ */
+ public function doManipulation( &$value, array &$parameters ) {
+ $value = MapsYahooMaps::$mapTypes[$value];
+ }
+
+}
\ No newline at end of file
Property changes on:
trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMaps.php
===================================================================
--- trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMaps.php
2010-09-25 06:17:09 UTC (rev 73727)
+++ trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMaps.php
2010-09-25 06:39:18 UTC (rev 73728)
@@ -15,9 +15,11 @@
* Mapping for Yahoo! Maps map types.
* See http://developer.yahoo.com/maps/ajax
*
+ * @since 0.7
+ *
* @var array
*/
- protected static $mapTypes = array(
+ public static $mapTypes = array(
'normal' => 'YAHOO_MAP_REG',
'satellite' => 'YAHOO_MAP_SAT',
'hybrid' => 'YAHOO_MAP_HYB',
@@ -43,10 +45,6 @@
protected function initParameterInfo( array &$params ) {
global $egMapsYahooAutozoom, $egMapsYahooMapsType,
$egMapsYahooMapsTypes, $egMapsYahooMapsZoom, $egMapsYMapControls;
- // TODO
- //Validator::addOutputFormat( 'ymaptype', array( __CLASS__,
'setYMapType' ) );
- //Validator::addOutputFormat( 'ymaptypes', array( __CLASS__,
'setYMapTypes' ) );
-
//$params['zoom']->addCriterion( new CriterionInRange( 1, 13 )
);
//$params['zoom']->setDefault( self::getDefaultZoom() );
@@ -72,23 +70,19 @@
),
array( 'types' )
);
+ $params['type']->addManipulations( new MapsParamYMapType() );
- // TODO
- $params['type']->outputTypes = array( 'gmaptype' => array(
'gmaptype' ) );
-
$params['types'] = new ListParameter(
'types',
ListParameter::DEFAULT_DELIMITER,
Parameter::TYPE_STRING,
- $egMapsYahooMapsTypes, // FIXME: default value should
not be used when not present in types parameter.
+ $egMapsYahooMapsTypes,
array(),
array(
new CriterionInArray( self::getTypeNames() ),
)
);
-
- // TODO
- $params['types']->outputTypes = array( 'gmaptype' => array(
'gmaptype' ) );
+ $params['type']->addManipulations( new MapsParamYMapType() );
$params['autozoom'] = new Parameter(
'autozoom',
@@ -178,29 +172,5 @@
public static function getControlNames() {
return array( 'scale', 'type', 'pan', 'zoom', 'zoom-short',
'auto-zoom' );
}
-
- /**
- * Changes the map type name into the corresponding Yahoo! Maps API
identifier.
- *
- * @param string $type
- *
- * @return string
- */
- public static function setYMapType( &$type, $name, array $parameters ) {
- $type = self::$mapTypes[ $type ];
- }
-
- /**
- * Changes the map type names into the corresponding Yahoo! Maps API
identifiers.
- *
- * @param array $types
- *
- * @return array
- */
- public static function setYMapTypes( array &$types, $name, array
$parameters ) {
- for ( $i = count( $types ) - 1; $i >= 0; $i-- ) {
- $types[$i] = self::$mapTypes[ $types[$i] ];
- }
- }
}
\ No newline at end of file
Modified: trunk/extensions/Maps/includes/services/YahooMaps/YahooMaps.php
===================================================================
--- trunk/extensions/Maps/includes/services/YahooMaps/YahooMaps.php
2010-09-25 06:17:09 UTC (rev 73727)
+++ trunk/extensions/Maps/includes/services/YahooMaps/YahooMaps.php
2010-09-25 06:39:18 UTC (rev 73728)
@@ -25,9 +25,10 @@
function efMapsInitYahooMaps() {
global $wgAutoloadClasses;
- $wgAutoloadClasses['MapsYahooMaps'] = dirname( __FILE__ ) .
'/Maps_YahooMaps.php';
- $wgAutoloadClasses['MapsYahooMapsDispMap'] = dirname( __FILE__ ) .
'/Maps_YahooMapsDispMap.php';
- $wgAutoloadClasses['MapsYahooMapsDispPoint'] = dirname( __FILE__ ) .
'/Maps_YahooMapsDispPoint.php';
+ $wgAutoloadClasses['MapsParamYMapType'] = dirname(
__FILE__ ) . '/Maps_ParamYMapType.php';
+ $wgAutoloadClasses['MapsYahooMaps'] = dirname(
__FILE__ ) . '/Maps_YahooMaps.php';
+ $wgAutoloadClasses['MapsYahooMapsDispMap'] = dirname(
__FILE__ ) . '/Maps_YahooMapsDispMap.php';
+ $wgAutoloadClasses['MapsYahooMapsDispPoint'] = dirname( __FILE__ ) .
'/Maps_YahooMapsDispPoint.php';
MapsMappingServices::registerService(
'yahoomaps',
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs