r21649 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21648‎ | r21649 | r21650 >
Date:09:01, 27 April 2007
Author:raymond
Status:old
Tags:
Comment:
* Adding a 'reason' field to Special:Userrights
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialUserrights.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.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
@@ -690,6 +690,7 @@
691691 'userrights-groupsmember',
692692 'userrights-groupsavailable',
693693 'userrights-groupshelp',
 694+ 'userrights-reason',
694695 ),
695696 'group' => array(
696697 'group',
@@ -1222,7 +1223,7 @@
12231224 'contributions' => array(
12241225 'contributions',
12251226 'mycontris',
1226 - 'contribsub',
 1227+ 'contribsub2',
12271228 'nocontribs',
12281229 'ucnote',
12291230 'uclinks',
Index: trunk/phase3/includes/SpecialUserrights.php
@@ -53,10 +53,12 @@
5454 if( $this->mRequest->getCheck( 'saveusergroups' ) ) {
5555 global $wgUser;
5656 $username = $this->mRequest->getVal( 'user-editname' );
 57+ $reason = $this->mRequest->getVal( 'user-reason' );
5758 if( $wgUser->matchEditToken( $this->mRequest->getVal( 'wpEditToken' ), $username ) ) {
5859 $this->saveUserGroups( $username,
5960 $this->mRequest->getArray( 'member' ),
60 - $this->mRequest->getArray( 'available' ) );
 61+ $this->mRequest->getArray( 'available' ),
 62+ $reason );
6163 }
6264 }
6365 }
@@ -69,9 +71,10 @@
7072 * @param string $username Username to apply changes to.
7173 * @param array $removegroup id of groups to be removed.
7274 * @param array $addgroup id of groups to be added.
 75+ * @param string $reason Reason for group change
7376 *
7477 */
75 - function saveUserGroups( $username, $removegroup, $addgroup) {
 78+ function saveUserGroups( $username, $removegroup, $addgroup, $reason ) {
7679 global $wgOut;
7780 $u = User::newFromName($username);
7881
@@ -107,7 +110,7 @@
108111
109112 wfRunHooks( 'UserRights', array( &$u, $addgroup, $removegroup ) );
110113 $log = new LogPage( 'rights' );
111 - $log->addEntry( 'rights', Title::makeTitle( NS_USER, $u->getName() ), '', array( $this->makeGroupNameList( $oldGroups ),
 114+ $log->addEntry( 'rights', Title::makeTitle( NS_USER, $u->getName() ), $reason, array( $this->makeGroupNameList( $oldGroups ),
112115 $this->makeGroupNameList( $newGroups ) ) );
113116 }
114117
@@ -148,29 +151,27 @@
149152
150153 $groups = $user->getGroups();
151154
152 - $wgOut->addHTML( "<form name=\"editGroup\" action=\"$this->action\" method=\"post\">\n".
153 - wfElement( 'input', array(
154 - 'type' => 'hidden',
155 - 'name' => 'user-editname',
156 - 'value' => $username ) ) .
157 - wfElement( 'input', array(
158 - 'type' => 'hidden',
159 - 'name' => 'wpEditToken',
160 - 'value' => $wgUser->editToken( $username ) ) ) .
161 - $this->fieldset( 'editusergroup',
162 - $wgOut->parse( wfMsg('editinguser', $username ) ) .
163 - '<table border="0" align="center"><tr><td>'.
164 - HTMLSelectGroups('member', $this->mName.'-groupsmember', $groups,true,6).
165 - '</td><td>'.
166 - HTMLSelectGroups('available', $this->mName.'-groupsavailable', $groups,true,6,true).
167 - '</td></tr></table>'."\n".
 155+ $wgOut->addHTML(
 156+ Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->action, 'name' => 'editGroup' ) ) .
 157+ Xml::hidden( 'user-editname', $username ) .
 158+ Xml::hidden( 'wpEditToken', $wgUser->editToken( $username ) ) .
 159+ Xml::openElement( 'fieldset' ) .
 160+ Xml::element( 'legend', array(), wfMsg( 'userrights-editusergroup' ) ) .
 161+ $wgOut->parse( wfMsg( 'editinguser', $username ) ) .
 162+ "<table border='0' align='center'>
 163+ <tr>
 164+ <td>" . HTMLSelectGroups( 'member', $this->mName.'-groupsmember', $groups, true, 6 ) . "</td>
 165+ <td align='right'>" . HTMLSelectGroups( 'available', $this->mName.'-groupsavailable', $groups, true, 6, true) . "</td>
 166+ </tr><tr>
 167+ <td>" . $wgOut->parse( wfMsg( 'userrights-reason' ) ) . "</td>
 168+ <td align='right'>" . Xml::input( 'user-reason', 30 ) . "</td>
 169+ </tr>
 170+ </table> \n" .
168171 $wgOut->parse( wfMsg('userrights-groupshelp') ) .
169 - wfElement( 'input', array(
170 - 'type' => 'submit',
171 - 'name' => 'saveusergroups',
172 - 'value' => wfMsg( 'saveusergroups' ) ) )
173 - ));
174 - $wgOut->addHTML( "</form>\n" );
 172+ Xml::submitButton( wfMsg( 'saveusergroups' ), array( 'name' => 'saveusergroups' ) ) .
 173+ Xml::closeElement( 'fieldset' ) .
 174+ Xml::closeElement( 'form' ) . "\n"
 175+ );
175176 }
176177 } // end class UserrightsForm
177178 ?>
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1266,6 +1266,7 @@
12671267 'userrights-groupsavailable' => 'Available groups:',
12681268 'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to.
12691269 Unselected groups will not be changed. You can deselect a group with CTRL + Left Click',
 1270+'userrights-reason' => 'Reason:',
