Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php |
— | — | @@ -39,7 +39,7 @@ |
40 | 40 | */ |
41 | 41 | protected function addFormDependencies() { |
42 | 42 | global $wgJsMimeType; |
43 | | - global $smgIncludePath, $smgYahooFormsOnThisPage; |
| 43 | + global $smgScriptPath, $smgYahooFormsOnThisPage; |
44 | 44 | |
45 | 45 | MapsYahooMapsUtils::addYMapDependencies($this->output); |
46 | 46 | |
Index: trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php |
— | — | @@ -75,13 +75,12 @@ |
76 | 76 | if ($this->enableGeocoding) { |
77 | 77 | $sfgTabIndex++; |
78 | 78 | |
79 | | - // Retrieve language values |
80 | | - // wfLoadExtensionMessages( 'SemanticMaps' ); // TODO: remove? |
| 79 | + // Retrieve language valuess |
81 | 80 | $enter_address_here_text = wfMsg('semanticmaps_enteraddresshere'); |
82 | 81 | $lookup_coordinates_text = wfMsg('semanticmaps_lookupcoordinates'); |
83 | 82 | $not_found_text = wfMsg('semanticmaps_notfound'); |
84 | 83 | |
85 | | - $adress_field = smfGetDynamicInput($this->geocodeFieldName, $enter_address_here_text, 'size="30" name="geocode" style="color: #707070" tabindex="'.$sfgTabIndex.'"'); |
| 84 | + $adress_field = SMFormInput::getDynamicInput($this->geocodeFieldName, $enter_address_here_text, 'size="30" name="geocode" style="color: #707070" tabindex="'.$sfgTabIndex.'"'); |
86 | 85 | $this->output .= " |
87 | 86 | <p> |
88 | 87 | $adress_field |
— | — | @@ -141,10 +140,28 @@ |
142 | 141 | } |
143 | 142 | } |
144 | 143 | else { |
145 | | - $centre = MapsUtils::getLatLon($this->centre); |
| 144 | + // Geocode and convert if required. |
| 145 | + $centre = MapsGeocodeUtils::attemptToGeocode($this->centre, $this->geoservice, $this->serviceName); |
| 146 | + $centre = MapsUtils::getLatLon($centre); |
| 147 | + |
146 | 148 | $this->centre_lat = $centre['lat']; |
147 | 149 | $this->centre_lon = $centre['lon']; |
148 | 150 | } |
149 | 151 | } |
| 152 | + |
| 153 | + /** |
| 154 | + * Returns html for an html input field with a default value that will automatically dissapear when |
| 155 | + * the user clicks in it, and reappers when the focus on the field is lost and it's still empty. |
| 156 | + * |
| 157 | + * @author Jeroen De Dauw |
| 158 | + * |
| 159 | + * @param string $id |
| 160 | + * @param string $value |
| 161 | + * @param string $args |
| 162 | + * @return html |
| 163 | + */ |
| 164 | + private static function getDynamicInput($id, $value, $args='') { |
| 165 | + return '<input id="'.$id.'" '.$args.' value="'.$value.'" onfocus="if (this.value==\''.$value.'\') {this.value=\'\';}" onblur="if (this.value==\'\') {this.value=\''.$value.'\';}" />'; |
| 166 | + } |
150 | 167 | } |
151 | 168 | |
Index: trunk/extensions/SemanticMaps/SemanticMaps.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | die( 'Not an entry point.' ); |
25 | 25 | } |
26 | 26 | |
27 | | -define('SM_VERSION', '0.4 RC1'); |
| 27 | +define('SM_VERSION', '0.4.1 a1'); |
28 | 28 | |
29 | 29 | $smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps'; |
30 | 30 | $smgIP = $IP . '/extensions/SemanticMaps'; |
— | — | @@ -60,7 +60,6 @@ |
61 | 61 | foreach (array_keys($egMapsServices) as $name) $services[] = wfMsg('maps_'.$name); |
62 | 62 | $services_list = $wgLang->listToText($services); |
63 | 63 | |
64 | | - // TODO: split for feature hook system? |
65 | 64 | wfLoadExtensionMessages( 'SemanticMaps' ); |
66 | 65 | |
67 | 66 | $wgExtensionCredits['other'][]= array( |
— | — | @@ -77,21 +76,6 @@ |
78 | 77 | } |
79 | 78 | |
80 | 79 | /** |
81 | | - * Returns html for an html input field with a default value that will automatically dissapear when |
82 | | - * the user clicks in it, and reappers when the focus on the field is lost and it's still empty. |
83 | | - * |
84 | | - * @author Jeroen De Dauw |
85 | | - * |
86 | | - * @param string $id |
87 | | - * @param string $value |
88 | | - * @param string $args |
89 | | - * @return html |
90 | | - */ // TODO: move to FI feature code |
91 | | -function smfGetDynamicInput($id, $value, $args='') { |
92 | | - return '<input id="'.$id.'" '.$args.' value="'.$value.'" onfocus="if (this.value==\''.$value.'\') {this.value=\'\';}" onblur="if (this.value==\'\') {this.value=\''.$value.'\';}" />'; |
93 | | -} |
94 | | - |
95 | | -/** |
96 | 80 | * Adds a link to Admin Links page |
97 | 81 | */ |
98 | 82 | function smfAddToAdminLinks(&$admin_links_tree) { |
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php |
— | — | @@ -226,9 +226,12 @@ |
227 | 227 | * |
228 | 228 | */ |
229 | 229 | private function setCentre() { |
| 230 | + // If a centre value is set, use it. |
230 | 231 | if (strlen($this->centre) > 0) { |
231 | | - // If a centre value is set, use it. |
232 | | - $centre = MapsUtils::getLatLon($this->centre); |
| 232 | + // Geocode and convert if required. |
| 233 | + $centre = MapsGeocodeUtils::attemptToGeocode($this->centre, $this->geoservice, $this->serviceName); |
| 234 | + $centre = MapsUtils::getLatLon($centre); |
| 235 | + |
233 | 236 | $this->centre_lat = $centre['lat']; |
234 | 237 | $this->centre_lon = $centre['lon']; |
235 | 238 | } |
— | — | @@ -236,7 +239,7 @@ |
237 | 240 | // If centre is not set, and there are multiple points, set the values to null, to be auto determined by the JS of the mapping API. |
238 | 241 | $this->centre_lat = 'null'; |
239 | 242 | $this->centre_lon = 'null'; |
240 | | - } |
| 243 | + } |
241 | 244 | else { |
242 | 245 | // If centre is not set and there is exactelly one marker, use it's coordinates. |
243 | 246 | $this->centre_lat = $this->m_locations[0][0]; |