Index: trunk/extensions/SemanticMaps/includes/services/OpenLayers/SM_OpenLayersForms.js |
— | — | @@ -71,14 +71,17 @@ |
72 | 72 | * |
73 | 73 | * @param mapName Name of the map as in OLMaps[mapName]. |
74 | 74 | * @param newLocation The location for the new marker. |
75 | | - * @return |
76 | 75 | */ |
77 | 76 | function replaceMarker(mapName, newLocation) { |
78 | 77 | var map = OLMaps[mapName]; |
79 | 78 | var markerLayer = map.getLayer('markerLayer'); |
80 | 79 | |
81 | 80 | removeMarkers(markerLayer); |
82 | | - markerLayer.addMarker(getOLMarker(markerLayer, getOLMarkerData(newLocation.lon, newLocation.lat, '', '', ''), map.getProjectionObject())); |
| 81 | + markerLayer.addMarker(getOLMarker( |
| 82 | + markerLayer, |
| 83 | + { lonlat:newLocation, title: "", label:"", icon:"" }, |
| 84 | + map.getProjectionObject()) |
| 85 | + ); |
83 | 86 | |
84 | 87 | map.panTo(newLocation); |
85 | 88 | } |
Index: trunk/extensions/SemanticMaps/includes/forminputs/SM_FormInput.php |
— | — | @@ -183,6 +183,29 @@ |
184 | 184 | |
185 | 185 | $geocodingFunction = $this->getShowAddressFunction(); |
186 | 186 | |
| 187 | + static $addedFormJs = false; |
| 188 | + if ( !$addedFormJs ) { |
| 189 | + global $wgOut; |
| 190 | + $addedFormJs = true; |
| 191 | + |
| 192 | + $n = Xml::escapeJsString( wfMsgForContent( 'maps-abb-north' ) ); |
| 193 | + $e = Xml::escapeJsString( wfMsgForContent( 'maps-abb-east' ) ); |
| 194 | + $s = Xml::escapeJsString( wfMsgForContent( 'maps-abb-south' ) ); |
| 195 | + $w = Xml::escapeJsString( wfMsgForContent( 'maps-abb-west' ) ); |
| 196 | + $deg = Xml::escapeJsString( MapsCoordinateParser::SYMBOL_DEG ); |
| 197 | + |
| 198 | + $wgOut->addInlineScript( |
| 199 | + <<<EOT |
| 200 | +function convertLatToDMS (val) { |
| 201 | + return Math.abs(val) + "$deg " + ( val < 0 ? "$s" : "$n" ); |
| 202 | +} |
| 203 | +function convertLngToDMS (val) { |
| 204 | + return Math.abs(val) + "$deg " + ( val < 0 ? "$w" : "$e" ); |
| 205 | +} |
| 206 | +EOT |
| 207 | + ); |
| 208 | + } |
| 209 | + |
187 | 210 | // Create the non specific form HTML. |
188 | 211 | $this->output .= Html::input( |
189 | 212 | $input_name, |
— | — | @@ -205,7 +228,7 @@ |
206 | 229 | |
207 | 230 | if ( $geocodingFunction !== false ) { |
208 | 231 | $this->addGeocodingField( $geocodingFunction, $mapName, $mapName . '_geocode_' . $sfgTabIndex ); |
209 | | - } |
| 232 | + } |
210 | 233 | |
211 | 234 | if ( $this->markerCoords === false ) { |
212 | 235 | $this->markerCoords = array( |
— | — | @@ -233,30 +256,9 @@ |
234 | 257 | * @param string $geocodeFieldName |
235 | 258 | */ |
236 | 259 | private function addGeocodingField( $geocodingFunction, $mapName, $geocodeFieldId ) { |
237 | | - global $sfgTabIndex, $wgOut, $smgAddedFormJs; |
| 260 | + global $sfgTabIndex; |
238 | 261 | $sfgTabIndex++; |
239 | 262 | |
240 | | - if ( !$smgAddedFormJs ) { |
241 | | - $smgAddedFormJs = true; |
242 | | - |
243 | | - $n = Xml::escapeJsString( wfMsgForContent( 'maps-abb-north' ) ); |
244 | | - $e = Xml::escapeJsString( wfMsgForContent( 'maps-abb-east' ) ); |
245 | | - $s = Xml::escapeJsString( wfMsgForContent( 'maps-abb-south' ) ); |
246 | | - $w = Xml::escapeJsString( wfMsgForContent( 'maps-abb-west' ) ); |
247 | | - $deg = Xml::escapeJsString( MapsCoordinateParser::SYMBOL_DEG ); |
248 | | - |
249 | | - $wgOut->addInlineScript( |
250 | | - <<<EOT |
251 | | -function convertLatToDMS (val) { |
252 | | - return Math.abs(val) + "$deg " + ( val < 0 ? "$s" : "$n" ); |
253 | | -} |
254 | | -function convertLngToDMS (val) { |
255 | | - return Math.abs(val) + "$deg " + ( val < 0 ? "$w" : "$e" ); |
256 | | -} |
257 | | -EOT |
258 | | - ); |
259 | | - } |
260 | | - |
261 | 263 | $adressField = SMFormInput::getDynamicInput( |
262 | 264 | 'geocode', |
263 | 265 | wfMsg( 'semanticmaps_enteraddresshere' ), |