r83364 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83363‎ | r83364 | r83365 >
Date:03:53, 6 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
param handling fix
Modified paths:
  • /branches/SemanticMaps0.8/includes/queryprinters/SM_KMLPrinter.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/queryprinters/SM_QueryHandler.php (modified) (history)

Diff [purge]

Index: branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php
@@ -61,7 +61,7 @@
6262 $fatalError = $validator->hasFatalError();
6363
6464 if ( $fatalError === false ) {
65 - $this->parameters = $validator->getParameters( false );
 65+ $this->parameters = $validator->getParameterValues();
6666 }
6767 else {
6868 $this->fatalErrorMsg =
@@ -86,6 +86,7 @@
8787 $params = $this->parameters;
8888
8989 $queryHandler = new SMQueryHandler( $res, $outputmode, $params );
 90+ //$queryHandler->setText( );
9091
9192 $this->handleMarkerData( $params, $queryHandler->getLocations() );
9293
@@ -178,7 +179,7 @@
179180 $iconUrl = MapsMapper::getImageUrl( $params['icon'] );
180181 $params['locations'] = array();
181182
182 - foreach ( array_merge( $params['coordinates'], $queryLocations ) as $location ) {
 183+ foreach ( array_merge( $params['staticlocations'], $queryLocations ) as $location ) {
183184 if ( $location->isValid() ) {
184185 $jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl );
185186
@@ -189,7 +190,7 @@
190191 }
191192 }
192193
193 - unset( $params['coordinates'] );
 194+ unset( $params['staticlocations'] );
194195 }
195196
196197 /**
Index: branches/SemanticMaps0.8/includes/queryprinters/SM_QueryHandler.php
@@ -19,9 +19,35 @@
2020
2121 // TODO: add system to properly handle query parameters
2222 public $template = false;
 23+
 24+ /**
 25+ * The global icon.
 26+ *
 27+ * @since 0.7.3
 28+ *
 29+ * @var string
 30+ */
2331 public $icon = '';
2432
2533 /**
 34+ * The global text.
 35+ *
 36+ * @since 0.8
 37+ *
 38+ * @var string
 39+ */
 40+ public $text = '';
 41+
 42+ /**
 43+ * The global title.
 44+ *
 45+ * @since 0.8
 46+ *
 47+ * @var string
 48+ */
 49+ public $title = '';
 50+
 51+ /**
2652 * Make a separate link to the title or not?
2753 *
2854 * @since 0.7.3
@@ -66,6 +92,39 @@
6793 }
6894
6995 /**
 96+ * Sets the global icon.
 97+ *
 98+ * @since 0.8
 99+ *
 100+ * @param string $icon
 101+ */
 102+ public function setIcon( $icon ) {
 103+ $this->icon = $icon;
 104+ }
 105+
 106+ /**
 107+ * Sets the global title.
 108+ *
 109+ * @since 0.8
 110+ *
 111+ * @param string $title
 112+ */
 113+ public function setTitle( $title ) {
 114+ $this->title = $title;
 115+ }
 116+
 117+ /**
 118+ * Sets the global text.
 119+ *
 120+ * @since 0.8
 121+ *
 122+ * @param string $text
 123+ */
 124+ public function setText( $text ) {
 125+ $this->text = $text;
 126+ }
 127+
 128+ /**
70129 * Gets the query result as a list of locations.
71130 *
72131 * @since 0.7.3
Index: branches/SemanticMaps0.8/includes/queryprinters/SM_KMLPrinter.php
@@ -57,6 +57,9 @@
5858 protected function getParameterInfo() {
5959 $params = array();
6060
 61+ $params[] = new Parameter( 'text' );
 62+ $params[] = new Parameter( 'title' );
 63+
6164 $params[] = new Parameter( 'linkabsolute', Parameter::TYPE_BOOLEAN, true );
6265
6366 $params['pagelinktext'] = new Parameter( 'pagelinktext', Parameter::TYPE_STRING, wfMsg( 'semanticmaps-default-kml-pagelink' ) );
@@ -77,10 +80,11 @@
7881 */
7982 protected function getKML( SMWQueryResult $res, $outputmode, array $params ) {
8083 $queryHandler = new SMQueryHandler( $res, $outputmode, $params['linkabsolute'], $params['pagelinktext'], false );
81 - $locations = $queryHandler->getLocations();
 84+ $queryHandler->setText( $params['text'] );
 85+ $queryHandler->setTitle( $params['title'] );
8286
8387 $formatter = new MapsKMLFormatter( $params );
84 - $formatter->addPlacemarks( $locations );
 88+ $formatter->addPlacemarks( $queryHandler->getLocations() );
8589
8690 return $formatter->getKML();
8791 }

Status & tagging log