r83366 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83365‎ | r83366 | r83367 >
Date:04:19, 6 March 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed map queries
Modified paths:
  • /branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/queryprinters/SM_QueryHandler.php (modified) (history)
  • /branches/SemanticMaps0.8/includes/queryprinters/SM_QueryPrinters.php (modified) (history)

Diff [purge]

Index: branches/SemanticMaps0.8/includes/queryprinters/SM_QueryPrinters.php
@@ -77,15 +77,14 @@
7878 $params['staticlocations']->addManipulations( new MapsParamLocation( '~' ) );
7979 $params['staticlocations']->setDefault( array() );
8080
81 - $params['centre'] = new Parameter(
82 - 'centre',
83 - Parameter::TYPE_STRING,
84 - '', // TODO
85 - array( 'center' ),
86 - array(
87 - new CriterionIsLocation(),
88 - )
89 - );
 81+ $params['centre'] = new Parameter( 'centre' );
 82+ $params['centre']->setDefault( false );
 83+ $params['centre']->addAliases( 'center' );
 84+ $params['centre']->addCriteria( new CriterionIsLocation() );
 85+ $params['centre']->setDoManipulationOfDefault( false );
 86+ $manipulation = new MapsParamLocation();
 87+ $manipulation->toJSONObj = true;
 88+ $params['centre']->addManipulations( $manipulation );
9089
9190 $params['icon'] = new Parameter(
9291 'icon',
Index: branches/SemanticMaps0.8/includes/queryprinters/SM_MapPrinter.php
@@ -183,8 +183,7 @@
184184 if ( $location->isValid() ) {
185185 $jsonObj = $location->getJSONObject( $params['title'], $params['label'], $iconUrl );
186186
187 - $jsonObj['title'] = strip_tags( $parser->parse( $jsonObj['title'], $wgTitle, new ParserOptions() )->getText() );
188 - $jsonObj['text'] = $parser->parse( $jsonObj['text'], $wgTitle, new ParserOptions() )->getText();
 187+ $jsonObj['title'] = strip_tags( $jsonObj['title'] );
189188
190189 $params['locations'][] = $jsonObj;
191190 }
Index: branches/SemanticMaps0.8/includes/queryprinters/SM_QueryHandler.php
@@ -191,15 +191,17 @@
192192 // Loop throught all the parts of the field value.
193193 while ( ( /* SMWDataValue */ $object = $resultArray->getNextObject() ) !== false ) {
194194 if ( $object->getTypeID() == '_wpg' && $i == 0 ) {
 195+ $title = $object->getLongText( $this->outputmode, null );
 196+
195197 if ( !$this->titleLinkSeperate && $this->linkAbsolute ) {
196 - $title = Html::element(
 198+ $text = Html::element(
197199 'a',
198200 array( 'href' => $object->getTitle()->getFullUrl() ),
199201 $object->getTitle()->getText()
200 - );
 202+ ) . '<br />';
201203 }
202204 else {
203 - $title = $object->getLongText( $this->outputmode, $skin );
 205+ $text = $object->getLongText( $this->outputmode, $skin ) . '<br />';
204206 }
205207
206208 if ( $this->titleLinkSeperate ) {

Status & tagging log