Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMapsDispMap.php |
— | — | @@ -13,9 +13,7 @@ |
14 | 14 | /** |
15 | 15 | * @see MapsBaseMap::getMapHTML() |
16 | 16 | */ |
17 | | - public function getMapHTML( array $params, Parser $parser ) { |
18 | | - $mapName = $this->service->getMapId(); |
19 | | - |
| 17 | + public function getMapHTML( array $params, Parser $parser, $mapName ) { |
20 | 18 | $output = $this->service->getOverlayOutput( $mapName, $params['overlays'], $params['controls'] ); |
21 | 19 | |
22 | 20 | return $output . Html::element( |
Index: branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.js |
— | — | @@ -25,8 +25,8 @@ |
26 | 26 | ]; |
27 | 27 | |
28 | 28 | for ( i in window.maps.googlemaps2 ) { |
29 | | - var map = new googleMap( jQuery ); |
30 | | - map.initializeGoogleMap( 'foo',{},[] ); |
| 29 | + var map = new GoogleMap( jQuery, window.maps.googlemaps2[i] ); |
| 30 | + map.initiate( i ); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
— | — | @@ -37,8 +37,14 @@ |
38 | 38 | function () { loadGoogleMaps(); } |
39 | 39 | ); |
40 | 40 | |
41 | | -var googleMap = function($) { |
| 41 | +var GoogleMap = function( $, args ) { |
42 | 42 | |
| 43 | + var args = args; |
| 44 | + |
| 45 | + this.initiate = function( mapName ) { |
| 46 | + //alert( mapName ); |
| 47 | + } |
| 48 | + |
43 | 49 | /** |
44 | 50 | * Returns GMarker object on the provided location. It will show a popup baloon |
45 | 51 | * with title and label when clicked, if either of these is set. |
— | — | @@ -92,7 +98,7 @@ |
93 | 99 | * Returns GMap2 object with the provided properties and markers. |
94 | 100 | * This is done by setting the map centre and size, and passing the arguments to function createGoogleMap. |
95 | 101 | */ |
96 | | - var initializeGoogleMap = function(mapName, mapOptions, markers) { |
| 102 | + this.initializeGoogleMap = function(mapName, mapOptions, markers) { |
97 | 103 | if (GBrowserIsCompatible()) { |
98 | 104 | mapOptions.centre = (mapOptions.lat != null && mapOptions.lon != null) ? new GLatLng(mapOptions.lat, mapOptions.lon) : null; |
99 | 105 | //mapOptions.size = new GSize(mapOptions.width, mapOptions.height); |
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMapsDispPoint.php |
— | — | @@ -13,9 +13,7 @@ |
14 | 14 | /** |
15 | 15 | * @see MapsBasePointMap::getMapHTML |
16 | 16 | */ |
17 | | - public function getMapHTML( array $params, Parser $parser ) { |
18 | | - $mapName = $this->service->getMapId(); |
19 | | - |
| 17 | + public function getMapHTML( array $params, Parser $parser, $mapName ) { |
20 | 18 | $output = $this->service->getOverlayOutput( $mapName, $params['overlays'], $params['controls'] ); |
21 | 19 | |
22 | 20 | return $output . Html::element( |
Index: branches/Maps0.8/includes/features/Maps_BasePointMap.php |
— | — | @@ -26,10 +26,11 @@ |
27 | 27 | * |
28 | 28 | * @param array $params |
29 | 29 | * @param Parser $parser |
| 30 | + * @param string $mapName |
30 | 31 | * |
31 | 32 | * @return string |
32 | 33 | */ |
33 | | - protected abstract function getMapHTML( array $params, Parser $parser ); |
| 34 | + protected abstract function getMapHTML( array $params, Parser $parser, $mapName ); |
34 | 35 | |
35 | 36 | public function __construct( iMappingService $service ) { |
36 | 37 | $this->service = $service; |
— | — | @@ -71,8 +72,10 @@ |
72 | 73 | public final function renderMap( array $params, Parser $parser ) { |
73 | 74 | $this->handleMarkerData( $params ); |
74 | 75 | |
75 | | - $output = $this->getMapHTML( $params, $parser ) . $this->getJSON( $params, $parser ); |
| 76 | + $mapName = $this->service->getMapId(); |
76 | 77 | |
| 78 | + $output = $this->getMapHTML( $params, $parser, $mapName ) . $this->getJSON( $params, $parser, $mapName ); |
| 79 | + |
77 | 80 | global $wgTitle; |
78 | 81 | if ( $wgTitle->isSpecialPage() ) { |
79 | 82 | global $wgOut; |
— | — | @@ -92,10 +95,11 @@ |
93 | 96 | * |
94 | 97 | * @param array $params |
95 | 98 | * @param Parser $parser |
| 99 | + * @param string $mapName |
96 | 100 | * |
97 | 101 | * @return string |
98 | 102 | */ |
99 | | - protected function getJSON( array $params, Parser $parser ) { |
| 103 | + protected function getJSON( array $params, Parser $parser, $mapName ) { |
100 | 104 | $object = $this->getJSONObject( $params, $parser ); |
101 | 105 | |
102 | 106 | if ( $object === false ) { |
— | — | @@ -103,7 +107,7 @@ |
104 | 108 | } |
105 | 109 | |
106 | 110 | // TODO |
107 | | - return Html::inlineScript( "maps=[]; maps['{$this->service->getName()}']=[]; maps['{$this->service->getName()}'].push(" . json_encode( $object ) . ')' ); |
| 111 | + return Html::inlineScript( "maps=[]; maps['{$this->service->getName()}']=[]; maps['{$this->service->getName()}']['{$mapName}']=" . json_encode( $object ) . ';' ); |
108 | 112 | } |
109 | 113 | |
110 | 114 | /** |
Index: branches/Maps0.8/includes/features/Maps_BaseMap.php |
— | — | @@ -29,14 +29,15 @@ |
30 | 30 | /** |
31 | 31 | * Returns the HTML to display the map. |
32 | 32 | * |
33 | | - * @since 0.7.3 |
| 33 | + * @since 0.8 |
34 | 34 | * |
35 | 35 | * @param array $params |
36 | | - * @param $parser |
| 36 | + * @param Parser $parser |
| 37 | + * @param string $mapName |
37 | 38 | * |
38 | 39 | * @return string |
39 | 40 | */ |
40 | | - protected abstract function getMapHTML( array $params, Parser $parser ); |
| 41 | + protected abstract function getMapHTML( array $params, Parser $parser, $mapName ); |
41 | 42 | |
42 | 43 | /** |
43 | 44 | * Constructor. |
— | — | @@ -73,8 +74,10 @@ |
74 | 75 | $params['zoom'] = $this->service->getDefaultZoom(); |
75 | 76 | } |
76 | 77 | |
77 | | - $output = $this->getMapHTML( $params, $parser ) . $this->getJSON( $params, $parser ); |
| 78 | + $mapName = $this->service->getMapId(); |
78 | 79 | |
| 80 | + $output = $this->getMapHTML( $params, $parser, $mapName ) . $this->getJSON( $params, $parser, $mapName ); |
| 81 | + |
79 | 82 | global $wgTitle; |
80 | 83 | if ( $wgTitle->isSpecialPage() ) { |
81 | 84 | global $wgOut; |
— | — | @@ -94,10 +97,11 @@ |
95 | 98 | * |
96 | 99 | * @param array $params |
97 | 100 | * @param Parser $parser |
| 101 | + * @param string $mapName |
98 | 102 | * |
99 | 103 | * @return string |
100 | 104 | */ |
101 | | - protected function getJSON( array $params, Parser $parser ) { |
| 105 | + protected function getJSON( array $params, Parser $parser, $mapName ) { |
102 | 106 | $object = $this->getJSONObject( $params, $parser ); |
103 | 107 | |
104 | 108 | if ( $object === false ) { |
— | — | @@ -105,7 +109,7 @@ |
106 | 110 | } |
107 | 111 | |
108 | 112 | // TODO |
109 | | - return Html::inlineScript( "maps=[]; maps['{$this->service->getName()}']=[]; maps['{$this->service->getName()}'].push(" . json_encode( $object ) . ')' ); |
| 113 | + return Html::inlineScript( "maps=[]; maps['{$this->service->getName()}']=[]; maps['{$this->service->getName()}']['{$mapName}']=" . json_encode( $object ) . ';' ); |
110 | 114 | } |
111 | 115 | |
112 | 116 | /** |