r73770 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73769‎ | r73770 | r73771 >
Date:05:16, 26 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.7 - partially adapted the display_points parser hook to use Validator 0.4
Modified paths:
  • /trunk/extensions/Maps/includes/features/Maps_BasePointMap.php (modified) (history)
  • /trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMapsDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3DispPoint.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayersDispPoint.php (modified) (history)
  • /trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMapsDispPoint.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3DispPoint.php
@@ -1,32 +1,20 @@
22 <?php
33
44 /**
5 - * File holding the MapsGoogleMaps3DispPoint class.
 5+ * Class for handling the display_point(s) parser functions with Google Maps v3.
66 *
77 * @file Maps_GoogleMaps3DispPoint.php
88 * @ingroup MapsGoogleMaps3
99 *
1010 * @author Jeroen De Dauw
1111 */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -/**
18 - * Class for handling the display_point(s) parser functions with Google Maps v3.
19 - *
20 - * @ingroup MapsGoogleMaps3
21 - *
22 - * @author Jeroen De Dauw
23 - */
2412 final class MapsGoogleMaps3DispPoint extends MapsBasePointMap {
2513
2614 /**
2715 * @see MapsBaseMap::addSpecificMapHTML
2816 *
2917 */
30 - public function addSpecificMapHTML() {
 18+ public function addSpecificMapHTML( Parser $parser ) {
3119 $mapName = $this->service->getMapId();;
3220
3321 $this->output .= Html::element(
@@ -38,7 +26,7 @@
3927 null
4028 );
4129
42 - $this->parser->getOutput()->addHeadItem(
 30+ $parser->getOutput()->addHeadItem(
4331 Html::inlineScript( <<<EOT
4432 addOnloadHook(
4533 function() {
Index: trunk/extensions/Maps/includes/services/YahooMaps/Maps_YahooMapsDispPoint.php
@@ -1,29 +1,19 @@
22 <?php
33
44 /**
5 - * File holding the MapsYahooMapsDispPoint class.
 5+ * Class for handling the display_point(s) parser functions with Yahoo! Maps.
66 *
77 * @file Maps_YahooMapsDispPoint.php
88 * @ingroup MapsYahooMaps
99 *
1010 * @author Jeroen De Dauw
1111 */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -/**
18 - * Class for handling the display_point(s) parser functions with Yahoo! Maps.
19 - *
20 - * @author Jeroen De Dauw
21 - */
2212 class MapsYahooMapsDispPoint extends MapsBasePointMap {
2313
2414 /**
2515 * @see MapsBaseMap::addSpecificMapHTML
2616 */
27 - public function addSpecificMapHTML() {
 17+ public function addSpecificMapHTML( Parser $parser ) {
2818 $mapName = $this->service->getMapId();
2919
3020 $this->output .= Html::element(
@@ -35,7 +25,7 @@
3626 wfMsg( 'maps-loading-map' )
3727 );
3828
39 - $this->parser->getOutput()->addHeadItem(
 29+ $parser->getOutput()->addHeadItem(
4030 Html::inlineScript( <<<EOT
4131 addOnloadHook(
4232 function() {
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayersDispPoint.php
@@ -1,29 +1,19 @@
22 <?php
33
44 /**
5 - * File holding the MapsOpenLayersDispPoint class.
 5+ * Class for handling the display_point(s) parser functions with OpenLayers.
66 *
77 * @file Maps_OpenLayersDispPoint.php
88 * @ingroup MapsOpenLayers
99 *
1010 * @author Jeroen De Dauw
1111 */
12 -
13 -if ( !defined( 'MEDIAWIKI' ) ) {
14 - die( 'Not an entry point.' );
15 -}
16 -
17 -/**
18 - * Class for handling the display_point(s) parser functions with OpenLayers.
19 - *
20 - * @author Jeroen De Dauw
21 - */
2212 class MapsOpenLayersDispPoint extends MapsBasePointMap {
2313
2414 /**
2515 * @see MapsBaseMap::addSpecificMapHTML
2616 */
27 - public function addSpecificMapHTML() {
 17+ public function addSpecificMapHTML( Parser $parser ) {
2818 global $wgLang;
2919
3020 $layerItems = $this->service->createLayersStringAndLoadDependencies( $this->layers );
@@ -41,7 +31,7 @@
4232
4333 $langCode = $wgLang->getCode();
4434
45 - $this->parser->getOutput()->addHeadItem(
 35+ $parser->getOutput()->addHeadItem(
4636 Html::inlineScript( <<<EOT
4737 addOnloadHook(
4838 function() {
Index: trunk/extensions/Maps/includes/services/GoogleMaps/Maps_GoogleMapsDispPoint.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(
4848 <<<EOT
4949 addOnloadHook(
Index: trunk/extensions/Maps/includes/parserHooks/Maps_DisplayPoint.php
@@ -84,7 +84,7 @@
8585 * @return array
8686 */
8787 protected function getParameterInfo() {
88 - global $egMapsMapWidth, $egMapsMapHeight, $egMapsDefaultServices, $egMapsDefaultTitle, $egMapsDefaultLabel;
 88+ global $egMapsMapWidth, $egMapsMapHeight, $egMapsDefaultServices, $egMapsDefaultTitle, $egMapsDefaultLabel, $egMapsDefaultMapCentre;
8989
9090 // TODO
9191 //Validator::addOutputFormat( 'geoPoints', array( __CLASS__, 'formatGeoPoints' ) );
@@ -164,18 +164,12 @@
165165 */
166166 public function render( array $parameters ) {
167167 // Get the instance of the service class.
168 - $service = MapsMappingServices::getValidServiceInstance( $parameters['mappingservice'], $this->getName() );
 168+ $service = MapsMappingServices::getServiceInstance( $parameters['mappingservice'], $this->getName() );
169169
170170 // Get an instance of the class handling the current parser hook and service.
171171 $mapClass = $service->getFeatureInstance( $this->getName() );
172172
173 - if ( $mapClass === false ) {
174 - return ''; // TODO
175 - }
176 - else {
177 - return ''; // TODO
178 - //return $mapClass->getMapHtml( $parameters );
179 - }
 173+ return $mapClass->getMapHtml( $parameters, $this->parser );
180174 }
181175
182176 }
\ No newline at end of file
Index: trunk/extensions/Maps/includes/features/Maps_BasePointMap.php
@@ -77,25 +77,27 @@
7878 * mapping services, calling the specific methods and finally returning the resulting output.
7979 *
8080 * @param array $params
 81+ * @param Parser $parser
8182 *
8283 * @return html
8384 */
84 - public final function getMapHtml( array $params ) {
 85+ public final function getMapHtml( array $params, Parser $parser ) {
8586 $this->setMapProperties( $params );
8687
8788 $this->setMarkerData();
8889
8990 $this->setCentre();
9091
 92+ // TODO
9193 if ( count( $this->markerData ) <= 1 && $this->zoom == 'null' ) {
9294 $this->zoom = $this->service->getDefaultZoom();
9395 }
9496
9597 $this->markerJs = $this->service->createMarkersJs( $this->markerData );
9698
97 - $this->addSpecificMapHTML();
 99+ $this->addSpecificMapHTML( $parser );
98100
99 - $this->service->addDependencies( $this->parser );
 101+ $this->service->addDependencies( $parser );
100102
101103 return $this->output;
102104 }
@@ -112,6 +114,7 @@
113115 $this->title = $parser->parse( $this->title, $wgTitle, new ParserOptions() )->getText();
114116 $this->label = $parser->parse( $this->label, $wgTitle, new ParserOptions() )->getText();
115117
 118+ /* TODO
116119 // Each $args is an array containg the coordinate set as first element, possibly followed by meta data.
117120 foreach ( $this->coordinates as $args ) {
118121 $markerData = MapsCoordinateParser::parseCoordinates( array_shift( $args ) );
@@ -159,6 +162,7 @@
160163
161164 $this->markerData[] = $markerData;
162165 }
 166+ */
163167 }
164168
165169 /**

Status & tagging log