r23466 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23465‎ | r23466 | r23467 >
Date:08:53, 27 June 2007
Author:robchurch
Status:old
Tags:
Comment:
Rights log formatting
Modified paths:
  • /branches/robchurch/logs/includes/CoreLogFormatter.php (modified) (history)
  • /branches/robchurch/logs/includes/DefaultSettings.php (modified) (history)
  • /branches/robchurch/logs/includes/LogPage.php (modified) (history)

Diff [purge]

Index: branches/robchurch/logs/includes/DefaultSettings.php
@@ -2268,6 +2268,7 @@
22692269 $wgLogActionCallbacks = array(
22702270 'block' => array( 'BlockLogFormatter', 'makeActionText' ),
22712271 'patrol' => array( 'PatrolLog', 'makeActionText' ),
 2272+ 'rights' => array( 'CoreLogFormatter', 'formatRights' ),
22722273 );
22732274
22742275 /**
Index: branches/robchurch/logs/includes/CoreLogFormatter.php
@@ -9,6 +9,30 @@
1010 */
1111 class CoreLogFormatter {
1212
 13+ /**
 14+ * Build the action text for a user rights log item
 15+ *
 16+ * @param LogItem $item Item to format
 17+ * @return string
 18+ */
 19+ public static function formatRights( $item ) {
 20+ global $wgUser, $wgContLang;
 21+ $skin = $wgUser->getSkin();
 22+ $target = $wgContLang->ucfirst( $item->getTarget()->getText() );
 23+ $data = $item->getParameters();
 24+
 25+ $params[] = $skin->userLink( 1, $target )
 26+ . $skin->userToolLinks( 1, $target );
 27+ $params[] = ( isset( $data[0] ) && trim( $data[0] ) !== '' )
 28+ ? $data[0]
 29+ : wfMsg( 'rightsnone' );
 30+ $params[] = ( isset( $data[1] ) && trim( $data[1] ) !== '' )
 31+ ? $data[1]
 32+ : wfMsg( 'rightsnone' );
 33+
 34+ return LogFormatter::getActionText( $item, $params );
 35+ }
 36+
1337 }
1438
1539 ?>
\ No newline at end of file
Index: branches/robchurch/logs/includes/LogPage.php
@@ -112,10 +112,6 @@
113113 $titleLink = $skin->makeLinkObj( $title, $title->getPrefixedText(), 'redirect=no' );
114114 $params[0] = $skin->makeLinkObj( Title::newFromText( $params[0] ), $params[0] );
115115 break;
116 - case 'rights':
117 - $text = $wgContLang->ucfirst( $title->getText() );
118 - $titleLink = $skin->makeLinkObj( Title::makeTitle( NS_USER, $text ) );
119 - break;
120116 default:
121117 $titleLink = $skin->makeLinkObj( $title );
122118 }
@@ -123,17 +119,6 @@
124120 } else {
125121 $titleLink = $title->getPrefixedText();
126122 }
127 - if( $key == 'rights/rights' ) {
128 - if ($skin) {
129 - $rightsnone = wfMsg( 'rightsnone' );
130 - } else {
131 - $rightsnone = wfMsgForContent( 'rightsnone' );
132 - }
133 - if( !isset( $params[0] ) || trim( $params[0] ) == '' )
134 - $params[0] = $rightsnone;
135 - if( !isset( $params[1] ) || trim( $params[1] ) == '' )
136 - $params[1] = $rightsnone;
137 - }
138123 if( count( $params ) == 0 ) {
139124 if ( $skin ) {
140125 $rv = wfMsg( $wgLogActions[$key], $titleLink );

Status & tagging log