Index: trunk/extensions/SemanticMaps/Services/YahooMaps/SM_YahooMapsFormInput.php |
— | — | @@ -92,8 +92,8 @@ |
93 | 93 | [$this->types], |
94 | 94 | [$this->controls], |
95 | 95 | $this->autozoom, |
96 | | - $this->marker_lat, |
97 | | - $this->marker_lon |
| 96 | + {$this->markerCoords['lat']}, |
| 97 | + {$this->markerCoords['lon']} |
98 | 98 | ); |
99 | 99 | } |
100 | 100 | ); |
Index: trunk/extensions/SemanticMaps/Services/OpenLayers/SM_OpenLayersFormInput.php |
— | — | @@ -89,8 +89,8 @@ |
90 | 90 | $this->centreLat, |
91 | 91 | $this->centreLon, |
92 | 92 | $this->zoom, |
93 | | - $this->marker_lat, |
94 | | - $this->marker_lon, |
| 93 | + {$this->markerCoords['lat']}, |
| 94 | + {$this->markerCoords['lon']}, |
95 | 95 | [$layerItems], |
96 | 96 | [$this->controls] |
97 | 97 | ); |
Index: trunk/extensions/SemanticMaps/Services/GoogleMaps/SM_GoogleMapsFormInput.php |
— | — | @@ -102,8 +102,8 @@ |
103 | 103 | controls: [$this->controls], |
104 | 104 | scrollWheelZoom: $this->autozoom |
105 | 105 | }, |
106 | | - $this->marker_lat, |
107 | | - $this->marker_lon |
| 106 | + {$this->markerCoords['lat']}, |
| 107 | + {$this->markerCoords['lon']} |
108 | 108 | ); |
109 | 109 | } |
110 | 110 | ); |
Index: trunk/extensions/SemanticMaps/Features/FormInputs/SM_FormInput.php |
— | — | @@ -25,11 +25,15 @@ |
26 | 26 | */ |
27 | 27 | protected abstract function addFormDependencies(); |
28 | 28 | |
| 29 | + /** |
| 30 | + * @var string |
| 31 | + */ |
29 | 32 | protected $mapName; |
30 | 33 | |
31 | | - // TODO: change into a single array |
32 | | - protected $marker_lat; |
33 | | - protected $marker_lon; |
| 34 | + /** |
| 35 | + * @var array |
| 36 | + */ |
| 37 | + protected $markerCoords; |
34 | 38 | |
35 | 39 | protected $earthZoom; |
36 | 40 | |
— | — | @@ -118,9 +122,16 @@ |
119 | 123 | $this->infoFieldName = $this->elementNamePrefix . '_info_' . $this->elementNr . '_' . $sfgTabIndex; |
120 | 124 | |
121 | 125 | // 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 | + |
122 | 133 | $this->output .= Html::input( |
123 | 134 | $input_name, |
124 | | - MapsCoordinateParser::formatCoordinates( array( 'lat' => $this->marker_lat, 'lon' => $this->marker_lon ) ), |
| 135 | + $coords, |
125 | 136 | 'text', |
126 | 137 | array( |
127 | 138 | 'size' => 42, |
— | — | @@ -205,30 +216,27 @@ |
206 | 217 | } |
207 | 218 | |
208 | 219 | /** |
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. |
210 | 221 | */ |
211 | 222 | private function setCoordinates() { |
212 | 223 | 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; |
216 | 226 | } |
217 | 227 | 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 ); |
221 | 229 | } |
222 | 230 | } |
223 | 231 | |
224 | 232 | /** |
225 | | - * Sets the $centre_lat and $centre_lon fields. |
| 233 | + * Sets the $centreLat and $centreLon fields. |
226 | 234 | * Note: this needs to be done AFTRE the maker coordinates are set. |
227 | 235 | */ |
228 | 236 | private function setCentre() { |
229 | 237 | if ( empty( $this->centre ) ) { |
230 | 238 | 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']; |
233 | 241 | } |
234 | 242 | else { |
235 | 243 | $this->centreLat = '0'; |