X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fchanges%2FEnhancedChangesList.php;h=62cf39ee45d46f843e6f1fcadef8004f60f856bd;hb=36fdf484e98446ddbf4ea7ec6a5f9939c37e14c5;hp=28b30d8ba413425c2e6243bb59eeadac8d7005c9;hpb=cfd0e73f10e7f897131dc6b058225ab5e999b623;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php
index 28b30d8ba4..62cf39ee45 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -1,4 +1,7 @@
lastdate = '';
$this->rclistOpen = false;
$this->getOutput()->addModuleStyles( [
+ 'mediawiki.icon',
+ 'mediawiki.interface.helpers.styles',
'mediawiki.special.changeslist',
'mediawiki.special.changeslist.enhanced',
] );
$this->getOutput()->addModules( [
'jquery.makeCollapsible',
- 'mediawiki.icon',
] );
return '
';
@@ -183,9 +187,7 @@ class EnhancedChangesList extends ChangesList {
$tableClasses[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
. $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
}
- if ( $block[0]->watched
- && $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
- ) {
+ if ( $block[0]->watched ) {
$tableClasses[] = 'mw-changeslist-line-watched';
} else {
$tableClasses[] = 'mw-changeslist-line-not-watched';
@@ -218,7 +220,7 @@ class EnhancedChangesList extends ChangesList {
foreach ( $block as $rcObj ) {
// If all log actions to this page were hidden, then don't
// give the name of the affected page for this block!
- if ( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
+ if ( !static::isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
$namehidden = false;
}
$u = $rcObj->userlink;
@@ -259,7 +261,8 @@ class EnhancedChangesList extends ChangesList {
} elseif ( $allLogs ) {
$articleLink = $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
} else {
- $articleLink = $this->getArticleLink( $block[0], $block[0]->unpatrolled, $block[0]->watched );
+ $articleLink = $this->getArticleLink(
+ $block[0], $block[0]->unpatrolled, $block[0]->watched );
}
$queryParams['curid'] = $curId;
@@ -385,14 +388,12 @@ class EnhancedChangesList extends ChangesList {
$lineParams = [ 'targetTitle' => $rcObj->getTitle() ];
$classes = [ 'mw-enhanced-rc' ];
- if ( $rcObj->watched
- && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
- ) {
+ if ( $rcObj->watched ) {
$classes[] = 'mw-enhanced-watched';
}
$classes = array_merge( $classes, $this->getHTMLClasses( $rcObj, $rcObj->watched ) );
- $separator = ' . . ';
+ $separator = ' ';
$data['recentChangesFlags'] = [
'newpage' => $type == RC_NEW,
@@ -411,7 +412,7 @@ class EnhancedChangesList extends ChangesList {
if ( $type == RC_LOG ) {
$link = htmlspecialchars( $rcObj->timestamp );
# Revision link
- } elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
+ } elseif ( !ChangesList::userCan( $rcObj, RevisionRecord::DELETED_TEXT, $this->getUser() ) ) {
$link = Html::element( 'span', [ 'class' => 'history-deleted' ], $rcObj->timestamp );
} else {
$link = $this->linkRenderer->makeKnownLink(
@@ -420,7 +421,7 @@ class EnhancedChangesList extends ChangesList {
[],
$params
);
- if ( $this->isDeleted( $rcObj, Revision::DELETED_TEXT ) ) {
+ if ( static::isDeleted( $rcObj, RevisionRecord::DELETED_TEXT ) ) {
$link = '' . $link . ' ';
}
}
@@ -502,7 +503,7 @@ class EnhancedChangesList extends ChangesList {
/**
* Generates amount of changes (linking to diff ) & link to history.
*
- * @param array $block
+ * @param RCCacheEntry[] $block
* @param array $queryParams
* @param bool $allLogs
* @param bool $isnew
@@ -528,7 +529,7 @@ class EnhancedChangesList extends ChangesList {
/** @var RCCacheEntry $rcObj */
foreach ( $block as $rcObj ) {
// Same logic as below inside main foreach
- if ( $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched ) {
+ if ( $rcObj->watched ) {
$sinceLast++;
$unvisitedOldid = $rcObj->mAttribs['rc_last_oldid'];
}
@@ -551,32 +552,42 @@ class EnhancedChangesList extends ChangesList {
$block0 = $block[0];
$last = $block[count( $block ) - 1];
if ( !$allLogs ) {
- if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ||
+ if (
$isnew ||
- $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE
+ $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE ||
+ !ChangesList::userCan( $rcObj, RevisionRecord::DELETED_TEXT, $this->getUser() )
) {
- $links['total-changes'] = $nchanges[$n];
+ $links['total-changes'] = Html::rawElement( 'span', [], $nchanges[$n] );
} else {
- $links['total-changes'] = $this->linkRenderer->makeKnownLink(
- $block0->getTitle(),
- new HtmlArmor( $nchanges[$n] ),
- [ 'class' => 'mw-changeslist-groupdiff' ],
- $queryParams + [
- 'diff' => $currentRevision,
- 'oldid' => $last->mAttribs['rc_last_oldid'],
- ]
+ $links['total-changes'] = Html::rawElement( 'span', [],
+ $this->linkRenderer->makeKnownLink(
+ $block0->getTitle(),
+ new HtmlArmor( $nchanges[$n] ),
+ [ 'class' => 'mw-changeslist-groupdiff' ],
+ $queryParams + [
+ 'diff' => $currentRevision,
+ 'oldid' => $last->mAttribs['rc_last_oldid'],
+ ]
+ )
+ );
+ }
+
+ if (
+ $rcObj->mAttribs['rc_type'] != RC_CATEGORIZE &&
+ $sinceLast > 0 &&
+ $sinceLast < $n
+ ) {
+ $links['total-changes-since-last'] = Html::rawElement( 'span', [],
+ $this->linkRenderer->makeKnownLink(
+ $block0->getTitle(),
+ new HtmlArmor( $sinceLastVisitMsg[$sinceLast] ),
+ [ 'class' => 'mw-changeslist-groupdiff' ],
+ $queryParams + [
+ 'diff' => $currentRevision,
+ 'oldid' => $unvisitedOldid,
+ ]
+ )
);
- if ( $sinceLast > 0 && $sinceLast < $n ) {
- $links['total-changes-since-last'] = $this->linkRenderer->makeKnownLink(
- $block0->getTitle(),
- new HtmlArmor( $sinceLastVisitMsg[$sinceLast] ),
- [ 'class' => 'mw-changeslist-groupdiff' ],
- $queryParams + [
- 'diff' => $currentRevision,
- 'oldid' => $unvisitedOldid,
- ]
- );
- }
}
}
@@ -584,17 +595,19 @@ class EnhancedChangesList extends ChangesList {
if ( $allLogs || $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE ) {
// don't show history link for logs
} elseif ( $namehidden || !$block0->getTitle()->exists() ) {
- $links['history'] = $this->message['enhancedrc-history'];
+ $links['history'] = Html::rawElement( 'span', [], $this->message['enhancedrc-history'] );
} else {
$params = $queryParams;
$params['action'] = 'history';
- $links['history'] = $this->linkRenderer->makeKnownLink(
+ $links['history'] = Html::rawElement( 'span', [],
+ $this->linkRenderer->makeKnownLink(
$block0->getTitle(),
new HtmlArmor( $this->message['enhancedrc-history'] ),
[ 'class' => 'mw-changeslist-history' ],
$params
- );
+ )
+ );
}
# Allow others to alter, remove or add to these links
@@ -605,8 +618,8 @@ class EnhancedChangesList extends ChangesList {
return '';
}
- $logtext = implode( $this->message['pipe-separator'], $links );
- $logtext = $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
+ $logtext = Html::rawElement( 'span', [ 'class' => 'mw-changeslist-links' ],
+ implode( ' ', $links ) );
return ' ' . $logtext;
}
@@ -652,10 +665,9 @@ class EnhancedChangesList extends ChangesList {
$logPage = new LogPage( $logType );
$logTitle = SpecialPage::getTitleFor( 'Log', $logType );
$logName = $logPage->getName()->text();
- $data['logLink'] = $this->msg( 'parentheses' )
- ->rawParams(
- $this->linkRenderer->makeKnownLink( $logTitle, $logName )
- )->escaped();
+ $data['logLink'] = Html::rawElement( 'span', [ 'class' => 'mw-changeslist-links' ],
+ $this->linkRenderer->makeKnownLink( $logTitle, $logName )
+ );
} else {
$data['articleLink'] = $this->getArticleLink( $rcObj, $rcObj->unpatrolled, $rcObj->watched );
}
@@ -663,16 +675,16 @@ class EnhancedChangesList extends ChangesList {
# Diff and hist links
if ( $type != RC_LOG && $type != RC_CATEGORIZE ) {
$query['action'] = 'history';
- $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
+ $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query, false );
}
- $data['separatorAfterLinks'] = ' . . ';
+ $data['separatorAfterLinks'] = ' ';
# Character diff
if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
$cd = $this->formatCharacterDifference( $rcObj );
if ( $cd !== '' ) {
$data['characterDiff'] = $cd;
- $data['separatorAftercharacterDiff'] = ' . . ';
+ $data['separatorAftercharacterDiff'] = ' ';
}
}
@@ -685,7 +697,7 @@ class EnhancedChangesList extends ChangesList {
$data['userTalkLink'] = $rcObj->usertalklink;
$data['comment'] = $this->insertComment( $rcObj );
if ( $type == RC_CATEGORIZE ) {
- $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
+ $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query, false );
}
$data['rollback'] = $this->getRollback( $rcObj );
}
@@ -743,7 +755,11 @@ class EnhancedChangesList extends ChangesList {
] );
// everything else: makes it easier for extensions to add or remove data
- $line .= implode( '', $data );
+ foreach ( $data as $key => $dataItem ) {
+ $line .= Html::rawElement( 'span', [
+ 'class' => 'mw-changeslist-line-inner-' . $key,
+ ], $dataItem );
+ }
$line .= "\n";
@@ -758,9 +774,10 @@ class EnhancedChangesList extends ChangesList {
*
* @param RCCacheEntry $rc
* @param array $query array of key/value pairs to append as a query string
+ * @param bool $useParentheses (optional) Wrap comments in parentheses where needed
* @return string HTML
*/
- public function getDiffHistLinks( RCCacheEntry $rc, array $query ) {
+ public function getDiffHistLinks( RCCacheEntry $rc, array $query, $useParentheses = true ) {
$pageTitle = $rc->getTitle();
if ( $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE ) {
// For categorizations we must swap the category title with the page title!
@@ -772,15 +789,23 @@ class EnhancedChangesList extends ChangesList {
}
}
- $retVal = ' ' . $this->msg( 'parentheses' )
- ->rawParams( $rc->difflink . $this->message['pipe-separator']
- . $this->linkRenderer->makeKnownLink(
- $pageTitle,
- new HtmlArmor( $this->message['hist'] ),
- [ 'class' => 'mw-changeslist-history' ],
- $query
- ) )->escaped();
- return $retVal;
+ $histLink = $this->linkRenderer->makeKnownLink(
+ $pageTitle,
+ new HtmlArmor( $this->message['hist'] ),
+ [ 'class' => 'mw-changeslist-history' ],
+ $query
+ );
+ if ( $useParentheses ) {
+ $retVal = $this->msg( 'parentheses' )
+ ->rawParams( $rc->difflink . $this->message['pipe-separator']
+ . $histLink )->escaped();
+ } else {
+ $retVal = Html::rawElement( 'span', [ 'class' => 'mw-changeslist-links' ],
+ Html::rawElement( 'span', [], $rc->difflink ) .
+ Html::rawElement( 'span', [], $histLink )
+ );
+ }
+ return ' ' . $retVal;
}
/**