12701271
12711272 # Groups
12721273 'group' => 'Group:',
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -884,6 +884,7 @@
885885 'userrights-groupsavailable' => 'Verfügbare Gruppen:',
886886 'userrights-groupshelp' => "Wählen Sie die Gruppen, aus denen der Benutzer entfernt oder zu denen er hinzugefügt werden soll.
887887 Nicht selektierte Gruppen werden nicht geändert. Eine Selektion kann mit '''Strg + Linksklick''' (bzw. Ctrl + Linksklick) entfernt werden.",
 888+'userrights-reason' => 'Grund:',
888889
889890 # Groups
890891 'group' => 'Gruppe:',
@@ -1469,7 +1470,7 @@
14701471 # Contributions
14711472 'contributions' => 'Benutzerbeiträge',
14721473 'mycontris' => 'Eigene Beiträge',
1473 -'contribsub2' => 'Für $1 ($2)',
 1474+'contribsub2' => 'Für $1 ($2)',
14741475 'nocontribs' => 'Es wurden keine Benutzerbeiträge mit diesen Kriterien gefunden.',
14751476 'ucnote' => 'Dies sind die letzten <b>$1</b> Beiträge des Benutzers in den letzten <b>$2</b> Tagen.',
14761477 'uclinks' => 'Zeige die letzten $1 Beiträge; zeige die letzten $2 Tage.',
@@ -1885,7 +1886,7 @@
18861887 'variantname-kk-cn' => 'kk-cn',
18871888 'variantname-kk' => 'kk',
18881889
1889 -'passwordtooshort' => 'Das Passwort ist zu kurz. Es muss mindestens $1 Zeichen lang sein.',
 1890+'passwordtooshort' => 'Fehler bei der Passwort-Wahl: Es muss mindestens $1 Zeichen lang sein und darf nicht mit dem Benutzernamen identisch sein.',
18901891
18911892 # Metadata
18921893 'metadata' => 'Metadaten',
Index: trunk/phase3/RELEASE-NOTES
@@ -128,6 +128,7 @@
129129 * 'contribsub' message changed to 'contribsub2' with two parameters to permit
130130 better localization. Change is reverse-compatible and can be ignored for
131131 most wikis.
 132+* Adding a 'reason' field to Special:Userrights
132133
133134 == Bugfixes since 1.9 ==
134135