* Do not display empty columns on Special:UserRights if all groups are changeable...
authorAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 18 Apr 2008 00:23:52 +0000 (00:23 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Fri, 18 Apr 2008 00:23:52 +0000 (00:23 +0000)
* On Special:UserRights, when you can add a group you can't remove or remove one you can't add, a notice is printed to warn you.  This is to avoid confusion like that exhibited at bug 13503; it's a fairly unusual situation in MediaWiki to be unable to reverse your own actions, so a notice seems to be appropriate.  (I changed the userrights-groups-help message to point out the meaning of the extra markup; should it be renamed?  It's a common and kind of annoying problem, we should think up some consistent way of versioning messages.  Start adding numbers to the end?)

RELEASE-NOTES
includes/SpecialUserrights.php
languages/messages/MessagesEn.php
maintenance/language/messageTypes.inc
maintenance/language/messages.inc

index c692146..25b1f68 100644 (file)
@@ -81,6 +81,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   a slightly less huge margin and padding.
 * (bug 13527) Use sitemaps.org format 0.9 instead of a Google-specific format
 * Allow \C and \Q as TeX commands to match \R, \N, \Z
+* On Special:UserRights, when you can add a group you can't remove or remove
+  one you can't add, a notice is printed to warn you
 
 === Bug fixes in 1.13 ===
 
@@ -197,6 +199,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Properly escape search terms with regex chars so they appear highlighted in
   search results
 * (bug 13768) pt_title field encoding fixed
+* Do not display empty columns on Special:UserRights if all groups are
+  changeable or all unchangeable
 
 
 === API changes in 1.13 ===
index 349009d..4061a89 100644 (file)
@@ -406,13 +406,21 @@ class UserrightsPage extends SpecialPage {
 
                foreach ($allgroups as $group) {
                        $set = in_array( $group, $usergroups );
+                       # Should the checkbox be disabled?
                        $disabled = !(
                                ( $set && $this->canRemove( $group ) ) ||
                                ( !$set && $this->canAdd( $group ) ) );
+                       # Do we need to point out that this action is irreversible?
+                       $irreversible = !$disabled && (
+                               ($set && !$this->canAdd( $group )) ||
+                               (!$set && !$this->canRemove( $group ) ) );
 
                        $attr = $disabled ? array( 'disabled' => 'disabled' ) : array();
-                       $checkbox = Xml::checkLabel( User::getGroupMember( $group ), "wpGroup-$group",
-                                       "wpGroup-$group", $set, $attr );
+                       $text = $irreversible
+                               ? wfMsgHtml( 'userrights-irreversible-marker', User::getGroupMember( $group ) )
+                               : User::getGroupMember( $group );
+                       $checkbox = Xml::checkLabel( $text, "wpGroup-$group",
+                               "wpGroup-$group", $set, $attr );
                        $checkbox = $disabled ? Xml::tags( 'span', array( 'class' => 'mw-userrights-disabled' ), $checkbox ) : $checkbox;
 
                        if ($disabled) {
@@ -424,19 +432,32 @@ class UserrightsPage extends SpecialPage {
 
                if ($column) {
                        $ret .= Xml::openElement( 'table', array( 'border' => '0', 'class' => 'mw-userrights-groups' ) ) .
-                               "<tr>" .
-                                       xml::element( 'th', null, wfMsg( 'userrights-changeable-col' ) ) .
-                                       xml::element( 'th', null, wfMsg( 'userrights-unchangeable-col' ) ) .
-                               "</tr>
+                               "<tr>
+";
+                       if( $settable_col !== '' ) {
+                               $ret .= xml::element( 'th', null, wfMsg( 'userrights-changeable-col' ) );
+                       }
+                       if( $unsettable_col !== '' ) {
+                               $ret .= xml::element( 'th', null, wfMsg( 'userrights-unchangeable-col' ) );
+                       }
+                       $ret.= "</tr>
                                <tr>
-                                       <td style='vertical-align:top;'>
+";
+                       if( $settable_col !== '' ) {
+                               $ret .=
+"                                      <td style='vertical-align:top;'>
                                                $settable_col
                                        </td>
-                                       <td style='vertical-align:top;'>
+";
+                       }
+                       if( $unsettable_col !== '' ) {
+                               $ret .=
+"                                      <td style='vertical-align:top;'>
                                                $unsettable_col
                                        </td>
-                               </tr>" .
-                               Xml::closeElement( 'table' );
+                               </tr>";
+                       }
+                       $ret .= Xml::closeElement( 'table' );
                }
 
                return $ret;
index 755c577..5cefa6d 100644 (file)
@@ -1413,7 +1413,8 @@ please see math/README to configure.',
 'userrights-groupsavailable'       => 'Available groups:',
 'userrights-groups-help'           => 'You may alter the groups this user is in.
 A checked box means the user is in that group.
-An unchecked box means the user is not in that group.',
+An unchecked box means the user is not in that group.
+A * indicates that you cannot remove the group once you have added it, or vice versa.',
 'userrights-reason'                => 'Reason for change:',
 'userrights-available-none'        => 'You may not alter group membership.',
 'userrights-available-add'         => 'You can add any user to {{PLURAL:$2|this group|these groups}}: $1.',
@@ -1426,6 +1427,7 @@ An unchecked box means the user is not in that group.',
 'userrights-notallowed'            => 'Your account does not have permission to assign user rights.',
 'userrights-changeable-col'        => 'Groups you can change',
 'userrights-unchangeable-col'      => 'Groups you cannot change',
+'userrights-irreversible-marker'   => '$1*', # only translate this message to other languages if you have to change it
 
 # Groups
 'group'                => 'Group:',
index 90c82bd..6736223 100644 (file)
@@ -151,6 +151,7 @@ $wgOptionalMessages = array(
        'ancientpages-summary',
        'unwatchedpages-summary',
        'userrights-summary',
+       'userrights-irreversible-marker',
        'brokenredirects-summary',
        'deadendpages-summary',
        'protectedpages-summary',
index 429e510..e046219 100644 (file)
@@ -812,6 +812,7 @@ $wgMessageStructure = array(
                'userrights-notallowed',
                'userrights-changeable-col',
                'userrights-unchangeable-col',
+               'userrights-irreversible-marker',
        ),
        'group' => array(
                'group',