Index: branches/Maps0.8/includes/Maps_MappingService.php |
— | — | @@ -50,6 +50,25 @@ |
51 | 51 | protected $resourceModules = array(); |
52 | 52 | |
53 | 53 | /** |
| 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 | + |
| 72 | + /** |
54 | 73 | * Constructor. Creates a new instance of MapsMappingService. |
55 | 74 | * |
56 | 75 | * @since 0.6.3 |
— | — | @@ -73,15 +92,6 @@ |
74 | 93 | } |
75 | 94 | |
76 | 95 | /** |
77 | | - * @see iMappingService::createMarkersJs |
78 | | - * |
79 | | - * @since 0.6.5 |
80 | | - */ |
81 | | - public function createMarkersJs( array $markers ) { |
82 | | - return '[]'; |
83 | | - } |
84 | | - |
85 | | - /** |
86 | 96 | * @see iMappingService::addFeature |
87 | 97 | * |
88 | 98 | * @since 0.6.3 |
— | — | @@ -96,16 +106,58 @@ |
97 | 107 | * @since 0.6.3 |
98 | 108 | */ |
99 | 109 | public final function addDependencies( &$parserOrOut ) { |
| 110 | + $dependencies = $this->getDependencyHtml(); |
| 111 | + |
100 | 112 | // Only add a head item when there are dependencies. |
101 | 113 | if ( $parserOrOut instanceof Parser ) { |
| 114 | + if ( $dependencies ) { |
| 115 | + $parserOrOut->getOutput()->addHeadItem( $dependencies ); |
| 116 | + } |
| 117 | + |
102 | 118 | $parserOrOut->getOutput()->addModules( $this->getResourceModules() ); |
103 | 119 | } |
104 | | - else if ( $parserOrOut instanceof OutputPage ) { |
| 120 | + else if ( $parserOrOut instanceof OutputPage ) { |
| 121 | + if ( $dependencies ) { |
| 122 | + $parserOrOut->addHeadItem( md5( $dependencies ), $dependencies ); |
| 123 | + } |
| 124 | + |
105 | 125 | $parserOrOut->addModules( $this->getResourceModules() ); |
106 | 126 | } |
107 | 127 | } |
108 | 128 | |
109 | 129 | /** |
| 130 | + * @see iMappingService::getDependencyHtml |
| 131 | + * |
| 132 | + * @since 0.6.3 |
| 133 | + */ |
| 134 | + public final function getDependencyHtml() { |
| 135 | + $allDependencies = array_merge( $this->getDependencies(), $this->dependencies ); |
| 136 | + $dependencies = array(); |
| 137 | + |
| 138 | + // Only add dependnecies that have not yet been added. |
| 139 | + foreach ( $allDependencies as $dependency ) { |
| 140 | + if ( !in_array( $dependency, $this->addedDependencies ) ) { |
| 141 | + $dependencies[] = $dependency; |
| 142 | + $this->addedDependencies[] = $dependency; |
| 143 | + } |
| 144 | + } |
| 145 | + |
| 146 | + // If there are dependencies, put them all together in a string, otherwise return false. |
| 147 | + return count( $dependencies ) > 0 ? implode( '', $dependencies ) : false; |
| 148 | + } |
| 149 | + |
| 150 | + /** |
| 151 | + * Returns a list of html fragments, such as script includes, the current service depends on. |
| 152 | + * |
| 153 | + * @since 0.6.3 |
| 154 | + * |
| 155 | + * @return array |
| 156 | + */ |
| 157 | + protected function getDependencies() { |
| 158 | + return array(); |
| 159 | + } |
| 160 | + |
| 161 | + /** |
110 | 162 | * @see iMappingService::getName |
111 | 163 | * |
112 | 164 | * @since 0.6.3 |
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php |
— | — | @@ -134,6 +134,15 @@ |
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
| 138 | + * @see MapsMappingService::getMapObject |
| 139 | + * |
| 140 | + * @since 0.8 |
| 141 | + */ |
| 142 | + public function getMapObject() { |
| 143 | + |
| 144 | + } |
| 145 | + |
| 146 | + /** |
138 | 147 | * @see MapsMappingService::createMarkersJs |
139 | 148 | * |
140 | 149 | * @since 0.6.5 |
— | — | @@ -211,7 +220,7 @@ |
212 | 221 | */ |
213 | 222 | protected function getDependencies() { |
214 | 223 | global $wgLang; |
215 | | - global $egGoogleMapsKeys, $egGoogleMapsKey, $egMapsStyleVersion, $egMapsScriptPath; |
| 224 | + global $egGoogleMapsKeys, $egGoogleMapsKey; |
216 | 225 | |
217 | 226 | $langCode = self::getMappedLanguageCode( $wgLang->getCode() ); |
218 | 227 | |
— | — | @@ -302,14 +311,14 @@ |
303 | 312 | 'div', |
304 | 313 | array( |
305 | 314 | 'class' => 'outer-more', |
306 | | - 'id' => htmlspecialchars( "$mapName-outer-more" ) |
| 315 | + 'id' => "$mapName-outer-more" |
307 | 316 | ), |
308 | 317 | '<form action="">' . |
309 | 318 | Html::rawElement( |
310 | 319 | 'div', |
311 | 320 | array( |
312 | 321 | 'class' => 'more-box', |
313 | | - 'id' => htmlspecialchars( "$mapName-more-box" ) |
| 322 | + 'id' => "$mapName-more-box" |
314 | 323 | ), |
315 | 324 | $overlayHtml |
316 | 325 | ) . |
— | — | @@ -320,7 +329,7 @@ |
321 | 330 | /** |
322 | 331 | * @see MapsMappingService::getResourceModules |
323 | 332 | * |
324 | | - * @since 0.7.4 |
| 333 | + * @since 0.8 |
325 | 334 | * |
326 | 335 | * @return array of string |
327 | 336 | */ |
— | — | @@ -334,7 +343,7 @@ |
335 | 344 | /** |
336 | 345 | * Register the resource modules for the resource loader. |
337 | 346 | * |
338 | | - * @since 0.7.4 |
| 347 | + * @since 0.8 |
339 | 348 | * |
340 | 349 | * @param ResourceLoader $resourceLoader |
341 | 350 | * |
— | — | @@ -346,10 +355,16 @@ |
347 | 356 | $modules = array( |
348 | 357 | 'ext.maps.googlemaps2' => array( |
349 | 358 | 'scripts' => array( |
350 | | - 'ext.maps.googlemaps2.js' |
| 359 | + 'ext.maps.googlemaps2.js', |
| 360 | + 'ext.maps.googlemaps2.css', |
351 | 361 | ), |
352 | 362 | 'messages' => array( |
353 | | - 'maps-markers' |
| 363 | + 'maps-markers', |
| 364 | + 'maps_overlays', |
| 365 | + 'maps_photos', |
| 366 | + 'maps_videos', |
| 367 | + 'maps_wikipedia', |
| 368 | + 'maps_webcams' |
354 | 369 | ) |
355 | 370 | ), |
356 | 371 | ); |
Index: branches/Maps0.8/includes/services/GoogleMaps/ext.maps.googlemaps2.js |
— | — | @@ -18,11 +18,15 @@ |
19 | 19 | new GLayer("com.google.webcams") |
20 | 20 | ]; |
21 | 21 | |
| 22 | + for ( mapName in window. ) { |
| 23 | + |
| 24 | + } |
| 25 | + |
22 | 26 | /** |
23 | 27 | * Returns GMarker object on the provided location. It will show a popup baloon |
24 | 28 | * with title and label when clicked, if either of these is set. |
25 | 29 | */ |
26 | | - function createGMarker( markerData ) { |
| 30 | + function createGMarker( markerData ) { |
27 | 31 | var marker; |
28 | 32 | |
29 | 33 | if ( markerData.icon != '' ) { |
Index: branches/Maps0.8/includes/parserHooks/Maps_Coordinates.php |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | /** |
133 | 133 | * @see ParserHook::getDescription() |
134 | 134 | * |
135 | | - * @since 0.7.4 |
| 135 | + * @since 0.8 |
136 | 136 | */ |
137 | 137 | public function getDescription() { |
138 | 138 | return wfMsg( 'maps-coordinates-description' ); |
Index: branches/Maps0.8/includes/parserHooks/Maps_Distance.php |
— | — | @@ -113,7 +113,7 @@ |
114 | 114 | /** |
115 | 115 | * @see ParserHook::getDescription() |
116 | 116 | * |
117 | | - * @since 0.7.4 |
| 117 | + * @since 0.8 |
118 | 118 | */ |
119 | 119 | public function getDescription() { |
120 | 120 | return wfMsg( 'maps-distance-description' ); |
Index: branches/Maps0.8/includes/parserHooks/Maps_DisplayPoint.php |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | /** |
164 | 164 | * @see ParserHook::getDescription() |
165 | 165 | * |
166 | | - * @since 0.7.4 |
| 166 | + * @since 0.8 |
167 | 167 | */ |
168 | 168 | public function getDescription() { |
169 | 169 | return wfMsg( 'maps-displaypoint-description' ); |
Index: branches/Maps0.8/includes/parserHooks/Maps_Finddestination.php |
— | — | @@ -182,7 +182,7 @@ |
183 | 183 | /** |
184 | 184 | * @see ParserHook::getDescription() |
185 | 185 | * |
186 | | - * @since 0.7.4 |
| 186 | + * @since 0.8 |
187 | 187 | */ |
188 | 188 | public function getDescription() { |
189 | 189 | return wfMsg( 'maps-finddestination-description' ); |
Index: branches/Maps0.8/includes/parserHooks/Maps_DisplayMap.php |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | /** |
127 | 127 | * @see ParserHook::getDescription() |
128 | 128 | * |
129 | | - * @since 0.7.4 |
| 129 | + * @since 0.8 |
130 | 130 | */ |
131 | 131 | public function getDescription() { |
132 | 132 | return wfMsg( 'maps-displaymap-description' ); |
Index: branches/Maps0.8/includes/parserHooks/Maps_Geocode.php |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | /** |
165 | 165 | * @see ParserHook::getDescription() |
166 | 166 | * |
167 | | - * @since 0.7.4 |
| 167 | + * @since 0.8 |
168 | 168 | */ |
169 | 169 | public function getDescription() { |
170 | 170 | return wfMsg( 'maps-geocode-description' ); |
Index: branches/Maps0.8/includes/parserHooks/Maps_Geodistance.php |
— | — | @@ -172,7 +172,7 @@ |
173 | 173 | /** |
174 | 174 | * @see ParserHook::getDescription() |
175 | 175 | * |
176 | | - * @since 0.7.4 |
| 176 | + * @since 0.8 |
177 | 177 | */ |
178 | 178 | public function getDescription() { |
179 | 179 | return wfMsg( 'maps-geodistance-description' ); |
Index: branches/Maps0.8/includes/iMappingService.php |
— | — | @@ -113,16 +113,4 @@ |
114 | 114 | */ |
115 | 115 | function getMapId( $increment = true ); |
116 | 116 | |
117 | | - /** |
118 | | - * Creates a JS array with marker meta data that can be used to construct a |
119 | | - * map with markers via a function in this services JS file. |
120 | | - * |
121 | | - * @since 0.6.5 |
122 | | - * |
123 | | - * @param array $markers |
124 | | - * |
125 | | - * @return string |
126 | | - */ |
127 | | - function createMarkersJs( array $markers ); |
128 | | - |
129 | 117 | } |
\ No newline at end of file |
Index: branches/Maps0.8/includes/Maps_KMLFormatter.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | class MapsKMLFormatter { |
15 | 15 | |
16 | 16 | /** |
17 | | - * @since 0.7.4 |
| 17 | + * @since 0.8 |
18 | 18 | * |
19 | 19 | * @var array |
20 | 20 | */ |
Index: branches/Maps0.8/includes/features/Maps_BasePointMap.php |
— | — | @@ -93,8 +93,6 @@ |
94 | 94 | $this->zoom = $this->service->getDefaultZoom(); |
95 | 95 | } |
96 | 96 | |
97 | | - $this->markerJs = $this->service->createMarkersJs( $this->markerData ); |
98 | | - |
99 | 97 | $this->addSpecificMapHTML( $parser ); |
100 | 98 | |
101 | 99 | global $wgTitle; |