r73767 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73766‎ | r73767 | r73768 >
Date:04:51, 26 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - Follow up to r73766
Modified paths:
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_CoordinateParser.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_DistanceParser.php (modified) (history)
  • /trunk/extensions/Maps/includes/features/Maps_BaseMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/iMappingService.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php (modified) (history)
  • /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/GoogleMaps3/Maps_GoogleMaps3DispMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/OSM/Maps_OSMDispMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayers.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayersDispMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMaps.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMapsDispMap.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-4' );
 40+ define( 'Maps_VERSION', '0.7 alpha-5' );
4141
4242 // The different coordinate notations.
4343 define( 'Maps_COORDS_FLOAT', 'float' );
Index: trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3DispMap.php
@@ -25,7 +25,7 @@
2626 /**
2727 * @see MapsBaseMap::addSpecificMapHTML()
2828 */
29 - public function addSpecificMapHTML() {
 29+ public function addSpecificMapHTML( Parser $parser ) {
3030 $mapName = $this->service->getMapId();
3131
3232 $this->output .= Html::element(
@@ -37,7 +37,7 @@
3838 null
3939 );
4040
41 - $this->parser->getOutput()->addHeadItem(
 41+ $parser->getOutput()->addHeadItem(
4242 Html::inlineScript( <<<EOT
4343 addOnloadHook(
4444 function() {
Index: trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMapsDispMap.php
@@ -18,7 +18,7 @@
1919 /**
2020 * @see MapsBaseMap::addSpecificMapHTML()
2121 */
22 - public function addSpecificMapHTML() {
 22+ public function addSpecificMapHTML( Parser $parser ) {
2323 $mapName = $this->service->getMapId();
2424
2525 $this->output .= Html::element(
@@ -30,7 +30,7 @@
3131 wfMsg( 'maps-loading-map' )
3232 );
3333
34 - $this->parser->getOutput()->addHeadItem(
 34+ $parser->getOutput()->addHeadItem(
3535 Html::inlineScript( <<<EOT
3636 addOnloadHook(
3737 function() {
Index: trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMaps.php
@@ -45,7 +45,7 @@
4646 protected function initParameterInfo( array &$params ) {
4747 global $egMapsYahooAutozoom, $egMapsYahooMapsType, $egMapsYahooMapsTypes, $egMapsYahooMapsZoom, $egMapsYMapControls;
4848
49 - //$params['zoom']->addCriterion( new CriterionInRange( 1, 13 ) );
 49+ //$params['zoom']->addCriteria( new CriterionInRange( 1, 13 ) );
5050 //$params['zoom']->setDefault( self::getDefaultZoom() );
5151
5252 $params['controls'] = new ListParameter(
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayersDispMap.php
@@ -18,7 +18,7 @@
1919 /**
2020 * @see MapsBaseMap::addSpecificMapHTML()
2121 */
22 - public function addSpecificMapHTML() {
 22+ public function addSpecificMapHTML( Parser $parser ) {
2323 global $wgLang;
2424
2525 $layerItems = $this->service->createLayersStringAndLoadDependencies( $this->layers );
@@ -36,7 +36,7 @@
3737
3838 $langCode = $wgLang->getCode();
3939
40 - $this->parser->getOutput()->addHeadItem(
 40+ $parser->getOutput()->addHeadItem(
4141 Html::inlineScript( <<<EOT
4242 addOnloadHook(
4343 function() {
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayers.php
@@ -43,7 +43,7 @@
4444 protected function initParameterInfo( array &$params ) {
4545 global $egMapsOLLayers, $egMapsOLControls, $egMapsOpenLayersZoom;
4646
47 - //$params['zoom']->addCriterion( new CriterionInRange( 0, 19 ) );
 47+ //$params['zoom']->addCriteria( new CriterionInRange( 0, 19 ) );
4848 //$params['zoom']->setDefault( self::getDefaultZoom() );
4949
5050 $params['controls'] = new ListParameter(
Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMapsDispMap.php
@@ -28,7 +28,7 @@
2929 /**
3030 * @see MapsBaseMap::addSpecificMapHTML()
3131 */
32 - public function addSpecificMapHTML() {
 32+ public function addSpecificMapHTML( Parser $parser ) {
3333 $mapName = $this->service->getMapId();
3434
3535 $this->service->addOverlayOutput( $this->output, $mapName, $this->overlays, $this->controls );
@@ -42,7 +42,7 @@
4343 wfMsg( 'maps-loading-map' )
4444 );
4545
46 - $this->parser->getOutput()->addHeadItem(
 46+ $parser->getOutput()->addHeadItem(
4747 Html::inlineScript( <<<EOT
4848 addOnloadHook(
4949 function() {
Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMaps.php
@@ -45,7 +45,7 @@
4646 protected function initParameterInfo( array &$params ) {
4747 global $egMapsGoogleMapsType, $egMapsGoogleMapsTypes, $egMapsGoogleAutozoom, $egMapsGMapControls, $egMapsGMapOverlays;
4848
49 - //$params['zoom']->addCriterion( new CriterionInRange( 0, 20 ) );
 49+ //$params['zoom']->addCriteria( new CriterionInRange( 0, 20 ) );
5050 //$params['zoom']->setDefault( self::getDefaultZoom() );
5151
5252 $params['controls'] = new ListParameter(
@@ -104,6 +104,7 @@
105105 ListParameter::DEFAULT_DELIMITER,
106106 Parameter::TYPE_STRING,
107107 $egMapsGMapOverlays,
 108+ array(),
108109 array(
109110 new CriterionGoogleOverlay( self::$overlayData )
110111 )
Index: trunk/extensions/Maps/includes/services/OSM/Maps_OSMDispMap.php
@@ -29,7 +29,7 @@
3030 *
3131 * @since 0.6.4
3232 */
33 - public function addSpecificMapHTML() {
 33+ public function addSpecificMapHTML( Parser $parser ) {
3434 $this->output .= Html::element(
3535 'iframe',
3636 array(
Index: trunk/extensions/Maps/includes/parserHooks/Maps_DisplayMap.php
@@ -97,18 +97,12 @@
9898 */
9999 public function render( array $parameters ) {
100100 // Get the instance of the service class.
101 - $service = MapsMappingServices::getValidServiceInstance( $parameters['mappingservice'], $this->getName() );
 101+ $service = MapsMappingServices::getServiceInstance( $parameters['mappingservice'], $this->getName() );
102102
103103 // Get an instance of the class handling the current parser hook and service.
104104 $mapClass = $service->getFeatureInstance( $this->getName() );
105105
106 - if ( $mapClass === false ) {
107 - return ''; // TODO
108 - }
109 - else {
110 - return ''; // TODO
111 - //return $mapClass->getMapHtml( $parameters );
112 - }
 106+ return $mapClass->getMapHtml( $parameters, $this->parser );
113107 }
114108
115109 }
\ No newline at end of file
Index: trunk/extensions/Maps/includes/Maps_CoordinateParser.php
@@ -13,9 +13,10 @@
1414 * regex to also accept dm and dd, which can give unexpected results in certain
1515 * usecases. The different seperator support could also be made nice.
1616 *
 17+ * @since 0.6
 18+ *
1719 * @file Maps_CoordinateParser.php
1820 * @ingroup Maps
19 - * @since 0.6
2021 *
2122 * @author Jeroen De Dauw
2223 */
Index: trunk/extensions/Maps/includes/iMappingService.php
@@ -1,25 +1,15 @@
22 <?php
33
44 /**
5 - * File holding interface iMapParserFunction.
 5+ * Interface that should be implemented by all mapping feature classes.
66 *
 7+ * @since 0.6.3
 8+ *
79 * @file iMappingService.php
810 * @ingroup Maps
911 *
1012 * @author Jeroen De Dauw
1113 */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -/**
18 - * Interface that should be implemented by all mapping feature classes.
19 - *
20 - * @since 0.6.3
21 - *
22 - * @author Jeroen De Dauw
23 - */
2414 interface iMappingService {
2515
2616 /**
Index: trunk/extensions/Maps/includes/Maps_DistanceParser.php
@@ -1,21 +1,9 @@
22 <?php
33
44 /**
5 - * File holding class MapsDistanceParser.
6 - *
7 - * @file Maps_DistanceParser.php
8 - * @ingroup Maps
9 - *
10 - * @author Jeroen De Dauw
11 - */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -/**
185 * Static class for distance validation and parsing. Internal representatations are in meters.
196 *
 7+ * @file Maps_DistanceParser.php
208 * @ingroup Maps
219 *
2210 * @since 0.6
Index: trunk/extensions/Maps/includes/features/Maps_BaseMap.php
@@ -79,10 +79,11 @@
8080 * mapping services, calling the specific methods and finally returning the resulting output.
8181 *
8282 * @param array $params
 83+ * @param Parser $parser
8384 *
8485 * @return html
8586 */
86 - public final function getMapHtml( array $params ) {
 87+ public final function getMapHtml( array $params, Parser $parser ) {
8788 $this->setMapProperties( $params );
8889
8990 $this->setCentre();
@@ -91,9 +92,9 @@
9293 $this->zoom = $this->service->getDefaultZoom();
9394 }
9495
95 - $this->addSpecificMapHTML();
 96+ $this->addSpecificMapHTML( $parser );
9697
97 - $this->service->addDependencies( $this->parser );
 98+ $this->service->addDependencies( $parser );
9899
99100 return $this->output;
100101 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r73769Fixed some fails from r73767jeroendedauw05:04, 26 September 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r73766Changes for 0.4 - added support for parameter list manipulation during valida...jeroendedauw04:50, 26 September 2010

Status & tagging log