Index: trunk/extensions/Maps/Maps_Settings.php |
— | — | @@ -215,6 +215,7 @@ |
216 | 216 | |
217 | 217 | $egMapsGMaps3Layers = array(); |
218 | 218 | |
| 219 | + $egGoogleJsApiKey = ''; |
219 | 220 | |
220 | 221 | |
221 | 222 | # Google Maps |
Index: trunk/extensions/Maps/includes/Maps_MappingService.php |
— | — | @@ -123,6 +123,17 @@ |
124 | 124 | $parserOrOut->addModules( $this->getResourceModules() ); |
125 | 125 | } |
126 | 126 | } |
| 127 | + |
| 128 | + /** |
| 129 | + * Returns a list of all config variables that should be passed to the JS. |
| 130 | + * |
| 131 | + * @since 1.0.1 |
| 132 | + * |
| 133 | + * @return array |
| 134 | + */ |
| 135 | + public function getConfigVariables() { |
| 136 | + return array(); |
| 137 | + } |
127 | 138 | |
128 | 139 | /** |
129 | 140 | * @see iMappingService::getDependencyHtml |
Index: trunk/extensions/Maps/includes/services/GoogleMaps3/jquery.googlemap.js |
— | — | @@ -175,9 +175,23 @@ |
176 | 176 | } |
177 | 177 | |
178 | 178 | if ( showEarth ) { |
179 | | - mw.loader.using( 'ext.maps.gm3.earth', function() { |
180 | | - var ge = new GoogleEarth( map ); |
181 | | - } ); |
| 179 | + $.getScript( |
| 180 | + 'https://www.google.com/jsapi?key=' + mw.config.get( 'egGoogleJsApiKey' ), |
| 181 | + function( data, textStatus ) { |
| 182 | + google.load( 'earth', '1', { callback: function() { |
| 183 | + mw.loader.using( 'ext.maps.gm3.earth', function() { |
| 184 | + if ( google.earth.isSupported() ) { |
| 185 | + var ge = new GoogleEarth( map ); |
| 186 | + |
| 187 | + var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND); |
| 188 | + |
| 189 | + lookAt.setTilt(lookAt.getTilt() + options.tilt); |
| 190 | + ge.getView().setAbstractView(lookAt); |
| 191 | + } |
| 192 | + } ); |
| 193 | + } } ); |
| 194 | + } |
| 195 | + ); |
182 | 196 | } |
183 | 197 | |
184 | 198 | for ( i = options.fusiontables.length - 1; i >= 0; i-- ) { |
Index: trunk/extensions/Maps/includes/services/GoogleMaps3/GoogleMaps3.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | 'remoteBasePath' => $egMapsScriptPath . '/includes/services/GoogleMaps3/earth', |
51 | 51 | 'group' => 'ext.maps', |
52 | 52 | 'scripts' => array( |
53 | | - 'googleearth-compiled.js', |
| 53 | + 'googleearth.js', |
54 | 54 | ), |
55 | 55 | ); |
56 | 56 | |
Index: trunk/extensions/Maps/includes/services/GoogleMaps3/Maps_GoogleMaps3.php |
— | — | @@ -144,6 +144,11 @@ |
145 | 145 | $params['resizable'] = new Parameter( 'resizable', Parameter::TYPE_BOOLEAN ); |
146 | 146 | $params['resizable']->setDefault( $egMapsResizableByDefault, false ); |
147 | 147 | $params['resizable']->setMessage( 'maps-par-resizable' ); |
| 148 | + |
| 149 | + $egMapsGMaps3DefaultTilt = 15; // TODO |
| 150 | + $params['tilt'] = new Parameter( 'tilt', Parameter::TYPE_INTEGER ); |
| 151 | + $params['tilt']->setDefault( $egMapsGMaps3DefaultTilt, false ); |
| 152 | + $params['tilt']->setMessage( 'maps-par-tilt' ); |
148 | 153 | } |
149 | 154 | |
150 | 155 | /** |
— | — | @@ -240,6 +245,20 @@ |
241 | 246 | parent::getResourceModules(), |
242 | 247 | array( 'ext.maps.googlemaps3' ) |
243 | 248 | ); |
244 | | - } |
| 249 | + } |
| 250 | + |
| 251 | + /** |
| 252 | + * Returns a list of all config variables that should be passed to the JS. |
| 253 | + * |
| 254 | + * @since 1.0.1 |
| 255 | + * |
| 256 | + * @return array |
| 257 | + */ |
| 258 | + public final function getConfigVariables() { |
| 259 | + return parent::getConfigVariables() |
| 260 | + + array( |
| 261 | + 'egGoogleJsApiKey' => $GLOBALS['egGoogleJsApiKey'] |
| 262 | + ); |
| 263 | + } |
245 | 264 | |
246 | 265 | } |
Index: trunk/extensions/Maps/includes/features/Maps_BasePointMap.php |
— | — | @@ -39,13 +39,17 @@ |
40 | 40 | |
41 | 41 | $output = $this->getMapHTML( $params, $parser, $mapName ) . $this->getJSON( $params, $parser, $mapName ); |
42 | 42 | |
| 43 | + $configVars = Skin::makeVariablesScript( $this->service->getConfigVariables() ); |
| 44 | + |
43 | 45 | global $wgTitle; |
44 | 46 | if ( !is_null( $wgTitle ) && $wgTitle->isSpecialPage() ) { |
45 | 47 | global $wgOut; |
46 | 48 | $this->service->addDependencies( $wgOut ); |
| 49 | + $wgOut->addScript( $configVars ); |
47 | 50 | } |
48 | 51 | else { |
49 | | - $this->service->addDependencies( $parser ); |
| 52 | + $this->service->addDependencies( $parser ); |
| 53 | + $parser->getOutput()->addHeadItem( $configVars ); |
50 | 54 | } |
51 | 55 | |
52 | 56 | return $output; |
Index: trunk/extensions/Maps/includes/features/Maps_BaseMap.php |
— | — | @@ -63,13 +63,17 @@ |
64 | 64 | |
65 | 65 | $output = $this->getMapHTML( $params, $parser, $mapName ) . $this->getJSON( $params, $parser, $mapName ); |
66 | 66 | |
| 67 | + $configVars = Skin::makeVariablesScript( $this->service->getConfigVariables() ); |
| 68 | + |
67 | 69 | global $wgTitle; |
68 | 70 | if ( !is_null( $wgTitle ) && $wgTitle->isSpecialPage() ) { |
69 | 71 | global $wgOut; |
70 | 72 | $this->service->addDependencies( $wgOut ); |
| 73 | + $wgOut->addScript( $configVars ); |
71 | 74 | } |
72 | 75 | else { |
73 | | - $this->service->addDependencies( $parser ); |
| 76 | + $this->service->addDependencies( $parser ); |
| 77 | + $parser->getOutput()->addHeadItem( $configVars ); |
74 | 78 | } |
75 | 79 | |
76 | 80 | return $output; |