Index: trunk/extensions/SemanticMaps/includes/services/OpenLayers/jquery.openlayersinput.js |
— | — | @@ -60,30 +60,32 @@ |
61 | 61 | this.projectAndShowLocation( new OpenLayers.LonLat( coordinate.lon, coordinate.lat ), '' ); |
62 | 62 | }; |
63 | 63 | |
64 | | - this.geocodeAddress = function( address ) { |
65 | | - $.getJSON( |
66 | | - 'http://api.geonames.org/searchJSON?callback=?', |
67 | | - { |
68 | | - 'q': address, |
69 | | - 'username': options.geonamesusername, |
70 | | - //'formatted': 'true', |
71 | | - 'maxRows': 1 |
72 | | - }, |
73 | | - function( data ) { |
74 | | - if ( data.totalResultsCount ) { |
75 | | - if ( data.totalResultsCount > 0 ) { |
76 | | - self.projectAndShowLocation( new OpenLayers.LonLat( data.geonames[0].lng, data.geonames[0].lat ), address ); |
| 64 | + if ( options.geonamesusername != '' ) { |
| 65 | + this.geocodeAddress = function( address ) { |
| 66 | + $.getJSON( |
| 67 | + 'http://api.geonames.org/searchJSON?callback=?', |
| 68 | + { |
| 69 | + 'q': address, |
| 70 | + 'username': options.geonamesusername, |
| 71 | + //'formatted': 'true', |
| 72 | + 'maxRows': 1 |
| 73 | + }, |
| 74 | + function( data ) { |
| 75 | + if ( data.totalResultsCount ) { |
| 76 | + if ( data.totalResultsCount > 0 ) { |
| 77 | + self.projectAndShowLocation( new OpenLayers.LonLat( data.geonames[0].lng, data.geonames[0].lat ), address ); |
| 78 | + } |
| 79 | + else { |
| 80 | + // TODO: notify no result |
| 81 | + } |
77 | 82 | } |
78 | 83 | else { |
79 | | - // TODO: notify no result |
| 84 | + // TODO: error |
80 | 85 | } |
81 | 86 | } |
82 | | - else { |
83 | | - // TODO: error |
84 | | - } |
85 | | - } |
86 | | - ); |
87 | | - }; |
| 87 | + ); |
| 88 | + }; |
| 89 | + } |
88 | 90 | |
89 | 91 | this.mapforminput( mapDivId, options ); |
90 | 92 | |
Index: trunk/extensions/SemanticMaps/includes/forminputs/jquery.mapforminput.js |
— | — | @@ -69,6 +69,7 @@ |
70 | 70 | |
71 | 71 | this.input.keypress( function( event ) { |
72 | 72 | if ( event.which == '13' ) { |
| 73 | + event.preventDefault(); |
73 | 74 | updateButton.click(); |
74 | 75 | } |
75 | 76 | } ); |
— | — | @@ -104,6 +105,7 @@ |
105 | 106 | |
106 | 107 | this.geofield.keypress( function( event ) { |
107 | 108 | if ( event.which == '13' ) { |
| 109 | + event.preventDefault(); |
108 | 110 | geoButton.click(); |
109 | 111 | } |
110 | 112 | } ); |