Index: branches/Maps0.8/Maps_Settings.php |
— | — | @@ -422,32 +422,7 @@ |
423 | 423 | 'osm' => array( 'osmarender', 'osm-mapnik', 'osm-cyclemap' ), |
424 | 424 | ); |
425 | 425 | |
426 | | - # Layer dependencie (MediaWiki >= 1.17). |
427 | | - // http://maps.google.com/maps/api/js?sensor=false |
428 | | - $egMapsOLLayerModules = array(/* |
429 | | - 'ext.maps.ol.osm' => array( |
430 | | - 'scripts' => array( |
431 | | - 'OSM/OpenStreetMap.js', |
432 | | - ), |
433 | | - ), |
434 | | - 'ext.maps.ol.yahoo' => array( |
435 | | - 'scripts' => array( |
436 | | - 'http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers', |
437 | | - ), |
438 | | - ), |
439 | | - 'ext.maps.ol.bing' => array( |
440 | | - 'scripts' => array( |
441 | | - 'http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1', |
442 | | - ), |
443 | | - ), |
444 | | - 'ext.maps.ol.ol-wms' => array( |
445 | | - 'scripts' => array( |
446 | | - 'http://clients.multimap.com/API/maps/1.1/metacarta_04', |
447 | | - ), |
448 | | - ) |
449 | | - */); |
450 | | - |
451 | | - # Layer dependencies (MediaWiki < 1.17). |
| 426 | + # Layer dependencies |
452 | 427 | $egMapsOLLayerDependencies = array( |
453 | 428 | 'yahoo' => "<style type='text/css'> #controls {width: 512px;}</style><script src='http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers'></script>", |
454 | 429 | 'bing' => "<script type='$wgJsMimeType' src='http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1'></script>", |
Index: branches/Maps0.8/includes/Maps_MappingService.php |
— | — | @@ -67,7 +67,6 @@ |
68 | 68 | */ |
69 | 69 | private $dependencies = array(); |
70 | 70 | |
71 | | - |
72 | 71 | /** |
73 | 72 | * Constructor. Creates a new instance of MapsMappingService. |
74 | 73 | * |
— | — | @@ -76,7 +75,7 @@ |
77 | 76 | * @param string $serviceName |
78 | 77 | * @param array $aliases |
79 | 78 | */ |
80 | | - function __construct( $serviceName, array $aliases = array() ) { |
| 79 | + public function __construct( $serviceName, array $aliases = array() ) { |
81 | 80 | $this->serviceName = $serviceName; |
82 | 81 | $this->aliases = $aliases; |
83 | 82 | } |
— | — | @@ -215,7 +214,7 @@ |
216 | 215 | * |
217 | 216 | * @return array of string |
218 | 217 | */ |
219 | | - protected function getResourceModules() { |
| 218 | + public function getResourceModules() { |
220 | 219 | return $this->resourceModules; |
221 | 220 | } |
222 | 221 | |
— | — | @@ -230,4 +229,13 @@ |
231 | 230 | $this->resourceModules = array_merge( $this->resourceModules, (array)$modules ); |
232 | 231 | } |
233 | 232 | |
| 233 | + /** |
| 234 | + * @see iMappingService::addDependency |
| 235 | + * |
| 236 | + * @since 0.6.3 |
| 237 | + */ |
| 238 | + public final function addDependency( $dependencyHtml ) { |
| 239 | + $this->dependencies[] = $dependencyHtml; |
| 240 | + } |
| 241 | + |
234 | 242 | } |
\ No newline at end of file |
Index: branches/Maps0.8/includes/services/GoogleMaps3/Maps_GoogleMaps3.php |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | * |
183 | 183 | * @return array of string |
184 | 184 | */ |
185 | | - protected function getResourceModules() { |
| 185 | + public function getResourceModules() { |
186 | 186 | return array_merge( |
187 | 187 | parent::getResourceModules(), |
188 | 188 | array( 'ext.maps.googlemaps3' ) |
Index: branches/Maps0.8/includes/services/YahooMaps/Maps_YahooMaps.php |
— | — | @@ -114,28 +114,6 @@ |
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | | - * @see MapsMappingService::createMarkersJs |
119 | | - * |
120 | | - * @since 0.6.5 |
121 | | - */ |
122 | | - public function createMarkersJs( array $markers ) { |
123 | | - $markerItems = array(); |
124 | | - |
125 | | - foreach ( $markers as $marker ) { |
126 | | - $markerItems[] = MapsMapper::encodeJsVar( (object)array( |
127 | | - 'lat' => $marker[0], |
128 | | - 'lon' => $marker[1], |
129 | | - 'title' => $marker[2], |
130 | | - 'label' =>$marker[3], |
131 | | - 'icon' => $marker[4] |
132 | | - ) ); |
133 | | - } |
134 | | - |
135 | | - // Create a string containing the marker JS. |
136 | | - return '[' . implode( ',', $markerItems ) . ']'; |
137 | | - } |
138 | | - |
139 | | - /** |
140 | 118 | * @see MapsMappingService::getDependencies |
141 | 119 | * |
142 | 120 | * @return array |
— | — | @@ -169,4 +147,5 @@ |
170 | 148 | return array( 'scale', 'type', 'pan', 'zoom', 'zoom-short', 'auto-zoom' ); |
171 | 149 | } |
172 | 150 | |
173 | | -} |
\ No newline at end of file |
| 151 | +} |
| 152 | + |
\ No newline at end of file |
Index: branches/Maps0.8/includes/services/OpenLayers/Maps_ParamOLLayers.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | |
92 | 92 | $parameter->setValue( $layerDefs ); |
93 | 93 | |
94 | | - MapsMappingServices::getServiceInstance( 'openlayers' )->addResourceModules( $this->getModules( $layerNames ) ); |
| 94 | + MapsMappingServices::getServiceInstance( 'openlayers' )->addLayerDependencies( $this->getDependencies( $layerNames ) ); |
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
— | — | @@ -119,30 +119,4 @@ |
120 | 120 | return array_unique( $layerDependencies ); |
121 | 121 | } |
122 | 122 | |
123 | | - /** |
124 | | - * Returns the names of the resource modules for the provided layers. |
125 | | - * |
126 | | - * @since 0.7.3 |
127 | | - * |
128 | | - * @param array $layerNames |
129 | | - * |
130 | | - * @return array |
131 | | - */ |
132 | | - protected function getModules( array $layerNames ) { |
133 | | - global $egMapsOLLayerModules, $egMapsOLAvailableLayers; |
134 | | - |
135 | | - $moduleNames = array(); |
136 | | - |
137 | | - foreach ( $layerNames as $layerName ) { |
138 | | - if ( array_key_exists( $layerName, $egMapsOLAvailableLayers ) // The layer must be defined in php |
139 | | - && is_array( $egMapsOLAvailableLayers[$layerName] ) // The layer must be an array... |
140 | | - && count( $egMapsOLAvailableLayers[$layerName] ) > 1 // ...with a second element... |
141 | | - && array_key_exists( 'ext.maps.ol.' . $egMapsOLAvailableLayers[$layerName][1], $egMapsOLLayerModules ) ) { //...that is a dependency. |
142 | | - $moduleNames[] = 'ext.maps.ol.' . $egMapsOLAvailableLayers[$layerName][1]; |
143 | | - } |
144 | | - } |
145 | | - |
146 | | - return array_unique( $moduleNames ); |
147 | | - } |
148 | | - |
149 | 123 | } |
\ No newline at end of file |
Index: branches/Maps0.8/includes/services/OpenLayers/Maps_OpenLayers.php |
— | — | @@ -48,8 +48,6 @@ |
49 | 49 | $params['layers']->setDoManipulationOfDefault( true ); |
50 | 50 | $params['layers']->addCriteria( new CriterionOLLayer() ); |
51 | 51 | $params['layers']->setDefault( $egMapsOLLayers ); |
52 | | - |
53 | | - //$params['imagelayers'] = new ListParameter(); |
54 | 52 | } |
55 | 53 | |
56 | 54 | /** |
— | — | @@ -78,29 +76,6 @@ |
79 | 77 | } |
80 | 78 | |
81 | 79 | /** |
82 | | - * @see MapsMappingService::createMarkersJs |
83 | | - * |
84 | | - * @since 0.6.5 |
85 | | - */ |
86 | | - public function createMarkersJs( array $markers ) { |
87 | | - $markerItems = array(); |
88 | | - $defaultGroup = wfMsg( 'maps-markers' ); |
89 | | - |
90 | | - foreach ( $markers as $marker ) { |
91 | | - $markerItems[] = MapsMapper::encodeJsVar( (object)array( |
92 | | - 'lat' => $marker[0], |
93 | | - 'lon' => $marker[1], |
94 | | - 'title' => $marker[2], |
95 | | - 'label' =>$marker[3], |
96 | | - 'icon' => $marker[4] |
97 | | - ) ); |
98 | | - } |
99 | | - |
100 | | - // Create a string containing the marker JS. |
101 | | - return '[' . implode( ',', $markerItems ) . ']'; |
102 | | - } |
103 | | - |
104 | | - /** |
105 | 80 | * Returns the names of all supported controls. |
106 | 81 | * This data is a copy of the one used to actually translate the names |
107 | 82 | * into the controls, since this resides client side, in OpenLayerFunctions.js. |
— | — | @@ -157,7 +132,7 @@ |
158 | 133 | * |
159 | 134 | * @return array of string |
160 | 135 | */ |
161 | | - protected function getResourceModules() { |
| 136 | + public function getResourceModules() { |
162 | 137 | return array_merge( |
163 | 138 | parent::getResourceModules(), |
164 | 139 | array( 'ext.maps.openlayers' ) |
Index: branches/Maps0.8/includes/services/GoogleMaps/Maps_GoogleMaps.php |
— | — | @@ -139,28 +139,6 @@ |
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
143 | | - * @see MapsMappingService::createMarkersJs |
144 | | - * |
145 | | - * @since 0.6.5 |
146 | | - */ |
147 | | - public function createMarkersJs( array $markers ) { |
148 | | - $markerItems = array(); |
149 | | - |
150 | | - foreach ( $markers as $marker ) { |
151 | | - $markerItems[] = array( |
152 | | - 'lat' => $marker[0], |
153 | | - 'lon' => $marker[1], |
154 | | - 'title' => $marker[2], |
155 | | - 'label' =>$marker[3], |
156 | | - 'icon' => $marker[4] |
157 | | - ); |
158 | | - } |
159 | | - |
160 | | - // Return a string containing the marker JS. |
161 | | - return json_encode( $markerItems ); |
162 | | - } |
163 | | - |
164 | | - /** |
165 | 143 | * A list of mappings between supported map type values and their corresponding JS variable. |
166 | 144 | * |
167 | 145 | * http://code.google.com/apis/maps/documentation/reference.html#GMapType.G_NORMAL_MAP |
— | — | @@ -333,7 +311,7 @@ |
334 | 312 | * |
335 | 313 | * @return array of string |
336 | 314 | */ |
337 | | - protected function getResourceModules() { |
| 315 | + public function getResourceModules() { |
338 | 316 | return array_merge( |
339 | 317 | parent::getResourceModules(), |
340 | 318 | array( 'ext.maps.googlemaps2' ) |
Index: branches/Maps0.8/includes/services/OSM/Maps_OSM.php |
— | — | @@ -74,4 +74,4 @@ |
75 | 75 | ); |
76 | 76 | } |
77 | 77 | |
78 | | -} |
\ No newline at end of file |
| 78 | +} |