Index: trunk/extensions/SemanticMediaWiki/RELEASE-NOTES |
— | — | @@ -14,6 +14,7 @@ |
15 | 15 | * Fixed display of properties of type URL (bug 30912). |
16 | 16 | * Fixed hide query functionality on Special:Ask (bug 30768). |
17 | 17 | * Fixed display of internal SMW helper constants in certain queries (bug 30969). |
| 18 | +* Fixed some issue with the category result format (including bug 30761). |
18 | 19 | |
19 | 20 | == SMW 1.6.1 == |
20 | 21 | |
Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Category.php |
— | — | @@ -3,8 +3,11 @@ |
4 | 4 | * Print query results in alphabetic groups displayed in columns, a la the |
5 | 5 | * standard Category pages and the default view in Semantic Drilldown. |
6 | 6 | * Based on SMW_QP_List by Markus Krötzsch. |
| 7 | + * |
7 | 8 | * @author David Loomer |
8 | 9 | * @author Yaron Koren |
| 10 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 11 | + * |
9 | 12 | * @file |
10 | 13 | * @ingroup SMWQuery |
11 | 14 | */ |
— | — | @@ -16,28 +19,32 @@ |
17 | 20 | */ |
18 | 21 | class SMWCategoryResultPrinter extends SMWResultPrinter { |
19 | 22 | |
20 | | - protected $mDelim = ','; |
21 | | - protected $mTemplate = ''; |
22 | | - protected $mUserParam = ''; |
23 | | - protected $mNumColumns = 3; |
| 23 | + protected $mDelim; |
| 24 | + protected $mTemplate; |
| 25 | + protected $mUserParam; |
| 26 | + protected $mNumColumns; |
24 | 27 | |
25 | | - protected function readParameters( $params, $outputmode ) { |
26 | | - parent::readParameters( $params, $outputmode ); |
27 | | - |
28 | | - if ( array_key_exists( 'delim', $params ) ) { |
29 | | - $this->mDelim = str_replace( '_', ' ', $params['delim'] ); |
30 | | - } |
31 | | - if ( array_key_exists( 'template', $params ) ) { |
32 | | - $this->mTemplate = trim( $params['template'] ); |
33 | | - } |
34 | | - if ( array_key_exists( 'userparam', $params ) ) { |
35 | | - $this->mUserParam = trim( $params['userparam'] ); |
36 | | - } |
37 | | - if ( array_key_exists( 'columns', $params ) ) { |
38 | | - $this->mNumColumns = (int)$params['columns']; |
39 | | - } |
| 28 | + public function __construct( $format, $inline, $useValidator = true ) { |
| 29 | + parent::__construct( $format, $inline, $useValidator ); |
40 | 30 | } |
41 | | - |
| 31 | + |
| 32 | + /** |
| 33 | + * @see SMWResultPrinter::handleParameters |
| 34 | + * |
| 35 | + * @since 1.6.2 |
| 36 | + * |
| 37 | + * @param array $params |
| 38 | + * @param $outputmode |
| 39 | + */ |
| 40 | + protected function handleParameters( array $params, $outputmode ) { |
| 41 | + parent::handleParameters( $params, $outputmode ); |
| 42 | + |
| 43 | + $this->mUserParam = trim( $params['userparam'] ); |
| 44 | + $this->mDelim = trim( $params['delim'] ); |
| 45 | + $this->mNumColumns = $params['columns']; |
| 46 | + $this->mTemplate = $params['template']; |
| 47 | + } |
| 48 | + |
42 | 49 | public function getName() { |
43 | 50 | smwfLoadExtensionMessages( 'SemanticMediaWiki' ); |
44 | 51 | return wfMsg( 'smw_printername_' . $this->mFormat ); |
— | — | @@ -186,8 +193,20 @@ |
187 | 194 | |
188 | 195 | $params['columns'] = new Parameter( 'columns', Parameter::TYPE_INTEGER ); |
189 | 196 | $params['columns']->setDescription( wfMsg( 'smw_paramdesc_columns', 3 ) ); |
190 | | - $params['columns']->setDefault( '', false ); |
| 197 | + $params['columns']->setDefault( 3, false ); |
191 | 198 | |
| 199 | + $params['delim'] = new Parameter( 'delim' ); |
| 200 | + $params['delim']->setDescription( wfMsg( 'smw-paramdesc-category-delim' ) ); |
| 201 | + $params['delim']->setDefault( ',' ); |
| 202 | + |
| 203 | + $params['template'] = new Parameter( 'template' ); |
| 204 | + $params['template']->setDescription( wfMsg( 'smw-paramdesc-category-template' ) ); |
| 205 | + $params['template']->setDefault( '' ); |
| 206 | + |
| 207 | + $params['userparam'] = new Parameter( 'userparam' ); |
| 208 | + $params['userparam']->setDescription( wfMsg( 'smw-paramdesc-category-userparam' ) ); |
| 209 | + $params['userparam']->setDefault( '' ); |
| 210 | + |
192 | 211 | return $params; |
193 | 212 | } |
194 | 213 | |
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php |
— | — | @@ -375,6 +375,11 @@ |
376 | 376 | 'smw_adminlinks_datastructure' => 'Data structure', |
377 | 377 | 'smw_adminlinks_displayingdata' => 'Data display', |
378 | 378 | 'smw_adminlinks_inlinequerieshelp' => 'Inline queries help', |
| 379 | + |
| 380 | + // Category QP |
| 381 | + 'smw-paramdesc-category-delim' => 'The delimiter', |
| 382 | + 'smw-paramdesc-category-template' => 'A template to format the items with', |
| 383 | + 'smw-paramdesc-category-userparam' => 'A parameter to pass to the template', |
379 | 384 | ); |
380 | 385 | |
381 | 386 | /** Message documentation (Message documentation) |