r65947 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65946‎ | r65947 | r65948 >
Date:09:19, 5 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - minor refactoring
Modified paths:
  • /trunk/extensions/SemanticMaps/Features/FormInputs/SM_FormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsFormInput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsFormInput.php
@@ -92,8 +92,8 @@
9393 [$this->types],
9494 [$this->controls],
9595 $this->autozoom,
96 - $this->marker_lat,
97 - $this->marker_lon
 96+ {$this->markerCoords['lat']},
 97+ {$this->markerCoords['lon']}
9898 );
9999 }
100100 );
Index: trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersFormInput.php
@@ -89,8 +89,8 @@
9090 $this->centreLat,
9191 $this->centreLon,
9292 $this->zoom,
93 - $this->marker_lat,
94 - $this->marker_lon,
 93+ {$this->markerCoords['lat']},
 94+ {$this->markerCoords['lon']},
9595 [$layerItems],
9696 [$this->controls]
9797 );
Index: trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsFormInput.php
@@ -102,8 +102,8 @@
103103 controls: [$this->controls],
104104 scrollWheelZoom: $this->autozoom
105105 },
106 - $this->marker_lat,
107 - $this->marker_lon
 106+ {$this->markerCoords['lat']},
 107+ {$this->markerCoords['lon']}
108108 );
109109 }
110110 );
Index: trunk/extensions/SemanticMaps/Features/FormInputs/SM_FormInput.php
@@ -25,11 +25,15 @@
2626 */
2727 protected abstract function addFormDependencies();
2828
 29+ /**
 30+ * @var string
 31+ */
2932 protected $mapName;
3033
31 - // TODO: change into a single array
32 - protected $marker_lat;
33 - protected $marker_lon;
 34+ /**
 35+ * @var array
 36+ */
 37+ protected $markerCoords;
3438
3539 protected $earthZoom;
3640
@@ -118,9 +122,16 @@
119123 $this->infoFieldName = $this->elementNamePrefix . '_info_' . $this->elementNr . '_' . $sfgTabIndex;
120124
121125 // Create the non specific form HTML.
 126+ if ( $this->markerCoords === false ) {
 127+ $coords = 'null, null';
 128+ }
 129+ else {
 130+ $coords = MapsCoordinateParser::formatCoordinates( $this->markerCoords );
 131+ }
 132+
122133 $this->output .= Html::input(
123134 $input_name,
124 - MapsCoordinateParser::formatCoordinates( array( 'lat' => $this->marker_lat, 'lon' => $this->marker_lon ) ),
 135+ $coords,
125136 'text',
126137 array(
127138 'size' => 42,
@@ -205,30 +216,27 @@
206217 }
207218
208219 /**
209 - * Sets the $marler_lon and $marler_lat fields and when set, the starting coordinates.
 220+ * Sets the $this->markerCoords value, which are the coordinates for the marker.
210221 */
211222 private function setCoordinates() {
212223 if ( empty( $this->coordinates ) ) {
213 - // If no coordinates exist yet, no marker should be displayed
214 - $this->marker_lat = 'null';
215 - $this->marker_lon = 'null';
 224+ // If no coordinates exist yet, no marker should be displayed.
 225+ $this->markerCoords = false;
216226 }
217227 else {
218 - $marker = MapsCoordinateParser::parseCoordinates( $this->coordinates );
219 - $this->marker_lat = $marker['lat'];
220 - $this->marker_lon = $marker['lon'];
 228+ $this->markerCoords = MapsCoordinateParser::parseCoordinates( $this->coordinates );
221229 }
222230 }
223231
224232 /**
225 - * Sets the $centre_lat and $centre_lon fields.
 233+ * Sets the $centreLat and $centreLon fields.
226234 * Note: this needs to be done AFTRE the maker coordinates are set.
227235 */
228236 private function setCentre() {
229237 if ( empty( $this->centre ) ) {
230238 if ( isset( $this->coordinates ) ) {
231 - $this->centreLat = $this->marker_lat;
232 - $this->centreLon = $this->marker_lon;
 239+ $this->centreLat = $this->markerCoords['lat'];
 240+ $this->centreLon = $this->markerCoords['lon'];
233241 }
234242 else {
235243 $this->centreLat = '0';

Status & tagging log