From: Scimonster Date: Sun, 24 Nov 2013 09:30:50 +0000 (+0200) Subject: Add legend to Special:RecentChanges and Special:Watchlist X-Git-Tag: 1.31.0-rc.0~17919^2~1 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=626ca47f12cce74012c6f2251f3dfabac374f931;p=lhc%2Fweb%2Fwiklou.git Add legend to Special:RecentChanges and Special:Watchlist Bug: 52005 Change-Id: Iabf4873ff8534ddf39bc8bbef79214fd3138e984 --- diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 23203ea576..e8e35aa093 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -562,6 +562,7 @@ class SpecialRecentChanges extends IncludableSpecialPage { $nondefaults = $opts->getChangedValues(); $panel = array(); + $panel[] = self::makeLegend( $this->getContext() ); $panel[] = $this->optionsPanel( $defaults, $nondefaults ); $panel[] = '
'; @@ -653,6 +654,59 @@ class SpecialRecentChanges extends IncludableSpecialPage { return $extraOpts; } + /** + * Return the legend displayed within the fieldset + * + * @param $context the object available as $this in non-static functions + * @return string + */ + public static function makeLegend( IContextSource $context ) { + $user = $context->getUser(); + # The legend showing what the letters and stuff mean + $legend = Xml::openElement( 'dl', array( 'class' => 'mw-changeslist-legend' ) ) . "\n"; + # Iterates through them and gets the messages for both letter and tooltip + # Messages: + # * minoreditletter + # * boteditletter + # * newpageletter + # * unpatrolledletter + # * recentchanges-label-minor + # * recentchanges-label-bot + # * recentchanges-label-newpage + # * recentchanges-label-unpatrolled + $legendItems = array( 'newpage' => 'newpage', 'minor' => 'minoredit', 'bot' => 'botedit' ); + if ( $user->useRCPatrol() ) { + $legendItems['unpatrolled'] = 'unpatrolled'; + } + foreach ( $legendItems as $label => $letter ) { # generate items of the legend + $legend .= Xml::element( 'dt', + array( 'class' => $label ), $context->msg( $letter . 'letter' )->text() + ) . "\n"; + if ( $letter === 'newpage' ) { + $legend .= Xml::openElement( 'dd' ); + $legend .= $context->msg( "recentchanges-label-$label" )->escaped(); + $legend .= ' ' . $context->msg( 'recentchanges-legend-newpage' )->parse(); + $legend .= Xml::closeElement( 'dd' ) . "\n"; + } else { + $legend .= Xml::element( 'dd', array(), + $context->msg( "recentchanges-label-$label" )->text() + ) . "\n"; + } + } + # (+-123) + $legend .= Xml::tags( 'dt', + array( 'class' => 'mw-plusminus-pos' ), + $context->msg( 'recentchanges-legend-plusminus' )->parse() + ) . "\n"; + $legend .= Xml::element( + 'dd', + array( 'class' => 'mw-changeslist-legend-plusminus' ), + $context->msg( 'recentchanges-label-plusminus' )->text() + ) . "\n"; + $legend .= Xml::closeElement( 'dl' ) . "\n"; + return $legend; + } + /** * Send the text to be displayed above the options * diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 2c511f53c0..154825a37c 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -39,6 +39,7 @@ class SpecialWatchlist extends SpecialPage { $user = $this->getUser(); $output = $this->getOutput(); + $output->addModuleStyles( 'mediawiki.special.changeslist' ); # Anons don't get a watchlist $this->requireLogin( 'watchlistanontext' ); @@ -255,6 +256,8 @@ class SpecialWatchlist extends SpecialPage { array( 'id' => 'mw-watchlist-options' ) ); + $form .= SpecialRecentChanges::makeLegend( $this->getContext() ); + $tables = array( 'recentchanges', 'watchlist' ); $fields = RecentChange::selectFields(); $join_conds = array( diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index ea1f20cf5f..3720b0546f 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2209,6 +2209,9 @@ Your email address is not revealed when other users contact you.', 'recentchanges-label-minor' => 'This is a minor edit', 'recentchanges-label-bot' => 'This edit was performed by a bot', 'recentchanges-label-unpatrolled' => 'This edit has not yet been patrolled', +'recentchanges-label-plusminus' => 'The page size changed by this number of bytes', +'recentchanges-legend-newpage' => '(also see [[Special:NewPages|list of new pages]])', +'recentchanges-legend-plusminus' => "(''±123'')", '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).", 'rclistfrom' => 'Show new changes starting from $1', diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index f1da92fcfe..cca04d2954 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -118,6 +118,7 @@ * @author SPQRobin * @author Sanbec * @author Sborsody + * @author Scimonster * @author Se4598 * @author Seb35 * @author Sherbrooke @@ -3589,6 +3590,9 @@ See also: 'recentchanges-label-minor' => 'Tooltip for {{msg-mw|minoreditletter}}', 'recentchanges-label-bot' => 'Tooltip for {{msg-mw|boteditletter}}', 'recentchanges-label-unpatrolled' => 'Tooltip for {{msg-mw|unpatrolledletter}}', +'recentchanges-label-plusminus' => 'Legend item for plus/minus', +'recentchanges-legend-newpage' => 'A link to [[Special:NewPages]]', +'recentchanges-legend-plusminus' => 'A plus/minus sign with a number for the legend.', 'rcnote' => 'Used on [[Special:RecentChanges]]. Similar to {{msg-mw|wlnote}} which is used on [[Special:Watchlist]]. diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index a6c99bd022..02a40026bc 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1328,6 +1328,9 @@ $wgMessageStructure = array( 'recentchanges-label-minor', 'recentchanges-label-bot', 'recentchanges-label-unpatrolled', + 'recentchanges-label-plusminus', + 'recentchanges-legend-newpage', + 'recentchanges-legend-plusminus', 'rcnote', 'rcnotefrom', 'rclistfrom', diff --git a/resources/mediawiki.special/mediawiki.special.changeslist.css b/resources/mediawiki.special/mediawiki.special.changeslist.css index 5e4af7b686..b96a26e1aa 100644 --- a/resources/mediawiki.special/mediawiki.special.changeslist.css +++ b/resources/mediawiki.special/mediawiki.special.changeslist.css @@ -5,3 +5,27 @@ .mw-changeslist-line-watched .mw-title { font-weight: bold; } + +.mw-changeslist-legend { + float: right; + margin-left: 1em; + margin-bottom: 0.5em; + clear: right; + font-size: 85%; + line-height: 1.2em; + padding: 0.5em; + border: 1px solid #ddd; +} + +.mw-changeslist-legend dt { + float: left; +} + +.mw-changeslist-legend dd { + margin-left: 1.5em; + line-height: 1.3em; +} + +.mw-changeslist-legend dd.mw-changeslist-legend-plusminus { + margin-left: 3.5em; +}