r58799 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58798‎ | r58799 | r58800 >
Date:01:01, 9 November 2009
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Modified paths:
  • /trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/SemanticMaps.php (modified) (history)
  • /trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFormInput.php
@@ -39,7 +39,7 @@
4040 */
4141 protected function addFormDependencies() {
4242 global $wgJsMimeType;
43 - global $smgIncludePath, $smgYahooFormsOnThisPage;
 43+ global $smgScriptPath, $smgYahooFormsOnThisPage;
4444
4545 MapsYahooMapsUtils::addYMapDependencies($this->output);
4646
Index: trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php
@@ -75,13 +75,12 @@
7676 if ($this->enableGeocoding) {
7777 $sfgTabIndex++;
7878
79 - // Retrieve language values
80 - // wfLoadExtensionMessages( 'SemanticMaps' ); // TODO: remove?
 79+ // Retrieve language valuess
8180 $enter_address_here_text = wfMsg('semanticmaps_enteraddresshere');
8281 $lookup_coordinates_text = wfMsg('semanticmaps_lookupcoordinates');
8382 $not_found_text = wfMsg('semanticmaps_notfound');
8483
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.'"');
8685 $this->output .= "
8786 <p>
8887 $adress_field
@@ -141,10 +140,28 @@
142141 }
143142 }
144143 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+
146148 $this->centre_lat = $centre['lat'];
147149 $this->centre_lon = $centre['lon'];
148150 }
149151 }
 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+ }
150167 }
151168
Index: trunk/extensions/SemanticMaps/SemanticMaps.php
@@ -23,7 +23,7 @@
2424 die( 'Not an entry point.' );
2525 }
2626
27 -define('SM_VERSION', '0.4 RC1');
 27+define('SM_VERSION', '0.4.1 a1');
2828
2929 $smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps';
3030 $smgIP = $IP . '/extensions/SemanticMaps';
@@ -60,7 +60,6 @@
6161 foreach (array_keys($egMapsServices) as $name) $services[] = wfMsg('maps_'.$name);
6262 $services_list = $wgLang->listToText($services);
6363
64 - // TODO: split for feature hook system?
6564 wfLoadExtensionMessages( 'SemanticMaps' );
6665
6766 $wgExtensionCredits['other'][]= array(
@@ -77,21 +76,6 @@
7877 }
7978
8079 /**
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 -/**
9680 * Adds a link to Admin Links page
9781 */
9882 function smfAddToAdminLinks(&$admin_links_tree) {
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
@@ -226,9 +226,12 @@
227227 *
228228 */
229229 private function setCentre() {
 230+ // If a centre value is set, use it.
230231 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+
233236 $this->centre_lat = $centre['lat'];
234237 $this->centre_lon = $centre['lon'];
235238 }
@@ -236,7 +239,7 @@
237240 // 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.
238241 $this->centre_lat = 'null';
239242 $this->centre_lon = 'null';
240 - }
 243+ }
241244 else {
242245 // If centre is not set and there is exactelly one marker, use it's coordinates.
243246 $this->centre_lat = $this->m_locations[0][0];

Status & tagging log