From: Aryeh Gregor Date: Tue, 4 Aug 2009 00:48:45 +0000 (+0000) Subject: Only show useful info in RC legend X-Git-Tag: 1.31.0-rc.0~40523 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=34c814e7919a25176c4765033b655544c3f1420e;p=lhc%2Fweb%2Fwiklou.git Only show useful info in RC legend This splits up the message recentchanges-label-legend so that pieces of it can be provided only when they're relevant, and more can be added later. Any existing translations will need to be retranslated, but it's only been a day, so creating a new message name seemed like overkill. Follow-up to r54242. --- diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 2691dd461e..f2433c2876 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -123,6 +123,19 @@ class ChangesList { . ''; } + /** + * Some explanatory wrapper text for the given flag, to be used in a legend + * explaining what the flags mean. For instance, "N - new page". See + * also flag(). + * + * @param $key string 'newpage', 'unpatrolled', 'minor', or 'bot' + * @return string Raw HTML + */ + public static function flagLegend( $key ) { + return wfMsgExt( "recentchanges-legend-$key", array( 'escapenoentities', + 'replaceafter' ), self::flag( $key ) ); + } + /** * Returns text for the start of the tabular part of RC * @return string diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 04dfb40b47..608bb500b2 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -408,7 +408,7 @@ class SpecialRecentChanges extends SpecialPage { * @return String: XHTML */ public function doHeader( $opts ) { - global $wgScript, $wgOut; + global $wgScript, $wgOut, $wgLang, $wgUser, $wgGroupPermissions; $this->setTopText( $wgOut, $opts ); @@ -457,12 +457,23 @@ class SpecialRecentChanges extends SpecialPage { Xml::fieldset( wfMsg( 'recentchanges-legend' ), $panelString, array( 'class' => 'rcoptions' ) ) ); - # TODO: This is probably a bad format for the message. If anyone - # customizes it and we add a new flag, it won't show up in the - # customized message unless it's changed. + $flags = array( ChangesList::flagLegend( 'newpage' ), + ChangesList::flagLegend( 'minor' ) ); + + # Don't show info on bot edits unless there's a bot group of some kind + foreach ( $wgGroupPermissions as $rights ) { + if ( isset( $rights['bot'] ) && $rights['bot'] ) { + $flags[] = ChangesList::flagLegend( 'bot' ); + break; + } + } + + if ( $wgUser->useRCPatrol() ) { + $flags[] = ChangesList::flagLegend( 'unpatrolled' ); + } + $wgOut->addWikiMsg( 'recentchanges-label-legend', - ChangesList::flag( 'newpage' ), ChangesList::flag( 'minor' ), - ChangesList::flag( 'bot' ), ChangesList::flag( 'unpatrolled' ) ); + $wgLang->commaList( $flags ) ); $this->setBottomText( $wgOut, $opts ); } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 13d50e0c1c..29f3369f8e 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1964,10 +1964,14 @@ You can also choose to let others contact you through your user or talk page wit 'recentchanges-legend' => 'Recent changes options', 'recentchangestext' => 'Track the most recent changes to the wiki on this page.', 'recentchanges-feed-description' => 'Track the most recent changes to the wiki in this feed.', -'recentchanges-label-legend' => 'Legend: $1 - new page, $2 - minor edit, $3 - bot edit, $4 - unpatrolled edit.', +'recentchanges-label-legend' => 'Legend: $1.', +'recentchanges-legend-newpage' => '$1 - new page', 'recentchanges-label-newpage' => 'This edit created a new page', +'recentchanges-legend-minor' => '$1 - minor edit', 'recentchanges-label-minor' => 'This is a minor edit', +'recentchanges-legend-bot' => '$1 - bot edit', 'recentchanges-label-bot' => 'This edit was performed by a bot', +'recentchanges-legend-unpatrolled' => '$1 - unpatrolled edit', 'recentchanges-label-unpatrolled' => 'This edit has not yet been patrolled', 'rcnote' => "Below {{PLURAL:$1|is '''1''' change|are the last '''$1''' changes}} in the last {{PLURAL:$2|day|'''$2''' days}}, as of $5, $4.", 'rcnotefrom' => "Below are the changes since '''$2''' (up to '''$1''' shown).", diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index deb3b1aad6..66a62ccbaf 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1151,9 +1151,13 @@ $wgMessageStructure = array( 'recentchangestext', 'recentchanges-feed-description', 'recentchanges-label-legend', + 'recentchanges-legend-newpage', 'recentchanges-label-newpage', + 'recentchanges-legend-minor', 'recentchanges-label-minor', + 'recentchanges-legend-bot', 'recentchanges-label-bot', + 'recentchanges-legend-unpatrolled', 'recentchanges-label-unpatrolled', 'rcnote', 'rcnotefrom',