r53441 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53440‎ | r53441 | r53442 >
Date:13:50, 18 July 2009
Author:raymond
Status:ok
Tags:
Comment:
Follow-up r53286: Fix some issues:
* Fix invalid HTML
* Show language code in list too (for consistency with Special:Preferences)
* Change CSS class/ID names to stick with our code standards (mw-...)
* Use more proper XML functions
* Add some messages for the input form instead of reusing messages from other forms to make i18n easier
Modified paths:
  • /trunk/phase3/includes/specials/SpecialAllmessages.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -2068,6 +2068,8 @@
20692069 'allmessages-filter-all',
20702070 'allmessages-filter-modified',
20712071 'allmessages-prefix',
 2072+ 'allmessages-language',
 2073+ 'allmessages-filter-submit',
20722074 ),
20732075 'thumbnails' => array(
20742076 'thumbnail-more',
Index: trunk/phase3/includes/specials/SpecialAllmessages.php
@@ -49,51 +49,70 @@
5050 function buildForm() {
5151 global $wgScript;
5252
53 - $action = htmlspecialchars( $wgScript );
5453 $languages = Language::getLanguageNames( false );
5554 ksort( $languages );
5655
57 - $out = "<form method=\"get\" action=\"$action\"><fieldset>\n" .
 56+ $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) .
 57+ Xml::fieldset( wfMsg( 'allmessages-filter-legend' ) ) .
5858 Xml::hidden( 'title', $this->getTitle() ) .
59 - Xml::element( 'legend', null, wfMsg( 'allmessages' ) ) . "<table><tr>\n" .
60 - "<td class=\"mw-label\">" .
61 - Xml::label( wfMsg('allmessages-prefix'), 'am-form-prefix' ) .
62 - "</td>\n<td class=\"mw-input\">" .
63 - Xml::input( 'prefix', 20, str_replace('_',' ',$this->prefix), array( 'id' => 'am-form-prefix' ) ) .
64 - "</select>" .
65 - "</td>\n</tr><tr>\n<td class='mw-label'>" .
66 - Xml::label( wfMsg('allmessages-filter'), 'am-form-filter' ) .
67 - "</td>\n<td class='mw-input'>" .
68 - Xml::radioLabel( wfMsg('allmessages-filter-unmodified'),
 59+ Xml::openElement( 'table', array( 'class' => 'mw-allmessages-table' ) ) . "\n" .
 60+ '<tr>
 61+ <td class="mw-label">' .
 62+ Xml::label( wfMsg( 'allmessages-prefix' ), 'mw-allmessages-form-prefix' ) .
 63+ "</td>\n
 64+ <td class=\"mw-input\">" .
 65+ Xml::input( 'prefix', 20, str_replace( '_', ' ', $this->prefix ), array( 'id' => 'mw-allmessages-form-prefix' ) ) .
 66+ "</td>\n
 67+ </tr>
 68+ <tr>\n
 69+ <td class='mw-label'>" .
 70+ Xml::label( wfMsg( 'allmessages-filter' ), 'mw-allmessages-form-filter' ) .
 71+ "</td>\n
 72+ <td class='mw-input'>" .
 73+ Xml::radioLabel( wfMsg( 'allmessages-filter-unmodified' ),
6974 'filter',
7075 'unmodified',
71 - 'am-form-filter-unmodified',
 76+ 'mw-allmessages-form-filter-unmodified',
7277 ( $this->filter == 'unmodified' ? true : false )
7378 ) .
74 - Xml::radioLabel( wfMsg('allmessages-filter-all'),
 79+ Xml::radioLabel( wfMsg( 'allmessages-filter-all' ),
7580 'filter',
7681 'all',
77 - 'am-form-filter-all',
 82+ 'mw-allmessages-form-filter-all',
7883 ( $this->filter == 'all' ? true : false )
7984 ) .
80 - Xml::radioLabel( wfMsg('allmessages-filter-modified'),
 85+ Xml::radioLabel( wfMsg( 'allmessages-filter-modified' ),
8186 'filter',
8287 'modified',
83 - 'am-form-filter-modified',
 88+ 'mw-allmessages-form-filter-modified',
8489 ( $this->filter == 'modified' ? true : false )
8590 ) .
86 - "</td>\n</tr><tr>\n<td class=\"mw-label\">" .
87 - Xml::label( wfMsg('yourlanguage'), 'am-form-lang' ) .
88 - "</td>\n<td class=\"mw-input\">" .
89 - Xml::openElement( 'select', array( 'id' => 'am-form-lang', 'name' => 'lang' ) );
 91+ "</td>\n
 92+ </tr>
 93+ <tr>\n
 94+ <td class=\"mw-label\">" .
 95+ Xml::label( wfMsg( 'allmessages-language' ), 'mw-allmessages-form-lang' ) .
 96+ "</td>\n
 97+ <td class=\"mw-input\">" .
 98+ Xml::openElement( 'select', array( 'id' => 'mw-allmessages-form-lang', 'name' => 'lang' ) );
 99+
90100 foreach( $languages as $lang => $name ) {
91 - $selected = $lang == $this->langCode ? 'selected="selected"' : '';
92 - $out .= "<option value=\"$lang\" $selected>$name</option>\n";
 101+ $selected = $lang == $this->langCode ? true : false;
 102+ $out .= Xml::option( $lang . ' - ' . $name, $lang, $selected ) . "\n";
93103 }
94 - $out .= "</td>\n</tr><tr>\n<td></td><td>" . Xml::submitButton( wfMsg('allpagessubmit') ) .
95 - "</table>" .
96 - $this->table->getHiddenFields( array( 'title', 'prefix', 'filter', 'lang' ) ) .
97 - "</fieldset></form>";
 104+ $out .= Xml::closeElement( 'select' ) .
 105+ "</td>\n
 106+ </tr>
 107+ <tr>\n
 108+ <td></td>
 109+ <td>" .
 110+ Xml::submitButton( wfMsg( 'allmessages-filter-submit' ) ) .
 111+ "</td>\n
 112+ </tr>" .
 113+ Xml::closeElement( 'table' ) .
 114+ $this->table->getHiddenFields( array( 'title', 'prefix', 'filter', 'lang' ) ) .
 115+ Xml::closeElement( 'fieldset' ) .
 116+ Xml::closeElement( 'form' );
98117 return $out;
99118 }
100119 }
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3045,11 +3045,14 @@
30463046 'allmessagestext' => 'This is a list of system messages available in the MediaWiki namespace.
30473047 Please visit [http://www.mediawiki.org/wiki/Localisation MediaWiki Localisation] and [http://translatewiki.net translatewiki.net] if you wish to contribute to the generic MediaWiki localisation.',
30483048 'allmessagesnotsupportedDB' => "This page cannot be used because '''\$wgUseDatabaseMessages''' has been disabled.",
 3049+'allmessages-filter-legend' => 'Filter',
30493050 'allmessages-filter' => 'Filter by customisation state:',
30503051 'allmessages-filter-unmodified' => 'Unmodified',
30513052 'allmessages-filter-all' => 'All',
30523053 'allmessages-filter-modified' => 'Modified',
30533054 'allmessages-prefix' => 'Filter by prefix:',
 3055+'allmessages-language' => 'Language:',
 3056+'allmessages-filter-submit' => 'Go',
30543057
30553058 # Thumbnails
30563059 'thumbnail-more' => 'Enlarge',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r53286(bug 16497) Paginate Special:AllMessagesdemon02:03, 15 July 2009

Status & tagging log