r83846 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83845‎ | r83846 | r83847 >
Date:18:26, 13 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added button and fixed field submission
Modified paths:
  • /branches/SemanticMaps0.8/SemanticMaps.i18n.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayers.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/services/OpenLayers/jquery.openlayersinput.js (modified) (history)

Diff [purge]

Index: branches/SemanticMaps0.8/includes/services/OpenLayers/SM_OpenLayers.php
@@ -31,6 +31,7 @@
3232 ),
3333 'messages' => array(
3434 'semanticmaps_enteraddresshere',
 35+ 'semanticmaps-updatemap',
3536 'semanticmaps_lookupcoordinates',
3637 'semanticmaps-forminput-remove',
3738 'semanticmaps-forminput-add',
Index: branches/SemanticMaps0.8/includes/services/OpenLayers/jquery.openlayersinput.js
@@ -19,6 +19,19 @@
2020 'size': options.fieldsize
2121 } );
2222
 23+ var updateButton = $( '<button />' ).text( mediaWiki.msg( 'semanticmaps-updatemap' ) );
 24+
 25+ updateButton.click( function() {
 26+ // TODO
 27+ return false;
 28+ } );
 29+
 30+ input.keypress( function( event ) {
 31+ if ( event.which == '13' ) {
 32+ updateButton.click();
 33+ }
 34+ } );
 35+
2336 var geofield = $( '<input />' ).attr( {
2437 'type': 'text',
2538 'id': mapDivId + '_geofield',
@@ -41,13 +54,19 @@
4255 }
4356 } );
4457
45 - var button = $( '<input />' ).attr( { 'type': 'submit', 'value': mediaWiki.msg( 'semanticmaps_lookupcoordinates' ) } );
 58+ var geoButton = $( '<button />' ).text( mediaWiki.msg( 'semanticmaps_lookupcoordinates' ) );
4659
47 - button.click( function() {
 60+ geoButton.click( function() {
4861 geocodeAddress( $( '#' + mapDivId + '_geofield' ).attr( 'value' ) );
4962 return false;
5063 } );
5164
 65+ geofield.keypress( function( event ) {
 66+ if ( event.which == '13' ) {
 67+ geoButton.click();
 68+ }
 69+ } );
 70+
5271 var mapDiv = $( '<div />' )
5372 .attr( {
5473 'id': mapDivId,
@@ -58,10 +77,10 @@
5978 'height': options.height
6079 } );
6180
62 - this.html( $( '<p />' ).append( input ) );
 81+ this.html( $( '<p />' ).append( input ).append( updateButton ) );
6382
6483 if ( options.geonamesusername != '' ) {
65 - this.append( $( '<p />' ).append( geofield ).append( button ) );
 84+ this.append( $( '<p />' ).append( geofield ).append( geoButton ) );
6685 }
6786
6887 this.append( mapDiv );
@@ -151,8 +170,9 @@
152171
153172 mapDiv.map.panTo( location );
154173
155 - location.transform( new OpenLayers.Projection( "EPSG:900913" ), new OpenLayers.Projection( "EPSG:4326" ) );
156 - $( '#' + mapDivId + '_values' ).attr( 'value', semanticMaps.buildInputValue( [ location ] ) );
 174+ var normalProjectionLocation = new OpenLayers.LonLat( location.lon, location.lat );
 175+ normalProjectionLocation.transform( new OpenLayers.Projection( "EPSG:900913" ), new OpenLayers.Projection( "EPSG:4326" ) );
 176+ $( '#' + mapDivId + '_values' ).attr( 'value', semanticMaps.buildInputValue( [ normalProjectionLocation ] ) );
157177 }
158178
159179 return this;
Index: branches/SemanticMaps0.8/SemanticMaps.i18n.php
@@ -26,9 +26,10 @@
2727 'semanticmaps-default-kml-pagelink' => 'View page $1',
2828
2929 // Forms
 30+ 'semanticmaps-loading-forminput' => 'Loading map form input...',
3031 'semanticmaps_lookupcoordinates' => 'Look up coordinates',
3132 'semanticmaps_enteraddresshere' => 'Enter address here',
32 - 'semanticmaps-loading-forminput' => 'Loading map form input...',
 33+ 'semanticmaps-updatemap' => 'Update map',
3334 'semanticmaps_notfound' => 'not found',
3435 'semanticmaps-forminput-remove' => 'Remove',
3536 'semanticmaps-forminput-add' => 'Add',

Status & tagging log