Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php |
— | — | @@ -704,6 +704,9 @@ |
705 | 705 | |
706 | 706 | $params = method_exists( $printer, 'getParameters' ) ? $printer->getParameters() : array(); |
707 | 707 | |
| 708 | + // Ignore the format parameter, as we got a special control in the GUI for it already. |
| 709 | + unset( $params['format'] ); |
| 710 | + |
708 | 711 | $optionsHtml = array(); |
709 | 712 | |
710 | 713 | foreach ( $params as $param ) { |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QueryPrinter.php |
— | — | @@ -59,6 +59,15 @@ |
60 | 60 | protected $mLinker; // Linker object as needed for making result links. Might come from some skin at some time. |
61 | 61 | |
62 | 62 | /** |
| 63 | + * List of errors that occured while processing the parameters. |
| 64 | + * |
| 65 | + * @since 1.6 |
| 66 | + * |
| 67 | + * @var array |
| 68 | + */ |
| 69 | + protected $mErrors = array(); |
| 70 | + |
| 71 | + /** |
63 | 72 | * If set, treat result as plain HTML. Can be used by printer classes if wiki mark-up is not enough. |
64 | 73 | * This setting is used only after the result text was generated. |
65 | 74 | * @note HTML query results cannot be used as parameters for other templates or in any other way |
— | — | @@ -285,7 +294,7 @@ |
286 | 295 | throw new Exception( 'Validator: fatal param validation error' ); |
287 | 296 | } |
288 | 297 | else { |
289 | | - // TODO: keep track of non-fatal errors to display |
| 298 | + $this->mErrors = $validator->getErrorMessages(); |
290 | 299 | return $validator->getParameterValues(); |
291 | 300 | } |
292 | 301 | } |
— | — | @@ -469,10 +478,12 @@ |
470 | 479 | * Can be used if not specific error formatting is desired. Compatible with HTML |
471 | 480 | * and Wiki. |
472 | 481 | * |
| 482 | + * @param SMWQueryResult $res |
| 483 | + * |
473 | 484 | * @return string |
474 | 485 | */ |
475 | | - public function getErrorString( $res ) { |
476 | | - return $this->mShowErrors ? smwfEncodeMessages( $res->getErrors() ) : ''; |
| 486 | + public function getErrorString( SMWQueryResult $res ) { |
| 487 | + return $this->mShowErrors ? smwfEncodeMessages( array_merge( $this->mErrors, $res->getErrors() ) ) : ''; |
477 | 488 | } |
478 | 489 | |
479 | 490 | /** |
— | — | @@ -514,6 +525,18 @@ |
515 | 526 | protected function linkFurtherResults( $results ) { |
516 | 527 | return ( $this->mInline && $results->hasFurtherResults() && ( $this->mSearchlabel !== '' ) ); |
517 | 528 | } |
| 529 | + |
| 530 | + /** |
| 531 | + * Adds an error message for a parameter handling error so a list |
| 532 | + * of errors can be created later on. |
| 533 | + * |
| 534 | + * @since 1.6 |
| 535 | + * |
| 536 | + * @param string $errorMessage |
| 537 | + */ |
| 538 | + protected function addError( $errorMessage ) { |
| 539 | + $this->mErrors[] = $errorMessage; |
| 540 | + } |
518 | 541 | |
519 | 542 | /** |
520 | 543 | * Return an array describing the parameters of specifically text-based |
— | — | @@ -572,6 +595,8 @@ |
573 | 596 | public function getParameters() { |
574 | 597 | $params = array(); |
575 | 598 | |
| 599 | + $params['format'] = new Parameter( 'format' ); |
| 600 | + |
576 | 601 | $params['limit'] = new Parameter( 'limit', Parameter::TYPE_INTEGER ); |
577 | 602 | $params['limit']->setDescription( wfMsg( 'smw_paramdesc_limit' ) ); |
578 | 603 | $params['limit']->setDefault( 20 ); |