r92663 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92662‎ | r92663 | r92664 >
Date:18:59, 20 July 2011
Author:devayon
Status:deferred
Tags:
Comment:
follow-up to r92532 ( fixed ui error related format selector)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -624,15 +624,15 @@
625625 protected function showFormatOptions( $format, array $paramValues ) {
626626 $printer = SMWQueryProcessor::getResultPrinter( $format, SMWQueryProcessor::SPECIAL_PAGE );
627627
628 - $params = method_exists( $printer, 'getParameters' ) ? $printer->getParameters() : array();
 628+ $params = method_exists( $printer, 'getValidatorParameters' ) ? $printer->getValidatorParameters() : array();
629629
630 - // Ignore the format parameter, as we got a special control in the GUI for it already.
631 - unset( $params['format'] );
632 -
633630 $optionsHtml = array();
634631
635632 foreach ( $params as $param ) {
636 - $param = $this->tovalidatorParam($param);
 633+ // Ignore the format parameter, as we got a special control in the GUI for it already.
 634+ if( $param->getName() == 'format') {
 635+ continue;
 636+ }
637637 $currentValue = array_key_exists( $param->getName(), $paramValues ) ? $paramValues[$param->getName()] : false;
638638
639639 $optionsHtml[] =
@@ -675,45 +675,6 @@
676676 }
677677
678678 /**
679 - * Returns a Validator style Parameter definition.
680 - * SMW 1.5.x style definitions are converted.
681 - *
682 - * @param mixed $param Parameter or array
683 - *
684 - * @return Parameter
685 - */
686 - private function toValidatorParam( $param ) {
687 - static $typeMap = array(
688 - 'int' => Parameter::TYPE_INTEGER
689 - );
690 -
691 - if ( !( $param instanceof Parameter ) ) {
692 - if ( !array_key_exists( 'type', $param ) ) {
693 - $param['type'] = 'string';
694 - }
695 -
696 - $paramClass = $param['type'] == 'enum-list' ?
697 - 'ListParameter' : 'Parameter';
698 - $paramType = array_key_exists( $param['type'], $typeMap ) ?
699 - $typeMap[$param['type']] : Parameter::TYPE_STRING;
700 -
701 - $parameter = new $paramClass( $param['name'], $paramType );
702 -
703 - if ( array_key_exists( 'description', $param ) ) {
704 - $parameter->setDescription( $param['description'] );
705 - }
706 -
707 - if ( array_key_exists( 'values', $param ) && is_array( $param['values'] ) ) {
708 - $parameter->addCriteria( new CriterionInArray( $param['values'] ) );
709 - }
710 -
711 - return $parameter;
712 - } else {
713 - return $param;
714 - }
715 - }
716 -
717 - /**
718679 * Get the HTML for a single parameter input.
719680 * A helper method for showFormatOptions()
720681 *

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92532Cleanup based on r92356devayon13:23, 19 July 2011