r92532 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92531‎ | r92532 | r92533 >
Date:13:23, 19 July 2011
Author:devayon
Status:deferred
Tags:
Comment:
Cleanup based on r92356
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_QueryUIHelper.php
@@ -624,7 +624,7 @@
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
630630 // Ignore the format parameter, as we got a special control in the GUI for it already.
631631 unset( $params['format'] );
@@ -632,7 +632,6 @@
633633 $optionsHtml = array();
634634
635635 foreach ( $params as $param ) {
636 - $param = $this->toValidatorParam( $param );
637636 $currentValue = array_key_exists( $param->getName(), $paramValues ) ? $paramValues[$param->getName()] : false;
638637
639638 $optionsHtml[] =
@@ -675,45 +674,6 @@
676675 }
677676
678677 /**
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 - /**
718678 * Get the HTML for a single parameter input.
719679 * A helper method for showFormatOptions()
720680 *

Follow-up revisions

RevisionCommit summaryAuthorDate
r92663follow-up to r92532 ( fixed ui error related format selector)devayon18:59, 20 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92356added smwdoc parser hook to auto generate parameter documentation tables for ...jeroendedauw14:24, 16 July 2011