From 0384c29d7ce36579c47b828b8d91b978bb240b9f Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sat, 30 Jun 2007 04:04:34 +0000 Subject: [PATCH] Ditch over-verbose "statement of rights" in Special:Userrights; this isn't a sodding constitution. Replace with two simple lists using the proper list-formatting functions. --- includes/SpecialUserrights.php | 22 +++++++++++++++++++--- languages/messages/MessagesEn.php | 7 +++---- maintenance/language/messages.inc | 7 +++---- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/includes/SpecialUserrights.php b/includes/SpecialUserrights.php index 0558265c83..57b43c33cf 100644 --- a/includes/SpecialUserrights.php +++ b/includes/SpecialUserrights.php @@ -229,12 +229,26 @@ class UserrightsForm extends HTMLForm { } /** - * Explains what groups the user can add and remove, and why. + * Prepare a list of groups the user is able to add and remove * - * @return string Explanatory sanitized HTML message + * @return string */ private function explainRights() { - global $wgUser; + global $wgUser, $wgLang; + + $out = array(); + list( $add, $remove ) = array_values( $this->changeableGroups() ); + + if( count( $add ) > 0 ) + $out[] = wfMsgExt( 'userrights-available-add', 'parseinline', $wgLang->listToText( $add ) ); + if( count( $remove ) > 0 ) + $out[] = wfMsgExt( 'userrights-available-remove', 'parseinline', $wgLang->listToText( $remove ) ); + + return count( $out ) > 0 + ? implode( ' ', $out ) + : wfMsgExt( 'userrights-available-none', 'parseinline' ); + + $groups = $wgUser->getEffectiveGroups(); foreach( $groups as $group ) { if( $this->changeableByGroup( $group ) == array( @@ -248,6 +262,8 @@ class UserrightsForm extends HTMLForm { $grouplists = array( $groups ); list( $grouplists[1], $grouplists[2] ) = array_values( $this->changeableGroups() ); + + // Now format them nicely for display (yay mutable variables? I'm sick // of thinking up new names) foreach( $grouplists as &$list ) { diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 5d37f18581..6d07492fcb 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1273,10 +1273,9 @@ containing all of the search terms will appear in the result).", 'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to. Unselected groups will not be changed. You can deselect a group with CTRL + Left Click', 'userrights-reason' => 'Reason for change:', -'userrights-list' => 'Because you are a member of $1, you can add $2 and remove $3.', -'userrights-list-nogroups' => 'no groups', -'userrights-list-groups' => 'the {{PLURAL:$1|group|groups}} $2', -'userrights-list-separator' => ', ', # only translate this message to other languages if you have to change it +'userrights-available-none' => 'You may not alter group membership.', +'userrights-available-add' => 'You can add users to $1.', +'userrights-available-remove' => 'You can remove users from $1.', # Groups 'group' => 'Group:', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 7e14258df2..8aa4d286a1 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -693,10 +693,9 @@ $wgMessageStructure = array( 'userrights-groupsavailable', 'userrights-groupshelp', 'userrights-reason', - 'userrights-list', - 'userrights-list-nogroups', - 'userrights-list-groups', - 'userrights-list-separator', + 'userrights-available-none', + 'userrights-available-add', + 'userrights-available-remove', ), 'group' => array( 'group', -- 2.20.1