r23583 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23582‎ | r23583 | r23584 >
Date:08:42, 30 June 2007
Author:catrope
Status:old
Tags:
Comment:
Merging r23572 through r23582 into apiedit branch.
Modified paths:
  • /branches/apiedit/phase3/RELEASE-NOTES (modified) (history)
  • /branches/apiedit/phase3/includes/SpecialUserrights.php (modified) (history)
  • /branches/apiedit/phase3/includes/UserMailer.php (modified) (history)
  • /branches/apiedit/phase3/includes/Wiki.php (modified) (history)
  • /branches/apiedit/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /branches/apiedit/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: branches/apiedit/phase3/RELEASE-NOTES
@@ -113,6 +113,7 @@
114114 * (bug 10387) Detect and handle '.php5' extension environments at install time
115115 Patch by Edward Z. Yang.
116116 * Introduce 'ShowRawCssJs' hook; see docs/hooks.txt for more information
 117+* (bug 10404) Show rights log fragment for the selected user in Special:Userrights
117118
118119 == Bugfixes since 1.10 ==
119120
Index: branches/apiedit/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:',
Index: branches/apiedit/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: branches/apiedit/phase3/includes/Wiki.php
@@ -98,7 +98,7 @@
9999 $lang->findVariantLink( $title, $ret );
100100
101101 }
102 - if ( $oldid = $request->getInt( 'oldid' ) ) {
 102+ if ( $ret->getNamespace() != NS_SPECIAL && $oldid = $request->getInt( 'oldid' ) ) {
103103 // Allow oldid to override a changed or missing title.
104104 $rev = Revision::newFromId( $oldid );
105105 if( $rev ) {
Index: branches/apiedit/phase3/includes/SpecialUserrights.php
@@ -154,6 +154,7 @@
155155 }
156156
157157 $this->showEditUserGroupsForm( $username, $user->getGroups() );
 158+ $this->showLogFragment( $user, $wgOut );
158159 }
159160
160161 /**
@@ -229,51 +230,24 @@
230231 }
231232
232233 /**
233 - * Explains what groups the user can add and remove, and why.
 234+ * Prepare a list of groups the user is able to add and remove
234235 *
235 - * @return string Explanatory sanitized HTML message
 236+ * @return string
236237 */
237238 private function explainRights() {
238 - global $wgUser;
239 - $groups = $wgUser->getEffectiveGroups();
240 - foreach( $groups as $group ) {
241 - if( $this->changeableByGroup( $group ) == array(
242 - 'add' => array(),
243 - 'remove' => array()
244 - ) ) {
245 - // Can't add or remove anything, ignore this group
246 - $groups = array_diff( $groups, array( $group ) );
247 - }
248 - }
249 - $grouplists = array( $groups );
250 - list( $grouplists[1], $grouplists[2] ) = array_values( $this->changeableGroups() );
 239+ global $wgUser, $wgLang;
251240
252 - // Now format them nicely for display (yay mutable variables? I'm sick
253 - // of thinking up new names)
254 - foreach( $grouplists as &$list ) {
255 - if( $list == array() ) {
256 - $list = wfMsgExt( 'userrights-list-nogroups', 'parseinline' );
257 - } else {
258 - $list = wfMsgExt(
259 - 'userrights-list-groups',
260 - 'parseinline',
261 - count( $list ),
262 - implode(
263 - $list,
264 - wfMsgHtml( 'userrights-list-separator' )
265 - )
266 - );
267 - }
268 - }
 241+ $out = array();
 242+ list( $add, $remove ) = array_values( $this->changeableGroups() );
269243
270 - return wfMsgExt(
271 - 'userrights-list',
272 - 'parse',
273 - $grouplists[0],
274 - $grouplists[1],
275 - $grouplists[2]
276 - );
277 -
 244+ if( count( $add ) > 0 )
 245+ $out[] = wfMsgExt( 'userrights-available-add', 'parseinline', $wgLang->listToText( $add ) );
 246+ if( count( $remove ) > 0 )
 247+ $out[] = wfMsgExt( 'userrights-available-remove', 'parseinline', $wgLang->listToText( $remove ) );
 248+
 249+ return count( $out ) > 0
 250+ ? implode( ' ', $out )
 251+ : wfMsgExt( 'userrights-available-none', 'parseinline' );
278252 }
279253
280254 /**
@@ -403,5 +377,26 @@
404378 }
405379 return $groups;
406380 }
407 -} // end class UserrightsForm
408 -
 381+
 382+ /**
 383+ * Show a rights log fragment for the specified user
 384+ *
 385+ * @param User $user User to show log for
 386+ * @param OutputPage $output OutputPage to use
 387+ */
 388+ protected function showLogFragment( $user, $output ) {
 389+ $viewer = new LogViewer(
 390+ new LogReader(
 391+ new FauxRequest(
 392+ array(
 393+ 'type' => 'rights',
 394+ 'page' => $user->getUserPage()->getPrefixedUrl(),
 395+ )
 396+ )
 397+ )
 398+ );
 399+ $output->addHtml( "<h2>" . htmlspecialchars( LogPage::logName( 'rights' ) ) . "</h2>\n" );
 400+ $viewer->showList( $output );
 401+ }
 402+
 403+}
\ No newline at end of file
Index: branches/apiedit/phase3/includes/UserMailer.php
@@ -373,6 +373,7 @@
374374 ), array( /* WHERE */
375375 'wl_title' => $title->getDBkey(),
376376 'wl_namespace' => $title->getNamespace(),
 377+ 'wl_notificationtimestamp' => NULL
377378 ), 'UserMailer::NotifyOnChange'
378379 );
379380 # FIXME what do we do on failure ?

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r23572*Tiny UI fix for oldidsaaron23:41, 29 June 2007
r23582history tab worksdavid05:20, 30 June 2007

Status & tagging log