r97972 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97971‎ | r97972 | r97973 >
Date:23:02, 23 September 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r97968, preserve form values
Modified paths:
  • /trunk/extensions/MoodBar/SpecialMoodBarFeedback.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MoodBar/SpecialMoodBarFeedback.php
@@ -36,6 +36,7 @@
3737 }
3838
3939 public function buildForm() {
 40+ global $wgRequest;
4041 $filtersMsg = wfMessage( 'moodbar-feedback-filters' )->escaped();
4142 $typeMsg = wfMessage( 'moodbar-feedback-filters-type' )->escaped();
4243 $praiseMsg = wfMessage( 'moodbar-feedback-filters-type-happy' )->escaped();
@@ -45,6 +46,16 @@
4647 $setFiltersMsg = wfMessage( 'moodbar-feedback-filters-button' )->escaped();
4748 $whatIsMsg = wfMessage( 'moodbar-feedback-whatis' )->escaped();
4849
 50+ $types = $wgRequest->getArray( 'type' );
 51+ $happyCheckbox = Xml::check( 'type[]', in_array( 'happy', $types ),
 52+ array( 'id' => 'fbd-filters-type-praise', 'value' => 'happy' ) );
 53+ $confusedCheckbox = Xml::check( 'type[]', in_array( 'confused', $types ),
 54+ array( 'id' => 'fbd-filters-type-confusion', 'value' => 'confused' ) );
 55+ $sadCheckbox = Xml::check( 'type[]', in_array( 'sad', $types ),
 56+ array( 'id' => 'fbd-filters-type-issues', 'value' => 'sad' ) );
 57+ $usernameTextbox = Html::input( 'username', $wgRequest->getText( 'username' ), 'text',
 58+ array( 'id' => 'fbd-filters-username', 'class' => 'fbd-filters-input' ) );
 59+
4960 return <<<HTML
5061 <div id="fbd-filters">
5162 <form>
@@ -53,21 +64,21 @@
5465 <legend class="fbd-filters-label">$typeMsg</legend>
5566 <ul>
5667 <li>
57 - <input type="checkbox" id="fbd-filters-type-praise" name="type[]" value="happy">
 68+ $happyCheckbox
5869 <label for="fbd-filters-type-praise" id="fbd-filters-type-praise-label">$praiseMsg</label>
5970 </li>
6071 <li>
61 - <input type="checkbox" id="fbd-filters-type-confusion" name="type[]" value="confused">
 72+ $confusedCheckbox
6273 <label for="fbd-filters-type-confusion" id="fbd-filters-type-confusion-label">$confusionMsg</label>
6374 </li>
6475 <li>
65 - <input type="checkbox" id="fbd-filters-type-issues" name="type[]" value="sad">
 76+ $sadCheckbox
6677 <label for="fbd-filters-type-issues" id="fbd-filters-type-issues-label">$issuesMsg</label>
6778 </li>
6879 </ul>
6980 </fieldset>
7081 <label for="fbd-filters-username" class="fbd-filters-label">$usernameMsg</label>
71 - <input type="text" id="fbd-filters-username" class="fbd-filters-input" name="username" />
 82+ $usernameTextbox
7283 <button type="submit" id="fbd-filters-set">$setFiltersMsg</button>
7384 </form>
7485 <a href="#" id="fbd-about">$whatIsMsg</a>

Follow-up revisions

RevisionCommit summaryAuthorDate
r97992Fix notice in r97972. I figured getArray would return, well, an *array*, but ...catrope11:47, 24 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97968MoodBar: Implement filtering in Special:MoodBarFeedback. Doesn't preserve for...catrope22:44, 23 September 2011

Status & tagging log