r88595 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88594‎ | r88595 | r88596 >
Date:19:21, 22 May 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 28272) Special:Allmessages should have only one "Go" button

Patch by MZMcBride
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -38,7 +38,6 @@
3939 added to the textarea on the edit form.
4040 * mw.util.getScript has been implemented (like wfScript in GlobalFunctions.php)
4141
42 -
4342 === Bug fixes in 1.19 ===
4443 * (bug 10154) Don't allow user to specify days beyond $wgRCMaxAge.
4544 * (bug 28868) Show total pages in the subtitle of an image on the
@@ -75,9 +74,9 @@
7675 * (bug 29055) Make don't send email on minor edits preference apply to
7776 changes to talk page in addition to watchlist edits.
7877 * (bug 29071) mediawiki.action.watch.ajax.js should pass uselang to API.
 78+* (bug 28272) Special:Allmessages should have only one "Go" button
7979
8080 === API changes in 1.19 ===
81 -
8281 * BREAKING CHANGE: action=watch now requires POST and token.
8382 * (bug 27790) add query type for querymodules to action=paraminfo
8483 * (bug 28963) add langbacklinks module to api
Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -34,8 +34,6 @@
3535 */
3636 protected $table;
3737
38 - protected $filter, $prefix, $langCode;
39 -
4038 /**
4139 * Constructor
4240 */
@@ -75,91 +73,25 @@
7674
7775 $this->langCode = $this->table->lang->getCode();
7876
79 - $out->addHTML( $this->buildForm() .
 77+ $out->addHTML( $this->table->buildForm() .
8078 $this->table->getNavigationBar() .
81 - $this->table->getLimitForm() .
8279 $this->table->getBody() .
8380 $this->table->getNavigationBar() );
8481
8582 }
8683
87 - function buildForm() {
88 - global $wgScript;
 84+}
