r74294 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74293‎ | r74294 | r74295 >
Date:11:26, 5 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - changes to add support for conditional defaulting of the zoom parameter
Modified paths:
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/includes/manipulations/Maps_ParamCoordSet.php (modified) (history)
  • /trunk/extensions/Maps/includes/manipulations/Maps_ParamDimension.php (modified) (history)
  • /trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php (modified) (history)
  • /trunk/extensions/Maps/includes/manipulations/Maps_ParamZoom.php (added) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps/Maps_ParamGMapType.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps.php
@@ -36,7 +36,7 @@
3737 echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.';
3838 }
3939 else {
40 - define( 'Maps_VERSION', '0.7 alpha-6' );
 40+ define( 'Maps_VERSION', '0.7 alpha-7' );
4141
4242 // The different coordinate notations.
4343 define( 'Maps_COORDS_FLOAT', 'float' );
@@ -133,6 +133,7 @@
134134 $wgAutoloadClasses['MapsParamCoordSet'] = $manDir . 'Maps_ParamCoordSet.php';
135135 $wgAutoloadClasses['MapsParamDimension'] = $manDir . 'Maps_ParamDimension.php';
136136 $wgAutoloadClasses['MapsParamService'] = $manDir . 'Maps_ParamService.php';
 137+ $wgAutoloadClasses['MapsParamZoom'] = $manDir . 'Maps_ParamZoom.php';
137138
138139 // Autoload the "includes/parserHooks/" classes.
139140 $phDir = $incDir . '/parserHooks/';
Index: trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_ParamGMap3Type.php
@@ -28,7 +28,7 @@
2929 *
3030 * @since 0.7
3131 */
32 - public function doManipulation( &$value, array &$parameters ) {
 32+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
3333 $value = 'google.maps.MapTypeId.' . MapsGoogleMaps3::$mapTypes[$value];
3434 }
3535
Index: trunk/extensions/Maps/includes/services/YahooMaps/Maps_ParamYMapType.php
@@ -28,7 +28,7 @@
2929 *
3030 * @since 0.7
3131 */
32 - public function doManipulation( &$value, array &$parameters ) {
 32+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
3333 $value = MapsYahooMaps::$mapTypes[$value];
3434 }
3535
Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_ParamGMapType.php
@@ -28,7 +28,7 @@
2929 *
3030 * @since 0.7
3131 */
32 - public function doManipulation( &$value, array &$parameters ) {
 32+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
3333 $value = MapsGoogleMaps::$mapTypes[$value];
3434 }
3535
Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamService.php
@@ -38,7 +38,7 @@
3939 *
4040 * @since 0.7
4141 */
42 - public function doManipulation( &$value, array &$parameters ) {
 42+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
4343 // Make sure the service is valid.
4444 $value = MapsMappingServices::getValidServiceName( $value, $this->feature );
4545
Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamCoordSet.php
@@ -40,7 +40,7 @@
4141 *
4242 * @since 0.7
4343 */
44 - public function doManipulation( &$value, array &$parameters ) {
 44+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
4545 if ( $this->metaDataSeparator !== false ) {
4646 $parts = explode( $this->metaDataSeparator, $value );
4747 $value = array_shift( $parts );
Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamZoom.php
@@ -0,0 +1,37 @@
 2+<?php
 3+
 4+/**
 5+ * Parameter manipulation ensuring the value is a coordinate set.
 6+ *
 7+ * @since 0.7
 8+ *
 9+ * @file Maps_ParamCoordSet.php
 10+ * @ingroup Maps
 11+ * @ingroup ParameterManipulations
 12+ *
 13+ * @author Jeroen De Dauw
 14+ */
 15+class MapsParamZoom extends ItemParameterManipulation {
 16+
 17+ /**
 18+ * Constructor.
 19+ *
 20+ * @since 0.7
 21+ */
 22+ public function __construct() {
 23+ parent::__construct();
 24+ }
 25+
 26+ /**
 27+ * @see ItemParameterManipulation::doManipulation
 28+ *
 29+ * @since 0.7
 30+ */
 31+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
 32+ if ( $parameter->wasSetToDefault() ) {
 33+ //var_dump($parameters['coordinates']);exit;
 34+ // TODO
 35+ }
 36+ }
 37+
 38+}
\ No newline at end of file
Property changes on: trunk/extensions/Maps/includes/manipulations/Maps_ParamZoom.php
___________________________________________________________________
Added: svn:eol-style
139 + native
Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamDimension.php
@@ -38,7 +38,7 @@
3939 *
4040 * @since 0.7
4141 */
42 - public function doManipulation( &$value, array &$parameters ) {
 42+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
4343 global $egMapsSizeRestrictions;
4444
4545 // Set the default if the value is not valid.
Index: trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php
@@ -60,6 +60,9 @@
6161 $params['mappingservice']->setDefault( $egMapsDefaultServices['display_point'] );
6262 $params['mappingservice']->addManipulations( new MapsParamService( 'display_point' ) );
6363
 64+ $params['zoom']->addDependencies( 'coordinates' );
 65+ $params['zoom']->addManipulations( new MapsParamZoom() );
 66+
6467 $params['coordinates'] = new ListParameter( 'coordinates', ';' );
6568 $params['coordinates']->addAliases( 'coords', 'location', 'address', 'addresses', 'locations' );
6669 $params['coordinates']->addCriteria( new CriterionIsLocation( '~' ) );

Status & tagging log