r21658 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21657‎ | r21658 | r21659 >
Date:16:09, 27 April 2007
Author:brion
Status:old
Tags:
Comment:
Avoid the duplication of form UI code between Special:Userrights and Special:Makesysop
Modified paths:
  • /trunk/extensions/Makesysop/SpecialMakesysop_body.php (modified) (history)
  • /trunk/phase3/includes/SpecialUserrights.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialUserrights.php
@@ -138,7 +138,7 @@
139139 * @param string $username Name of the user.
140140 */
141141 function editUserGroupsForm($username) {
142 - global $wgOut, $wgUser;
 142+ global $wgOut;
143143
144144 $user = User::newFromName($username);
145145 if( is_null( $user ) ) {
@@ -150,7 +150,11 @@
151151 }
152152
153153 $groups = $user->getGroups();
154 -
 154+ $this->showEditUserGroupsForm( $username, $groups );
 155+ }
 156+
 157+ function showEditUserGroupsForm( $username, $groups ) {
 158+ global $wgOut, $wgUser;
155159 $wgOut->addHTML(
156160 Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->action, 'name' => 'editGroup' ) ) .
157161 Xml::hidden( 'user-editname', $username ) .
Index: trunk/extensions/Makesysop/SpecialMakesysop_body.php
@@ -303,29 +303,8 @@
304304 }
305305
306306 $groups = $this->getUserGroups( $database, $userid );
307 -
308 - $wgOut->addHTML(
309 - Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->action, 'name' => 'editGroup' ) ) .
310 - Xml::hidden( 'user-editname', $username ) .
311 - Xml::hidden( 'wpEditToken', $wgUser->editToken( $username ) ) .
312 - Xml::openElement( 'fieldset' ) .
313 - Xml::element( 'legend', array(), wfMsg( 'userrights-editusergroup' ) ) .
314 - $wgOut->parse( wfMsg( 'editinguser', $username ) ) .
315 - "<table border='0' align='center'>
316 - <tr>
317 - <td>" . HTMLSelectGroups( 'member', $this->mName.'-groupsmember', $groups, true, 6 ) . "</td>
318 - <td align='right'>" . HTMLSelectGroups( 'available', $this->mName.'-groupsavailable', $groups, true, 6, true) . "</td>
319 - </tr><tr>
320 - <td>" . $wgOut->parse( wfMsg( 'makesysopreason' ) ) . "</td>
321 - <td align='right'>" . Xml::input( 'wpMakesysopReason', 30 ) . "</td>
322 - </tr>
323 - </table> \n" .
324 - $wgOut->parse( wfMsg('userrights-groupshelp') ) .
325 - Xml::submitButton( wfMsg( 'saveusergroups' ), array( 'name' => 'saveusergroups' ) ) .
326 - Xml::closeElement( 'fieldset' ) .
327 - Xml::closeElement( 'form' ) . "\n"
328 - );
329 -
 307+
 308+ $this->showEditUserGroupsForm( $username, $groups );
330309 }
331310
332311 function splitUsername( $username ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r21683* (Bug 9693) fix regression, broken since r21658raymond15:36, 28 April 2007