r65414 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65413‎ | r65414 | r65415 >
Date:22:09, 21 April 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - fixed several issues with the parameters for the display_map and display_point(s) parser functions
Modified paths:
  • /trunk/extensions/Maps/Geocoders/Maps_Geocoder.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispMap.php (modified) (history)
  • /trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispPoint.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/Maps_OpenLayers.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php (modified) (history)
  • /trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/DisplayMap/Maps_BaseMap.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_BasePointMap.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php (modified) (history)
  • /trunk/extensions/Maps/ParserFunctions/Maps_iMapFeature.php (modified) (history)
  • /trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php (modified) (history)
  • /trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php (modified) (history)
  • /trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispPoint.php
@@ -26,6 +26,11 @@
2727
2828 protected $markerStringFormat = 'getGMaps3MarkerData(lat, lon, \'title\', \'label\', "icon")';
2929
 30+ protected function getDefaultZoom() {
 31+ global $egMapsGMaps3Zoom;
 32+ return $egMapsGMaps3Zoom;
 33+ }
 34+
3035 /**
3136 * @see MapsBaseMap::doMapServiceLoad()
3237 *
Index: trunk/extensions/Maps/GoogleMaps3/Maps_GoogleMaps3DispMap.php
@@ -24,6 +24,11 @@
2525
2626 public $serviceName = MapsGoogleMaps3::SERVICE_NAME;
2727
 28+ protected function getDefaultZoom() {
 29+ global $egMapsGMaps3Zoom;
 30+ return $egMapsGMaps3Zoom;
 31+ }
 32+
2833 /**
2934 * @see MapsBaseMap::doMapServiceLoad()
3035 *
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispPoint.php
@@ -24,6 +24,11 @@
2525
2626 protected $markerStringFormat = 'getOLMarkerData(lon, lat, \'title\', \'label\', "icon")';
2727
 28+ protected function getDefaultZoom() {
 29+ global $egMapsOpenLayersZoom;
 30+ return $egMapsOpenLayersZoom;
 31+ }
 32+
2833 /**
2934 * @see MapsBaseMap::doMapServiceLoad()
3035 *
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayersDispMap.php
@@ -17,6 +17,11 @@
1818
1919 public $serviceName = MapsOpenLayers::SERVICE_NAME;
2020
 21+ protected function getDefaultZoom() {
 22+ global $egMapsOpenLayersZoom;
 23+ return $egMapsOpenLayersZoom;
 24+ }
 25+
2126 /**
2227 * @see MapsBaseMap::doMapServiceLoad()
2328 */
Index: trunk/extensions/Maps/OpenLayers/Maps_OpenLayers.php
@@ -84,7 +84,6 @@
8585 ),
8686 );
8787
88 - $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsOpenLayersZoom;
8988 $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array( 0, 19 );
9089 }
9190
Index: trunk/extensions/Maps/ParserFunctions/DisplayPoint/Maps_BasePointMap.php
@@ -21,8 +21,6 @@
2222 * @ingroup Maps
2323 *
2424 * @author Jeroen De Dauw
25 - *
26 - * TODO: fix zoom - should default to 'null' when no value given and multiple points
2725 */
2826 abstract class MapsBasePointMap implements iMapFeature {
2927
@@ -120,6 +118,10 @@
121119
122120 $this->setCentre();
123121
 122+ if ( count( $this->markerData ) <= 1 && $this->zoom == 'null' ) {
 123+ $this->zoom = $this->getDefaultZoom();
 124+ }
 125+
124126 $this->addSpecificMapHTML( $parser );
125127
126128 return $this->output;
Index: trunk/extensions/Maps/ParserFunctions/DisplayMap/Maps_BaseMap.php
@@ -96,6 +96,10 @@
9797
9898 $this->setCentre();
9999
 100+ if ( $this->zoom == 'null' ) {
 101+ $htis->zoom = $this->getDefaultZoom();
 102+ }
 103+
100104 $this->addSpecificMapHTML( $parser );
101105
102106 return $this->output;
Index: trunk/extensions/Maps/ParserFunctions/Maps_iMapFeature.php
@@ -7,6 +7,8 @@
88 * @ingroup Maps
99 *
1010 * @author Jeroen De Dauw
 11+ *
 12+ * TODO: revise this interface
1113 */
1214
1315 if ( !defined( 'MEDIAWIKI' ) ) {
Index: trunk/extensions/Maps/ParserFunctions/Maps_ParserFunctions.php
@@ -41,9 +41,6 @@
4242 return true;
4343 }
4444
45 - private static function initializeParams() {
46 - }
47 -
4845 /**
4946 * Returns the output for the call to the specified parser function.
5047 *
@@ -88,9 +85,9 @@
8986 * again overidden by the service parameters (the ones spesific to the service),
9087 * and finally by the spesific parameters (the ones spesific to a service-feature combination).
9188 */
92 - $parameterInfo = array_merge( MapsMapper::getCommonParameters(), $mapClass->getFeatureParameters() );
93 - $parameterInfo = array_merge( $parameterInfo, $egMapsServices[$service]['parameters'] );
94 - $parameterInfo = array_merge( $parameterInfo, $mapClass->getSpecificParameterInfo() );
 89+ $parameterInfo = array_merge_recursive( MapsMapper::getCommonParameters(), $mapClass->getFeatureParameters() );
 90+ $parameterInfo = array_merge_recursive( $parameterInfo, $egMapsServices[$service]['parameters'] );
 91+ $parameterInfo = array_merge_recursive( $parameterInfo, $mapClass->getSpecificParameterInfo() );
9592
9693 $parameters = $manager->manageParameters(
9794 $parameters,
Index: trunk/extensions/Maps/Maps.php
@@ -33,7 +33,7 @@
3434 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>.';
3535 }
3636 else {
37 - define( 'Maps_VERSION', '0.6 a15' );
 37+ define( 'Maps_VERSION', '0.6 a16' );
3838
3939 // The different coordinate notations.
4040 define( 'Maps_COORDS_FLOAT', 'float' );
Index: trunk/extensions/Maps/Maps_Mapper.php
@@ -227,7 +227,8 @@
228228 'type' => 'integer',
229229 'criteria' => array(
230230 'not_empty' => array()
231 - )
 231+ ),
 232+ 'default' => 'null'
232233 ),
233234 'width' => array(
234235 'criteria' => array(
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispMap.php
@@ -24,9 +24,13 @@
2525
2626 public $serviceName = MapsGoogleMaps::SERVICE_NAME;
2727
 28+ protected function getDefaultZoom() {
 29+ global $egMapsGoogleMapsZoom;
 30+ return $egMapsGoogleMapsZoom;
 31+ }
 32+
2833 public function getSpecificParameterInfo() {
2934 global $egMapsGMapOverlays;
30 - // TODO: it'd be cool to have this static so it can be cheched in order to only init it once.
3135 $this->spesificParameters = array(
3236 'overlays' => array(
3337 'type' => array( 'string', 'list' ),
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMaps.php
@@ -60,7 +60,7 @@
6161 }
6262
6363 private static function initializeParams() {
64 - global $egMapsServices, $egMapsGoogleMapsType, $egMapsGoogleMapsTypes, $egMapsGoogleAutozoom, $egMapsGoogleMapsZoom, $egMapsGMapControls;
 64+ global $egMapsServices, $egMapsGoogleMapsType, $egMapsGoogleMapsTypes, $egMapsGoogleAutozoom, $egMapsGMapControls;
6565
6666 $allowedTypes = self::getTypeNames();
6767
@@ -98,7 +98,6 @@
9999 ),
100100 );
101101
102 - $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsGoogleMapsZoom;
103102 $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array( 0, 20 );
104103 }
105104
Index: trunk/extensions/Maps/GoogleMaps/Maps_GoogleMapsDispPoint.php
@@ -26,6 +26,11 @@
2727
2828 protected $markerStringFormat = 'getGMarkerData(lat, lon, \'title\', \'label\', "icon")';
2929
 30+ protected function getDefaultZoom() {
 31+ global $egMapsGoogleMapsZoom;
 32+ return $egMapsGoogleMapsZoom;
 33+ }
 34+
3035 public function getSpecificParameterInfo() {
3136 global $egMapsGMapOverlays;
3237 // TODO: it'd be cool to have this static so it can be cheched in order to only init it once.
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispPoint.php
@@ -24,6 +24,11 @@
2525
2626 protected $markerStringFormat = 'getYMarkerData(lat, lon, \'title\', \'label\', "icon")';
2727
 28+ protected function getDefaultZoom() {
 29+ global $egMapsYahooMapsZoom;
 30+ return $egMapsYahooMapsZoom;
 31+ }
 32+
2833 /**
2934 * @see MapsBaseMap::doMapServiceLoad()
3035 *
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMapsDispMap.php
@@ -17,6 +17,11 @@
1818
1919 public $serviceName = MapsYahooMaps::SERVICE_NAME;
2020
 21+ protected function getDefaultZoom() {
 22+ global $egMapsYahooMapsZoom;
 23+ return $egMapsYahooMapsZoom;
 24+ }
 25+
2126 /**
2227 * @see MapsBaseMap::doMapServiceLoad()
2328 */
Index: trunk/extensions/Maps/YahooMaps/Maps_YahooMaps.php
@@ -96,7 +96,6 @@
9797 ),
9898 );
9999
100 - $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['default'] = $egMapsYahooMapsZoom;
101100 $egMapsServices[self::SERVICE_NAME]['parameters']['zoom']['criteria']['in_range'] = array( 1, 13 );
102101 }
103102
Index: trunk/extensions/Maps/Geocoders/Maps_Geocoder.php
@@ -38,7 +38,7 @@
3939 * @return array or false
4040 */
4141 public static function attemptToGeocode( $coordsOrAddress, $geoservice = '', $mappingService = false, $checkForCoords = true ) {
42 - if ( $checkForCoords ) {
 42+ if ( $checkForCoords ) {
4343 if ( MapsCoordinateParser::areCoordinates( $coordsOrAddress ) ) {
4444 return MapsCoordinateParser::parseCoordinates( $coordsOrAddress );
4545 } else {
@@ -96,7 +96,7 @@
9797 }
9898
9999 $service = self::getValidGeoService( $service, $mappingService );
100 -
 100+
101101 // Call the geocode function in the spesific geocoder class.
102102 $coordinates = call_user_func( array( $egMapsGeoServices[$service], 'geocode' ), $address );
103103

Status & tagging log