Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php |
— | — | @@ -370,7 +370,7 @@ |
371 | 371 | if ( array_key_exists( 'order', $this->m_params ) ) $urlArgs['order'] = $this->m_params['order']; |
372 | 372 | |
373 | 373 | if ( $this->m_querystring != '' ) { |
374 | | - $params = SMWQueryProcessor::getProcessedParams( $this->m_params ); |
| 374 | + $params = SMWQueryProcessor::getProcessedParams( $this->m_params, $this->m_printouts ); |
375 | 375 | $this->m_params['format'] = $params['format']; |
376 | 376 | |
377 | 377 | $queryobj = SMWQueryProcessor::createQuery( |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryProcessor.php |
— | — | @@ -81,6 +81,10 @@ |
82 | 82 | $qp->setDefaultNamespaces( $smwgQDefaultNamespaces ); |
83 | 83 | $desc = $qp->getQueryDescription( $querystring ); |
84 | 84 | |
| 85 | + if ( $format === '' ) { |
| 86 | + $format = $params['format']; |
| 87 | + } |
| 88 | + |
85 | 89 | if ( $format == 'count' ) { |
86 | 90 | $querymode = SMWQuery::MODE_COUNT; |
87 | 91 | } elseif ( $format == 'debug' ) { |
Index: trunk/extensions/SemanticMediaWiki/includes/params/SMW_ParamFormat.php |
— | — | @@ -46,10 +46,6 @@ |
47 | 47 | // Add the formats parameters to the parameter list. |
48 | 48 | $queryPrinter = SMWQueryProcessor::getResultPrinter( $value ); |
49 | 49 | |
50 | | - if ( $queryPrinter instanceof SMWAutoResultPrinter ) { |
51 | | - $queryPrinter->determineFormat(); |
52 | | - } |
53 | | - |
54 | 50 | $parameters = array_merge( $parameters, $queryPrinter->getValidatorParameters() ); |
55 | 51 | } |
56 | 52 | |
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Auto.php |
— | — | @@ -1,97 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Print query results in tables or lists, depending on their shape. |
5 | | - * This implements the automatic printer selection used in SMW if no |
6 | | - * query format is specified. |
7 | | - * |
8 | | - * @file |
9 | | - * @ingroup SMWQuery |
10 | | - * |
11 | | - * @author Markus Krötzsch |
12 | | - * @author Jeroen De Dauw |
13 | | - */ |
14 | | - |
15 | | -/** |
16 | | - * New implementation of SMW's printer for automatically selecting the |
17 | | - * format for printing a result. |
18 | | - * |
19 | | - * @ingroup SMWQuery |
20 | | - */ |
21 | | -class SMWAutoResultPrinter extends SMWResultPrinter { |
22 | | - |
23 | | - protected $format = false; |
24 | | - |
25 | | - /** |
26 | | - * @see SMWResultPrinter::getResult |
27 | | - * |
28 | | - * @param $results SMWQueryResult |
29 | | - * @param $params array |
30 | | - * @param $outputmode integer |
31 | | - * |
32 | | - * @return string |
33 | | - */ |
34 | | - public function getResult( SMWQueryResult $results, array $params, $outputmode ) { |
35 | | - $this->determineFormat( $results, $params ); |
36 | | - |
37 | | - $printer = SMWQueryProcessor::getResultPrinter( |
38 | | - $this->format, |
39 | | - $this->mInline ? SMWQueryProcessor::INLINE_QUERY : SMWQueryProcessor::SPECIAL_PAGE |
40 | | - ); |
41 | | - |
42 | | - return $printer->getResult( $results, $params, $outputmode ); |
43 | | - } |
44 | | - |
45 | | - /** |
46 | | - * @see SMWResultPrinter::getResultText |
47 | | - * |
48 | | - * @param SMWQueryResult $res |
49 | | - * @param $outputmode |
50 | | - */ |
51 | | - protected function getResultText( SMWQueryResult $res, $outputmode ) { |
52 | | - return ''; // acutally not needed in this implementation |
53 | | - } |
54 | | - |
55 | | - public function getName() { |
56 | | - smwfLoadExtensionMessages( 'SemanticMediaWiki' ); |
57 | | - return wfMsg( 'smw_printername_auto' ); |
58 | | - } |
59 | | - |
60 | | - /** |
61 | | - * (non-PHPdoc) |
62 | | - * @see SMWResultPrinter::getParameters() |
63 | | - * |
64 | | - * To work correctly as of 1.6.2, you need to call determineFormat first. |
65 | | - */ |
66 | | - public function getParameters() { |
67 | | - $printer = SMWQueryProcessor::getResultPrinter( |
68 | | - $this->format, |
69 | | - $this->mInline ? SMWQueryProcessor::INLINE_QUERY : SMWQueryProcessor::SPECIAL_PAGE |
70 | | - ); |
71 | | - |
72 | | - return $printer->getParameters(); |
73 | | - } |
74 | | - |
75 | | - /** |
76 | | - * Determine the format, based on the result and provided parameters. |
77 | | - * |
78 | | - * @since 1.6.2 |
79 | | - * |
80 | | - * @param SMWQueryResult $results |
81 | | - * @param array $params |
82 | | - * |
83 | | - * @return string |
84 | | - */ |
85 | | - public function determineFormat( SMWQueryResult $results = null, array $params = null ) { |
86 | | - if ( $this->format === false ) { |
87 | | - if ( is_null( $results ) || is_null( $params ) ) { |
88 | | - $this->format = 'table'; |
89 | | - } |
90 | | - else { |
91 | | - |
92 | | - } |
93 | | - } |
94 | | - |
95 | | - return $this->format; |
96 | | - } |
97 | | - |
98 | | -} |
Index: trunk/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php |
— | — | @@ -23,21 +23,13 @@ |
24 | 24 | protected $parameters; |
25 | 25 | |
26 | 26 | /** |
27 | | - * Query printeouts. |
28 | 27 | * |
29 | | - * @since 1.6.2 |
30 | | - * @var array |
31 | | - */ |
32 | | - protected $printeouts; |
33 | | - |
34 | | - /** |
35 | | - * |
36 | 28 | * @return SMWQuery |
37 | 29 | */ |
38 | 30 | protected function getQuery( $queryString, array $printeouts ) { |
39 | 31 | return SMWQueryProcessor::createQuery( |
40 | 32 | $queryString, |
41 | | - SMWQueryProcessor::getProcessedParams( $this->parameters ), |
| 33 | + SMWQueryProcessor::getProcessedParams( $this->parameters, $printeouts ), |
42 | 34 | SMWQueryProcessor::SPECIAL_PAGE, |
43 | 35 | '', |
44 | 36 | $printeouts |