r97417 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97416‎ | r97417 | r97418 >
Date:13:58, 18 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
up rel notes and attempt to fix bug
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/RELEASE-NOTES (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QueryPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES
@@ -9,6 +9,7 @@
1010 * Added definitions for missing params (sort, order, searchlabel) to the base query printer.
1111 * Added validation and manipulation of the format paremeter using Validator.
1212 * Added class parameter to the table format which allows setting the css class.
 13+* Added alpha version of native SMW Ask API with moudles ask and askargs.
1314
1415 == SMW 1.6.1 ==
1516
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QueryPrinter.php
@@ -190,7 +190,7 @@
191191 return $result;
192192 }
193193 }
194 -
 194+
195195 // Get output from printer:
196196 $result = $this->getResultText( $results, $outputmode );
197197
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php
@@ -71,6 +71,11 @@
7272 * @param boolean $furtherRes
7373 */
7474 public function __construct( array $printRequests, SMWQuery $query, array $results, SMWStore $store, $furtherRes = false ) {
 75+ // FIXME: this is a evil hack treating the symptom of something going wrong closer to the store
 76+// if ( count( $results ) > 0 && $results[0]->getInterwiki() === SMW_SQL2_SMWBORDERIW ) {
 77+// unset( $results[0] );
 78+// }
 79+
7580 $this->mResults = $results;
7681 reset( $this->mResults );
7782 $this->mPrintRequests = $printRequests;
@@ -266,15 +271,22 @@
267272 }
268273
269274 foreach ( $this->mResults as /* SMWDIWikiPage */ $diWikiPage ) {
270 - $result = array();
 275+ $result = array( 'printeouts' => array() );
271276
272277 foreach ( $this->mPrintRequests as /* SMWPrintRequest */ $printRequest ) {
273278 $resultAarray = new SMWResultArray( $diWikiPage, $printRequest, $this->mStore );
274279
275 - $result[$printRequest->getLabel()] = array_map(
276 - array( __class__, 'getDataItemSerialization' ),
277 - $resultAarray->getContent()
278 - );
 280+ if ( $printRequest->getMode() === SMWPrintRequest::PRINT_THIS ) {
 281+ $dataItems = $resultAarray->getContent();
 282+ $result += $this->getDataItemSerialization( array_shift( $dataItems ) );
 283+ }
 284+ else {
 285+ $result['printeouts'][$printRequest->getLabel()] = array_map(
 286+ array( __class__, 'getDataItemSerialization' ),
 287+ $resultAarray->getContent()
 288+ );
 289+ }
 290+
279291 }
280292
281293 $results[$diWikiPage->getTitle()->getFullText()] = $result;
Index: trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php
@@ -61,12 +61,22 @@
6262 $result->setIndexedTagName( $serialized['results'], 'result' );
6363 $result->setIndexedTagName( $serialized['printrequests'], 'printrequest' );
6464
65 - $result->addValue( 'query', null, $serialized );
 65+ foreach ( $serialized['results'] as $subjectName => $subject ) {
 66+ if ( is_array( $subject ) && array_key_exists( 'printeouts', $subject ) ) {
 67+ foreach ( $subject['printeouts'] as $property => $values ) {
 68+ if ( is_array( $values ) ) {
 69+ $result->setIndexedTagName( $serialized['results'][$subjectName]['printeouts'][$property], 'value' );
 70+ }
 71+ }
 72+ }
 73+ }
6674
 75+ $result->addValue( null, 'query', $serialized );
 76+
6777 if ( $queryResult->hasFurtherResults() ) {
6878 // TODO: obtain continuation data from store
6979 $result->disableSizeCheck();
70 - $result->addValue( 'query-continue', null, 0 );
 80+ $result->addValue( null, 'query-continue', 0 );
7181 $result->enableSizeCheck();
7282 }
7383 }