r80482 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80481‎ | r80482 | r80483 >
Date:01:02, 18 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Threw out a whole bunch of b/c related code
Modified paths:
  • /branches/Maps0.8/Maps.php (modified) (history)
  • /branches/Maps0.8/includes/Maps_Mapper.php (modified) (history)
  • /branches/Maps0.8/includes/Maps_MappingService.php (modified) (history)
  • /branches/Maps0.8/includes/iMappingService.php (modified) (history)
  • /branches/Maps0.8/includes/mapsonload.js (deleted) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/GoogleMapFunctions.js (deleted) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMapsDispMap.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMapsDispPoint.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.css (added) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.js (added) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3DispMap.php (modified) (history)
  • /branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3DispPoint.php (modified) (history)
  • /branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispMap.php (modified) (history)
  • /branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispPoint.php (modified) (history)
  • /branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMapsDispMap.php (modified) (history)
  • /branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMapsDispPoint.php (modified) (history)

Diff [purge]

Index: branches/Maps0.8/Maps.php
@@ -155,7 +155,7 @@
156156 * @return true
157157 */
158158 function efMapsSetup() {
159 - global $wgExtensionCredits, $wgLang, $wgExtraNamespaces, $wgNamespaceAliases, $wgVersion;
 159+ global $wgExtensionCredits, $wgLang, $wgExtraNamespaces, $wgNamespaceAliases;
160160
161161 if ( is_null( $wgExtraNamespaces ) ) {
162162 $wgExtraNamespaces = array();
Index: branches/Maps0.8/includes/mapsonload.js
@@ -1,60 +0,0 @@
2 -/**
3 - * Some JS stolen from wikibits.js to allow Maps to work in MW 1.17 with the resource loader.
4 - * This approach might not be optimal, but prevents the need for a rewrite of the actual output for now.
5 - *
6 - * @since 0.7
7 - *
8 - * @file maponload.js
9 - * @ingroup Maps
10 - *
11 - * @author Jeroen De Dauw
12 - */
13 -
14 -// add any onload functions in this hook (please don't hard-code any events in the xhtml source)
15 -var doneMapsOnloadHook;
16 -
17 -if (!window.mapsOnloadFuncts) {
18 - var mapsOnloadFuncts = [];
19 -}
20 -
21 -function addMapsOnloadHook(hookFunct) {
22 - // Allows add-on scripts to add onload functions
23 - if(!doneMapsOnloadHook) {
24 - mapsOnloadFuncts[mapsOnloadFuncts.length] = hookFunct;
25 - } else {
26 - hookFunct(); // bug in MSIE script loading
27 - }
28 -}
29 -
30 -addMapOnloadHandler(window, "load",
31 - function () {
32 - // don't run anything below this for non-dom browsers
33 - if (doneMapsOnloadHook || !(document.getElementById && document.getElementsByTagName)) {
34 - return;
35 - }
36 -
37 - // set this before running any hooks, since any errors below
38 - // might cause the function to terminate prematurely
39 - doneMapsOnloadHook = true;
40 -
41 - // Run any added-on functions
42 - for (var i = 0; i < mapsOnloadFuncts.length; i++) {
43 - mapsOnloadFuncts[i]();
44 - }
45 - }
46 -);
47 -
48 -/**
49 - * Add an event handler to an element
50 - *
51 - * @param Element element Element to add handler to
52 - * @param String attach Event to attach to
53 - * @param callable handler Event handler callback
54 - */
55 -function addMapOnloadHandler( element, attach, handler ) {
56 - if( window.addEventListener ) {
57 - element.addEventListener( attach, handler, false );
58 - } else if( window.attachEvent ) {
59 - element.attachEvent( 'on' + attach, handler );
60 - }
61 -}
Index: branches/Maps0.8/includes/Maps_MappingService.php
@@ -50,24 +50,6 @@
5151 protected $resourceModules = array();
5252
5353 /**
54 - * A list of dependencies (header items) that have been added.
55 - *
56 - * @since 0.6.3
57 - *
58 - * @var array
59 - */
60 - private $addedDependencies = array();
61 -
62 - /**
63 - * A list of dependencies (header items) that need to be added.
64 - *
65 - * @since 0.6.3
66 - *
67 - * @var array
68 - */
69 - private $dependencies = array();
70 -
71 - /**
7254 * Constructor. Creates a new instance of MapsMappingService.
7355 *
7456 * @since 0.6.3
@@ -114,62 +96,16 @@
11597 * @since 0.6.3
11698 */
11799 public final function addDependencies( &$parserOrOut ) {
118 - global $egMapsUseRL;
119 -
120 - $dependencies = $this->getDependencyHtml();
121 -
122100 // Only add a head item when there are dependencies.
123101 if ( $parserOrOut instanceof Parser ) {
124 - if ( $dependencies ) {
125 - $parserOrOut->getOutput()->addHeadItem( $dependencies );
126 - }
127 -
128 - if ( $egMapsUseRL /* method_exists( $parserOrOut->getOutput(), 'addModules' ) */ ) {
129 - $parserOrOut->getOutput()->addModules( $this->getResourceModules() );
130 - }
 102+ $parserOrOut->getOutput()->addModules( $this->getResourceModules() );
131103 }
132104 else if ( $parserOrOut instanceof OutputPage ) {
133 - if ( $dependencies ) {
134 - $parserOrOut->addHeadItem( md5( $dependencies ), $dependencies );
135 - }
136 -
137 - if ( $egMapsUseRL /* method_exists( $parserOrOut, 'addModules' ) */ ) {
138 - $parserOrOut->addModules( $this->getResourceModules() );
139 - }
140 - }
141 - }
142 -
143 - /**
144 - * @see iMappingService::getDependencyHtml
145 - *
146 - * @since 0.6.3
147 - */
148 - public final function getDependencyHtml() {
149 - $allDependencies = array_merge( $this->getDependencies(), $this->dependencies );
150 - $dependencies = array();
151 -
152 - // Only add dependnecies that have not yet been added.
153 - foreach ( $allDependencies as $dependency ) {
154 - if ( !in_array( $dependency, $this->addedDependencies ) ) {
155 - $dependencies[] = $dependency;
156 - $this->addedDependencies[] = $dependency;
157 - }
 105+ $parserOrOut->addModules( $this->getResourceModules() );
158106 }
159 -
160 - // If there are dependencies, put them all together in a string, otherwise return false.
161 - return count( $dependencies ) > 0 ? implode( '', $dependencies ) : false;
162107 }
163108
164109 /**
165 - * @see iMappingService::addDependency
166 - *
167 - * @since 0.6.3
168 - */
169 - public final function addDependency( $dependencyHtml ) {
170 - $this->dependencies[] = $dependencyHtml;
171 - }
172 -
173 - /**
174110 * @see iMappingService::getName
175111 *
176112 * @since 0.6.3
@@ -221,17 +157,6 @@
222158 }
223159
224160 /**
225 - * Returns a list of html fragments, such as script includes, the current service depends on.
226 - *
227 - * @since 0.6.3
228 - *
229 - * @return array
230 - */
231 - protected function getDependencies() {
232 - return array();
233 - }
234 -
235 - /**
236161 * Returns the resource modules that need to be loaded to use this mapping service.
237162 *
238163 * @since 0.7.3
Index: branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3DispPoint.php
@@ -14,31 +14,14 @@
1515 * @see MapsBaseMap::addSpecificMapHTML
1616 */
1717 public function addSpecificMapHTML( Parser $parser ) {
18 - $mapName = $this->service->getMapId();
19 -
20 - $this->output .= Html::element(
 18+ return Html::element(
2119 'div',
2220 array(
23 - 'id' => $mapName,
 21+ 'id' => $this->service->getMapId(),
2422 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;"
2523 ),
2624 null
2725 );
28 -
29 - MapsMapper::addInlineScript( $this->service, <<<EOT
30 - initGMap3(
31 - "$mapName",
32 - {
33 - zoom: $this->zoom,
34 - lat: $this->centreLat,
35 - lon: $this->centreLon,
36 - types: [],
37 - mapTypeId: $this->type
38 - },
39 - $this->markerJs
40 - );
41 -EOT
42 - );
4326 }
4427
4528 }
\ No newline at end of file
Index: branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3DispMap.php
@@ -13,36 +13,10 @@
1414 * @see MapsBaseMap::getMapHTML()
1515 */
1616 public function getMapHTML( array $params, Parser $parser ) {
17 - global $egMapsUseRL;
18 -
19 - $mapName = $this->service->getMapId();
20 -
21 - if ( !$egMapsUseRL ) {
22 - $centreLat = MapsMapper::encodeJsVar( $params['centre']['lat'] );
23 - $centreLon = MapsMapper::encodeJsVar( $params['centre']['lon'] );
24 - $zoom = MapsMapper::encodeJsVar( $params['zoom'] );
25 - $type = Xml::escapeJsString( $params['type'] );
26 -
27 - MapsMapper::addInlineScript( $this->service, <<<EOT
28 - initGMap3(
29 - "$mapName",
30 - {
31 - zoom: $zoom,
32 - lat: $centreLat,
33 - lon: $centreLon,
34 - types: [],
35 - mapTypeId: $type
36 - },
37 - []
38 - );
39 -EOT
40 - );
41 - }
42 -
4317 return Html::element(
4418 'div',
4519 array(
46 - 'id' => $mapName,
 20+ 'id' => $this->service->getMapId(),
4721 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
4822 ),
4923 wfMsg( 'maps-loading-map' )
Index: branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMapsDispPoint.php
@@ -14,31 +14,14 @@
1515 * @see MapsBaseMap::addSpecificMapHTML
1616 */
1717 public function addSpecificMapHTML( Parser $parser ) {
18 - $mapName = $this->service->getMapId();
19 -
20 - $this->output .= Html::element(
 18+ return Html::element(
2119 'div',
2220 array(
23 - 'id' => $mapName,
 21+ 'id' => $this->service->getMapId(),
2422 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
2523 ),
2624 wfMsg( 'maps-loading-map' )
2725 );
28 -
29 - MapsMapper::addInlineScript( $this->service, <<<EOT
30 - initializeYahooMap(
31 - "$mapName",
32 - $this->centreLat,
33 - $this->centreLon,
34 - $this->zoom,
35 - $this->type,
36 - [$this->types],
37 - [$this->controls],
38 - $this->autozoom,
39 - $this->markerJs
40 - );
41 -EOT
42 - );
4326 }
4427
4528 }
\ No newline at end of file
Index: branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMapsDispMap.php
@@ -14,36 +14,10 @@
1515 * @see MapsBaseMap::getMapHTML()
1616 */
1717 public function getMapHTML( array $params, Parser $parser ) {
18 - global $egMapsUseRL;
19 -
20 - $mapName = $this->service->getMapId();
21 -
22 - if ( !$egMapsUseRL ) {
23 - $centreLat = MapsMapper::encodeJsVar( $params['centre']['lat'] );
24 - $centreLon = MapsMapper::encodeJsVar( $params['centre']['lon'] );
25 - $zoom = MapsMapper::encodeJsVar( $params['zoom'] );
26 - $type = Xml::escapeJsString( $params['type'] );
27 -
28 - MapsMapper::addInlineScript( $this->service, <<<EOT
29 - initializeYahooMap(
30 - "$mapName",
31 - $centreLat,
32 - $centreLon,
33 - $zoom,
34 - $type,
35 - [{$params['types']}],
36 - [{$params['controls']}],
37 - {$params['autozoom']},
38 - []
39 - );
40 -EOT
41 - );
42 - }
43 -
4418 return Html::element(
4519 'div',
4620 array(
47 - 'id' => $mapName,
 21+ 'id' => $this->service->getMapId(),
4822 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
4923 ),
5024 wfMsg( 'maps-loading-map' )
Index: branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispPoint.php
@@ -14,34 +14,14 @@
1515 * @see MapsBaseMap::addSpecificMapHTML
1616 */
1717 public function addSpecificMapHTML( Parser $parser ) {
18 - global $wgLang;
19 -
20 - $mapName = $this->service->getMapId();
21 -
22 - $this->output .= Html::element(
 18+ return Html::element(
2319 'div',
2420 array(
25 - 'id' => $mapName,
 21+ 'id' => $this->service->getMapId(),
2622 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;",
2723 ),
2824 wfMsg( 'maps-loading-map' )
2925 );
30 -
31 - $langCode = $wgLang->getCode();
32 -
33 - MapsMapper::addInlineScript( $this->service, <<<EOT
34 - initOpenLayer(
35 - "$mapName",
36 - $this->centreLon,
37 - $this->centreLat,
38 - $this->zoom,
39 - {$this->layers},
40 - [$this->controls],
41 - $this->markerJs,
42 - "$langCode"
43 - );
44 -EOT
45 - );
4626 }
4727
4828 }
\ No newline at end of file
Index: branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayersDispMap.php
@@ -33,35 +33,10 @@
3434 * @since 0.7.3
3535 */
3636 public function getMapHTML( array $params, Parser $parser ) {
37 - global $wgLang, $egMapsUseRL;
38 -
39 - $mapName = $this->service->getMapId();
40 -
41 - if ( !$egMapsUseRL ) {
42 - $langCode = $wgLang->getCode();
43 - $centreLat = MapsMapper::encodeJsVar( $params['centre']['lat'] );
44 - $centreLon = MapsMapper::encodeJsVar( $params['centre']['lon'] );
45 - $zoom = MapsMapper::encodeJsVar( $params['zoom'] );
46 -
47 - MapsMapper::addInlineScript( $this->service, <<<EOT
48 - initOpenLayer(
49 - "$mapName",
50 - $centreLon,
51 - $centreLat,
52 - $zoom,
53 - {$params['layers']},
54 - [{$params['controls']}],
55 - [],
56 - "$langCode"
57 - );
58 -EOT
59 - );
60 - }
61 -
6237 return Html::element(
6338 'div',
6439 array(
65 - 'id' => $mapName,
 40+ 'id' => $this->service->getMapId(),
6641 'style' => "width: {$params['width']}; height: {$params['height']}; background-color: #cccccc; overflow: hidden;",
6742 ),
6843 wfMsg( 'maps-loading-map' )
Index: branches/Maps0.8/includes/services/GoogleMaps/GoogleMapFunctions.js
@@ -1,280 +0,0 @@
2 - /**
3 - * Javascript functions for Google Maps functionality in Maps.
4 - *
5 - * @file GoogleMapFunctions.js
6 - * @ingroup MapsGoogleMaps
7 - *
8 - * @author Robert Buzink
9 - * @author Yaron Koren
10 - * @author Jeroen De Dauw
11 - */
12 -
13 -var GOverlays = [
14 - new GLayer("com.panoramio.all"),
15 - new GLayer("com.youtube.all"),
16 - new GLayer("org.wikipedia.en"),
17 - new GLayer("com.google.webcams")
18 -];
19 -
20 -
21 -/**
22 - * Returns GMarker object on the provided location. It will show a popup baloon
23 - * with title and label when clicked, if either of these is set.
24 - */
25 -function createGMarker( markerData ) {
26 - var marker;
27 -
28 - if ( markerData.icon != '' ) {
29 - var iconObj = new GIcon( G_DEFAULT_ICON );
30 - iconObj.image = markerData.icon;
31 -
32 -
33 - var newimg = new Image();
34 - newimg.src = markerData.icon;
35 -
36 - // Only do these things when there is an actual width, which there won,t the first time the image is loaded.
37 - // FIXME: this means the image won't have it's correct size when it differs from the default on first load!
38 - if ( newimg.width > 0 ) {
39 - /* Determine size of icon and pass it in */
40 - iconObj.iconSize.width = newimg.width;
41 - iconObj.iconSize.height = newimg.height;
42 - iconObj.shadow = null;
43 -
44 - /* Anchor the icon on bottom middle */
45 - var anchor = new GPoint();
46 - anchor.x = Math.floor( newimg.width / 2 );
47 - anchor.y = newimg.height;
48 - iconObj.iconAnchor = anchor;
49 - }
50 -
51 - marker = new GMarker( markerData.point, { icon: iconObj } );
52 - } else {
53 - marker = new GMarker( markerData.point );
54 - }
55 -
56 - if ( ( markerData.title + markerData.label ).length != '' ) {
57 - var bothTxtAreSet = markerData.title.length != '' && markerData.label.length != '';
58 - var popupText = bothTxtAreSet ? '<b>' + markerData.title + '</b><hr />' + markerData.label : markerData.title + markerData.label;
59 - popupText = '<div style="overflow:auto;max-height:130px;">' + popupText + '</div>';
60 -
61 - GEvent.addListener(marker, 'click',
62 - function() {
63 - marker.openInfoWindowHtml(popupText, {maxWidth:350});
64 - }
65 - );
66 - }
67 -
68 - return marker;
69 -}
70 -
71 -/**
72 - * Returns GMap2 object with the provided properties and markers.
73 - * This is done by setting the map centre and size, and passing the arguments to function createGoogleMap.
74 - */
75 -function initializeGoogleMap(mapName, mapOptions, markers) {
76 - if (GBrowserIsCompatible()) {
77 - mapOptions.centre = (mapOptions.lat != null && mapOptions.lon != null) ? new GLatLng(mapOptions.lat, mapOptions.lon) : null;
78 - //mapOptions.size = new GSize(mapOptions.width, mapOptions.height);
79 - return createGoogleMap(mapName, mapOptions, markers);
80 - }
81 - else {
82 - return false;
83 - }
84 -}
85 -
86 -/**
87 - * Returns GMap2 object with the provided properties.
88 - */
89 -function createGoogleMap(mapName, mapOptions, markers) {
90 - var mapElement = document.getElementById(mapName);
91 - var typesContainType = false;
92 -
93 - for (var i = 0; i < mapOptions.types.length; i++) {
94 - if (mapOptions.types[i] == mapOptions.type) typesContainType = true;
95 - }
96 -
97 - if (! typesContainType) mapOptions.types.push(mapOptions.type);
98 -
99 - var map = new GMap2(mapElement, {mapTypes: mapOptions.types});
100 - map.name = mapName;
101 -
102 - map.setMapType(mapOptions.type);
103 -
104 - var hasSearchBar = false;
105 -
106 - for ( i = mapOptions.controls.length - 1; i >= 0; i-- ) {
107 - if ( mapOptions.controls[i] == 'searchbar' ) {
108 - hasSearchBar = true;
109 - break;
110 - }
111 - }
112 -
113 - // List of GControls: http://code.google.com/apis/maps/documentation/reference.html#GControl
114 - for ( i = 0; i < mapOptions.controls.length; i++ ) {
115 - if ( mapOptions.controls[i].toLowerCase() == 'auto' ) {
116 - if ( mapElement.offsetHeight > 75 ) mapOptions.controls[i] = mapElement.offsetHeight > 320 ? 'large' : 'small';
117 - }
118 -
119 - switch ( mapOptions.controls[i] ) {
120 - case 'large' :
121 - map.addControl( new GLargeMapControl3D() );
122 - break;
123 - case 'small' :
124 - map.addControl( new GSmallZoomControl3D() );
125 - break;
126 - case 'large-original' :
127 - map.addControl( new GLargeMapControl() );
128 - break;
129 - case 'small-original' :
130 - map.addControl( new GSmallMapControl() );
131 - break;
132 - case 'zoom' :
133 - map.addControl( new GSmallZoomControl() );
134 - break;
135 - case 'type' :
136 - map.addControl( new GMapTypeControl() );
137 - break;
138 - case 'type-menu' :
139 - map.addControl( new GMenuMapTypeControl() );
140 - break;
141 - case 'overlays' :
142 - map.addControl( new MoreControl() );
143 - break;
144 - case 'overview' : case 'overview-map' :
145 - map.addControl( new GOverviewMapControl() );
146 - break;
147 - case 'scale' :
148 - if ( hasSearchBar ) {
149 - map.addControl( new GScaleControl(), new GControlPosition( G_ANCHOR_BOTTOM_LEFT, new GSize( 5,37 ) ) );
150 - }
151 - else {
152 - map.addControl( new GScaleControl() );
153 - }
154 - break;
155 - case 'nav-label' : case 'nav' :
156 - map.addControl( new GNavLabelControl() );
157 - break;
158 - case 'searchbar' :
159 - map.enableGoogleBar();
160 - break;
161 - }
162 - }
163 -
164 - var bounds = ((mapOptions.zoom == null || mapOptions.centre == null) && markers.length > 1) ? new GLatLngBounds() : null;
165 -
166 - for ( i = markers.length - 1; i >= 0; i-- ) {
167 - var marker = markers[i];
168 - marker.point = new GLatLng( marker.lat, marker.lon );
169 - map.addOverlay( createGMarker( marker ) );
170 - if ( bounds != null ) bounds.extend( marker.point );
171 - }
172 -
173 - if (bounds != null) {
174 - map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
175 - }
176 -
177 - if (mapOptions.centre != null) map.setCenter(mapOptions.centre);
178 - if (mapOptions.zoom != null) map.setZoom(mapOptions.zoom);
179 -
180 - if (mapOptions.scrollWheelZoom) map.enableScrollWheelZoom();
181 -
182 - map.enableContinuousZoom();
183 -
184 - // Code to add KML files.
185 - var kmlOverlays = [];
186 - for ( i = mapOptions.kml.length - 1; i >= 0; i-- ) {
187 - kmlOverlays[i] = new GGeoXml( mapOptions.kml[i] );
188 - map.addOverlay( kmlOverlays[i] );
189 - }
190 -
191 - // Make the map variable available for other functions.
192 - if (!window.GMaps) window.GMaps = new Object;
193 - eval("window.GMaps." + mapName + " = map;");
194 -
195 - return map;
196 -}
197 -
198 -function setupCheckboxShiftClick() { return true; }
199 -
200 -function MoreControl() {};
201 -MoreControl.prototype = new GControl();
202 -
203 -MoreControl.prototype.initialize = function(map) {
204 - this.map = map;
205 -
206 - var more = document.getElementById(map.name + "-outer-more");
207 -
208 - var buttonDiv = document.createElement("div");
209 - buttonDiv.id = map.name + "-more-button";
210 - buttonDiv.title = "Show/Hide Overlays";
211 - buttonDiv.style.border = "1px solid black";
212 - buttonDiv.style.width = "86px";
213 -
214 - var textDiv = document.createElement("div");
215 - textDiv.id = map.name + "-inner-more";
216 - textDiv.setAttribute('class', 'inner-more');
217 - textDiv.appendChild(document.createTextNode( msgOverlays ));
218 -
219 - buttonDiv.appendChild(textDiv);
220 -
221 - // Register Event handlers
222 - more.onmouseover = showGLayerbox;
223 - more.onmouseout = setGLayerboxClose;
224 -
225 - // Insert the button just after outer_more div.
226 - more.insertBefore(buttonDiv, document.getElementById(map.name + "-more-box").parentNode);
227 -
228 - // Remove the whole div from its location and reinsert it to the map.
229 - map.getContainer().appendChild(more);
230 -
231 - return more;
232 -};
233 -
234 -MoreControl.prototype.getDefaultPosition = function() {
235 - return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 35));
236 -};
237 -
238 -function checkGChecked(mapName) {
239 - // Returns true if a checkbox is still checked otherwise false.
240 - var boxes = document.getElementsByName(mapName + "-overlay-box");
241 - for(var i = 0; i < boxes.length; i++) {
242 - if(boxes[i].checked) return true;
243 - }
244 - return false;
245 -}
246 -
247 -function showGLayerbox() {
248 - var mapName = this.id.split('-')[0];
249 - eval("if(window.timer_" + mapName + ") clearTimeout(timer_" + mapName + ");");
250 - document.getElementById(mapName + "-more-box").style.display = "block";
251 - var button = document.getElementById(mapName + "-inner-more");
252 - button.style.borderBottomWidth = "4px";
253 - button.style.borderBottomColor = "white";
254 -}
255 -
256 -
257 -function setGLayerboxClose() {
258 - var mapName = this.id.split('-')[0];
259 - var layerbox = document.getElementById(mapName + "-more-box");
260 - var button = document.getElementById(mapName + "-inner-more");
261 - var bottomColor = checkGChecked(mapName) ? "#6495ed" : "#c0c0c0";
262 - eval("timer_" + mapName + " = window.setTimeout(function() { layerbox.style.display = 'none'; button.style.borderBottomWidth = '1px'; button.style.borderBottomColor = bottomColor; }, 400);");
263 -}
264 -
265 -function switchGLayer(map, checked, layer) {
266 - var layerbox = document.getElementById(map.name + "-more-box");
267 - var button = document.getElementById(map.name + "-inner-more");
268 -
269 - if(checked) {
270 - map.addOverlay(layer);
271 - }
272 - else {
273 - map.removeOverlay(layer);
274 - }
275 -
276 -}
277 -
278 -function initiateGOverlay(elementId, mapName, urlNr) {
279 - document.getElementById(elementId).checked = true;
280 - switchGLayer(GMaps[mapName], true, GOverlays[urlNr]);
281 -}
\ No newline at end of file
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMapsDispMap.php
@@ -14,37 +14,12 @@
1515 * @see MapsBaseMap::getMapHTML()
1616 */
1717 public function getMapHTML( array $params, Parser $parser ) {
18 - global $egMapsUseRL;
19 -
2018 $mapName = $this->service->getMapId();
2119
2220 $output = '';
2321
2422 $this->service->addOverlayOutput( $output, $mapName, $params['overlays'], $params['controls'] );
2523
26 - if ( !$egMapsUseRL ) {
27 - $centreLat = MapsMapper::encodeJsVar( $params['centre']['lat'] );
28 - $centreLon = MapsMapper::encodeJsVar( $params['centre']['lon'] );
29 - $zoom = MapsMapper::encodeJsVar( $params['zoom'] );
30 - $type = Xml::escapeJsString( $params['type'] );
31 -
32 - MapsMapper::addInlineScript( $this->service, <<<EOT
33 - initializeGoogleMap("$mapName",
34 - {
35 - lat: $centreLat,
36 - lon: $centreLon,
37 - zoom: $zoom,
38 - type: $type,
39 - types: [{$params['types']}],
40 - controls: [{$params['controls']}],
41 - scrollWheelZoom: {$params['autozoom']},
42 - kml: [{$params['kml']}]
43 - },
44 - []);
45 -EOT
46 - );
47 - }
48 -
4924 return $output . Html::element(
5025 'div',
5126 array(
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php
@@ -142,17 +142,17 @@
143143 $markerItems = array();
144144
145145 foreach ( $markers as $marker ) {
146 - $markerItems[] = MapsMapper::encodeJsVar( (object)array(
 146+ $markerItems[] = array(
147147 'lat' => $marker[0],
148148 'lon' => $marker[1],
149149 'title' => $marker[2],
150150 'label' =>$marker[3],
151151 'icon' => $marker[4]
152 - ) );
 152+ );
153153 }
154154
155 - // Create a string containing the marker JS.
156 - return '[' . implode( ',', $markerItems ) . ']';
 155+ // Return a string containing the marker JS.
 156+ return json_encode( $markerItems );
157157 }
158158
159159 /**
@@ -211,15 +211,24 @@
212212 */
213213 protected function getDependencies() {
214214 global $wgLang;
215 - global $egGoogleMapsKey, $egMapsStyleVersion, $egMapsScriptPath;
 215+ global $egGoogleMapsKeys, $egGoogleMapsKey, $egMapsStyleVersion, $egMapsScriptPath, $egMapsUseRL;
216216
217217 $langCode = self::getMappedLanguageCode( $wgLang->getCode() );
218218
219 - return array(
220 - Html::linkedScript( "http://maps.google.com/maps?file=api&v=2&key=$egGoogleMapsKey&hl=$langCode" ),
221 - Html::linkedScript( "$egMapsScriptPath/includes/services/GoogleMaps/GoogleMapFunctions.js?$egMapsStyleVersion" ),
222 - Html::inlineScript( 'window.unload = GUnload; var msgOverlays = ' . Xml::encodeJsVar( wfMsg( 'maps_overlays' ) ) . ';' )
 219+ $dependencies = array();
 220+
 221+ $dependencies[] = Html::inlineScript(
 222+ 'var googleMapsKey = '. json_encode( $egGoogleMapsKey ) . ';' .
 223+ 'var googleMapsKeys = '. json_encode( $egGoogleMapsKeys ) . ';' .
 224+ 'var googleLangCode = '. json_encode( $langCode ) . ';'
223225 );
 226+
 227+ if ( !$egMapsUseRL ) {
 228+ $dependencies[] = Html::linkedScript( "$egMapsScriptPath/includes/services/GoogleMaps/ext.maps.googlemaps2.js?$egMapsStyleVersion" );
 229+ $dependencies[] = Html::inlineScript( 'var msgOverlays = ' . Xml::encodeJsVar( wfMsg( 'maps_overlays' ) ) . ';' );
 230+ }
 231+
 232+ return $dependencies;
224233 }
225234
226235 /**
@@ -294,32 +303,6 @@
295304 $overlayHtml = '';
296305 $onloadFunctions = array();
297306
298 - foreach ( $overlays as $overlay => $isOn ) {
299 - $overlay = strtolower( $overlay );
300 -
301 - if ( in_array( $overlay, $overlayNames ) ) {
302 - if ( !in_array( $overlay, $addedOverlays ) ) {
303 - $addedOverlays[] = $overlay;
304 - $label = wfMsg( 'maps_' . $overlay );
305 - $urlNr = self::$overlayData[$overlay];
306 -
307 - $overlayHtml .= Html::input(
308 - "$mapName-overlay-box",
309 - null,
310 - 'checkbox',
311 - array(
312 - 'id' => "$mapName-overlay-box-$overlay",
313 - 'onclick' => "switchGLayer(GMaps['$mapName'], this.checked, GOverlays[$urlNr])"
314 - )
315 - ) . htmlspecialchars( $label ) . '<br />' ;
316 -
317 - if ( $isOn ) {
318 - $onloadFunctions[] = "addOnloadHook( function() { initiateGOverlay('$mapName-overlay-box-$overlay', '$mapName', $urlNr) } );";
319 - }
320 - }
321 - }
322 - }
323 -
324307 $output .= Html::rawElement(
325308 'div',
326309 array(
@@ -336,63 +319,55 @@
337320 $overlayHtml
338321 ) .
339322 '</form>'
340 - );
341 -
342 - // If the overlays JS and CSS has not yet loaded, do it.
343 - if ( empty( $egMapsGoogleOverlLoaded ) ) {
344 - $egMapsGoogleOverlLoaded = true;
345 -
346 - $this->addDependency(
347 - $this->getOverlayCss()
348 - . Html::inlineScript( 'var timer_' . htmlspecialchars( $mapName ) . ';' . implode( "\n", $onloadFunctions ) )
349 - );
350 - }
 323+ );
351324 }
352325
353326 /**
354 - * Returns CSS for the overlays.
 327+ * @see MapsMappingService::getResourceModules
 328+ *
 329+ * @since 0.7.4
 330+ *
 331+ * @return array of string
355332 */
356 - protected function getOverlayCss() {
357 - return Html::inlineStyle( <<<EOT
358 -.inner-more {
359 - text-align:center;
360 - font-size:12px;
361 - background-color: #fff;
362 - color: #000;
363 - border: 1px solid #fff;
364 - border-right-color: #b0b0b0;
365 - border-bottom-color: #c0c0c0;
366 - width:7em;
367 - cursor: pointer;
368 -}
369 -
370 -.inner-more.highlight {
371 - font-weight: bold;
372 - border: 1px solid #483D8B;
373 - border-right-color: #6495ed;
374 - border-bottom-color: #6495ed;
375 -}
376 -
377 -.more-box { position:absolute;
378 - top:25px; left:0px;
379 - margin-top:-1px;
380 - font-size:12px;
381 - padding: 6px 4px;
382 - width:120px;
383 - background-color: #fff;
384 - color: #000;
385 - border: 1px solid gray;
386 - border-top:1px solid #e2e2e2;
387 - display: none;
388 - cursor:default;
389 -}
390 -
391 -.more-box.highlight {
392 - width:119px;
393 - border-width:2px;
394 -}
395 -EOT
 333+ protected function getResourceModules() {
 334+ return array_merge(
 335+ parent::getResourceModules(),
 336+ array( 'ext.maps.googlemaps2' )
396337 );
397338 }
398339
 340+ /**
 341+ * Register the resource modules for the resource loader.
 342+ *
 343+ * @since 0.7.4
 344+ *
 345+ * @param ResourceLoader $resourceLoader
 346+ *
 347+ * @return true
 348+ */
 349+ public static function registerResourceLoaderModules( ResourceLoader &$resourceLoader ) {
 350+ global $egMapsScriptPath, $egMapsOLLayerModules;
 351+
 352+ $modules = array(
 353+ 'ext.maps.googlemaps2' => array(
 354+ 'scripts' => array(
 355+ 'ext.maps.googlemaps2.js'
 356+ ),
 357+ 'messages' => array(
 358+ 'maps-markers'
 359+ )
 360+ ),
 361+ );
 362+
 363+ foreach ( $modules as $name => $resources ) {
 364+ $resourceLoader->register( $name, new ResourceLoaderFileModule(
 365+ array_merge_recursive( $resources, array( 'group' => 'ext.maps' ) ),
 366+ dirname( __FILE__ ),
 367+ $egMapsScriptPath . '/includes/services/GoogleMaps'
 368+ ) );
 369+ }
 370+
 371+ return true;
 372+ }
 373+
399374 }
\ No newline at end of file
Index: branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.css
@@ -0,0 +1,37 @@
 2+.inner-more {
 3+ text-align:center;
 4+ font-size:12px;
 5+ background-color: #fff;
 6+ color: #000;
 7+ border: 1px solid #fff;
 8+ border-right-color: #b0b0b0;
 9+ border-bottom-color: #c0c0c0;
 10+ width:7em;
 11+ cursor: pointer;
 12+}
 13+
 14+.inner-more.highlight {
 15+ font-weight: bold;
 16+ border: 1px solid #483D8B;
 17+ border-right-color: #6495ed;
 18+ border-bottom-color: #6495ed;
 19+}
 20+
 21+.more-box { position:absolute;
 22+ top:25px; left:0px;
 23+ margin-top:-1px;
 24+ font-size:12px;
 25+ padding: 6px 4px;
 26+ width:120px;
 27+ background-color: #fff;
 28+ color: #000;
 29+ border: 1px solid gray;
 30+ border-top:1px solid #e2e2e2;
 31+ display: none;
 32+ cursor:default;
 33+}
 34+
 35+.more-box.highlight {
 36+ width:119px;
 37+ border-width:2px;
 38+}
\ No newline at end of file
Property changes on: branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.css
___________________________________________________________________
Added: svn:eol-style
139 + native
Index: branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.js
@@ -0,0 +1,282 @@
 2+/**
 3+ * JavasSript for Google Maps v2 maps in the Maps extension.
 4+ * @see http://www.mediawiki.org/wiki/Extension:Maps
 5+ *
 6+ * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
 7+ */
 8+
 9+(function($) { $( document ).ready( function() {
 10+
 11+ // http://maps.google.com/maps?file=api&v=2&key=$egGoogleMapsKey&hl=$langCode
 12+
 13+ window.unload = GUnload;
 14+
 15+ var GOverlays = [
 16+ new GLayer("com.panoramio.all"),
 17+ new GLayer("com.youtube.all"),
 18+ new GLayer("org.wikipedia.en"),
 19+ new GLayer("com.google.webcams")
 20+ ];
 21+
 22+ /**
 23+ * Returns GMarker object on the provided location. It will show a popup baloon
 24+ * with title and label when clicked, if either of these is set.
 25+ */
 26+ function createGMarker( markerData ) {
 27+ var marker;
 28+
 29+ if ( markerData.icon != '' ) {
 30+ var iconObj = new GIcon( G_DEFAULT_ICON );
 31+ iconObj.image = markerData.icon;
 32+
 33+ var newimg = new Image();
 34+ newimg.src = markerData.icon;
 35+
 36+ // Only do these things when there is an actual width, which there won,t the first time the image is loaded.
 37+ // FIXME: this means the image won't have it's correct size when it differs from the default on first load!
 38+ if ( newimg.width > 0 ) {
 39+ /* Determine size of icon and pass it in */
 40+ iconObj.iconSize.width = newimg.width;
 41+ iconObj.iconSize.height = newimg.height;
 42+ iconObj.shadow = null;
 43+
 44+ /* Anchor the icon on bottom middle */
 45+ var anchor = new GPoint();
 46+ anchor.x = Math.floor( newimg.width / 2 );
 47+ anchor.y = newimg.height;
 48+ iconObj.iconAnchor = anchor;
 49+ }
 50+
 51+ marker = new GMarker( markerData.point, { icon: iconObj } );
 52+ } else {
 53+ marker = new GMarker( markerData.point );
 54+ }
 55+
 56+ if ( ( markerData.title + markerData.label ).length != '' ) {
 57+ var bothTxtAreSet = markerData.title.length != '' && markerData.label.length != '';
 58+ var popupText = bothTxtAreSet ? '<b>' + markerData.title + '</b><hr />' + markerData.label : markerData.title + markerData.label;
 59+ popupText = '<div style="overflow:auto;max-height:130px;">' + popupText + '</div>';
 60+
 61+ GEvent.addListener(marker, 'click',
 62+ function() {
 63+ marker.openInfoWindowHtml(popupText, {maxWidth:350});
 64+ }
 65+ );
 66+ }
 67+
 68+ return marker;
 69+ }
 70+
 71+ /**
 72+ * Returns GMap2 object with the provided properties and markers.
 73+ * This is done by setting the map centre and size, and passing the arguments to function createGoogleMap.
 74+ */
 75+ function initializeGoogleMap(mapName, mapOptions, markers) {
 76+ if (GBrowserIsCompatible()) {
 77+ mapOptions.centre = (mapOptions.lat != null && mapOptions.lon != null) ? new GLatLng(mapOptions.lat, mapOptions.lon) : null;
 78+ //mapOptions.size = new GSize(mapOptions.width, mapOptions.height);
 79+ return createGoogleMap(mapName, mapOptions, markers);
 80+ }
 81+ else {
 82+ return false;
 83+ }
 84+ }
 85+
 86+ /**
 87+ * Returns GMap2 object with the provided properties.
 88+ */
 89+ function createGoogleMap(mapName, mapOptions, markers) {
 90+ var mapElement = document.getElementById(mapName);
 91+ var typesContainType = false;
 92+
 93+ for (var i = 0; i < mapOptions.types.length; i++) {
 94+ if (mapOptions.types[i] == mapOptions.type) typesContainType = true;
 95+ }
 96+
 97+ if (! typesContainType) mapOptions.types.push(mapOptions.type);
 98+
 99+ var map = new GMap2(mapElement, {mapTypes: mapOptions.types});
 100+ map.name = mapName;
 101+
 102+ map.setMapType(mapOptions.type);
 103+
 104+ var hasSearchBar = false;
 105+
 106+ for ( i = mapOptions.controls.length - 1; i >= 0; i-- ) {
 107+ if ( mapOptions.controls[i] == 'searchbar' ) {
 108+ hasSearchBar = true;
 109+ break;
 110+ }
 111+ }
 112+
 113+ // List of GControls: http://code.google.com/apis/maps/documentation/reference.html#GControl
 114+ for ( i = 0; i < mapOptions.controls.length; i++ ) {
 115+ if ( mapOptions.controls[i].toLowerCase() == 'auto' ) {
 116+ if ( mapElement.offsetHeight > 75 ) mapOptions.controls[i] = mapElement.offsetHeight > 320 ? 'large' : 'small';
 117+ }
 118+
 119+ switch ( mapOptions.controls[i] ) {
 120+ case 'large' :
 121+ map.addControl( new GLargeMapControl3D() );
 122+ break;
 123+ case 'small' :
 124+ map.addControl( new GSmallZoomControl3D() );
 125+ break;
 126+ case 'large-original' :
 127+ map.addControl( new GLargeMapControl() );
 128+ break;
 129+ case 'small-original' :
 130+ map.addControl( new GSmallMapControl() );
 131+ break;
 132+ case 'zoom' :
 133+ map.addControl( new GSmallZoomControl() );
 134+ break;
 135+ case 'type' :
 136+ map.addControl( new GMapTypeControl() );
 137+ break;
 138+ case 'type-menu' :
 139+ map.addControl( new GMenuMapTypeControl() );
 140+ break;
 141+ case 'overlays' :
 142+ map.addControl( new MoreControl() );
 143+ break;
 144+ case 'overview' : case 'overview-map' :
 145+ map.addControl( new GOverviewMapControl() );
 146+ break;
 147+ case 'scale' :
 148+ if ( hasSearchBar ) {
 149+ map.addControl( new GScaleControl(), new GControlPosition( G_ANCHOR_BOTTOM_LEFT, new GSize( 5,37 ) ) );
 150+ }
 151+ else {
 152+ map.addControl( new GScaleControl() );
 153+ }
 154+ break;
 155+ case 'nav-label' : case 'nav' :
 156+ map.addControl( new GNavLabelControl() );
 157+ break;
 158+ case 'searchbar' :
 159+ map.enableGoogleBar();
 160+ break;
 161+ }
 162+ }
 163+
 164+ var bounds = ((mapOptions.zoom == null || mapOptions.centre == null) && markers.length > 1) ? new GLatLngBounds() : null;
 165+
 166+ for ( i = markers.length - 1; i >= 0; i-- ) {
 167+ var marker = markers[i];
 168+ marker.point = new GLatLng( marker.lat, marker.lon );
 169+ map.addOverlay( createGMarker( marker ) );
 170+ if ( bounds != null ) bounds.extend( marker.point );
 171+ }
 172+
 173+ if (bounds != null) {
 174+ map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));
 175+ }
 176+
 177+ if (mapOptions.centre != null) map.setCenter(mapOptions.centre);
 178+ if (mapOptions.zoom != null) map.setZoom(mapOptions.zoom);
 179+
 180+ if (mapOptions.scrollWheelZoom) map.enableScrollWheelZoom();
 181+
 182+ map.enableContinuousZoom();
 183+
 184+ // Code to add KML files.
 185+ var kmlOverlays = [];
 186+ for ( i = mapOptions.kml.length - 1; i >= 0; i-- ) {
 187+ kmlOverlays[i] = new GGeoXml( mapOptions.kml[i] );
 188+ map.addOverlay( kmlOverlays[i] );
 189+ }
 190+
 191+ // Make the map variable available for other functions.
 192+ if (!window.GMaps) window.GMaps = new Object;
 193+ eval("window.GMaps." + mapName + " = map;");
 194+
 195+ return map;
 196+ }
 197+
 198+ function setupCheckboxShiftClick() { return true; }
 199+
 200+ function MoreControl() {};
 201+ MoreControl.prototype = new GControl();
 202+
 203+ MoreControl.prototype.initialize = function(map) {
 204+ this.map = map;
 205+
 206+ var more = document.getElementById(map.name + "-outer-more");
 207+
 208+ var buttonDiv = document.createElement("div");
 209+ buttonDiv.id = map.name + "-more-button";
 210+ buttonDiv.title = "Show/Hide Overlays";
 211+ buttonDiv.style.border = "1px solid black";
 212+ buttonDiv.style.width = "86px";
 213+
 214+ var textDiv = document.createElement("div");
 215+ textDiv.id = map.name + "-inner-more";
 216+ textDiv.setAttribute('class', 'inner-more');
 217+ textDiv.appendChild(document.createTextNode( msgOverlays ));
 218+
 219+ buttonDiv.appendChild(textDiv);
 220+
 221+ // Register Event handlers
 222+ more.onmouseover = showGLayerbox;
 223+ more.onmouseout = setGLayerboxClose;
 224+
 225+ // Insert the button just after outer_more div.
 226+ more.insertBefore(buttonDiv, document.getElementById(map.name + "-more-box").parentNode);
 227+
 228+ // Remove the whole div from its location and reinsert it to the map.
 229+ map.getContainer().appendChild(more);
 230+
 231+ return more;
 232+ };
 233+
 234+ MoreControl.prototype.getDefaultPosition = function() {
 235+ return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 35));
 236+ };
 237+
 238+ function checkGChecked(mapName) {
 239+ // Returns true if a checkbox is still checked otherwise false.
 240+ var boxes = document.getElementsByName(mapName + "-overlay-box");
 241+ for(var i = 0; i < boxes.length; i++) {
 242+ if(boxes[i].checked) return true;
 243+ }
 244+ return false;
 245+ }
 246+
 247+ function showGLayerbox() {
 248+ var mapName = this.id.split('-')[0];
 249+ eval("if(window.timer_" + mapName + ") clearTimeout(timer_" + mapName + ");");
 250+ document.getElementById(mapName + "-more-box").style.display = "block";
 251+ var button = document.getElementById(mapName + "-inner-more");
 252+ button.style.borderBottomWidth = "4px";
 253+ button.style.borderBottomColor = "white";
 254+ }
 255+
 256+
 257+ function setGLayerboxClose() {
 258+ var mapName = this.id.split('-')[0];
 259+ var layerbox = document.getElementById(mapName + "-more-box");
 260+ var button = document.getElementById(mapName + "-inner-more");
 261+ var bottomColor = checkGChecked(mapName) ? "#6495ed" : "#c0c0c0";
 262+ eval("timer_" + mapName + " = window.setTimeout(function() { layerbox.style.display = 'none'; button.style.borderBottomWidth = '1px'; button.style.borderBottomColor = bottomColor; }, 400);");
 263+ }
 264+
 265+ function switchGLayer(map, checked, layer) {
 266+ var layerbox = document.getElementById(map.name + "-more-box");
 267+ var button = document.getElementById(map.name + "-inner-more");
 268+
 269+ if(checked) {
 270+ map.addOverlay(layer);
 271+ }
 272+ else {
 273+ map.removeOverlay(layer);
 274+ }
 275+
 276+ }
 277+
 278+ function initiateGOverlay(elementId, mapName, urlNr) {
 279+ document.getElementById(elementId).checked = true;
 280+ switchGLayer(GMaps[mapName], true, GOverlays[urlNr]);
 281+ }
 282+
 283+} ); })(jQuery);
\ No newline at end of file
Property changes on: branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.js
___________________________________________________________________
Added: svn:eol-style
1284 + native
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMapsDispPoint.php
@@ -17,13 +17,11 @@
1818 * @see MapsBaseMap::addSpecificMapHTML
1919 */
2020 public function addSpecificMapHTML( Parser $parser ) {
21 - global $wgOut;
22 -
2321 $mapName = $this->service->getMapId();
2422
2523 $this->service->addOverlayOutput( $this->output, $mapName, $this->overlays, $this->controls );
2624
27 - $this->output .= Html::element(
 25+ return Html::element(
2826 'div',
2927 array(
3028 'id' => $mapName,
@@ -31,23 +29,6 @@
3230 ),
3331 wfMsg( 'maps-loading-map' )
3432 );
35 -
36 - MapsMapper::addInlineScript( $this->service, <<<EOT
37 - initializeGoogleMap("$mapName",
38 - {
39 - lat: $this->centreLat,
40 - lon: $this->centreLon,
41 - zoom: $this->zoom,
42 - type: $this->type,
43 - types: [$this->types],
44 - controls: [$this->controls],
45 - scrollWheelZoom: $this->autozoom,
46 - kml: [$this->kml]
47 - },
48 - $this->markerJs
49 - );
50 -EOT
51 - );
5233 }
5334
5435 }
\ No newline at end of file
Index: branches/Maps0.8/includes/Maps_Mapper.php
@@ -32,35 +32,6 @@
3333 }
3434
3535 /**
36 - * Adds a string of JavaScript as dependency for a mapping service
37 - * after wrapping it in an onload hook and script tag. This is sort
38 - * of a hack, but it takes care of the difference between artciles
39 - * and special pages.
40 - *
41 - * @since 0.7
42 - *
43 - * @param iMappingService $service
44 - * @param string $script
45 - */
46 - public static function addInlineScript( iMappingService $service, $script ) {
47 - static $addOnloadJs = false;
48 -
49 - if ( method_exists( 'OutputPage', 'addModules' ) && !$addOnloadJs ) {
50 - global $egMapsScriptPath, $egMapsStyleVersion;
51 -
52 - $service->addDependency(
53 - Html::linkedScript( "$egMapsScriptPath/includes/mapsonload.js?$egMapsStyleVersion" )
54 - );
55 -
56 - $addOnloadJs = true;
57 - }
58 -
59 - $service->addDependency( Html::inlineScript(
60 - ( method_exists( 'OutputPage', 'addModules' ) ? 'addMapsOnloadHook' : 'addOnloadHook' ) . "( function() { $script } );"
61 - ) );
62 - }
63 -
64 - /**
6536 * Encode a variable of unknown type to JavaScript.
6637 * Arrays are converted to JS arrays, objects are converted to JS associative
6738 * arrays (objects). So cast your PHP associative arrays to objects before
Index: branches/Maps0.8/includes/iMappingService.php
@@ -40,16 +40,6 @@
4141 function addParameterInfo( array &$parameterInfo );
4242
4343 /**
44 - * Adds a dependency that is needed for this service. It will be passed along with the next
45 - * call to getDependencyHtml or addDependencies.
46 - *
47 - * @since 0.6.5
48 - *
49 - * @param string $dependencyHtml
50 - */
51 - function addDependency( $dependencyHtml );
52 -
53 - /**
5444 * Adds a feature to this service. This is to indicate this service has support for this feature.
5545 *
5646 * @since 0.6.5
@@ -60,15 +50,6 @@
6151 function addFeature( $featureName, $handlingClass );
6252
6353 /**
64 - * Returns the html for the needed dependencies or false.
65 - *
66 - * @since 0.6.5
67 - *
68 - * @return mixed String or false
69 - */
70 - function getDependencyHtml();
71 -
72 - /**
7354 * Returns the name of the class that handles the provided feature in this service, or false if there is none.
7455 *
7556 * @since 0.6.5

Status & tagging log