r86945 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86944‎ | r86945 | r86946 >
Date:14:44, 26 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on Yahoo! Maps form input
Modified paths:
  • /trunk/extensions/SemanticMaps/includes/services/OpenLayers/ext.sm.openlayersinput.js (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/services/YahooMaps/ext.sm.yahoomaps.js (modified) (history)
  • /trunk/extensions/SemanticMaps/includes/services/YahooMaps/jquery.yahoomapsinput.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/includes/services/YahooMaps/ext.sm.yahoomaps.js
@@ -1,3 +1,25 @@
22 /**
 3+ * JavasSript for the Yahoo! Maps form input in the Semantic Maps extension.
 4+ * @see http://www.mediawiki.org/wiki/Extension:Semantic_Maps
35 *
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 @@
1313 (function( $ ){ $.fn.yahoomapsinput = function( options ) {
1414
1515 var self = this;
16 - var geocoder = false;
1716
1817 /**
1918 * Creates and places a new marker on the map at the provided
@@ -20,20 +19,34 @@
2120 * @param {Object} coordinate
2221 */
2322 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 ) );
2529 };
2630
27 - this.setupGeocoder = function() {
28 - if ( geocoder === false ) {
29 - // TODO
30 - }
31 - }
 31+ this.geocodeAddress = function( address ) {
 32+ this.mapDiv.map.drawZoomAndCenter( address );
3233
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+ );
3640 };
3741
 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+
3851 this.mapforminput( mapDivId, options );
3952
4053 this.mapDiv.yahoomaps( options );
Index: trunk/extensions/SemanticMaps/includes/services/OpenLayers/ext.sm.openlayersinput.js
@@ -1,5 +1,5 @@
22 /**
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.
44 * @see http://www.mediawiki.org/wiki/Extension:Semantic_Maps
55 *
66 * @since 0.8

Status & tagging log