From a1e602a93974bc998b932121b2e21cc5b40470b9 Mon Sep 17 00:00:00 2001 From: Dereckson Date: Thu, 30 Aug 2012 16:42:49 +0200 Subject: [PATCH] (bug 40072) Add semantic CSS classes to identify changes list items In the special pages containing changes list, adding the following CSS classes to revision rows: - mw-changeslist-date - mw-changeslist-title - mw-changeslist-separator (matching the dots, ". .") This enhancement has been implemented to the following special pages: - [[Special:Contributions]] - [[Special:DeletedContributions]] - [[Special:RecentChanges]] - [[Special:Watchlist]] It's also implemented on pages history. Change-Id: I2385ef21d9aed4bdbe4971bfcfa28efaf058e7dd --- includes/ChangesList.php | 22 +++++++++---------- includes/actions/HistoryAction.php | 6 ++--- includes/specials/SpecialContributions.php | 10 ++++----- .../specials/SpecialDeletedContributions.php | 11 +++++++--- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 8cca4bb620..84677124eb 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -345,7 +345,7 @@ class ChangesList extends ContextSource { 'action' => 'history' ) ); - $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() . ' . . '; + $s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() . ' . . '; } /** @@ -366,7 +366,7 @@ class ChangesList extends ContextSource { $articlelink = Linker::linkKnown( $rc->getTitle(), null, - array(), + array( 'class' => 'mw-changeslist-title' ), $params ); if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) { @@ -388,8 +388,8 @@ class ChangesList extends ContextSource { * @param $rc RecentChange */ public function insertTimestamp( &$s, $rc ) { - $s .= $this->message['semicolon-separator'] . - $this->getLanguage()->userTime( $rc->mAttribs['rc_timestamp'], $this->getUser() ) . ' . . '; + $s .= $this->message['semicolon-separator'] . '' . + $this->getLanguage()->userTime( $rc->mAttribs['rc_timestamp'], $this->getUser() ) . ' . . '; } /** @@ -628,7 +628,7 @@ class OldChangesList extends ChangesList { if ( $wgRCShowChangedSize ) { $cd = $this->formatCharacterDifference( $rc ); if ( $cd !== '' ) { - $s .= "$cd . . "; + $s .= $cd . ' . . '; } } @@ -994,7 +994,7 @@ class EnhancedChangesList extends ChangesList { $r .= $this->msg( 'parentheses' )->rawParams( $logtext )->escaped(); } - $r .= ' . . '; + $r .= ' . . '; # Character difference (does not apply if only log items) if( $wgRCShowChangedSize && !$allLogs ) { @@ -1013,7 +1013,7 @@ class EnhancedChangesList extends ChangesList { if( $chardiff == '' ) { $r .= ' '; } else { - $r .= ' ' . $chardiff. ' . . '; + $r .= ' ' . $chardiff. ' . . '; } } @@ -1066,13 +1066,13 @@ class EnhancedChangesList extends ChangesList { if ( !$type == RC_LOG || $type == RC_NEW ) { $r .= ' ' . $this->msg( 'parentheses' )->rawParams( $rcObj->curlink . $this->message['pipe-separator'] . $rcObj->lastlink )->escaped(); } - $r .= ' . . '; + $r .= ' . . '; # Character diff if ( $wgRCShowChangedSize ) { $cd = $this->formatCharacterDifference( $rcObj ); if ( $cd !== '' ) { - $r .= "$cd . . "; + $r .= $cd . ' . . '; } } @@ -1202,12 +1202,12 @@ class EnhancedChangesList extends ChangesList { $query ) )->escaped(); } - $r .= ' . . '; + $r .= ' . . '; # Character diff if ( $wgRCShowChangedSize ) { $cd = $this->formatCharacterDifference( $rcObj ); if ( $cd !== '' ) { - $r .= "$cd . . "; + $r .= $cd . ' . . '; } } diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index 1c57f2505a..dcd6fe5505 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -604,7 +604,7 @@ class HistoryPager extends ReverseChronologicalPager { : 0; $sDiff = ChangesList::showCharacterDifference( $prevSize, $rev->getSize() ); $fSize = Linker::formatRevisionSize($rev->getSize()); - $s .= " . . $fSize $sDiff"; + $s .= ' . . ' . "$fSize $sDiff"; # Text following the character difference is added just before running hooks $s2 = Linker::revComment( $rev, false, true ); @@ -658,7 +658,7 @@ class HistoryPager extends ReverseChronologicalPager { # Include separator between character difference and following text if ( $s2 !== '' ) { - $s .= " . . $s2"; + $s .= ' . . ' . $s2; } wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s, &$classes ) ); @@ -684,7 +684,7 @@ class HistoryPager extends ReverseChronologicalPager { $link = Linker::linkKnown( $this->getTitle(), $date, - array(), + array( 'class' => 'mw-changeslist-date' ), array( 'oldid' => $rev->getId() ) ); } else { diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index fb94ff72b2..54f8e26166 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -841,7 +841,7 @@ class ContribsPager extends ReverseChronologicalPager { $link = Linker::link( $page, htmlspecialchars( $page->getPrefixedText() ), - array(), + array( 'class' => 'mw-contributions-title' ), $page->isRedirect() ? array( 'redirect' => 'no' ) : array() ); # Mark current revisions @@ -882,11 +882,11 @@ class ContribsPager extends ReverseChronologicalPager { // For some reason rev_parent_id isn't populated for this row. // Its rumoured this is true on wikipedia for some revisions (bug 34922). // Next best thing is to have the total number of bytes. - $chardiff = ' . . ' . Linker::formatRevisionSize( $row->rev_len ) . ' . . '; + $chardiff = ' . . ' . Linker::formatRevisionSize( $row->rev_len ) . ' . . '; } else { $parentLen = isset( $this->mParentLens[$row->rev_parent_id] ) ? $this->mParentLens[$row->rev_parent_id] : 0; - $chardiff = ' . . ' . ChangesList::showCharacterDifference( - $parentLen, $row->rev_len, $this->getContext() ) . ' . . '; + $chardiff = ' . . ' . ChangesList::showCharacterDifference( + $parentLen, $row->rev_len, $this->getContext() ) . ' . . '; } $lang = $this->getLanguage(); @@ -896,7 +896,7 @@ class ContribsPager extends ReverseChronologicalPager { $d = Linker::linkKnown( $page, htmlspecialchars( $date ), - array(), + array( 'class' => 'mw-changeslist-date' ), array( 'oldid' => intval( $row->rev_id ) ) ); } else { diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 991e7a2c24..c880b61759 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -191,7 +191,7 @@ class DeletedContribsPager extends IndexPager { $link = Linker::linkKnown( $undelete, $date, - array(), + array( 'class' => 'mw-changeslist-date' ), array( 'target' => $page->getPrefixedText(), 'timestamp' => $rev->getTimestamp() @@ -203,7 +203,11 @@ class DeletedContribsPager extends IndexPager { $link = '' . $link . ''; } - $pagelink = Linker::link( $page ); + $pagelink = Linker::link( + $page, + null, + array( 'class' => 'mw-changeslist-title' ) + ); if( $rev->isMinor() ) { $mflag = ChangesList::flag( 'minor' ); @@ -222,7 +226,8 @@ class DeletedContribsPager extends IndexPager { array( $last, $dellog, $reviewlink ) ) )->escaped() ); - $ret = "{$del}{$link} {$tools} . . {$mflag} {$pagelink} {$comment}"; + $separator = '. .'; + $ret = "{$del}{$link} {$tools} {$separator} {$mflag} {$pagelink} {$comment}"; # Denote if username is redacted for this edit if( $rev->isDeleted( Revision::DELETED_USER ) ) { -- 2.20.1