Index: trunk/extensions/UsabilityInitiative/PrefSwitch/PrefSwitch.classes.php |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | 'boolean' => 'PrefSwitchSurveyFieldBoolean', |
14 | 14 | 'dimensions' => 'PrefSwitchSurveyFieldDimensions', |
15 | 15 | 'text' => 'PrefSwitchSurveyFieldText', |
| 16 | + 'smallinput' => 'PrefSwitchSurveyFieldSmallInput', |
16 | 17 | ); |
17 | 18 | |
18 | 19 | /* Static Functions */ |
— | — | @@ -345,3 +346,23 @@ |
346 | 347 | ); |
347 | 348 | } |
348 | 349 | } |
| 350 | + |
| 351 | +class PrefSwitchSurveyFieldSmallInput implements PrefSwitchSurveyField { |
| 352 | + |
| 353 | + /* Static Functions */ |
| 354 | + |
| 355 | + public static function render( $question, $config, $answer, $answerData ) { |
| 356 | + $html = Xml::tags( 'dt', null, wfMsgWikiHtml( $config['question'] ) ); |
| 357 | + $html .= Xml::tags( |
| 358 | + 'dd', null, Xml::input( "prefswitch-survey-{$question}", 5, $answerData ? $answerData : '' ) |
| 359 | + ); |
| 360 | + return $html; |
| 361 | + } |
| 362 | + public static function save( $question, $request ) { |
| 363 | + $answer = $request->getVal( "prefswitch-survey-{$question}" ); |
| 364 | + return array( |
| 365 | + 'pss_answer' => null, |
| 366 | + 'pss_answer_data' => $answer !== '' ? $answer : null, |
| 367 | + ); |
| 368 | + } |
| 369 | +} |