r86817 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86816‎ | r86817 | r86818 >
Date:14:56, 24 April 2011
Author:robin
Status:ok
Tags:
Comment:
Improve code of showForm() and add missing interface message
Modified paths:
  • /trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php
@@ -51,28 +51,18 @@
5252 */
5353 function showForm( $target ) {
5454 global $wgScript, $wgOut;
55 - $title = htmlspecialchars( $this->getTitle()->getPrefixedText() );
56 - $action = htmlspecialchars( $wgScript );
57 - $target = htmlspecialchars( $target );
58 - $ok = wfMsgHtml( 'wminc-viewuserlang-go' );
59 - $username = wfMsgHtml( 'wminc-viewuserlang-user' );
60 - $inputformtop = wfMsgHtml( 'wminc-viewuserlang' );
6155
62 - $wgOut->addHTML( <<<EOT
63 -<fieldset>
64 -<legend>$inputformtop</legend>
65 -<form method="get" action="$action">
66 -<input type="hidden" name="title" value="{$title}" />
67 -<table border="0">
68 -<tr>
69 -<td align="right">$username</td>
70 -<td align="left"><input type="text" size="50" name="target" value="$target" />
71 -<td colspan="2" align="center"><input type="submit" name="submit" value="$ok" /></td>
72 -</tr>
73 -</table>
74 -</form>
75 -</fieldset>
76 -EOT
 56+ $wgOut->addHTML(
 57+ Xml::fieldset( wfMsg( 'wminc-viewuserlang' ) ) .
 58+ Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) .
 59+ Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
 60+ "<p>" .
 61+ Xml::inputLabel( wfMsg( 'wminc-viewuserlang-user' ), 'target', 'viewuserlang-username', 40, $target ) .
 62+ ' ' .
 63+ Xml::submitButton( wfMsg( 'wminc-viewuserlang-go' ) ) .
 64+ "</p>" .
 65+ Xml::closeElement( 'form' ) .
 66+ Xml::closeElement( 'fieldset' )
7767 );
7868 }
7969
@@ -85,7 +75,7 @@
8676 $user = User::newFromName( $target );
8777 $langNames = Language::getLanguageNames();
8878 if ( $user == null || $user->getId() == 0 ) {
89 - $wgOut->addWikiText( '<span class="error">' . wfMsgNoTrans( 'wminc-viewuserlang-unexisting', $target ) . '</span>' );
 79+ $wgOut->addWikiText( '<span class="error">' . wfMsgNoTrans( 'wminc-userdoesnotexist', $target ) . '</span>' );
9080 } else {
9181 $name = $user->getName();
9282 $wgOut->addWikiText( '*' . wfMsg( 'username' ) . ' [[User:' . $name . '|' . $name . ']] (' .
Index: trunk/extensions/WikimediaIncubator/WikimediaIncubator.i18n.php
@@ -15,6 +15,7 @@
1616 'wminc-viewuserlang' => 'Look up user language and test wiki',
1717 'wminc-viewuserlang-user' => 'Username:',
1818 'wminc-viewuserlang-go' => 'Go',
 19+ 'wminc-userdoesnotexist' => 'The user "$1" does not exist.',
1920 'wminc-testwiki' => 'Test wiki:',
2021 'wminc-testwiki-none' => 'None/All',
2122 'wminc-prefinfo-language' => 'Your interface language - independent from your test wiki',

Status & tagging log