r20382 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r20381‎ | r20382 | r20383 >
Date:08:31, 13 March 2007
Author:raymond
Status:old
Tags:
Comment:
Make Special:Listusers caseinsensitive for first letter
User proper XML form functions
Attention translators: Slight change in message. A complete new message seem to be overdone.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialListusers.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialListusers.php
@@ -39,8 +39,11 @@
4040 function __construct($group=null) {
4141 global $wgRequest;
4242 $this->requestedGroup = $group != "" ? $group : $wgRequest->getVal( 'group' );
43 - $this->requestedUser = $wgRequest->getText( 'username', $this->mOffset );
44 -
 43+ $un = $wgRequest->getText( 'username' );
 44+ if ( $un != '' ) {
 45+ $username = Title::makeTitleSafe( NS_USER, $un );
 46+ $this->requestedUser = $username->getText();
 47+ }
4548 parent::__construct();
4649 }
4750
@@ -57,9 +60,9 @@
5861 if ($this->requestedUser != "") {
5962 $conds[] = 'user_name >= ' . wfGetDB()->addQuotes( $this->requestedUser );
6063 }
61 -
 64+
6265 list ($user,$user_groups) = wfGetDB()->tableNamesN('user','user_groups');
63 -
 66+
6467 return array(
6568 'tables' => " $user LEFT JOIN $user_groups ON user_id=ug_user ",
6669 'fields' => array('user_name',
@@ -70,7 +73,7 @@
7174 'conds' => $conds
7275 );
7376 }
74 -
 77+
7578 function formatRow($row) {
7679 $userPage = Title::makeTitle(NS_USER, $row->user_name);
7780 $name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
@@ -87,7 +90,7 @@
8891 } elseif ($row->numgroups == 1 ) { // MAX hack inside query :)
8992 $groups[$row->singlegroup] = User::getGroupMember( $row->singlegroup );
9093 }
91 -
 94+
9295 if ( count($groups) > 0 ) {
9396 foreach( $groups as $group => $desc ) {
9497 $list[] = User::makeGroupLinkHTML( $group, $desc);
@@ -96,18 +99,19 @@
97100 } else {
98101 $groups ='';
99102 }
 103+ //$ulink = $skin->userLink( $result->user, $result->user_text ) . ' ' . $skin->userToolLinks( $result->user, $result->user_text );
100104 return '<li>' . wfSpecialList ($name, $groups) .'</li>';
101105 }
102 -
 106+
103107 function getBody() {
104108 if (!$this->mQueryDone) {
105109 $this->doQuery();
106110 }
107111 $batch = new LinkBatch;
108112 $db = $this->mDb;
109 -
 113+
110114 $this->mResult->rewind();
111 -
 115+
112116 while ( $row = $this->mResult->fetchObject() ) {
113117 $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
114118 }
@@ -115,41 +119,45 @@
116120 $this->mResult->rewind();
117121 return parent::getBody();
118122 }
119 -
 123+
120124 function getPageHeader( ) {
 125+ global $wgRequest;
121126 $self = $this->getTitle();
122127
123128 # Form tag
124 - $out = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $self->getLocalUrl() ) );
125 -
 129+ $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $self->getLocalUrl() ) ) .
 130+ '<fieldset>' .
 131+ Xml::element( 'legend', array(), wfMsg( 'listusers' ) );
 132+
 133+ # Username field
 134+ $out .= Xml::label( wfMsg( 'listusersfrom' ), 'offset' ) . ' ' .
 135+ Xml::input( 'username', 20, $this->requestedUser ) . ' ';
 136+
 137+ if( $this->mLimit )
 138+ $out .= Xml::hidden( 'limit', $this->mLimit );
 139+
126140 # Group drop-down list
127 - $out .= wfElement( 'label', array( 'for' => 'group' ), wfMsg( 'group' ) ) . ' ';
128 - $out .= wfOpenElement( 'select', array( 'name' => 'group', 'id' => 'group' ) );
129 - $out .= wfElement( 'option', array( 'value' => '' ), wfMsg( 'group-all' ) ); # Item for "all groups"
 141+ $out .= Xml::label( wfMsg( 'group' ), 'group' ) . ' ' .
 142+ Xml::openElement('select', array( 'name' => 'group', 'id' => 'group' ) ) .
 143+ Xml::option( wfMsg( 'group-all' ), '' ); # Item for "all groups"
 144+
130145 $groups = User::getAllGroups();
131146 foreach( $groups as $group ) {
132147 $attribs = array( 'value' => $group );
133148 if( $group == $this->requestedGroup )
134149 $attribs['selected'] = 'selected';
135 - $out .= wfElement( 'option', $attribs, User::getGroupName( $group ) );
 150+ $out .= Xml::option( User::getGroupName( $group ), $attribs['value'], $attribs['selected'] );
136151 }
137 - $out .= wfCloseElement( 'select' ) . ' ';;# . wfElement( 'br' );
 152+ $out .= Xml::closeElement( 'select' ) . ' ';
138153
139 - # Username field
140 - $out .= wfElement( 'label', array( 'for' => 'offset' ), wfMsg( 'listusersfrom' ) ) . ' ';
141 - $out .= wfElement( 'input', array( 'type' => 'text', 'id' => 'username', 'name' => 'username',
142 - 'value' => $this->requestedUser ) ) . ' ';
143 -
144 - if( $this->mLimit )
145 - $out .= wfElement( 'input', array( 'type' => 'hidden', 'name' => 'limit', 'value' => $this->mLimit ) );
146 -
147154 # Submit button and form bottom
148 - $out .= wfElement( 'input', array( 'type' => 'submit', 'value' => wfMsg( 'allpagessubmit' ) ) );
149 - $out .= wfCloseElement( 'form' );
 155+ $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
 156+ '</fieldset>' .
 157+ Xml::closeElement( 'form' );
150158
151159 return $out;
152160 }
153 -
 161+
154162 /**
155163 * Preserve group and username offset parameters when paging
156164 * @return array
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1597,7 +1597,7 @@
15981598 # Special:Listusers
15991599 'listusersfrom' => 'Display users starting at:',
16001600 'listusers-submit' => 'Show',
1601 -'listusers-noresult' => 'No users found. Please check upper-/lowercase variants too.',
 1601+'listusers-noresult' => 'No user found.',
16021602
16031603 # Email this user
16041604 #
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -1198,7 +1198,7 @@
11991199 # Special:Listusers
12001200 'listusersfrom' => 'Zeige Benutzer ab:',
12011201 'listusers-submit' => 'Zeige',
1202 -'listusers-noresult' => 'Keine Benutzer gefunden. Bitte beachte, dass die Groß-/Kleinschreibung des Anfangsbuchstabens zu unterschiedlichen Ergebnissen führt.',
 1202+'listusers-noresult' => 'Keinen Benutzer gefunden.',
12031203
12041204 # E-mail user
12051205 'mailnologin' => 'Sie sind nicht angemeldet.',
Index: trunk/phase3/RELEASE-NOTES
@@ -264,8 +264,8 @@
265265 * (bug 8815) Setting password in initUser() breaks LdapAuthentication plugin
266266 * (bug 9256) Add a quick note to index.php header comments
267267 * (bug 1196) Add IPv6 support to blocks
 268+* Make Special:Listusers caseinsensitive for first letter
268269
269 -
270270 == Languages updated ==
271271
272272 * Arabic (ar)

Follow-up revisions

RevisionCommit summaryAuthorDate
r20428*Fix initialization regressions in r20382. Also, join on block table to hide ...aaron01:45, 14 March 2007