Scimonster has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/96584


Change subject: Added legend to Special:RecentChanges and Special:Watchlist
......................................................................

Added legend to Special:RecentChanges and Special:Watchlist

Change-Id: Iabf4873ff8534ddf39bc8bbef79214fd3138e984
---
M includes/specials/SpecialRecentchanges.php
M includes/specials/SpecialWatchlist.php
M languages/messages/MessagesEn.php
3 files changed, 69 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/84/96584/1

diff --git a/includes/specials/SpecialRecentchanges.php 
b/includes/specials/SpecialRecentchanges.php
index 23203ea..5d7d7e1 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -561,7 +561,41 @@
                $defaults = $opts->getAllValues();
                $nondefaults = $opts->getChangedValues();
 
+               $user = $this->getUser();
+               # The legend showing what the letters and stuff mean
+               $legend = Xml::openElement( 'dl', array( 'style' => 
'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;', 'id' => 
'changes-list-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( 'style' => 
'float: left;', 'class' => $label ), $this->msg( $letter . 'letter' )->text() ) 
. "\n";
+                       if ( $letter === 'newpage' ) {
+                               $legend .= Xml::openElement( 'dd', array( 
'style' => 'margin-left: 1.5em; line-height: 1.3em;' ) );
+                               $legend .= $this->msg( 
"recentchanges-label-$label" )->text();
+                               $legend .= Xml::tags( 'i', array(), ' ' . 
$this->msg( 'recentchanges-legend-newpage' )->parse() );
+                               $legend .= Xml::closeElement( 'dd' ) . "\n";
+                       } else {
+                               $legend .= Xml::element( 'dd', array( 'style' 
=> 'margin-left: 1.5em; line-height: 1.3em;' ), $this->msg( 
"recentchanges-label-$label" )->text() ) . "\n";
+                       }
+               }
+               # (+-123)
+               $legend .= Xml::tags( 'dt', array( 'style' => 'float: left; 
font-weight: normal; font-style: italic;', 'class' => 'mw-plusminus-pos' ), 
'(± 123)' ) . "\n";
+               $legend .= Xml::element( 'dd', array( 'style' => 'margin-left: 
4em; line-height: 1.3em;' ), $this->msg( "recentchanges-label-plusminus" 
)->text() ) . "\n";
+               $legend .= Xml::closeElement( 'dl' ) . "\n";
+
                $panel = array();
+               $panel[] = $legend;
                $panel[] = $this->optionsPanel( $defaults, $nondefaults );
                $panel[] = '<hr />';
 
diff --git a/includes/specials/SpecialWatchlist.php 
b/includes/specials/SpecialWatchlist.php
index c51b61b..b62e330 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -255,6 +255,39 @@
                        array( 'id' => 'mw-watchlist-options' )
                );
 
+               # The legend showing what the letters and stuff mean
+               $legend = Xml::openElement( 'dl', array( 'style' => 
'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;', 'id' => 
'changes-list-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( 'style' => 
'float: left;', 'class' => $label ), $this->msg( $letter . 'letter' )->text() ) 
. "\n";
+                       if ( $letter === 'newpage' ) {
+                               $legend .= Xml::openElement( 'dd', array( 
'style' => 'margin-left: 1.5em; line-height: 1.3em;' ) );
+                               $legend .= $this->msg( 
"recentchanges-label-$label" )->text();
+                               $legend .= Xml::tags( 'i', array(), ' ' . 
$this->msg( 'recentchanges-legend-newpage' )->parse() );
+                               $legend .= Xml::closeElement( 'dd' ) . "\n";
+                       } else {
+                               $legend .= Xml::element( 'dd', array( 'style' 
=> 'margin-left: 1.5em; line-height: 1.3em;' ), $this->msg( 
"recentchanges-label-$label" )->text() ) . "\n";
+                       }
+               }
+               # (+-123)
+               $legend .= Xml::tags( 'dt', array( 'style' => 'float: left; 
font-weight: normal; font-style: italic;', 'class' => 'mw-plusminus-pos' ), 
'(&#177; 123)' ) . "\n";
+               $legend .= Xml::element( 'dd', array( 'style' => 'margin-left: 
4em; line-height: 1.3em;' ), $this->msg( "recentchanges-label-plusminus" 
)->text() ) . "\n";
+               $legend .= Xml::closeElement( 'dl' ) . "\n";
+               $form .= $legend;
+
                $tables = array( 'recentchanges', 'watchlist' );
                $fields = RecentChange::selectFields();
                $join_conds = array(
diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index 5fd0b06..c7a9fff 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -2211,6 +2211,8 @@
 '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'      => '(see more [[Special:NewPages|here]])',
 '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',

-- 
To view, visit https://gerrit.wikimedia.org/r/96584
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iabf4873ff8534ddf39bc8bbef79214fd3138e984
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Scimonster <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to