8985
90 - $languages = Language::getLanguageNames( false );
91 - ksort( $languages );
9286
93 - $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) .
94 - Xml::fieldset( wfMsg( 'allmessages-filter-legend' ) ) .
95 - Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
96 - Xml::openElement( 'table', array( 'class' => 'mw-allmessages-table' ) ) . "\n" .
97 - '<tr>
98 - <td class="mw-label">' .
99 - Xml::label( wfMsg( 'allmessages-prefix' ), 'mw-allmessages-form-prefix' ) .
100 - "</td>\n
101 - <td class=\"mw-input\">" .
102 - Xml::input( 'prefix', 20, str_replace( '_', ' ', $this->prefix ), array( 'id' => 'mw-allmessages-form-prefix' ) ) .
103 - "</td>\n
104 - </tr>
105 - <tr>\n
106 - <td class='mw-label'>" .
107 - wfMsg( 'allmessages-filter' ) .
108 - "</td>\n
109 - <td class='mw-input'>" .
110 - Xml::radioLabel( wfMsg( 'allmessages-filter-unmodified' ),
111 - 'filter',
112 - 'unmodified',
113 - 'mw-allmessages-form-filter-unmodified',
114 - ( $this->filter == 'unmodified' )
115 - ) .
116 - Xml::radioLabel( wfMsg( 'allmessages-filter-all' ),
117 - 'filter',
118 - 'all',
119 - 'mw-allmessages-form-filter-all',
120 - ( $this->filter == 'all' )
121 - ) .
122 - Xml::radioLabel( wfMsg( 'allmessages-filter-modified' ),
123 - 'filter',
124 - 'modified',
125 - 'mw-allmessages-form-filter-modified',
126 - ( $this->filter == 'modified' )
127 - ) .
128 - "</td>\n
129 - </tr>
130 - <tr>\n
131 - <td class=\"mw-label\">" .
132 - Xml::label( wfMsg( 'allmessages-language' ), 'mw-allmessages-form-lang' ) .
133 - "</td>\n
134 - <td class=\"mw-input\">" .
135 - Xml::openElement( 'select', array( 'id' => 'mw-allmessages-form-lang', 'name' => 'lang' ) );
13687
137 - foreach( $languages as $lang => $name ) {
138 - $selected = $lang == $this->langCode;
139 - $out .= Xml::option( $lang . ' - ' . $name, $lang, $selected ) . "\n";
140 - }
141 - $out .= Xml::closeElement( 'select' ) .
142 - "</td>\n
143 - </tr>
144 - <tr>\n
145 - <td></td>
146 - <td>" .
147 - Xml::submitButton( wfMsg( 'allmessages-filter-submit' ) ) .
148 - "</td>\n
149 - </tr>" .
150 - Xml::closeElement( 'table' ) .
151 - $this->table->getHiddenFields( array( 'title', 'prefix', 'filter', 'lang' ) ) .
152 - Xml::closeElement( 'fieldset' ) .
153 - Xml::closeElement( 'form' );
154 - return $out;
155 - }
156 -}
157 -
15888 /**
15989 * Use TablePager for prettified output. We have to pretend that we're
16090 * getting data from a table when in fact not all of it comes from the database.
16191 */
16292 class AllmessagesTablePager extends TablePager {
16393
 94+ protected $filter, $prefix, $langCode;
 95+
16496 public $mLimitsShown;
16597
16698 /**
@@ -217,6 +149,85 @@
218150 }
219151 }
220152
 153+ function buildForm() {
 154+ global $wgScript;
 155+
 156+ $languages = Language::getLanguageNames( false );
 157+ ksort( $languages );
 158+
 159+ $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) .
 160+ Xml::fieldset( wfMsg( 'allmessages-filter-legend' ) ) .
 161+ Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
 162+ Xml::openElement( 'table', array( 'class' => 'mw-allmessages-table' ) ) . "\n" .
 163+ '<tr>
 164+ <td class="mw-label">' .
 165+ Xml::label( wfMsg( 'allmessages-prefix' ), 'mw-allmessages-form-prefix' ) .
 166+ "</td>\n
 167+ <td class=\"mw-input\">" .
 168+ Xml::input( 'prefix', 20, str_replace( '_', ' ', $this->prefix ), array( 'id' => 'mw-allmessages-form-prefix' ) ) .
 169+ "</td>\n
 170+ </tr>
 171+ <tr>\n
 172+ <td class='mw-label'>" .
 173+ wfMsg( 'allmessages-filter' ) .
 174+ "</td>\n
 175+ <td class='mw-input'>" .
 176+ Xml::radioLabel( wfMsg( 'allmessages-filter-unmodified' ),
 177+ 'filter',
 178+ 'unmodified',
 179+ 'mw-allmessages-form-filter-unmodified',
 180+ ( $this->filter == 'unmodified' )
 181+ ) .
 182+ Xml::radioLabel( wfMsg( 'allmessages-filter-all' ),
 183+ 'filter',
 184+ 'all',
 185+ 'mw-allmessages-form-filter-all',
 186+ ( $this->filter == 'all' )
 187+ ) .
 188+ Xml::radioLabel( wfMsg( 'allmessages-filter-modified' ),
 189+ 'filter',
 190+ 'modified',
 191+ 'mw-allmessages-form-filter-modified',
 192+ ( $this->filter == 'modified' )
 193+ ) .
 194+ "</td>\n
 195+ </tr>
 196+ <tr>\n
 197+ <td class=\"mw-label\">" .
 198+ Xml::label( wfMsg( 'allmessages-language' ), 'mw-allmessages-form-lang' ) .
 199+ "</td>\n
 200+ <td class=\"mw-input\">" .
 201+ Xml::openElement( 'select', array( 'id' => 'mw-allmessages-form-lang', 'name' => 'lang' ) );
 202+
 203+ foreach( $languages as $lang => $name ) {
 204+ $selected = $lang == $this->langcode;
 205+ $out .= Xml::option( $lang . ' - ' . $name, $lang, $selected ) . "\n";
 206+ }
 207+ $out .= Xml::closeElement( 'select' ) .
 208+ "</td>\n
 209+ </tr>" .
 210+
 211+ '<tr>
 212+ <td class="mw-label">' .
 213+ Xml::label( wfMsg( 'table_pager_limit_label'), 'mw-table_pager_limit_label' ) .
 214+ '</td>
 215+ <td class="mw-input">' .
 216+ $this->getLimitSelect() .
 217+ '</td>
 218+ <tr>
 219+ <td></td>
 220+ <td>' .
 221+ Xml::submitButton( wfMsg( 'allmessages-filter-submit' ) ) .
 222+ "</td>\n
 223+ </tr>" .
 224+
 225+ Xml::closeElement( 'table' ) .
 226+ $this->getHiddenFields( array( 'title', 'prefix', 'filter', 'lang', 'limit' ) ) .
 227+ Xml::closeElement( 'fieldset' ) .
 228+ Xml::closeElement( 'form' );
 229+ return $out;
 230+ }
 231+
221232 function getAllMessages( $descending ) {
222233 wfProfileIn( __METHOD__ );
223234 $messageNames = Language::getLocalisationCache()->getSubitemList( 'en', 'messages' );

Comments

#Comment by MZMcBride (talk | contribs)   19:25, 22 May 2011

Status & tagging log