r23577 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23576‎ | r23577 | r23578 >
Date:04:04, 30 June 2007
Author:robchurch
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/SpecialUserrights.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
@@ -693,10 +693,9 @@
694694 'userrights-groupsavailable',
695695 'userrights-groupshelp',
696696 'userrights-reason',
697 - 'userrights-list',
698 - 'userrights-list-nogroups',
699 - 'userrights-list-groups',
700 - 'userrights-list-separator',
 697+ 'userrights-available-none',
 698+ 'userrights-available-add',
 699+ 'userrights-available-remove',
701700 ),
702701 'group' => array(
703702 'group',
Index: trunk/phase3/includes/SpecialUserrights.php
@@ -229,12 +229,26 @@
230230 }
231231
232232 /**
233 - * Explains what groups the user can add and remove, and why.
 233+ * Prepare a list of groups the user is able to add and remove
234234 *
235 - * @return string Explanatory sanitized HTML message
 235+ * @return string
236236 */
237237 private function explainRights() {
238 - global $wgUser;
 238+ global $wgUser, $wgLang;
 239+
 240+ $out = array();
 241+ list( $add, $remove ) = array_values( $this->changeableGroups() );
 242+
 243+ if( count( $add ) > 0 )
 244+ $out[] = wfMsgExt( 'userrights-available-add', 'parseinline', $wgLang->listToText( $add ) );
 245+ if( count( $remove ) > 0 )
 246+ $out[] = wfMsgExt( 'userrights-available-remove', 'parseinline', $wgLang->listToText( $remove ) );
 247+
 248+ return count( $out ) > 0
 249+ ? implode( ' ', $out )
 250+ : wfMsgExt( 'userrights-available-none', 'parseinline' );
 251+
 252+
239253 $groups = $wgUser->getEffectiveGroups();
240254 foreach( $groups as $group ) {
241255 if( $this->changeableByGroup( $group ) == array(
@@ -248,6 +262,8 @@
249263 $grouplists = array( $groups );
250264 list( $grouplists[1], $grouplists[2] ) = array_values( $this->changeableGroups() );
251265
 266+
 267+
252268 // Now format them nicely for display (yay mutable variables? I'm sick
253269 // of thinking up new names)
254270 foreach( $grouplists as &$list ) {
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1273,10 +1273,9 @@
12741274 'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to.
12751275 Unselected groups will not be changed. You can deselect a group with CTRL + Left Click',
12761276 'userrights-reason' => 'Reason for change:',
1277 -'userrights-list' => 'Because you are a member of $1, you can add $2 and remove $3.',
1278 -'userrights-list-nogroups' => 'no groups',
1279 -'userrights-list-groups' => 'the {{PLURAL:$1|group|groups}} $2',
1280 -'userrights-list-separator' => ', ', # only translate this message to other languages if you have to change it
 1277+'userrights-available-none' => 'You may not alter group membership.',
 1278+'userrights-available-add' => 'You can add users to $1.',
 1279+'userrights-available-remove' => 'You can remove users from $1.',
12811280
12821281 # Groups
12831282 'group' => 'Group:',

Follow-up revisions

RevisionCommit summaryAuthorDate
r23581Merged revisions 23406-23580 via svnmerge from...david04:50, 30 June 2007

Status & tagging log