r60384 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60383‎ | r60384 | r60385 >
Date:00:55, 25 December 2009
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.5.1. Added forceshow parameter to the query printers.
Modified paths:
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_QueryPrinters.php
@@ -64,6 +64,12 @@
6565 'aliases' => array('center'),
6666 'default' => $egMapsDefaultCentre
6767 ),
 68+ 'forceshow' => array(
 69+ 'type' => 'boolean',
 70+ 'aliases' => array('force show'),
 71+ 'default' => false,
 72+ 'output-type' => 'boolean'
 73+ ),
6874 'limit' => array(),
6975 'headers' => array(),
7076 'mainlabel' => array(),
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
@@ -78,7 +78,7 @@
7979
8080 if (self::manageMapProperties($this->m_params, __CLASS__)) {
8181 // Only create a map when there is at least one result.
82 - if (count($this->m_locations) > 0) {
 82+ if (count($this->m_locations) > 0 || $this->forceshow) {
8383 $this->doMapServiceLoad();
8484
8585 $this->setMapName();
@@ -90,7 +90,7 @@
9191 $this->addSpecificMapHTML();
9292 }
9393 else {
94 - // TODO: add warning when level high enough and append to erro list.
 94+ // TODO: add warning when level high enough and append to error list?
9595 }
9696 }
9797
@@ -119,7 +119,7 @@
120120 $parameterInfo = array_merge($parameterInfo, $egMapsServices[$this->serviceName]['parameters']);
121121 $parameterInfo = array_merge($parameterInfo, $this->spesificParameters);
122122
123 - $manager = new ValidatorManager(); // TODO
 123+ $manager = new ValidatorManager();
124124
125125 $result = $manager->manageMapparameters($mapProperties, $parameterInfo);
126126
@@ -276,25 +276,33 @@
277277 *
278278 */
279279 private function setCentre() {
280 - // If a centre value is set, use it.
281 - if (strlen($this->centre) > 0) {
282 - // Geocode and convert if required.
283 - $centre = MapsGeocodeUtils::attemptToGeocode($this->centre, $this->geoservice, $this->serviceName);
284 - $centre = MapsUtils::getLatLon($centre);
285 -
286 - $this->centre_lat = $centre['lat'];
287 - $this->centre_lon = $centre['lon'];
 280+ // If there are no results, centre on the default coordinates.
 281+ if ( count($this->m_locations) < 1 ) {
 282+ global $egMapsMapLat, $egMapsMapLon;
 283+ $this->centre_lat = $egMapsMapLat;
 284+ $this->centre_lon = $egMapsMapLon;
288285 }
289 - elseif (count($this->m_locations) > 1) {
290 - // 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.
291 - $this->centre_lat = 'null';
292 - $this->centre_lon = 'null';
293 - }
294286 else {
295 - // If centre is not set and there is exactelly one marker, use it's coordinates.
296 - $this->centre_lat = $this->m_locations[0][0];
297 - $this->centre_lon = $this->m_locations[0][1];
298 - }
 287+ // If a centre value is set, use it.
 288+ if (strlen($this->centre) > 0) {
 289+ // Geocode and convert if required.
 290+ $centre = MapsGeocodeUtils::attemptToGeocode($this->centre, $this->geoservice, $this->serviceName);
 291+ $centre = MapsUtils::getLatLon($centre);
 292+
 293+ $this->centre_lat = $centre['lat'];
 294+ $this->centre_lon = $centre['lon'];
 295+ }
 296+ elseif (count($this->m_locations) > 1) {
 297+ // 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.
 298+ $this->centre_lat = 'null';
 299+ $this->centre_lon = 'null';
 300+ }
 301+ else {
 302+ // If centre is not set and there is exactelly one marker, use it's coordinates.
 303+ $this->centre_lat = $this->m_locations[0][0];
 304+ $this->centre_lon = $this->m_locations[0][1];
 305+ }
 306+ }
299307 }
300308
301309 /**

Status & tagging log