r85212 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:< r85211‎ | r85212 | r85213 >
Date:21:49, 2 April 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r85208
Modified paths:
  • /trunk/extensions/Validator/includes/ParameterInput.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/includes/ParameterInput.php
——@@ -102,7 +102,7 @@
103103 }
104104
105105 if ( count( $valueList ) > 0 ) {
106 - $valueList = call_user_func_array( 'array_intersect', $valueList );
 106+ $valueList = count( $valueList ) > 1 ? call_user_func_array( 'array_intersect', $valueList ) : $valueList[0];
107107 $html = $this->param->isList() ? $this->getChckboxListInput( $valueList ) : $this->getSelectInput( $valueList );
108108 }
109109 else {
——@@ -146,7 +146,7 @@
147147 protected function getNumberInput() {
148148 return Html::input(
149149 $this->inputName,
150 - $this->currentValue,
 150+ $this->getValueToUse(),
151151 'text',
152152 array(
153153 'size' => 6
——@@ -164,7 +164,7 @@
165165 protected function getStrInput() {
166166 return Html::input(
167167 $this->inputName,
168 - $this->currentValue,
 168+ $this->getValueToUse(),
169169 'text',
170170 array(
171171 'size' => 32
——@@ -182,7 +182,7 @@
183183 protected function getBooleanInput() {
184184 return Xml::check(
185185 $this->inputName,
186 - $this->currentValue
 186+ $this->getValueToUse()
187187 );
188188 }
189189
——@@ -199,14 +199,17 @@
200200 $options = array();
201201 $options[] = '<option value=""></option>';
202202
 203+ $currentValues = $this->getValueToUse();
 204+ if ( is_null( $currentValues ) ) $currentValues = array();
 205+
203206 foreach ( $valueList as $value ) {
204207 $options[] =
205208 '<option value="' . htmlspecialchars( $value ) . '"' .
206 - ( in_array( $value, $this->currentValue ) ? ' selected' : '' ) . '>' . htmlspecialchars( $value ) .
207 - '</option>'; // TODO
 209+ ( in_array( $value, $currentValues ) ? ' selected' : '' ) . '>' . htmlspecialchars( $value ) .
 210+ '</option>';
208211 }
209212
210 - return Html::element(
 213+ return Html::rawElement(
211214 'select',
212215 array(
213216 'name' => $this->inputName
——@@ -227,6 +230,9 @@
228231 protected function getCheckboxListInput( array $valueList ) {
229232 $boxes = array();
230233
 234+ $currentValues = $this->getValueToUse();
 235+ if ( is_null( $currentValues ) ) $currentValues = array();
 236+
231237 foreach ( $valueList as $value ) {
232238 $boxes[] = Html::rawElement(
233239 'span',
——@@ -235,7 +241,7 @@
236242 ),
237243 Xml::check(
238244 $this->inputName . '[' . htmlspecialchars( $value ). ']',
239 - in_array( $value, $this->currentValue )
 245+ in_array( $value, $currentValues )
240246 ) .
241247 Html::element( 'tt', $value )
242248 );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85208follow up to r85201jeroendedauw20:12, 2 April 2011

Status & tagging log