r76255 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76254‎ | r76255 | r76256 >
Date:17:43, 7 November 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r76228 - partial fix - still expecting problems for OpenLayers with display points and all OpenLayers maps in Semantic Maps
Modified paths:
  • /trunk/extensions/Maps/Maps.php (modified) (history)
  • /trunk/extensions/Maps/Maps_Settings.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/includes/Maps_MappingService.php (modified) (history)
  • /trunk/extensions/Maps/includes/features/Maps_BaseMap.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/OpenLayers/Maps_ParamOLLayers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps.php
@@ -51,6 +51,8 @@
5252
5353 $egMapsStyleVersion = $wgStyleVersion . '-' . Maps_VERSION;
5454
 55+ $egMapsUseRL = false; //method_exists( 'OutputPage', 'addModules' );
 56+
5557 $wgAutoloadClasses['MapsHooks'] = dirname( __FILE__ ) . '/Maps.hooks.php';
5658
5759 // Autoload the "includes/" classes and interfaces.
@@ -160,7 +162,6 @@
161163 function efMapsSetup() {
162164 global $wgExtensionCredits, $wgLang, $wgExtraNamespaces, $wgNamespaceAliases;
163165 global $egMapsDefaultService, $egMapsAvailableServices;
164 - global $egMapsDir, $egMapsUseMinJs;
165166
166167 // This function has been deprecated in 1.16, but needed for earlier versions.
167168 // It's present in 1.16 as a stub, but lets check if it exists in case it gets removed at some point.
Index: trunk/extensions/Maps/Maps_Settings.php
@@ -408,7 +408,7 @@
409409 'ol-wms' => "<script type='$wgJsMimeType' src='http://clients.multimap.com/API/maps/1.1/metacarta_04'></script>",
410410 );
411411
412 - if ( !method_exists( 'OutputPage', 'addModules' ) ) {
 412+ if ( !$egMapsUseRL ) {
413413 $egMapsOLLayerDependencies['osm'] = "<script type='$wgJsMimeType' src='$egMapsScriptPath/includes/services/OpenLayers/OSM/OpenStreetMap.js?$egMapsStyleVersion'></script>";
414414 }
415415
Index: trunk/extensions/Maps/includes/Maps_MappingService.php
@@ -105,6 +105,8 @@
106106 * @since 0.6.3
107107 */
108108 public final function addDependencies( &$parserOrOut ) {
 109+ global $egMapsUseRL;
 110+
109111 $dependencies = $this->getDependencyHtml();
110112
111113 // Only add a head item when there are dependencies.
@@ -113,7 +115,7 @@
114116 $parserOrOut->getOutput()->addHeadItem( $dependencies );
115117 }
116118
117 - if ( method_exists( $parserOrOut->getOutput(), 'addModules' ) ) {
 119+ if ( $egMapsUseRL /* method_exists( $parserOrOut->getOutput(), 'addModules' ) */ ) {
118120 $parserOrOut->getOutput()->addModules( $this->getResourceModules() );
119121 }
120122 }
@@ -122,7 +124,7 @@
123125 $parserOrOut->addHeadItem( md5( $dependencies ), $dependencies );
124126 }
125127
126 - if ( method_exists( $parserOrOut, 'addModules' ) ) {
 128+ if ( $egMapsUseRL /* method_exists( $parserOrOut, 'addModules' ) */ ) {
127129 $parserOrOut->addModules( $this->getResourceModules() );
128130 }
129131 }
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_ParamOLLayers.php
@@ -29,7 +29,7 @@
3030 * @since 0.7
3131 */
3232 public function manipulate( Parameter &$parameter, array &$parameters ) {
33 - global $egMapsOLLayerGroups, $egMapsOLAvailableLayers;
 33+ global $egMapsOLLayerGroups, $egMapsOLAvailableLayers, $egMapsUseRL;
3434
3535 $layerDefs = array();
3636 $layerNames = array();
@@ -88,9 +88,9 @@
8989 }
9090 }
9191
92 - $parameter->setValue( method_exists( 'OutputPage', 'addModules' ) ? $layerDefs : '[' . implode( ',', $layerDefs ) . ']' );
 92+ $parameter->setValue( $egMapsUseRL ? $layerDefs : '[' . implode( ',', $layerDefs ) . ']' );
9393
94 - MapsOpenLayers::addLayerDependencies( $this->getDependencies( $layerNames ) );
 94+ MapsMappingServices::getServiceInstance( 'openlayers' )->addLayerDependencies( $this->getDependencies( $layerNames ) );
