Index: trunk/extensions/SemanticMaps/includes/services/YahooMaps/ext.sm.yahoomaps.js |
— | — | @@ -1,3 +1,25 @@ |
2 | 2 | /** |
| 3 | + * JavasSript for the Yahoo! Maps form input in the Semantic Maps extension. |
| 4 | + * @see http://www.mediawiki.org/wiki/Extension:Semantic_Maps |
3 | 5 | * |
4 | | - */ |
\ No newline at end of file |
| 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.yahoomaps_forminputs ) { |
| 16 | + jQuery( '#' + i + '_forminput' ).yahoomapsinput( i, window.maps.yahoomaps_forminputs[i] ); |
| 17 | + } |
| 18 | + } |
| 19 | + else { |
| 20 | + alert( mediaWiki.msg( 'maps-yahoomaps-incompatbrowser' ) ); |
| 21 | + |
| 22 | + for ( i in window.maps.yahoomaps_forminputs ) { |
| 23 | + jQuery( '#' + i + '_forminput' ).text( mediaWiki.msg( 'maps-load-failed' ) ); |
| 24 | + } |
| 25 | + } |
| 26 | +}); |
Index: trunk/extensions/SemanticMaps/includes/services/YahooMaps/jquery.yahoomapsinput.js |
— | — | @@ -12,7 +12,6 @@ |
13 | 13 | (function( $ ){ $.fn.yahoomapsinput = function( options ) { |
14 | 14 | |
15 | 15 | var self = this; |
16 | | - var geocoder = false; |
17 | 16 | |
18 | 17 | /** |
19 | 18 | * Creates and places a new marker on the map at the provided |
— | — | @@ -20,20 +19,34 @@ |
21 | 20 | * @param {Object} coordinate |
22 | 21 | */ |
23 | 22 | this.showCoordinate = function( coordinate ) { |
24 | | - // TODO |
| 23 | + this.mapDiv.map.removeMarkersAll(); |
| 24 | + coordinate.icon = ''; |
| 25 | + coordinate.title = ''; |
| 26 | + coordinate.text = coord.dms( coordinate.lat, coordinate.lon ); |
| 27 | + var marker = this.mapDiv.addMarker( coordinate ); |
| 28 | + this.mapDiv.map.drawZoomAndCenter( new YGeoPoint( coordinate.lat, coordinate.lon ) ); |
25 | 29 | }; |
26 | 30 | |
27 | | - this.setupGeocoder = function() { |
28 | | - if ( geocoder === false ) { |
29 | | - // TODO |
30 | | - } |
31 | | - } |
| 31 | + this.geocodeAddress = function( address ) { |
| 32 | + this.mapDiv.map.drawZoomAndCenter( address ); |
32 | 33 | |
33 | | - this.geocodeAddress = function( address ) { |
34 | | - this.setupGeocoder(); |
35 | | - // TODO |
| 34 | + YEvent.Capture(this.mapDiv.map, EventsList.onEndGeoCode, |
| 35 | + function( resultObj ) { |
| 36 | + map.addOverlay( new YMarker( resultObj.GeoPoint ) ); |
| 37 | + this.updateInput( [ { 'lat': resultObj.GeoPoint.Lat, 'lon': resultObj.GeoPoint.Lon } ] ); |
| 38 | + } |
| 39 | + ); |
36 | 40 | }; |
37 | 41 | |
| 42 | + // Click event handler for updating the location of the marker. |
| 43 | + YEvent.Capture(this.mapDiv.map, EventsList.MouseClick, |
| 44 | + function(_e, point) { |
| 45 | + var coordinate = { 'lat': point.Lat, 'lon': point.Lon }; |
| 46 | + this.showCoordinate( coordinate ); |
| 47 | + this.updateInput( [ coordinate ] ); |
| 48 | + } |
| 49 | + ); |
| 50 | + |
38 | 51 | this.mapforminput( mapDivId, options ); |
39 | 52 | |
40 | 53 | this.mapDiv.yahoomaps( options ); |
Index: trunk/extensions/SemanticMaps/includes/services/OpenLayers/ext.sm.openlayersinput.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * JavasSript for the Google Maps v3 form input in the Semantic Maps extension. |
| 3 | + * JavasSript for the OpenLayers form input in the Semantic Maps extension. |
4 | 4 | * @see http://www.mediawiki.org/wiki/Extension:Semantic_Maps |
5 | 5 | * |
6 | 6 | * @since 0.8 |