Index: branches/SemanticMaps0.8/includes/services/GoogleMaps3/ext.sm.googlemapsinput.js |
— | — | @@ -9,8 +9,22 @@ |
10 | 10 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
11 | 11 | */ |
12 | 12 | |
| 13 | +function buildInputValue( locations ) { |
| 14 | + var dms = []; |
| 15 | + |
| 16 | + for ( i in locations ) { |
| 17 | + dms.push( locationToDMS( locations[i].lat, locations[i].lon ) ); |
| 18 | + } |
| 19 | + |
| 20 | + return dms.join( '; ' ); |
| 21 | +} |
| 22 | + |
| 23 | +function locationToDMS ( lat, lon ) { // TODO: i18n |
| 24 | + return Math.abs( lat ) + '° ' + ( lat < 0 ? 'S' : 'N' ) + ', ' + Math.abs( lon ) + '° ' + ( lon < 0 ? 'W' : 'E' ); |
| 25 | +} |
| 26 | + |
13 | 27 | jQuery(document).ready(function() { |
14 | | - if ( true ) { |
| 28 | + if ( false ) { |
15 | 29 | for ( i in window.maps.googlemaps3_forminputs ) { |
16 | 30 | jQuery( '#' + i + '_forminput' ).googlemapsinput( i, window.maps.googlemaps3_forminputs[i] ); |
17 | 31 | } |
— | — | @@ -18,8 +32,11 @@ |
19 | 33 | else { |
20 | 34 | alert( mediaWiki.msg( 'maps-googlemaps3-incompatbrowser' ) ); |
21 | 35 | |
22 | | - for ( i in window.maps.googlemaps3 ) { |
23 | | - jQuery( '#' + i + '_forminput' ).text( mediaWiki.msg( 'maps-load-failed' ) ); |
| 36 | + for ( i in window.maps.googlemaps3_forminputs ) { |
| 37 | + jQuery( '#' + i + '_forminput' ) |
| 38 | + .html( $( '<input />' ) |
| 39 | + .attr( { 'name': i, 'value': buildInputValue( window.maps.googlemaps3_forminputs[i].locations ) } ) |
| 40 | + ); |
24 | 41 | } |
25 | 42 | } |
26 | 43 | }); |
Index: branches/SemanticMaps0.8/includes/services/GoogleMaps3/jquery.googlemapsinput.js |
— | — | @@ -9,7 +9,6 @@ |
10 | 10 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
11 | 11 | */ |
12 | 12 | |
13 | | - |
14 | 13 | (function( $ ){ $.fn.googlemapsinput = function( mapDivId, options ) { |
15 | 14 | var MAPFILES_URL = "http://maps.gstatic.com/intl/en_us/mapfiles/"; |
16 | 15 | |
— | — | @@ -29,7 +28,7 @@ |
30 | 29 | this.html( |
31 | 30 | $( '<div />' ).css( { |
32 | 31 | 'display': 'none' |
33 | | - } ).append( $( '<input />' ).attr( { 'type': 'text', 'name': options.inputname, 'id': mapDivId + '_values' } ) ) |
| 32 | + } ).append( append( $( '<input />' ).attr( { 'type': 'text', 'name': options.inputname, 'id': mapDivId + '_values' } ) ) |
34 | 33 | ); |
35 | 34 | |
36 | 35 | updateInputValue( buildInputValue( options.locations ) ); |
— | — | @@ -298,9 +297,7 @@ |
299 | 298 | $( "#" + mapDivId + '_addbutton_' + i ).button().click( onRemoveButtonClick ); |
300 | 299 | } |
301 | 300 | |
302 | | - function locationToDMS ( lat, lon ) { // TODO: i18n |
303 | | - return Math.abs( lat ) + '° ' + ( lat < 0 ? 'S' : 'N' ) + ', ' + Math.abs( lon ) + '° ' + ( lon < 0 ? 'W' : 'E' ); |
304 | | - } |
| 301 | + |
305 | 302 | |
306 | 303 | function updateInput() { |
307 | 304 | var locations = []; |
— | — | @@ -314,16 +311,6 @@ |
315 | 312 | $( '#' + mapDivId + '_values' ).text( value ); |
316 | 313 | } |
317 | 314 | |
318 | | - function buildInputValue( locations ) { |
319 | | - var dms = []; |
320 | | - |
321 | | - for ( i in locations ) { |
322 | | - dms.push( locationToDMS( locations[i].lat, locations[i].lon ) ); |
323 | | - } |
324 | | - |
325 | | - return dms.join( '; ' ); |
326 | | - } |
327 | | - |
328 | 315 | return this; |
329 | 316 | |
330 | 317 | }; })( jQuery ); |
\ No newline at end of file |
Index: branches/SemanticMaps0.8/includes/services/GoogleMaps3/SM_GoogleMaps3FormInput.php |
— | — | @@ -12,25 +12,6 @@ |
13 | 13 | class SMGoogleMaps3FormInput extends SMFormInput { |
14 | 14 | |
15 | 15 | /** |
16 | | - * @see SMFormInput::getInputHTML |
17 | | - * |
18 | | - * @since 0.8 |
19 | | - * |
20 | | - * @param array $params |
21 | | - * @param Parser $parser |
22 | | - * @param string $mapName |
23 | | - * |
24 | | - * @return string |
25 | | - */ |
26 | | - protected function getInputHTML( array $params, Parser $parser, $mapName ) { |
27 | | - $html = ''; |
28 | | - |
29 | | - $html .= parent::getInputHTML( $params, $parser, $mapName ); |
30 | | - |
31 | | - return $html; |
32 | | - } |
33 | | - |
34 | | - /** |
35 | 16 | * @see SMFormInput::getResourceModules |
36 | 17 | * |
37 | 18 | * @since 0.8 |
Index: branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayers.php |
— | — | @@ -20,6 +20,22 @@ |
21 | 21 | die( 'Not an entry point.' ); |
22 | 22 | } |
23 | 23 | |
| 24 | +$wgResourceModules['ext.sm.fi.openlayers'] = array( |
| 25 | + 'dependencies' => array( 'ext.maps.openlayers', 'jquery.ui.button', 'jquery.ui.dialog' ), |
| 26 | + 'localBasePath' => dirname( __FILE__ ), |
| 27 | + 'remoteBasePath' => $smgScriptPath . '/includes/services/OpenLayers', |
| 28 | + 'group' => 'ext.semanticmaps', |
| 29 | + 'scripts' => array( |
| 30 | + 'jquery.openlayersinput.js', |
| 31 | + 'ext.sm.openlayersinput.js' |
| 32 | + ), |
| 33 | + 'messages' => array( |
| 34 | + 'semanticmaps-forminput-remove', |
| 35 | + 'semanticmaps-forminput-add', |
| 36 | + 'semanticmaps-forminput-locations' |
| 37 | + ) |
| 38 | +); |
| 39 | + |
24 | 40 | $wgHooks['MappingServiceLoad'][] = 'smfInitOpenLayers'; |
25 | 41 | |
26 | 42 | function smfInitOpenLayers() { |
Index: branches/SemanticMaps0.8/includes/services/OpenLayers/ext.sm.openlayersinput.js |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Google Maps v3 form input in the Semantic Maps extension. |
| 4 | + * @see http://www.mediawiki.org/wiki/Extension:Semantic_Maps |
| 5 | + * |
| 6 | + * @since 0.8 |
| 7 | + * @ingroup SemanticMaps |
| 8 | + * |
| 9 | + * @licence GNU GPL v3 |
| 10 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 11 | + */ |
| 12 | + |
| 13 | +jQuery(document).ready(function() { |
| 14 | + if ( true ) { |
| 15 | + for ( i in window.maps.openlayers_forminputs ) { |
| 16 | + jQuery( '#' + i + '_forminput' ).openlayersinput( i, window.maps.openlayers_forminputs[i] ); |
| 17 | + } |
| 18 | + } |
| 19 | + else { |
| 20 | + alert( mediaWiki.msg( 'maps-openlayers-incompatbrowser' ) ); |
| 21 | + |
| 22 | + for ( i in window.maps.openlayers_forminputs ) { |
| 23 | + jQuery( '#' + i + '_forminput' ).text( mediaWiki.msg( 'maps-load-failed' ) ); |
| 24 | + } |
| 25 | + } |
| 26 | +}); |
Property changes on: branches/SemanticMaps0.8/includes/services/OpenLayers/ext.sm.openlayersinput.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 27 | + native |
Index: branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayersFormInput.php |
— | — | @@ -11,28 +11,14 @@ |
12 | 12 | class SMOpenLayersFormInput extends SMFormInput { |
13 | 13 | |
14 | 14 | /** |
15 | | - * @see MapsMapFeature::addFormDependencies() |
| 15 | + * @see SMFormInput::getResourceModules |
| 16 | + * |
| 17 | + * @since 0.8 |
| 18 | + * |
| 19 | + * @return array of string |
16 | 20 | */ |
17 | | - protected function addFormDependencies() { |
18 | | - global $wgOut; |
19 | | - global $smgScriptPath, $smgStyleVersion; |
20 | | - |
21 | | - $this->service->addDependency( Html::linkedScript( "$smgScriptPath/includes/services/OpenLayers/SM_OpenLayersForms.js?$smgStyleVersion" ) ); |
22 | | - $this->service->addDependencies( $wgOut ); |
23 | | - } |
| 21 | + protected function getResourceModules() { |
| 22 | + return array_merge( parent::getResourceModules(), array( 'ext.sm.fi.openlayers' ) ); |
| 23 | + } |
24 | 24 | |
25 | | - /** |
26 | | - * @see MapsMapFeature::addSpecificMapHTML |
27 | | - */ |
28 | | - public function addSpecificMapHTML() { |
29 | | - return Html::element( |
30 | | - 'div', |
31 | | - array( |
32 | | - 'id' => $this->service->getMapId( false ), |
33 | | - 'style' => "width: $this->width; height: $this->height; background-color: #cccccc; overflow: hidden;", |
34 | | - ), |
35 | | - wfMsg( 'maps-loading-map' ) |
36 | | - ); |
37 | | - } |
38 | | - |
39 | 25 | } |
Index: branches/SemanticMaps0.8/includes/forminputs/SM_FormInput.php |
— | — | @@ -152,6 +152,7 @@ |
153 | 153 | 'div', |
154 | 154 | array( |
155 | 155 | 'id' => $mapName . '_forminput', |
| 156 | + 'style' => 'display: inline' |
156 | 157 | ), |
157 | 158 | wfMsg( 'semanticmaps-loading-forminput' ) |
158 | 159 | ); |
Index: branches/SemanticMaps0.8/SemanticMaps.php |
— | — | @@ -41,69 +41,66 @@ |
42 | 42 | die( '<b>Error:</b> You need to have <a href="http://semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Semantic Maps">Semantic Maps</a>.<br />' ); |
43 | 43 | } |
44 | 44 | |
45 | | -// Only initialize the extension when all dependencies are present. |
46 | | -if ( defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' ) ) { |
47 | | - define( 'SM_VERSION', '0.8 alpha' ); |
| 45 | +define( 'SM_VERSION', '0.8 alpha' ); |
48 | 46 | |
49 | | - $smgScriptPath = ( $wgExtensionAssetsPath === false ? '/extensions' : $wgExtensionAssetsPath ) . '/SemanticMaps'; |
50 | | - $smgDir = dirname( __FILE__ ) . '/'; |
| 47 | +$smgScriptPath = ( $wgExtensionAssetsPath === false ? '/extensions' : $wgExtensionAssetsPath ) . '/SemanticMaps'; |
| 48 | +$smgDir = dirname( __FILE__ ) . '/'; |
51 | 49 | |
52 | | - $smgStyleVersion = $wgStyleVersion . '-' . SM_VERSION; |
| 50 | +$smgStyleVersion = $wgStyleVersion . '-' . SM_VERSION; |
53 | 51 | |
54 | | - // Include the settings file. |
55 | | - require_once 'SM_Settings.php'; |
| 52 | +// Include the settings file. |
| 53 | +require_once 'SM_Settings.php'; |
56 | 54 | |
57 | | - # (named) Array of String. This array contains the available features for Maps. |
58 | | - # Commenting out the inclusion of any feature will make Maps completely ignore it, and so improve performance. |
59 | | - |
60 | | - # Query printers |
61 | | - include_once $smgDir . 'includes/queryprinters/SM_QueryPrinters.php'; |
62 | | - # Form imputs |
63 | | - include_once $smgDir . 'includes/forminputs/SM_FormInputs.php'; |
| 55 | +# (named) Array of String. This array contains the available features for Maps. |
| 56 | +# Commenting out the inclusion of any feature will make Maps completely ignore it, and so improve performance. |
64 | 57 | |
65 | | - # Include the mapping services that should be loaded into Semantic Maps. |
66 | | - # Commenting or removing a mapping service will cause Semantic Maps to completely ignore it, and so improve performance. |
67 | | - |
68 | | - # Google Maps API v2 |
69 | | - include_once $smgDir . 'includes/services/GoogleMaps/SM_GoogleMaps.php'; |
70 | | - # Google Maps API v3 |
71 | | - include_once $smgDir . 'includes/services/GoogleMaps3/SM_GoogleMaps3.php'; |
72 | | - # OpenLayers API |
73 | | - include_once $smgDir . 'includes/services/OpenLayers/SM_OpenLayers.php'; |
74 | | - # Yahoo! Maps API |
75 | | - include_once $smgDir . 'includes/services/YahooMaps/SM_YahooMaps.php'; |
76 | | - |
77 | | - $wgExtensionFunctions[] = 'smfSetup'; |
| 58 | + # Query printers |
| 59 | + include_once $smgDir . 'includes/queryprinters/SM_QueryPrinters.php'; |
| 60 | + # Form imputs |
| 61 | + include_once $smgDir . 'includes/forminputs/SM_FormInputs.php'; |
78 | 62 | |
79 | | - $wgExtensionMessagesFiles['SemanticMaps'] = $smgDir . 'SemanticMaps.i18n.php'; |
| 63 | +# Include the mapping services that should be loaded into Semantic Maps. |
| 64 | +# Commenting or removing a mapping service will cause Semantic Maps to completely ignore it, and so improve performance. |
80 | 65 | |
81 | | - $incDir = dirname( __FILE__ ) . '/includes/'; |
82 | | - |
83 | | - // Data values |
84 | | - $wgAutoloadClasses['SMGeoCoordsValue'] = $incDir . 'SM_GeoCoordsValue.php'; |
85 | | - |
86 | | - // Value descriptions |
87 | | - $wgAutoloadClasses['SMGeoCoordsValueDescription'] = $incDir . 'SM_GeoCoordsValueDescription.php'; |
88 | | - $wgAutoloadClasses['SMAreaValueDescription'] = $incDir . 'SM_AreaValueDescription.php'; |
89 | | - |
90 | | - $wgAutoloadClasses['SemanticMapsHooks'] = dirname( __FILE__ ) . '/SemanticMaps.hooks.php'; |
91 | | - |
92 | | - // Hook for initializing the Geographical Coordinate type. |
93 | | - $wgHooks['smwInitDatatypes'][] = 'SMGeoCoordsValue::initGeoCoordsType'; |
94 | | - |
95 | | - // Hook for initializing the field types needed by Geographical Coordinates. |
96 | | - $wgHooks['SMWCustomSQLStoreFieldType'][] = 'SMGeoCoordsValue::initGeoCoordsFieldTypes'; |
97 | | - |
98 | | - // Hook for defining a table to store geographical coordinates in. |
99 | | - $wgHooks['SMWPropertyTables'][] = 'SMGeoCoordsValue::initGeoCoordsTable'; |
100 | | - |
101 | | - // Hook for defining the default query printer for queries that ask for geographical coordinates. |
102 | | - $wgHooks['SMWResultFormat'][] = 'SMGeoCoordsValue::addGeoCoordsDefaultFormat'; |
103 | | - |
104 | | - // Hook for adding a Semantic Maps links to the Admin Links extension. |
105 | | - $wgHooks['AdminLinks'][] = 'SemanticMapsHooks::addToAdminLinks'; |
106 | | -} |
| 66 | + # Google Maps API v2 |
| 67 | + include_once $smgDir . 'includes/services/GoogleMaps/SM_GoogleMaps.php'; |
| 68 | + # Google Maps API v3 |
| 69 | + include_once $smgDir . 'includes/services/GoogleMaps3/SM_GoogleMaps3.php'; |
| 70 | + # OpenLayers API |
| 71 | + include_once $smgDir . 'includes/services/OpenLayers/SM_OpenLayers.php'; |
| 72 | + # Yahoo! Maps API |
| 73 | + include_once $smgDir . 'includes/services/YahooMaps/SM_YahooMaps.php'; |
107 | 74 | |
| 75 | +$wgExtensionFunctions[] = 'smfSetup'; |
| 76 | + |
| 77 | +$wgExtensionMessagesFiles['SemanticMaps'] = $smgDir . 'SemanticMaps.i18n.php'; |
| 78 | + |
| 79 | +$incDir = dirname( __FILE__ ) . '/includes/'; |
| 80 | + |
| 81 | +// Data values |
| 82 | +$wgAutoloadClasses['SMGeoCoordsValue'] = $incDir . 'SM_GeoCoordsValue.php'; |
| 83 | + |
| 84 | +// Value descriptions |
| 85 | +$wgAutoloadClasses['SMGeoCoordsValueDescription'] = $incDir . 'SM_GeoCoordsValueDescription.php'; |
| 86 | +$wgAutoloadClasses['SMAreaValueDescription'] = $incDir . 'SM_AreaValueDescription.php'; |
| 87 | + |
| 88 | +$wgAutoloadClasses['SemanticMapsHooks'] = dirname( __FILE__ ) . '/SemanticMaps.hooks.php'; |
| 89 | + |
| 90 | +// Hook for initializing the Geographical Coordinate type. |
| 91 | +$wgHooks['smwInitDatatypes'][] = 'SMGeoCoordsValue::initGeoCoordsType'; |
| 92 | + |
| 93 | +// Hook for initializing the field types needed by Geographical Coordinates. |
| 94 | +$wgHooks['SMWCustomSQLStoreFieldType'][] = 'SMGeoCoordsValue::initGeoCoordsFieldTypes'; |
| 95 | + |
| 96 | +// Hook for defining a table to store geographical coordinates in. |
| 97 | +$wgHooks['SMWPropertyTables'][] = 'SMGeoCoordsValue::initGeoCoordsTable'; |
| 98 | + |
| 99 | +// Hook for defining the default query printer for queries that ask for geographical coordinates. |
| 100 | +$wgHooks['SMWResultFormat'][] = 'SMGeoCoordsValue::addGeoCoordsDefaultFormat'; |
| 101 | + |
| 102 | +// Hook for adding a Semantic Maps links to the Admin Links extension. |
| 103 | +$wgHooks['AdminLinks'][] = 'SemanticMapsHooks::addToAdminLinks'; |
| 104 | + |
108 | 105 | /** |
109 | 106 | * 'Initialization' function for the Semantic Maps extension. |
110 | 107 | * The only work done here is creating the extension credits for |