r112059 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112058‎ | r112059 | r112060 >
Date:22:56, 21 February 2012
Author:foxtrott
Status:ok (Comments)
Tags:
Comment:
activate "sep" parameter for result printers "ul", "ol"
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_List.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_List.php
@@ -37,7 +37,7 @@
3838 protected function handleParameters( array $params, $outputmode ) {
3939 parent::handleParameters( $params, $outputmode );
4040
41 - $this->mSep = $this->isPlainlist() ? $params['sep'] : '';
 41+ $this->mSep = $params['sep'];
4242 $this->mTemplate = trim( $params['template'] );
4343 $this->mNamedArgs = $params['named args'];
4444 $this->mUserParam = trim( $params['userparam'] );
@@ -63,8 +63,6 @@
6464 $rowstart = "\t<li>";
6565 $rowend = "</li>\n";
6666 $plainlist = false;
67 - $finallistsep = '';
68 - $listsep = '';
6967 } else { // "list" and "template" format
7068 $header = '';
7169 $footer = '';
@@ -72,18 +70,24 @@
7371 $rowend = '';
7472 $plainlist = true;
7573
76 - if ( $this->mSep !== '' ) { // always respect custom separator
77 - $listsep = $this->mSep;
78 - $finallistsep = $listsep;
79 - } elseif ( $this->mFormat == 'list' ) { // make default list ", , , and "
80 - $listsep = ', ';
81 - $finallistsep = wfMsgForContent( 'smw_finallistconjunct' ) . ' ';
82 - } else { // no default separators for format "template"
83 - $listsep = '';
84 - $finallistsep = '';
85 - }
8674 }
8775
 76+ if ( $this->mSep !== '' ) { // always respect custom separator
 77+ $listsep = $this->mSep;
 78+ $finallistsep = $listsep;
 79+ } elseif ( $this->mFormat == 'list' ) { // make default list ", , , and "
 80+ // TODO: No default separator for "ul" and "ol" to not break
 81+ // compatibility with SMW pre 1.7.1. But they really should have
 82+ // default separators, i.e. the check should be for
 83+ // $this->mFormat !== 'template'
 84+
 85+ $listsep = ', ';
 86+ $finallistsep = wfMsgForContent( 'smw_finallistconjunct' ) . ' ';
 87+ } else { // no default separators for format "template", "ul", "ol"
 88+ $listsep = '';
 89+ $finallistsep = '';
 90+ }
 91+
8892 // Initialise more values
8993 $result = '';
9094 $column_width = 0;
@@ -285,12 +289,10 @@
286290 public function getParameters() {
287291 $params = array_merge( parent::getParameters(), parent::textDisplayParameters() );
288292
289 - if ( $this->isPlainlist() ) {
290 - $params['sep'] = new Parameter( 'sep' );
291 - $params['sep']->setMessage( 'smw_paramdesc_sep' );
292 - $params['sep']->setDefault( '' );
293 - }
294 -
 293+ $params['sep'] = new Parameter( 'sep' );
 294+ $params['sep']->setMessage( 'smw_paramdesc_sep' );
 295+ $params['sep']->setDefault( '' );
 296+
295297 $params['template'] = new Parameter( 'template' );
296298 $params['template']->setMessage( 'smw_paramdesc_template' );
297299 $params['template']->setDefault( '' );

Comments

#Comment by Nikerabbit (talk | contribs)   08:58, 22 February 2012

It works, thanks.

Status & tagging log