| Index: trunk/extensions/Validator/includes/ParameterInput.php |
| — | — | @@ -102,7 +102,7 @@ |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | 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]; |
| 107 | 107 | $html = $this->param->isList() ? $this->getChckboxListInput( $valueList ) : $this->getSelectInput( $valueList ); |
| 108 | 108 | } |
| 109 | 109 | else { |
| — | — | @@ -146,7 +146,7 @@ |
| 147 | 147 | protected function getNumberInput() { |
| 148 | 148 | return Html::input( |
| 149 | 149 | $this->inputName, |
| 150 | | - $this->currentValue, |
| | 150 | + $this->getValueToUse(), |
| 151 | 151 | 'text', |
| 152 | 152 | array( |
| 153 | 153 | 'size' => 6 |
| — | — | @@ -164,7 +164,7 @@ |
| 165 | 165 | protected function getStrInput() { |
| 166 | 166 | return Html::input( |
| 167 | 167 | $this->inputName, |
| 168 | | - $this->currentValue, |
| | 168 | + $this->getValueToUse(), |
| 169 | 169 | 'text', |
| 170 | 170 | array( |
| 171 | 171 | 'size' => 32 |
| — | — | @@ -182,7 +182,7 @@ |
| 183 | 183 | protected function getBooleanInput() { |
| 184 | 184 | return Xml::check( |
| 185 | 185 | $this->inputName, |
| 186 | | - $this->currentValue |
| | 186 | + $this->getValueToUse() |
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | 189 | |
| — | — | @@ -199,14 +199,17 @@ |
| 200 | 200 | $options = array(); |
| 201 | 201 | $options[] = '<option value=""></option>'; |
| 202 | 202 | |
| | 203 | + $currentValues = $this->getValueToUse(); |
| | 204 | + if ( is_null( $currentValues ) ) $currentValues = array(); |
| | 205 | + |
| 203 | 206 | foreach ( $valueList as $value ) { |
| 204 | 207 | $options[] = |
| 205 | 208 | '<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>'; |
| 208 | 211 | } |
| 209 | 212 | |
| 210 | | - return Html::element( |
| | 213 | + return Html::rawElement( |
| 211 | 214 | 'select', |
| 212 | 215 | array( |
| 213 | 216 | 'name' => $this->inputName |
| — | — | @@ -227,6 +230,9 @@ |
| 228 | 231 | protected function getCheckboxListInput( array $valueList ) { |
| 229 | 232 | $boxes = array(); |
| 230 | 233 | |
| | 234 | + $currentValues = $this->getValueToUse(); |
| | 235 | + if ( is_null( $currentValues ) ) $currentValues = array(); |
| | 236 | + |
| 231 | 237 | foreach ( $valueList as $value ) { |
| 232 | 238 | $boxes[] = Html::rawElement( |
| 233 | 239 | 'span', |
| — | — | @@ -235,7 +241,7 @@ |
| 236 | 242 | ), |
| 237 | 243 | Xml::check( |
| 238 | 244 | $this->inputName . '[' . htmlspecialchars( $value ). ']', |
| 239 | | - in_array( $value, $this->currentValue ) |
| | 245 | + in_array( $value, $currentValues ) |
| 240 | 246 | ) . |
| 241 | 247 | Html::element( 'tt', $value ) |
| 242 | 248 | ); |