Index: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES |
— | — | @@ -9,6 +9,7 @@ |
10 | 10 | * Added definitions for missing params (sort, order, searchlabel) to the base query printer. |
11 | 11 | * Added validation and manipulation of the format paremeter using Validator. |
12 | 12 | * 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. |
13 | 14 | |
14 | 15 | == SMW 1.6.1 == |
15 | 16 | |
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QueryPrinter.php |
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | return $result; |
192 | 192 | } |
193 | 193 | } |
194 | | - |
| 194 | + |
195 | 195 | // Get output from printer: |
196 | 196 | $result = $this->getResultText( $results, $outputmode ); |
197 | 197 | |
Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_QueryResult.php |
— | — | @@ -71,6 +71,11 @@ |
72 | 72 | * @param boolean $furtherRes |
73 | 73 | */ |
74 | 74 | 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 | + |
75 | 80 | $this->mResults = $results; |
76 | 81 | reset( $this->mResults ); |
77 | 82 | $this->mPrintRequests = $printRequests; |
— | — | @@ -266,15 +271,22 @@ |
267 | 272 | } |
268 | 273 | |
269 | 274 | foreach ( $this->mResults as /* SMWDIWikiPage */ $diWikiPage ) { |
270 | | - $result = array(); |
| 275 | + $result = array( 'printeouts' => array() ); |
271 | 276 | |
272 | 277 | foreach ( $this->mPrintRequests as /* SMWPrintRequest */ $printRequest ) { |
273 | 278 | $resultAarray = new SMWResultArray( $diWikiPage, $printRequest, $this->mStore ); |
274 | 279 | |
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 | + |
279 | 291 | } |
280 | 292 | |
281 | 293 | $results[$diWikiPage->getTitle()->getFullText()] = $result; |
Index: trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php |
— | — | @@ -61,12 +61,22 @@ |
62 | 62 | $result->setIndexedTagName( $serialized['results'], 'result' ); |
63 | 63 | $result->setIndexedTagName( $serialized['printrequests'], 'printrequest' ); |
64 | 64 | |
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 | + } |
66 | 74 | |
| 75 | + $result->addValue( null, 'query', $serialized ); |
| 76 | + |
67 | 77 | if ( $queryResult->hasFurtherResults() ) { |
68 | 78 | // TODO: obtain continuation data from store |
69 | 79 | $result->disableSizeCheck(); |
70 | | - $result->addValue( 'query-continue', null, 0 ); |
| 80 | + $result->addValue( null, 'query-continue', 0 ); |
71 | 81 | $result->enableSizeCheck(); |
72 | 82 | } |
73 | 83 | } |