r73663 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73662‎ | r73663 | r73664 >
Date:17:09, 24 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - created google maps overlay criterion
Modified paths:
  • /trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMapsDispPoint.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMapsDispMap.php
@@ -23,17 +23,6 @@
2424 final class MapsGoogleMapsDispMap extends MapsBaseMap {
2525
2626 protected function initSpecificParamInfo( array &$parameters ) {
27 - global $egMapsGMapOverlays;
28 -
29 - $parameters = array(
30 - 'overlays' => array(
31 - 'type' => array( 'string', 'list' ),
32 - 'criteria' => array(
33 - 'is_google_overlay' => array()
34 - ),
35 - 'default' => $egMapsGMapOverlays,
36 - ),
37 - );
3827 }
3928
4029 /**
Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php
@@ -26,6 +26,18 @@
2727 class MapsGoogleMaps extends MapsMappingService {
2828
2929 /**
 30+ * A list of supported overlays.
 31+ *
 32+ * @var array
 33+ */
 34+ protected static $overlayData = array(
 35+ 'photos' => '0',
 36+ 'videos' => '1',
 37+ 'wikipedia' => '2',
 38+ 'webcams' => '3'
 39+ );
 40+
 41+ /**
3042 * Constructor.
3143 *
3244 * @since 0.6.6
@@ -48,9 +60,6 @@
4961 Validator::addOutputFormat( 'gmaptype', array( __CLASS__, 'setGMapType' ) );
5062 Validator::addOutputFormat( 'gmaptypes', array( __CLASS__, 'setGMapTypes' ) );
5163
52 - // TODO
53 - //Validator::addValidationFunction( 'is_google_overlay', array( __CLASS__, 'isGOverlay' ) );
54 -
5564 //$params['zoom']->addCriterion( new CriterionInRange( 0, 20 ) );
5665 //$params['zoom']->setDefault( self::getDefaultZoom() );
5766
@@ -113,7 +122,17 @@
114123 );
115124
116125 // TODO
117 - $params['kml']->outputTypes = array( 'list' => array( 'list', ',', '\'' ) );
 126+ $params['kml']->outputTypes = array( 'list' => array( 'list', ',', '\'' ) );
 127+
 128+ $params['overlays'] = new ListParameter(
 129+ 'overlays',
 130+ ListParameter::DEFAULT_DELIMITER,
 131+ Parameter::TYPE_STRING,
 132+ $egMapsGMapOverlays,
 133+ array(
 134+ new CriterionGoogleOverlay( self::$overlayData )
 135+ )
 136+ );
118137 }
119138
120139 /**
@@ -186,18 +205,6 @@
187206 );
188207
189208 /**
190 - * A list of supported overlays.
191 - *
192 - * @var array
193 - */
194 - protected static $overlayData = array(
195 - 'photos' => '0',
196 - 'videos' => '1',
197 - 'wikipedia' => '2',
198 - 'webcams' => '3'
199 - );
200 -
201 - /**
202209 * Returns the names of all supported map types.
203210 *
204211 * @return array
@@ -234,29 +241,6 @@
235242 }
236243
237244 /**
238 - * Returns the names of all supported map overlays.
239 - *
240 - * @return array
241 - */
242 - public static function getOverlayNames() {
243 - return array_keys( self::$overlayData );
244 - }
245 -
246 - /**
247 - * Returns whether the provided value is a valid google overlay.
248 - *
249 - * @param $value
250 - *
251 - * @return boolean
252 - */
253 - public static function isGOverlay( $value, $name, array $parameters ) {
254 - $value = explode( '-', $value );
255 - if ( count( $value ) > 2 ) return false;
256 - if ( count( $value ) > 1 && !in_array( $value[1], array( '0', '1' ) ) ) return false;
257 - return in_array( $value[0], self::getOverlayNames() );
258 - }
259 -
260 - /**
261245 * Changes the map type name into the corresponding Google Maps API v2 identifier.
262246 *
263247 * @param string $type
Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMapsDispPoint.php
@@ -23,17 +23,6 @@
2424 final class MapsGoogleMapsDispPoint extends MapsBasePointMap {
2525
2626 protected function initSpecificParamInfo( array &$parameters ) {
27 - global $egMapsGMapOverlays;
28 -
29 - $parameters = array(
30 - 'overlays' => array(
31 - 'type' => array( 'string', 'list' ),
32 - 'criteria' => array(
33 - 'is_google_overlay' => array()
34 - ),
35 - 'default' => $egMapsGMapOverlays,
36 - ),
37 - );
3827 }
3928
4029 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r73664CHanges for 0.7 - follow up to r73663jeroendedauw17:10, 24 September 2010

Status & tagging log