r92426 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92425‎ | r92426 | r92427 >
Date:12:29, 18 July 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_JSONlink.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_JSONlink.php
@@ -58,12 +58,14 @@
5959 while ( ( /* array of SMWResultArray */ $row = $res->getNext() ) !== false ) {
6060 $rowsubject = false; // the wiki page value that this row is about
6161 $valuestack = array(); // contains Property-Value pairs to characterize an Item
 62+ $addedLabel = false;
6263
6364 foreach ( $row as /* SMWResultArray */ $field ) {
6465 $pr = $field->getPrintRequest();
6566
66 - if ( $rowsubject === false ) {
 67+ if ( $rowsubject === false && !$addedLabel ) {
6768 $valuestack[] = '"label": "' . $field->getResultSubject()->getTitle()->getFullText() . '"';
 69+ $addedLabel = true;
6870 }
6971
7072 if ( $pr->getMode() != SMWPrintRequest::PRINT_THIS ) {
@@ -74,7 +76,7 @@
7577 $finalvalues = '';
7678 switch ( $dataValue->getTypeID() ) {
7779 case '_geo':
78 - $values[] = '"' . $dataValue->getWikiValue() . '"';
 80+ $values[] = FormatJson::encode( $dataValue->getDataItem()->getCoordinateSet() );
7981 break;
8082 case '_num':
8183 $values[] = $dataValue->getDataItem()->getNumber();