r112357 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112356‎ | r112357 | r112358 >
Date:21:20, 24 February 2012
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
added parameters param to smwdoc
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_SMWDoc.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/parserhooks/SMW_SMWDoc.php
@@ -62,6 +62,10 @@
6363 $params['language'] = new Parameter( 'language' );
6464 $params['language']->setDefault( $GLOBALS['wgLanguageCode'] );
6565 $params['language']->setMessage( 'smw-smwdoc-par-language' );
 66+
 67+ $params['parameters'] = new Parameter( 'parameters', Parameter::TYPE_STRING, 'specific' );
 68+ $params['parameters']->setMessage( 'smw-smwdoc-par-parameters' );
 69+ $params['parameters']->addCriteria( new CriterionInArray( 'all', 'specific', 'base' ) );
6670
6771 return $params;
6872 }
@@ -75,7 +79,7 @@
7680 * @return array
7781 */
7882 protected function getDefaultParameters( $type ) {
79 - return array( 'format', 'language' );
 83+ return array( 'format', 'language', 'parameters' );
8084 }
8185
8286 /**
@@ -91,7 +95,15 @@
9296 public function render( array $parameters ) {
9397 $this->language = $parameters['language'];
9498
95 - $params = $this->getFormatParameters( $parameters['format'] );
 99+ $params = array();
 100+
 101+ if ( in_array( $parameters['parameters'], array( 'all', 'base' ) ) ) {
 102+ $params = array_merge( $params, SMWQueryProcessor::getParameters() );
 103+ }
 104+
 105+ if ( in_array( $parameters['parameters'], array( 'all', 'specific' ) ) ) {
 106+ $params = array_merge( $params, $this->getFormatParameters( $parameters['format'] ) );
 107+ }
96108
97109 return $this->getParameterTable( $params );
98110 }
Index: trunk/extensions/SemanticMediaWiki/languages/SMW_Messages.php
@@ -93,6 +93,7 @@
9494 'smw-paramdesc-dsv-filename' => 'The name for the DSV file',
9595 'smw-smwdoc-description' => 'Shows a table of all parameters that can be used for the specified result format together with default values and descriptions.',
9696 'smw-smwdoc-par-format' => 'The result format to display parameter documentation for.',
 97+ 'smw-smwdoc-par-parameters' => 'Which parameters to show. "specific" for those added by the format, "base" for those available in all formats, and "all" for both.',
9798 'smw-paramdesc-sort' => 'Property to sort the query by',
9899 'smw-paramdesc-order' => 'Order of the query sort',
99100 'smw-paramdesc-searchlabel' => 'Text for continuing the search (default is «… further results»)',

Follow-up revisions

RevisionCommit summaryAuthorDate
r112398Follow up to r31457; message docsjeroendedauw16:29, 25 February 2012

Comments

#Comment by Raymond (talk | contribs)   09:03, 25 February 2012

Please add message documentation for the newly added messages. Thanks.

As far as I see the keywords "specific", "base", "all" may not be translated?

#Comment by Jeroen De Dauw (talk | contribs)   16:30, 25 February 2012

> Please add message documentation for the newly added messages. Thanks.

follow up

> As far as I see the keywords "specific", "base", "all" may not be translated?

Indeed. These are values in a parser hook. Is there any parser hook you know of that has internationalization for it's parameter values?

Status & tagging log