9595 }
9696
9797 /**
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayersDispMap.php
@@ -32,11 +32,11 @@
3333 * @since 0.7.3
3434 */
3535 public function getMapHTML( array $params, Parser $parser ) {
36 - global $wgLang;
 36+ global $wgLang, $egMapsUseRL;
3737
3838 $mapName = $this->service->getMapId();
3939
40 - if ( !method_exists( 'OutputPage', 'addModules' ) ) {
 40+ if ( !$egMapsUseRL ) {
4141 $langCode = $wgLang->getCode();
4242 $centreLat = MapsMapper::encodeJsVar( $params['centre']['lat'] );
4343 $centreLon = MapsMapper::encodeJsVar( $params['centre']['lon'] );
@@ -48,7 +48,7 @@
4949 $centreLon,
5050 $centreLat,
5151 $zoom,
52 - {$params['layers'][0]},
 52+ {$params['layers']},
5353 [{$params['controls']}],
5454 [],
5555 "$langCode"
Index: trunk/extensions/Maps/includes/services/OpenLayers/Maps_OpenLayers.php
@@ -31,7 +31,7 @@
3232 * @since 0.7
3333 */
3434 public function addParameterInfo( array &$params ) {
35 - global $egMapsOLLayers, $egMapsOLControls;
 35+ global $egMapsOLLayers, $egMapsOLControls, $egMapsUseRL;
3636
3737 $params['zoom']->addCriteria( new CriterionInRange( 0, 19 ) );
3838 $params['zoom']->setDefault( self::getDefaultZoom() );
@@ -43,7 +43,7 @@
4444 new ParamManipulationFunctions( 'strtolower' )
4545 );
4646
47 - if ( !method_exists( 'OutputPage', 'addModules' ) ) {
 47+ if ( !$egMapsUseRL ) {
4848 $params['controls']->addManipulations(
4949 new ParamManipulationImplode( ',', "'" )
5050 );
@@ -112,9 +112,9 @@
113113 * @return array
114114 */
115115 protected function getDependencies() {
116 - global $egMapsStyleVersion, $egMapsScriptPath;
 116+ global $egMapsStyleVersion, $egMapsScriptPath, $egMapsUseRL;
117117
118 - if ( method_exists( 'OutputPage', 'addModules' ) ) {
 118+ if ( $egMapsUseRL ) {
119119 return array();
120120 }
121121 else {
Index: trunk/extensions/Maps/includes/Maps_Mapper.php
@@ -45,9 +45,7 @@
4646 public static function addInlineScript( iMappingService $service, $script ) {
4747 static $addOnloadJs = false;
4848
49 - $hasRL = method_exists( 'ParserOutput', 'addModules' );
50 -
51 - if ( $hasRL && !$addOnloadJs ) {
 49+ if ( method_exists( 'OutputPage', 'addModules' ) && !$addOnloadJs ) {
5250 global $egMapsScriptPath, $egMapsStyleVersion;
5351
5452 $service->addDependency(
@@ -58,7 +56,7 @@
5957 }
6058
6159 $service->addDependency( Html::inlineScript(
62 - ( $hasRL ? 'addMapsOnloadHook' : 'addOnloadHook' ) . "( function() { $script } );"
 60+ ( method_exists( 'OutputPage', 'addModules' ) ? 'addMapsOnloadHook' : 'addOnloadHook' ) . "( function() { $script } );"
6361 ) );
6462 }
6563
Index: trunk/extensions/Maps/includes/features/Maps_BaseMap.php
@@ -67,6 +67,8 @@
6868 * @return html
6969 */
7070 public final function renderMap( array $params, Parser $parser ) {
 71+ global $egMapsUseRL;
 72+
7173 $this->setCentre( $params );
7274
7375 if ( $params['zoom'] == 'null' ) {
@@ -75,7 +77,7 @@
7678
7779 $output = $this->getMapHTML( $params, $parser );
7880
79 - if ( method_exists( 'OutputPage', 'addModules' ) ) {
 81+ if ( $egMapsUseRL ) {
8082 $output .= $this->getJSON( $params, $parser );
8183 }
8284

Follow-up revisions

RevisionCommit summaryAuthorDate
r76256Follow up to r76228 and r76255 - partial fix - fixed OpenLayers for display p...jeroendedauw18:27, 7 November 2010
r76257Follow up to r76228 and r76255 - partial fix - fixed Yahoo! Maps for display mapjeroendedauw18:36, 7 November 2010
r76259Follow up to r76228 and r76255 - Fixed OSM and Google Maps v3 servicesjeroendedauw18:45, 7 November 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76228Fixed incorrect loading of bc classjeroendedauw00:58, 7 November 2010

Status & tagging log