r83342 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83341‎ | r83342 | r83343 >
Date:00:20, 6 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on gmaps3
Modified paths:
  • /branches/Maps0.8/Maps_Settings.php (modified) (history)
  • /branches/Maps0.8/RELEASE-NOTES (modified) (history)
  • /branches/Maps0.8/includes/Maps_MappingServices.php (modified) (history)
  • /branches/Maps0.8/includes/features/Maps_BaseMap.php (modified) (history)
  • /branches/Maps0.8/includes/features/Maps_BasePointMap.php (modified) (history)
  • /branches/Maps0.8/includes/parserHooks/Maps_DisplayMap.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps3/jquery.googlemap.js (modified) (history)
  • /branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispPoint.php (modified) (history)

Diff [purge]

Index: branches/Maps0.8/Maps_Settings.php
@@ -83,7 +83,7 @@
8484 # Commenting or removing a mapping service will make Maps completely ignore it, and so improve performance.
8585
8686 # Google Maps API v2
87 - include_once $egMapsDir . 'includes/services/GoogleMaps/GoogleMaps.php';
 87+ // include_once $egMapsDir . 'includes/services/GoogleMaps/GoogleMaps.php';
8888
8989 # Google Maps API v3
9090 include_once $egMapsDir . 'includes/services/GoogleMaps3/GoogleMaps3.php';
@@ -92,16 +92,16 @@
9393 include_once $egMapsDir . 'includes/services/OpenLayers/OpenLayers.php';
9494
9595 # Yahoo! Maps API
96 - include_once $egMapsDir . 'includes/services/YahooMaps/YahooMaps.php';
 96+ // include_once $egMapsDir . 'includes/services/YahooMaps/YahooMaps.php';
9797
98 - # Yahoo! Maps API
 98+ # WMF OSM
9999 include_once $egMapsDir . 'includes/services/OSM/OSM.php';
100100
101101 # Array of String. Array containing all the mapping services that will be made available to the user.
102102 $egMapsAvailableServices = array(
103 - 'googlemaps2',
 103+ //'googlemaps2',
104104 'googlemaps3',
105 - 'yahoomaps',
 105+ //'yahoomaps',
106106 'openlayers',
107107 'osm'
108108 );
Index: branches/Maps0.8/RELEASE-NOTES
@@ -10,6 +10,8 @@
1111 === Maps 0.8 ===
1212 (2011-0x-xx)
1313
 14+This version branched from Maps 0.7.x at version 0.7.3.
 15+
1416 * Removed compatibility with pre MediaWiki 1.17, in order to make full use of the new features.
1517
1618 * Added support for the auto-documentation features for parser hooks introduced in Validator 0.4.3.
Index: branches/Maps0.8/includes/services/GoogleMaps3/jquery.googlemap.js
@@ -28,7 +28,10 @@
2929
3030 var map = new google.maps.Map( this.get( 0 ), mapOptions );
3131
32 - var markers = [];
 32+ var markers = [];
 33+ if ( !options.locations ) {
 34+ options.locations = [];
 35+ }
3336
3437 // Add the markers.
3538 for ( var i = options.locations.length - 1; i >= 0; i-- ) {
@@ -61,7 +64,7 @@
6265
6366 var bounds;
6467
65 - if ( options.centre === false || options.zoom === false ) {
 68+ if ( ( options.centre === false || options.zoom === false ) && options.locations.lentgh > 1 ) {
6669 bounds = new google.maps.LatLngBounds();
6770
6871 for ( var i = markers.length - 1; i >= 0; i-- ) {
@@ -71,11 +74,29 @@
7275 map.fitBounds( bounds );
7376 }
7477
75 - map.setCenter(
76 - options.centre === false ?
77 - bounds.getCenter() : new google.maps.LatLng( options.centre.lat , options.centre.lon )
78 - );
 78+ if ( options.zoom !== false ) {
 79+ map.setZoom( options.zoom );
 80+ }
7981
 82+ var centre;
 83+
 84+ if ( options.centre === false ) {
 85+ if ( options.locations.length > 1 ) {
 86+ centre = bounds.getCenter();
 87+ }
 88+ else if ( options.locations.length == 1 ) {
 89+ centre = new google.maps.LatLng( options.locations[0].lat, options.locations[0].lon );
 90+ }
 91+ else {
 92+ centre = new google.maps.LatLng( 0, 0 );
 93+ }
 94+ }
 95+ else {
 96+ centre = options.centre;
 97+ }
 98+
 99+ map.setCenter( centre );
 100+
80101 if ( options.autoinfowindows ) {
81102 for ( var i = markers.length - 1; i >= 0; i-- ) {
82103 markers[i].openWindow = new google.maps.InfoWindow( { content: markers[i].text } );
Index: branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispPoint.php
@@ -13,7 +13,7 @@
1414 /**
1515 * @see MapsBasePointMap::getMapHTML()
1616 */
17 - public function addSpecificMapHTML( array $params, Parser $parser, $mapName ) {
 17+ public function getMapHTML( array $params, Parser $parser, $mapName ) {
1818 return Html::element(
1919 'div',
2020 array(
Index: branches/Maps0.8/includes/parserHooks/Maps_DisplayMap.php
@@ -68,9 +68,12 @@
6969 $params['coordinates'] = new Parameter( 'coordinates' );
7070 $params['coordinates']->addAliases( 'coords', 'location', 'address' );
7171 $params['coordinates']->addCriteria( new CriterionIsLocation() );
72 - $params['coordinates']->addManipulations( new MapsParamLocation() );
7372 $params['coordinates']->addDependencies( 'mappingservice', 'geoservice' );
7473 $params['coordinates']->setDescription( wfMsg( 'maps-displaymap-par-coordinates' ) );
 74+ $params['coordinates']->setDoManipulationOfDefault( false );
 75+ $manipulation = new MapsParamLocation();
 76+ $manipulation->toJSONObj = true;
 77+ $params['coordinates']->addManipulations( $manipulation );
7578
7679 return $params;
7780 }
Index: branches/Maps0.8/includes/Maps_MappingServices.php
@@ -236,4 +236,4 @@
237237 return $objects;
238238 }
239239
240 -}
\ No newline at end of file
 240+}
Index: branches/Maps0.8/includes/features/Maps_BasePointMap.php
@@ -145,7 +145,7 @@
146146 if ( $location->isValid() ) {
147147 $jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl );
148148
149 - $jsonObj['title'] = $parser->parse( $jsonObj['title'], $wgTitle, new ParserOptions() )->getText();
 149+ $jsonObj['title'] = strip_tags( $parser->parse( $jsonObj['title'], $wgTitle, new ParserOptions() )->getText() );
150150 $jsonObj['text'] = $parser->parse( $jsonObj['text'], $wgTitle, new ParserOptions() )->getText();
151151
152152 $params['locations'][] = $jsonObj;
Index: branches/Maps0.8/includes/features/Maps_BaseMap.php
@@ -70,7 +70,7 @@
7171 public final function renderMap( array $params, Parser $parser ) {
7272 $this->setCentre( $params );
7373
74 - if ( $params['zoom'] == 'null' ) {
 74+ if ( $params['zoom'] === false ) {
7575 $params['zoom'] = $this->service->getDefaultZoom();
7676 }
7777
@@ -150,7 +150,7 @@
151151 }
152152 }
153153 else {
154 - $params['centre'] = MapsCoordinateParser::parseCoordinates( $params['coordinates'] );
 154+ $params['centre'] = $params['coordinates'];
155155 }
156156
157157 unset( $params['coordinates'] );

Status & tagging log