2004-11-25 13:47:17 +00:00
|
|
|
|
<?php
|
2010-08-14 17:42:40 +00:00
|
|
|
|
/**
|
2012-05-21 19:56:04 +00:00
|
|
|
|
* Classes to show lists of changes.
|
|
|
|
|
|
*
|
|
|
|
|
|
* These can be:
|
2010-09-14 20:12:56 +00:00
|
|
|
|
* - watchlist
|
2010-08-14 17:42:40 +00:00
|
|
|
|
* - related changes
|
|
|
|
|
|
* - recent changes
|
|
|
|
|
|
*
|
2012-05-21 19:56:04 +00:00
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
|
*
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
*
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
|
*
|
2010-08-14 17:42:40 +00:00
|
|
|
|
* @file
|
|
|
|
|
|
*/
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2006-01-05 04:11:27 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @todo document
|
|
|
|
|
|
*/
|
2008-11-28 23:06:25 +00:00
|
|
|
|
class RCCacheEntry extends RecentChange {
|
2006-05-11 22:40:38 +00:00
|
|
|
|
var $secureName, $link;
|
2008-11-28 23:06:25 +00:00
|
|
|
|
var $curlink , $difflink, $lastlink, $usertalklink, $versionlink;
|
2006-05-11 22:40:38 +00:00
|
|
|
|
var $userlink, $timestamp, $watched;
|
2006-01-05 04:11:27 +00:00
|
|
|
|
|
2011-04-04 21:23:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @param $rc RecentChange
|
|
|
|
|
|
* @return RCCacheEntry
|
|
|
|
|
|
*/
|
2007-05-20 12:00:13 +00:00
|
|
|
|
static function newFromParent( $rc ) {
|
2006-01-05 04:11:27 +00:00
|
|
|
|
$rc2 = new RCCacheEntry;
|
|
|
|
|
|
$rc2->mAttribs = $rc->mAttribs;
|
|
|
|
|
|
$rc2->mExtra = $rc->mExtra;
|
|
|
|
|
|
return $rc2;
|
|
|
|
|
|
}
|
2008-11-28 23:06:25 +00:00
|
|
|
|
}
|
2006-01-05 04:11:27 +00:00
|
|
|
|
|
2005-01-27 19:51:47 +00:00
|
|
|
|
/**
|
2010-08-14 17:42:40 +00:00
|
|
|
|
* Base class for all changes lists
|
2005-01-27 19:51:47 +00:00
|
|
|
|
*/
|
2011-07-17 09:25:50 +00:00
|
|
|
|
class ChangesList extends ContextSource {
|
2011-04-04 21:23:22 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @var Skin
|
|
|
|
|
|
*/
|
2008-11-29 00:17:10 +00:00
|
|
|
|
public $skin;
|
2011-05-20 22:03:10 +00:00
|
|
|
|
|
2009-05-18 01:12:52 +00:00
|
|
|
|
protected $watchlist = false;
|
2011-05-20 22:03:10 +00:00
|
|
|
|
|
2011-05-21 20:39:31 +00:00
|
|
|
|
protected $message;
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2008-04-14 07:45:50 +00:00
|
|
|
|
/**
|
2011-07-17 09:25:50 +00:00
|
|
|
|
* Changeslist contructor
|
|
|
|
|
|
*
|
2011-09-15 15:19:49 +00:00
|
|
|
|
* @param $obj Skin or IContextSource
|
2011-07-17 09:25:50 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public function __construct( $obj ) {
|
2011-09-15 15:19:49 +00:00
|
|
|
|
if ( $obj instanceof IContextSource ) {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$this->setContext( $obj );
|
|
|
|
|
|
$this->skin = $obj->getSkin();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$this->setContext( $obj->getContext() );
|
|
|
|
|
|
$this->skin = $obj;
|
|
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$this->preCacheMessages();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2006-06-21 00:18:55 +00:00
|
|
|
|
/**
|
2011-07-17 09:25:50 +00:00
|
|
|
|
* Fetch an appropriate changes list class for the main context
|
|
|
|
|
|
* This first argument used to be an User object.
|
2006-06-21 00:18:55 +00:00
|
|
|
|
*
|
2011-07-18 23:01:08 +00:00
|
|
|
|
* @deprecated in 1.18; use newFromContext() instead
|
2012-02-10 15:37:33 +00:00
|
|
|
|
* @param $unused string|User Unused
|
2011-05-20 22:03:10 +00:00
|
|
|
|
* @return ChangesList|EnhancedChangesList|OldChangesList derivative
|
2006-06-21 00:18:55 +00:00
|
|
|
|
*/
|
2011-07-17 09:25:50 +00:00
|
|
|
|
public static function newFromUser( $unused ) {
|
2011-12-13 05:19:05 +00:00
|
|
|
|
wfDeprecated( __METHOD__, '1.18' );
|
2011-07-17 09:25:50 +00:00
|
|
|
|
return self::newFromContext( RequestContext::getMain() );
|
|
|
|
|
|
}
|
2010-04-03 14:48:25 +00:00
|
|
|
|
|
2011-07-17 09:25:50 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Fetch an appropriate changes list class for the specified context
|
|
|
|
|
|
* Some users might want to use an enhanced list format, for instance
|
|
|
|
|
|
*
|
2011-09-15 15:19:49 +00:00
|
|
|
|
* @param $context IContextSource to use
|
2011-07-17 09:25:50 +00:00
|
|
|
|
* @return ChangesList|EnhancedChangesList|OldChangesList derivative
|
|
|
|
|
|
*/
|
2011-09-15 15:19:49 +00:00
|
|
|
|
public static function newFromContext( IContextSource $context ) {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$user = $context->getUser();
|
|
|
|
|
|
$sk = $context->getSkin();
|
2009-12-11 21:07:27 +00:00
|
|
|
|
$list = null;
|
2011-04-03 11:33:10 +00:00
|
|
|
|
if( wfRunHooks( 'FetchChangesList', array( $user, &$sk, &$list ) ) ) {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$new = $context->getRequest()->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
|
|
|
|
|
|
return $new ? new EnhancedChangesList( $context ) : new OldChangesList( $context );
|
2005-09-15 00:40:51 +00:00
|
|
|
|
} else {
|
2006-06-21 00:18:55 +00:00
|
|
|
|
return $list;
|
2005-09-15 00:40:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2009-05-18 01:12:52 +00:00
|
|
|
|
/**
|
2009-05-26 11:03:50 +00:00
|
|
|
|
* Sets the list to use a <li class="watchlist-(namespace)-(page)"> tag
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @param $value Boolean
|
2009-05-18 01:12:52 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public function setWatchlistDivs( $value = true ) {
|
|
|
|
|
|
$this->watchlist = $value;
|
|
|
|
|
|
}
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* As we use the same small set of messages in various methods and that
|
|
|
|
|
|
* they are called often, we call them once and save them in $this->message
|
|
|
|
|
|
*/
|
2008-04-04 04:44:22 +00:00
|
|
|
|
private function preCacheMessages() {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
if( !isset( $this->message ) ) {
|
2009-08-02 22:15:55 +00:00
|
|
|
|
foreach ( explode( ' ', 'cur diff hist last blocklink history ' .
|
|
|
|
|
|
'semicolon-separator pipe-separator' ) as $msg ) {
|
2008-06-14 10:41:46 +00:00
|
|
|
|
$this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-04-24 15:43:49 +00:00
|
|
|
|
/**
|
2006-06-15 07:29:00 +00:00
|
|
|
|
* Returns the appropriate flags for new page, minor change and patrolling
|
2011-04-04 21:23:22 +00:00
|
|
|
|
* @param $flags Array Associative array of 'flag' => Bool
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @param $nothing String to use for empty space
|
|
|
|
|
|
* @return String
|
2005-04-24 15:43:49 +00:00
|
|
|
|
*/
|
2010-12-27 19:07:28 +00:00
|
|
|
|
protected function recentChangesFlags( $flags, $nothing = ' ' ) {
|
|
|
|
|
|
$f = '';
|
|
|
|
|
|
foreach( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ){
|
|
|
|
|
|
$f .= isset( $flags[$flag] ) && $flags[$flag]
|
|
|
|
|
|
? self::flag( $flag )
|
|
|
|
|
|
: $nothing;
|
|
|
|
|
|
}
|
2008-03-20 02:08:35 +00:00
|
|
|
|
return $f;
|
2005-04-24 15:43:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2009-08-02 22:15:55 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Provide the <abbr> element appropriate to a given abbreviated flag,
|
|
|
|
|
|
* namely the flag indicating a new page, a minor edit, a bot edit, or an
|
|
|
|
|
|
* unpatrolled edit. By default in English it will contain "N", "m", "b",
|
|
|
|
|
|
* "!" respectively, plus it will have an appropriate title and class.
|
|
|
|
|
|
*
|
2011-05-20 22:03:10 +00:00
|
|
|
|
* @param $flag String: 'newpage', 'unpatrolled', 'minor', or 'bot'
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @return String: Raw HTML
|
2009-08-02 22:15:55 +00:00
|
|
|
|
*/
|
2010-12-27 19:07:28 +00:00
|
|
|
|
public static function flag( $flag ) {
|
2009-08-02 22:15:55 +00:00
|
|
|
|
static $messages = null;
|
|
|
|
|
|
if ( is_null( $messages ) ) {
|
2011-05-25 15:39:47 +00:00
|
|
|
|
$messages = array(
|
2010-12-27 19:07:28 +00:00
|
|
|
|
'newpage' => array( 'newpageletter', 'recentchanges-label-newpage' ),
|
|
|
|
|
|
'minoredit' => array( 'minoreditletter', 'recentchanges-label-minor' ),
|
|
|
|
|
|
'botedit' => array( 'boteditletter', 'recentchanges-label-bot' ),
|
2011-05-25 15:39:47 +00:00
|
|
|
|
'unpatrolled' => array( 'unpatrolledletter', 'recentchanges-label-unpatrolled' ),
|
2010-12-27 19:07:28 +00:00
|
|
|
|
);
|
2011-02-23 12:35:41 +00:00
|
|
|
|
foreach( $messages as &$value ) {
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$value[0] = wfMsgExt( $value[0], 'escapenoentities' );
|
|
|
|
|
|
$value[1] = wfMsgExt( $value[1], 'escapenoentities' );
|
2009-08-02 22:15:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2010-12-27 19:07:28 +00:00
|
|
|
|
|
2010-12-25 00:29:41 +00:00
|
|
|
|
# Inconsistent naming, bleh
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$map = array(
|
|
|
|
|
|
'newpage' => 'newpage',
|
2010-12-27 19:50:51 +00:00
|
|
|
|
'minor' => 'minoredit',
|
|
|
|
|
|
'bot' => 'botedit',
|
2010-12-27 19:07:28 +00:00
|
|
|
|
'unpatrolled' => 'unpatrolled',
|
2010-12-27 20:02:10 +00:00
|
|
|
|
'minoredit' => 'minoredit',
|
|
|
|
|
|
'botedit' => 'botedit',
|
2010-12-27 19:07:28 +00:00
|
|
|
|
);
|
|
|
|
|
|
$flag = $map[$flag];
|
|
|
|
|
|
|
|
|
|
|
|
return "<abbr class='$flag' title='" . $messages[$flag][1] . "'>" . $messages[$flag][0] . '</abbr>';
|
2009-08-02 22:15:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-07-01 20:36:04 +00:00
|
|
|
|
/**
|
2005-01-27 19:51:47 +00:00
|
|
|
|
* Returns text for the start of the tabular part of RC
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @return String
|
2005-01-27 19:51:47 +00:00
|
|
|
|
*/
|
2008-04-04 04:44:22 +00:00
|
|
|
|
public function beginRecentChangesList() {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$this->rc_cache = array();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$this->rcMoveIndex = 0;
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$this->rcCacheIndex = 0;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$this->lastdate = '';
|
|
|
|
|
|
$this->rclistOpen = false;
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2008-11-16 23:18:43 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Show formatted char difference
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @param $old Integer: bytes
|
|
|
|
|
|
* @param $new Integer: bytes
|
2011-05-20 22:03:10 +00:00
|
|
|
|
* @return String
|
2008-11-16 23:18:43 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public static function showCharacterDifference( $old, $new ) {
|
2009-03-29 10:11:19 +00:00
|
|
|
|
global $wgRCChangedSizeThreshold, $wgLang, $wgMiserMode;
|
2008-11-16 23:18:43 +00:00
|
|
|
|
$szdiff = $new - $old;
|
2009-04-07 06:47:45 +00:00
|
|
|
|
|
|
|
|
|
|
$code = $wgLang->getCode();
|
|
|
|
|
|
static $fastCharDiff = array();
|
|
|
|
|
|
if ( !isset($fastCharDiff[$code]) ) {
|
|
|
|
|
|
$fastCharDiff[$code] = $wgMiserMode || wfMsgNoTrans( 'rc-change-size' ) === '$1';
|
|
|
|
|
|
}
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2011-10-04 00:12:09 +00:00
|
|
|
|
$formattedSize = $wgLang->formatNum($szdiff);
|
2009-04-07 06:47:45 +00:00
|
|
|
|
|
|
|
|
|
|
if ( !$fastCharDiff[$code] ) {
|
2011-10-04 03:08:49 +00:00
|
|
|
|
$formattedSize = wfMsgExt( 'rc-change-size', array( 'parsemag' ), $formattedSize );
|
2009-04-07 06:47:45 +00:00
|
|
|
|
}
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2008-11-16 23:18:43 +00:00
|
|
|
|
if( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
|
|
|
|
|
|
$tag = 'strong';
|
|
|
|
|
|
} else {
|
2011-05-25 15:39:47 +00:00
|
|
|
|
$tag = 'span';
|
2008-11-16 23:18:43 +00:00
|
|
|
|
}
|
2011-10-04 03:08:49 +00:00
|
|
|
|
|
2011-10-04 00:12:09 +00:00
|
|
|
|
if ( $szdiff === 0 ) {
|
2011-10-04 07:33:12 +00:00
|
|
|
|
$formattedSizeClass = 'mw-plusminus-null';
|
2011-10-04 00:12:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
if ( $szdiff > 0 ) {
|
|
|
|
|
|
$formattedSize = '+' . $formattedSize;
|
2011-10-04 07:33:12 +00:00
|
|
|
|
$formattedSizeClass = 'mw-plusminus-pos';
|
2011-10-04 00:12:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
if ( $szdiff < 0 ) {
|
2011-10-04 07:33:12 +00:00
|
|
|
|
$formattedSizeClass = 'mw-plusminus-neg';
|
2008-11-16 23:18:43 +00:00
|
|
|
|
}
|
2011-10-05 06:45:11 +00:00
|
|
|
|
|
2012-01-04 11:33:35 +00:00
|
|
|
|
$formattedTotalSize = wfMsgExt( 'rc-change-size-new', 'parsemag', $wgLang->formatNum( $new ) );
|
2011-11-23 21:01:03 +00:00
|
|
|
|
|
2011-10-05 06:45:11 +00:00
|
|
|
|
return Html::element( $tag,
|
2011-11-23 21:01:03 +00:00
|
|
|
|
array( 'dir' => 'ltr', 'class' => $formattedSizeClass, 'title' => $formattedTotalSize ),
|
2011-10-28 08:04:58 +00:00
|
|
|
|
wfMessage( 'parentheses', $formattedSize )->plain() ) . $wgLang->getDirMark();
|
2008-11-16 23:18:43 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
/**
|
2011-05-25 15:39:47 +00:00
|
|
|
|
* Returns text for the end of RC
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @return String
|
2004-11-25 13:47:17 +00:00
|
|
|
|
*/
|
2008-04-04 04:44:22 +00:00
|
|
|
|
public function endRecentChangesList() {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
if( $this->rclistOpen ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return "</ul>\n";
|
2004-11-25 13:47:17 +00:00
|
|
|
|
} else {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return '';
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2005-09-06 20:04:38 +00:00
|
|
|
|
|
2010-02-08 04:49:34 +00:00
|
|
|
|
public function insertDateHeader( &$s, $rc_timestamp ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# Make date header if necessary
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$date = $this->getLanguage()->date( $rc_timestamp, true, true );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $date != $this->lastdate ) {
|
2010-01-06 19:59:42 +00:00
|
|
|
|
if( $this->lastdate != '' ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$s .= "</ul>\n";
|
|
|
|
|
|
}
|
2009-05-22 09:35:48 +00:00
|
|
|
|
$s .= Xml::element( 'h4', null, $date ) . "\n<ul class=\"special\">";
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$this->lastdate = $date;
|
|
|
|
|
|
$this->rclistOpen = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2010-02-08 04:49:34 +00:00
|
|
|
|
public function insertLog( &$s, $title, $logtype ) {
|
2011-09-08 10:13:01 +00:00
|
|
|
|
$page = new LogPage( $logtype );
|
|
|
|
|
|
$logname = $page->getName()->escaped();
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$s .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $title, $logname ) )->escaped();
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2011-04-04 21:23:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @param $s
|
|
|
|
|
|
* @param $rc RecentChange
|
|
|
|
|
|
* @param $unpatrolled
|
|
|
|
|
|
*/
|
2010-02-08 04:49:34 +00:00
|
|
|
|
public function insertDiffHist( &$s, &$rc, $unpatrolled ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# Diff link
|
2008-12-20 08:25:39 +00:00
|
|
|
|
if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$diffLink = $this->message['diff'];
|
2011-10-12 15:09:04 +00:00
|
|
|
|
} elseif ( !self::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$diffLink = $this->message['diff'];
|
|
|
|
|
|
} else {
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$query = array(
|
|
|
|
|
|
'curid' => $rc->mAttribs['rc_cur_id'],
|
|
|
|
|
|
'diff' => $rc->mAttribs['rc_this_oldid'],
|
|
|
|
|
|
'oldid' => $rc->mAttribs['rc_last_oldid']
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if( $unpatrolled ) {
|
|
|
|
|
|
$query['rcid'] = $rc->mAttribs['rc_id'];
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$diffLink = Linker::linkKnown(
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$rc->getTitle(),
|
|
|
|
|
|
$this->message['diff'],
|
|
|
|
|
|
array( 'tabindex' => $rc->counter ),
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$query
|
2009-06-06 22:42:48 +00:00
|
|
|
|
);
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$diffhist = $diffLink . $this->message['pipe-separator'];
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# History link
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$diffhist .= Linker::linkKnown(
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$rc->getTitle(),
|
|
|
|
|
|
$this->message['hist'],
|
|
|
|
|
|
array(),
|
|
|
|
|
|
array(
|
2005-09-11 01:55:16 +00:00
|
|
|
|
'curid' => $rc->mAttribs['rc_cur_id'],
|
2009-06-06 22:42:48 +00:00
|
|
|
|
'action' => 'history'
|
2011-07-17 09:25:50 +00:00
|
|
|
|
)
|
2009-06-06 22:42:48 +00:00
|
|
|
|
);
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$s .= $this->msg( 'parentheses' )->rawParams( $diffhist )->escaped() . ' . . ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-12-18 03:47:11 +00:00
|
|
|
|
|
2011-04-04 21:23:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @param $s
|
|
|
|
|
|
* @param $rc RecentChange
|
|
|
|
|
|
* @param $unpatrolled
|
|
|
|
|
|
* @param $watched
|
|
|
|
|
|
*/
|
2010-02-08 04:49:34 +00:00
|
|
|
|
public function insertArticleLink( &$s, &$rc, $unpatrolled, $watched ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# If it's a new article, there is no diff link, but if it hasn't been
|
|
|
|
|
|
# patrolled yet, we need to give users a way to do so
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$params = array();
|
|
|
|
|
|
|
|
|
|
|
|
if ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW ) {
|
|
|
|
|
|
$params['rcid'] = $rc->mAttribs['rc_id'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2011-09-19 21:55:17 +00:00
|
|
|
|
$articlelink = Linker::linkKnown(
|
|
|
|
|
|
$rc->getTitle(),
|
|
|
|
|
|
null,
|
|
|
|
|
|
array(),
|
|
|
|
|
|
$params
|
|
|
|
|
|
);
|
2008-03-16 18:46:09 +00:00
|
|
|
|
if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$articlelink = '<span class="history-deleted">' . $articlelink . '</span>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2008-11-28 23:06:25 +00:00
|
|
|
|
# Bolden pages watched by this user
|
|
|
|
|
|
if( $watched ) {
|
2008-11-14 02:21:45 +00:00
|
|
|
|
$articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
|
2008-11-28 23:06:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
# RTL/LTR marker
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$articlelink .= $this->getLanguage()->getDirMark();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-11-29 00:17:10 +00:00
|
|
|
|
wfRunHooks( 'ChangesListInsertArticleLink',
|
|
|
|
|
|
array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched) );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-11-28 23:06:25 +00:00
|
|
|
|
$s .= " $articlelink";
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2011-04-04 21:23:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @param $s
|
|
|
|
|
|
* @param $rc RecentChange
|
|
|
|
|
|
*/
|
2010-02-08 04:49:34 +00:00
|
|
|
|
public function insertTimestamp( &$s, $rc ) {
|
2011-05-25 15:39:47 +00:00
|
|
|
|
$s .= $this->message['semicolon-separator'] .
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$this->getLanguage()->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2012-02-01 20:53:38 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Insert links to user page, user talk page and eventually a blocking link
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*
|
2012-02-01 20:53:38 +00:00
|
|
|
|
* @param &$s String HTML to update
|
|
|
|
|
|
* @param &$rc RecentChange
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*/
|
2009-01-25 16:34:21 +00:00
|
|
|
|
public function insertUserRelatedLinks( &$s, &$rc ) {
|
|
|
|
|
|
if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
|
2011-04-04 21:23:22 +00:00
|
|
|
|
$s .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
2012-01-12 19:03:32 +00:00
|
|
|
|
$s .= $this->getLanguage()->getDirMark() . Linker::userLink( $rc->mAttribs['rc_user'],
|
|
|
|
|
|
$rc->mAttribs['rc_user_text'] );
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$s .= Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-01-12 19:03:32 +00:00
|
|
|
|
/**
|
2012-02-01 20:53:38 +00:00
|
|
|
|
* Insert a formatted action
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @param $rc RecentChange
|
2012-02-09 21:33:27 +00:00
|
|
|
|
* @return string
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*/
|
2011-09-08 09:15:59 +00:00
|
|
|
|
public function insertLogEntry( $rc ) {
|
|
|
|
|
|
$formatter = LogFormatter::newFromRow( $rc->mAttribs );
|
2011-09-08 10:13:01 +00:00
|
|
|
|
$formatter->setShowUserToolLinks( true );
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$mark = $this->getLanguage()->getDirMark();
|
2011-09-08 09:15:59 +00:00
|
|
|
|
return $formatter->getActionText() . " $mark" . $formatter->getComment();
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2011-09-19 12:36:58 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Insert a formatted comment
|
|
|
|
|
|
* @param $rc RecentChange
|
2012-02-09 21:33:27 +00:00
|
|
|
|
* @return string
|
2011-09-19 12:36:58 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public function insertComment( $rc ) {
|
|
|
|
|
|
if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
|
|
|
|
|
|
if( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) {
|
|
|
|
|
|
return ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span>';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2008-04-13 17:55:10 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Check whether to enable recent changes patrol features
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @return Boolean
|
2008-04-13 17:55:10 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public static function usePatrol() {
|
|
|
|
|
|
global $wgUser;
|
|
|
|
|
|
return $wgUser->useRCPatrol();
|
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2007-01-17 18:13:56 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Returns the string which indicates the number of watching users
|
2012-02-09 21:33:27 +00:00
|
|
|
|
* @return string
|
2007-01-17 18:13:56 +00:00
|
|
|
|
*/
|
2008-04-04 04:44:22 +00:00
|
|
|
|
protected function numberofWatchingusers( $count ) {
|
2007-01-17 18:13:56 +00:00
|
|
|
|
static $cache = array();
|
2008-12-20 08:25:39 +00:00
|
|
|
|
if( $count > 0 ) {
|
|
|
|
|
|
if( !isset( $cache[$count] ) ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$cache[$count] = wfMsgExt( 'number_of_watching_users_RCview',
|
2011-11-21 16:13:21 +00:00
|
|
|
|
array('parsemag', 'escape' ), $this->getLanguage()->formatNum( $count ) );
|
2007-01-17 18:13:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
return $cache[$count];
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-04 04:44:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Determine if said field of a revision is hidden
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @param $rc RCCacheEntry
|
|
|
|
|
|
* @param $field Integer: one of DELETED_* bitfield constants
|
|
|
|
|
|
* @return Boolean
|
2008-04-04 04:44:22 +00:00
|
|
|
|
*/
|
|
|
|
|
|
public static function isDeleted( $rc, $field ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
return ( $rc->mAttribs['rc_deleted'] & $field ) == $field;
|
2008-04-04 04:44:22 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-04 04:44:22 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Determine if the current user is allowed to view a particular
|
|
|
|
|
|
* field of this revision, if it's marked as deleted.
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @param $rc RCCacheEntry
|
|
|
|
|
|
* @param $field Integer
|
2011-10-12 15:09:04 +00:00
|
|
|
|
* @param $user User object to check, or null to use $wgUser
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @return Boolean
|
2008-04-04 04:44:22 +00:00
|
|
|
|
*/
|
2011-10-12 15:09:04 +00:00
|
|
|
|
public static function userCan( $rc, $field, User $user = null ) {
|
2009-10-15 11:31:33 +00:00
|
|
|
|
if( $rc->mAttribs['rc_type'] == RC_LOG ) {
|
2011-10-12 15:09:04 +00:00
|
|
|
|
return LogEventsList::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
|
2008-04-04 04:44:22 +00:00
|
|
|
|
} else {
|
2011-10-12 15:09:04 +00:00
|
|
|
|
return Revision::userCanBitfield( $rc->mAttribs['rc_deleted'], $field, $user );
|
2008-04-04 04:44:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2008-11-09 21:44:56 +00:00
|
|
|
|
|
2012-01-12 19:03:32 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* @param $link string
|
|
|
|
|
|
* @param $watched bool
|
|
|
|
|
|
* @return string
|
|
|
|
|
|
*/
|
2009-06-06 22:42:48 +00:00
|
|
|
|
protected function maybeWatchedLink( $link, $watched = false ) {
|
2008-11-09 21:44:56 +00:00
|
|
|
|
if( $watched ) {
|
|
|
|
|
|
return '<strong class="mw-watched">' . $link . '</strong>';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return '<span class="mw-rc-unwatched">' . $link . '</span>';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2011-04-04 21:23:22 +00:00
|
|
|
|
/** Inserts a rollback link
|
|
|
|
|
|
*
|
2011-12-31 00:21:27 +00:00
|
|
|
|
* @param $s string
|
2011-04-04 21:23:22 +00:00
|
|
|
|
* @param $rc RecentChange
|
|
|
|
|
|
*/
|
LiquidThreads code quality, bug fixes and cleanup:
* Remove large swathes of dead code, hooks that have never existed, and dormant methods.
* Remove the TalkpageArchiveView, which has been inaccessible from the UI for ages.
* Break most miscellaneous hooks out into their own file, classes/Hooks.php
* Float the reply link on the RHS.
* Organise the hooks section of LiquidThreads.php somewhat.
* Remove deprecated =& syntax in some places.
* Move scratchTitle and related methods into Threads class instead of View class.
* Kill home-grown revision insertion code from leaveTrace, and rewrite it to use Article::doEdit
* Internal documentation, variable naming as appropriate.
* Remove special-case handling for links, unnecessary now.
* Fix customizeOldChangesList, it looks like it was never properly tested. Even if it had worked, it would have put (not by the author) on every edit to a post.
* Fail fast when trying to move a non-toplevel thread.
* Add rollback, extra links to the end of new-thread recentchanges entries.
2009-07-31 10:59:11 +00:00
|
|
|
|
public function insertRollback( &$s, &$rc ) {
|
2009-03-03 20:12:37 +00:00
|
|
|
|
if( !$rc->mAttribs['rc_new'] && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
|
2009-01-20 04:01:59 +00:00
|
|
|
|
$page = $rc->getTitle();
|
|
|
|
|
|
/** Check for rollback and edit permissions, disallow special pages, and only
|
|
|
|
|
|
* show a link on the top-most revision */
|
2011-07-17 09:25:50 +00:00
|
|
|
|
if ( $this->getUser()->isAllowed('rollback') && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] )
|
2009-01-20 04:01:59 +00:00
|
|
|
|
{
|
|
|
|
|
|
$rev = new Revision( array(
|
|
|
|
|
|
'id' => $rc->mAttribs['rc_this_oldid'],
|
|
|
|
|
|
'user' => $rc->mAttribs['rc_user'],
|
2009-03-03 20:12:37 +00:00
|
|
|
|
'user_text' => $rc->mAttribs['rc_user_text'],
|
|
|
|
|
|
'deleted' => $rc->mAttribs['rc_deleted']
|
2009-01-20 04:01:59 +00:00
|
|
|
|
) );
|
2009-02-20 13:00:58 +00:00
|
|
|
|
$rev->setTitle( $page );
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$s .= ' '.Linker::generateRollback( $rev, $this->getContext() );
|
2009-01-20 04:01:59 +00:00
|
|
|
|
}
|
2009-02-20 13:00:58 +00:00
|
|
|
|
}
|
2009-01-20 04:01:59 +00:00
|
|
|
|
}
|
2009-01-28 19:08:18 +00:00
|
|
|
|
|
2011-04-04 21:23:22 +00:00
|
|
|
|
/**
|
2011-12-31 00:21:27 +00:00
|
|
|
|
* @param $s string
|
2011-04-04 21:23:22 +00:00
|
|
|
|
* @param $rc RecentChange
|
|
|
|
|
|
* @param $classes
|
|
|
|
|
|
*/
|
LiquidThreads code quality, bug fixes and cleanup:
* Remove large swathes of dead code, hooks that have never existed, and dormant methods.
* Remove the TalkpageArchiveView, which has been inaccessible from the UI for ages.
* Break most miscellaneous hooks out into their own file, classes/Hooks.php
* Float the reply link on the RHS.
* Organise the hooks section of LiquidThreads.php somewhat.
* Remove deprecated =& syntax in some places.
* Move scratchTitle and related methods into Threads class instead of View class.
* Kill home-grown revision insertion code from leaveTrace, and rewrite it to use Article::doEdit
* Internal documentation, variable naming as appropriate.
* Remove special-case handling for links, unnecessary now.
* Fix customizeOldChangesList, it looks like it was never properly tested. Even if it had worked, it would have put (not by the author) on every edit to a post.
* Fail fast when trying to move a non-toplevel thread.
* Add rollback, extra links to the end of new-thread recentchanges entries.
2009-07-31 10:59:11 +00:00
|
|
|
|
public function insertTags( &$s, &$rc, &$classes ) {
|
2009-01-28 23:54:41 +00:00
|
|
|
|
if ( empty($rc->mAttribs['ts_tags']) )
|
|
|
|
|
|
return;
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2009-01-28 19:08:18 +00:00
|
|
|
|
list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $rc->mAttribs['ts_tags'], 'changeslist' );
|
|
|
|
|
|
$classes = array_merge( $classes, $newClasses );
|
|
|
|
|
|
$s .= ' ' . $tagSummary;
|
|
|
|
|
|
}
|
2009-01-29 22:44:31 +00:00
|
|
|
|
|
LiquidThreads code quality, bug fixes and cleanup:
* Remove large swathes of dead code, hooks that have never existed, and dormant methods.
* Remove the TalkpageArchiveView, which has been inaccessible from the UI for ages.
* Break most miscellaneous hooks out into their own file, classes/Hooks.php
* Float the reply link on the RHS.
* Organise the hooks section of LiquidThreads.php somewhat.
* Remove deprecated =& syntax in some places.
* Move scratchTitle and related methods into Threads class instead of View class.
* Kill home-grown revision insertion code from leaveTrace, and rewrite it to use Article::doEdit
* Internal documentation, variable naming as appropriate.
* Remove special-case handling for links, unnecessary now.
* Fix customizeOldChangesList, it looks like it was never properly tested. Even if it had worked, it would have put (not by the author) on every edit to a post.
* Fail fast when trying to move a non-toplevel thread.
* Add rollback, extra links to the end of new-thread recentchanges entries.
2009-07-31 10:59:11 +00:00
|
|
|
|
public function insertExtra( &$s, &$rc, &$classes ) {
|
2009-01-29 22:44:31 +00:00
|
|
|
|
## Empty, used for subclassers to add anything special.
|
|
|
|
|
|
}
|
2011-11-19 05:37:24 +00:00
|
|
|
|
|
|
|
|
|
|
protected function showAsUnpatrolled( RecentChange $rc ) {
|
|
|
|
|
|
$unpatrolled = false;
|
|
|
|
|
|
if ( !$rc->mAttribs['rc_patrolled'] ) {
|
|
|
|
|
|
if ( $this->getUser()->useRCPatrol() ) {
|
|
|
|
|
|
$unpatrolled = true;
|
|
|
|
|
|
} elseif ( $this->getUser()->useNPPatrol() && $rc->mAttribs['rc_new'] ) {
|
|
|
|
|
|
$unpatrolled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return $unpatrolled;
|
|
|
|
|
|
}
|
2005-09-06 18:43:45 +00:00
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
2005-09-06 18:43:45 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generate a list of changes using the good old system (no javascript)
|
|
|
|
|
|
*/
|
|
|
|
|
|
class OldChangesList extends ChangesList {
|
2005-09-06 18:14:24 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Format a line using the old system (aka without any javascript).
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @param $rc RecentChange
|
2012-02-09 21:33:27 +00:00
|
|
|
|
* @return string
|
2005-09-06 18:14:24 +00:00
|
|
|
|
*/
|
2009-12-11 21:07:27 +00:00
|
|
|
|
public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
global $wgRCShowChangedSize;
|
2008-11-29 00:17:10 +00:00
|
|
|
|
wfProfileIn( __METHOD__ );
|
2011-11-19 05:37:24 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Should patrol-related stuff be shown?
|
2011-11-19 05:37:24 +00:00
|
|
|
|
$unpatrolled = $this->showAsUnpatrolled( $rc );
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$dateheader = ''; // $s now contains only <li>...</li>, for hooks' convenience.
|
|
|
|
|
|
$this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2008-09-15 15:51:45 +00:00
|
|
|
|
$s = '';
|
2009-01-28 19:08:18 +00:00
|
|
|
|
$classes = array();
|
2009-02-08 15:55:32 +00:00
|
|
|
|
// use mw-line-even/mw-line-odd class only if linenumber is given (feature from bug 14468)
|
|
|
|
|
|
if( $linenumber ) {
|
|
|
|
|
|
if( $linenumber & 1 ) {
|
|
|
|
|
|
$classes[] = 'mw-line-odd';
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
$classes[] = 'mw-line-even';
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2011-09-08 09:15:59 +00:00
|
|
|
|
// Moved pages (very very old, not supported anymore)
|
2008-12-20 08:25:39 +00:00
|
|
|
|
if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// Log entries
|
2008-12-20 08:25:39 +00:00
|
|
|
|
} elseif( $rc->mAttribs['rc_log_type'] ) {
|
2011-09-21 09:41:40 +00:00
|
|
|
|
$logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$this->insertLog( $s, $logtitle, $rc->mAttribs['rc_log_type'] );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// Log entries (old format) or log targets, and special pages
|
2008-12-20 08:25:39 +00:00
|
|
|
|
} elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
|
2011-04-17 11:31:11 +00:00
|
|
|
|
list( $name, $subpage ) = SpecialPageFactory::resolveAlias( $rc->mAttribs['rc_title'] );
|
2008-12-20 08:25:39 +00:00
|
|
|
|
if( $name == 'Log' ) {
|
|
|
|
|
|
$this->insertLog( $s, $rc->getTitle(), $subpage );
|
2006-10-30 06:25:31 +00:00
|
|
|
|
}
|
2008-04-04 03:56:48 +00:00
|
|
|
|
// Regular entries
|
2007-03-16 16:01:07 +00:00
|
|
|
|
} else {
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$this->insertDiffHist( $s, $rc, $unpatrolled );
|
2006-06-15 07:29:00 +00:00
|
|
|
|
# M, N, b and ! (minor, new, bot and unpatrolled)
|
2011-05-25 15:39:47 +00:00
|
|
|
|
$s .= $this->recentChangesFlags(
|
2010-12-27 19:07:28 +00:00
|
|
|
|
array(
|
|
|
|
|
|
'newpage' => $rc->mAttribs['rc_new'],
|
2010-12-27 20:02:10 +00:00
|
|
|
|
'minor' => $rc->mAttribs['rc_minor'],
|
2011-05-25 15:39:47 +00:00
|
|
|
|
'unpatrolled' => $unpatrolled,
|
2010-12-27 20:02:10 +00:00
|
|
|
|
'bot' => $rc->mAttribs['rc_bot']
|
2010-12-27 19:07:28 +00:00
|
|
|
|
),
|
|
|
|
|
|
''
|
|
|
|
|
|
);
|
2008-12-20 08:25:39 +00:00
|
|
|
|
$this->insertArticleLink( $s, $rc, $unpatrolled, $watched );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-12-20 08:25:39 +00:00
|
|
|
|
# Edit/log timestamp
|
|
|
|
|
|
$this->insertTimestamp( $s, $rc );
|
|
|
|
|
|
# Bytes added or removed
|
2008-12-30 18:43:35 +00:00
|
|
|
|
if( $wgRCShowChangedSize ) {
|
|
|
|
|
|
$cd = $rc->getCharacterDifference();
|
|
|
|
|
|
if( $cd != '' ) {
|
|
|
|
|
|
$s .= "$cd . . ";
|
|
|
|
|
|
}
|
2006-12-13 20:08:02 +00:00
|
|
|
|
}
|
2011-09-08 09:15:59 +00:00
|
|
|
|
|
|
|
|
|
|
if ( $rc->mAttribs['rc_type'] == RC_LOG ) {
|
|
|
|
|
|
$s .= $this->insertLogEntry( $rc );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
# User tool links
|
|
|
|
|
|
$this->insertUserRelatedLinks( $s, $rc );
|
|
|
|
|
|
# LTR/RTL direction mark
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$s .= $this->getLanguage()->getDirMark();
|
2011-09-19 12:36:58 +00:00
|
|
|
|
$s .= $this->insertComment( $rc );
|
2011-09-08 09:15:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2009-01-28 19:08:18 +00:00
|
|
|
|
# Tags
|
|
|
|
|
|
$this->insertTags( $s, $rc, $classes );
|
2009-01-20 04:01:59 +00:00
|
|
|
|
# Rollback
|
|
|
|
|
|
$this->insertRollback( $s, $rc );
|
2009-01-29 22:44:31 +00:00
|
|
|
|
# For subclasses
|
|
|
|
|
|
$this->insertExtra( $s, $rc, $classes );
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2008-12-20 08:25:39 +00:00
|
|
|
|
# How many users watch this page
|
|
|
|
|
|
if( $rc->numberofWatchingusers > 0 ) {
|
2011-05-25 15:39:47 +00:00
|
|
|
|
$s .= ' ' . wfMsgExt( 'number_of_watching_users_RCview',
|
2011-11-21 16:13:21 +00:00
|
|
|
|
array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $rc->numberofWatchingusers ) );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2009-05-18 01:12:52 +00:00
|
|
|
|
if( $this->watchlist ) {
|
2009-05-26 11:03:50 +00:00
|
|
|
|
$classes[] = Sanitizer::escapeClass( 'watchlist-'.$rc->mAttribs['rc_namespace'].'-'.$rc->mAttribs['rc_title'] );
|
2009-05-18 01:12:52 +00:00
|
|
|
|
}
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2008-09-15 15:51:45 +00:00
|
|
|
|
wfRunHooks( 'OldChangesListRecentChangesLine', array(&$this, &$s, $rc) );
|
2008-09-03 22:13:03 +00:00
|
|
|
|
|
2008-11-29 00:17:10 +00:00
|
|
|
|
wfProfileOut( __METHOD__ );
|
2009-05-26 11:03:50 +00:00
|
|
|
|
return "$dateheader<li class=\"".implode( ' ', $classes )."\">".$s."</li>\n";
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2005-09-06 18:43:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
2005-09-06 18:43:45 +00:00
|
|
|
|
/**
|
2008-12-20 08:25:39 +00:00
|
|
|
|
* Generate a list of changes using an Enhanced system (uses javascript).
|
2005-09-06 18:43:45 +00:00
|
|
|
|
*/
|
|
|
|
|
|
class EnhancedChangesList extends ChangesList {
|
2012-01-12 19:03:32 +00:00
|
|
|
|
|
|
|
|
|
|
protected $rc_cache;
|
|
|
|
|
|
|
2008-10-25 20:57:56 +00:00
|
|
|
|
/**
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* Add the JavaScript file for enhanced changeslist
|
|
|
|
|
|
* @return String
|
|
|
|
|
|
*/
|
2008-10-25 20:57:56 +00:00
|
|
|
|
public function beginRecentChangesList() {
|
|
|
|
|
|
$this->rc_cache = array();
|
|
|
|
|
|
$this->rcMoveIndex = 0;
|
|
|
|
|
|
$this->rcCacheIndex = 0;
|
|
|
|
|
|
$this->lastdate = '';
|
|
|
|
|
|
$this->rclistOpen = false;
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
|
2010-09-11 14:26:37 +00:00
|
|
|
|
return '';
|
2008-10-25 20:57:56 +00:00
|
|
|
|
}
|
2005-09-06 18:14:24 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Format a line for enhanced recentchange (aka with javascript and block of lines).
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @param $baseRC RecentChange
|
2011-05-20 22:03:10 +00:00
|
|
|
|
* @param $watched bool
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return string
|
2005-09-06 18:14:24 +00:00
|
|
|
|
*/
|
2008-04-04 05:08:25 +00:00
|
|
|
|
public function recentChangesLine( &$baseRC, $watched = false ) {
|
2009-02-20 13:00:58 +00:00
|
|
|
|
wfProfileIn( __METHOD__ );
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Create a specialised object
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$rc = RCCacheEntry::newFromParent( $baseRC );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$curIdEq = array( 'curid' => $rc->mAttribs['rc_cur_id'] );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
|
|
|
|
|
# If it's a new day, add the headline and flush the cache
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$date = $this->getLanguage()->date( $rc->mAttribs['rc_timestamp'], true );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$ret = '';
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $date != $this->lastdate ) {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Process current cache
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$ret = $this->recentChangesBlock();
|
|
|
|
|
|
$this->rc_cache = array();
|
2010-11-08 21:21:32 +00:00
|
|
|
|
$ret .= Xml::element( 'h4', null, $date ) . "\n";
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$this->lastdate = $date;
|
|
|
|
|
|
}
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Should patrol-related stuff be shown?
|
2011-11-19 05:37:24 +00:00
|
|
|
|
$rc->unpatrolled = $this->showAsUnpatrolled( $rc );
|
2005-07-01 20:36:04 +00:00
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$showdifflinks = true;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Make article link
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$type = $rc->mAttribs['rc_type'];
|
|
|
|
|
|
$logType = $rc->mAttribs['rc_log_type'];
|
2011-09-12 14:46:17 +00:00
|
|
|
|
// Page moves, very old style, not supported anymore
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
|
2008-04-04 03:56:48 +00:00
|
|
|
|
// New unpatrolled pages
|
2011-06-17 16:03:52 +00:00
|
|
|
|
} elseif( $rc->unpatrolled && $type == RC_NEW ) {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$clink = Linker::linkKnown( $rc->getTitle(), null, array(),
|
2010-12-27 19:07:28 +00:00
|
|
|
|
array( 'rcid' => $rc->mAttribs['rc_id'] ) );
|
2008-04-12 03:23:02 +00:00
|
|
|
|
// Log entries
|
2011-06-17 16:03:52 +00:00
|
|
|
|
} elseif( $type == RC_LOG ) {
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $logType ) {
|
|
|
|
|
|
$logtitle = SpecialPage::getTitleFor( 'Log', $logType );
|
2011-12-29 12:58:43 +00:00
|
|
|
|
$logpage = new LogPage( $logType );
|
|
|
|
|
|
$logname = $logpage->getName()->escaped();
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$clink = $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logtitle, $logname ) )->escaped();
|
2008-04-15 03:55:16 +00:00
|
|
|
|
} else {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$clink = Linker::link( $rc->getTitle() );
|
2008-04-15 03:55:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
$watched = false;
|
2008-12-18 19:45:58 +00:00
|
|
|
|
// Log entries (old format) and special pages
|
2010-12-27 19:07:28 +00:00
|
|
|
|
} elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) {
|
2011-12-29 12:58:43 +00:00
|
|
|
|
wfDebug( "Unexpected special page in recentchanges\n" );
|
|
|
|
|
|
$clink = '';
|
2008-04-12 03:23:02 +00:00
|
|
|
|
// Edits
|
2004-11-25 13:47:17 +00:00
|
|
|
|
} else {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$clink = Linker::linkKnown( $rc->getTitle() );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Don't show unusable diff links
|
2011-10-12 15:09:04 +00:00
|
|
|
|
if ( !ChangesList::userCan( $rc, Revision::DELETED_TEXT, $this->getUser() ) ) {
|
2008-04-04 03:56:48 +00:00
|
|
|
|
$showdifflinks = false;
|
|
|
|
|
|
}
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$time = $this->getLanguage()->time( $rc->mAttribs['rc_timestamp'], true, true );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$rc->watched = $watched;
|
|
|
|
|
|
$rc->link = $clink;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$rc->timestamp = $time;
|
2004-12-18 03:47:11 +00:00
|
|
|
|
$rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
|
2004-11-25 13:47:17 +00:00
|
|
|
|
|
2009-06-06 22:42:48 +00:00
|
|
|
|
# Make "cur" and "diff" links. Do not use link(), it is too slow if
|
2009-03-29 17:09:47 +00:00
|
|
|
|
# called too many times (50% of CPU time on RecentChanges!).
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$thisOldid = $rc->mAttribs['rc_this_oldid'];
|
|
|
|
|
|
$lastOldid = $rc->mAttribs['rc_last_oldid'];
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $rc->unpatrolled ) {
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$rcIdQuery = array( 'rcid' => $rc->mAttribs['rc_id'] );
|
2004-11-29 04:00:05 +00:00
|
|
|
|
} else {
|
2009-03-29 16:02:16 +00:00
|
|
|
|
$rcIdQuery = array();
|
2004-11-29 04:00:05 +00:00
|
|
|
|
}
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$querycur = $curIdEq + array( 'diff' => '0', 'oldid' => $thisOldid );
|
|
|
|
|
|
$querydiff = $curIdEq + array( 'diff' => $thisOldid, 'oldid' =>
|
|
|
|
|
|
$lastOldid ) + $rcIdQuery;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-04 03:56:48 +00:00
|
|
|
|
if( !$showdifflinks ) {
|
2009-03-29 15:37:47 +00:00
|
|
|
|
$curLink = $this->message['cur'];
|
|
|
|
|
|
$diffLink = $this->message['diff'];
|
2011-06-17 16:03:52 +00:00
|
|
|
|
} elseif( in_array( $type, array( RC_NEW, RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if ( $type != RC_NEW ) {
|
2009-03-29 17:09:47 +00:00
|
|
|
|
$curLink = $this->message['cur'];
|
|
|
|
|
|
} else {
|
2011-11-10 03:27:55 +00:00
|
|
|
|
$curUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querycur ) );
|
2009-03-29 17:09:47 +00:00
|
|
|
|
$curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
|
|
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$diffLink = $this->message['diff'];
|
2004-11-25 13:47:17 +00:00
|
|
|
|
} else {
|
2011-11-10 03:27:55 +00:00
|
|
|
|
$diffUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querydiff ) );
|
|
|
|
|
|
$curUrl = htmlspecialchars( $rc->getTitle()->getLinkURL( $querycur ) );
|
2009-03-29 17:09:47 +00:00
|
|
|
|
$diffLink = "<a href=\"$diffUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['diff']}</a>";
|
|
|
|
|
|
$curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Make "last" link
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( !$showdifflinks || !$lastOldid ) {
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$lastLink = $this->message['last'];
|
2011-06-17 16:03:52 +00:00
|
|
|
|
} elseif( in_array( $type, array( RC_LOG, RC_MOVE, RC_MOVE_OVER_REDIRECT ) ) ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$lastLink = $this->message['last'];
|
2004-11-25 13:47:17 +00:00
|
|
|
|
} else {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$lastLink = Linker::linkKnown( $rc->getTitle(), $this->message['last'],
|
2010-12-27 19:07:28 +00:00
|
|
|
|
array(), $curIdEq + array('diff' => $thisOldid, 'oldid' => $lastOldid) + $rcIdQuery );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
# Make user links
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $this->isDeleted( $rc, Revision::DELETED_USER ) ) {
|
|
|
|
|
|
$rc->userlink = ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$rc->userlink = Linker::userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
|
|
|
|
|
|
$rc->usertalklink = Linker::userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2007-10-01 19:50:25 +00:00
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
$rc->lastlink = $lastLink;
|
|
|
|
|
|
$rc->curlink = $curLink;
|
|
|
|
|
|
$rc->difflink = $diffLink;
|
|
|
|
|
|
|
|
|
|
|
|
# Put accumulated information into the cache, for later display
|
|
|
|
|
|
# Page moves go on their own line
|
|
|
|
|
|
$title = $rc->getTitle();
|
|
|
|
|
|
$secureName = $title->getPrefixedDBkey();
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
|
2004-11-25 13:47:17 +00:00
|
|
|
|
# Use an @ character to prevent collision with page names
|
|
|
|
|
|
$this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
|
|
|
|
|
|
} else {
|
2008-04-15 21:39:33 +00:00
|
|
|
|
# Logs are grouped by type
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $type == RC_LOG ){
|
|
|
|
|
|
$secureName = SpecialPage::getTitleFor( 'Log', $logType )->getPrefixedDBkey();
|
2008-04-09 09:20:55 +00:00
|
|
|
|
}
|
2008-04-04 03:56:48 +00:00
|
|
|
|
if( !isset( $this->rc_cache[$secureName] ) ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$this->rc_cache[$secureName] = array();
|
|
|
|
|
|
}
|
2009-02-18 04:39:52 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
array_push( $this->rc_cache[$secureName], $rc );
|
2004-11-25 13:47:17 +00:00
|
|
|
|
}
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
|
|
|
2004-11-25 13:47:17 +00:00
|
|
|
|
return $ret;
|
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Enhanced RC group
|
2012-02-09 21:33:27 +00:00
|
|
|
|
* @return string
|
2005-09-06 22:16:41 +00:00
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlockGroup( $block ) {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
global $wgRCShowChangedSize;
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
|
|
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
|
|
2010-11-08 21:21:32 +00:00
|
|
|
|
# Add the namespace and title of the block as part of the class
|
|
|
|
|
|
if ( $block[0]->mAttribs['rc_log_type'] ) {
|
|
|
|
|
|
# Log entry
|
2012-01-12 19:03:32 +00:00
|
|
|
|
$classes = 'mw-collapsible mw-collapsed mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-'
|
|
|
|
|
|
. $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
} else {
|
2012-01-12 19:03:32 +00:00
|
|
|
|
$classes = 'mw-collapsible mw-collapsed mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns'
|
|
|
|
|
|
. $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
$r = Html::openElement( 'table', array( 'class' => $classes ) ) .
|
|
|
|
|
|
Html::openElement( 'tr' );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Collate list of users
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$userlinks = array();
|
|
|
|
|
|
# Other properties
|
2008-09-16 05:56:43 +00:00
|
|
|
|
$unpatrolled = false;
|
|
|
|
|
|
$isnew = false;
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$curId = $currentRevision = 0;
|
|
|
|
|
|
# Some catalyst variables...
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$namehidden = true;
|
2008-12-11 21:34:15 +00:00
|
|
|
|
$allLogs = true;
|
2005-12-16 23:56:44 +00:00
|
|
|
|
foreach( $block as $rcObj ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$oldid = $rcObj->mAttribs['rc_last_oldid'];
|
2008-09-16 05:56:43 +00:00
|
|
|
|
if( $rcObj->mAttribs['rc_new'] ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$isnew = true;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2008-03-16 18:46:09 +00:00
|
|
|
|
// If all log actions to this page were hidden, then don't
|
|
|
|
|
|
// give the name of the affected page for this block!
|
2008-04-04 03:56:48 +00:00
|
|
|
|
if( !$this->isDeleted( $rcObj, LogPage::DELETED_ACTION ) ) {
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$namehidden = false;
|
|
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$u = $rcObj->userlink;
|
|
|
|
|
|
if( !isset( $userlinks[$u] ) ) {
|
|
|
|
|
|
$userlinks[$u] = 0;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $rcObj->unpatrolled ) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$unpatrolled = true;
|
|
|
|
|
|
}
|
2008-04-01 22:41:19 +00:00
|
|
|
|
if( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
|
2008-12-11 21:34:15 +00:00
|
|
|
|
$allLogs = false;
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
# Get the latest entry with a page_id and oldid
|
|
|
|
|
|
# since logs may not have these.
|
|
|
|
|
|
if( !$curId && $rcObj->mAttribs['rc_cur_id'] ) {
|
|
|
|
|
|
$curId = $rcObj->mAttribs['rc_cur_id'];
|
|
|
|
|
|
}
|
|
|
|
|
|
if( !$currentRevision && $rcObj->mAttribs['rc_this_oldid'] ) {
|
|
|
|
|
|
$currentRevision = $rcObj->mAttribs['rc_this_oldid'];
|
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2006-06-15 07:29:00 +00:00
|
|
|
|
$bot = $rcObj->mAttribs['rc_bot'];
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$userlinks[$u]++;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Sort the list and convert to text
|
2005-12-16 23:56:44 +00:00
|
|
|
|
krsort( $userlinks );
|
|
|
|
|
|
asort( $userlinks );
|
|
|
|
|
|
$users = array();
|
|
|
|
|
|
foreach( $userlinks as $userlink => $count) {
|
2005-09-06 22:16:41 +00:00
|
|
|
|
$text = $userlink;
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$text .= $this->getLanguage()->getDirMark();
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( $count > 1 ) {
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$text .= ' ' . $this->msg( 'parentheses' )->rawParams( $this->getLanguage()->formatNum( $count ) . '×' )->escaped();
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
array_push( $users, $text );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2012-06-05 22:58:54 +00:00
|
|
|
|
$users = ' <span class="changedby">'
|
|
|
|
|
|
. $this->getContext()->msg( 'brackets' )->rawParams(
|
|
|
|
|
|
implode( $this->message['semicolon-separator'], $users )
|
|
|
|
|
|
)->plain() . '</span>';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
2012-02-27 00:03:14 +00:00
|
|
|
|
$tl = '<span class="mw-collapsible-toggle mw-enhancedchanges-arrow"></span>';
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= "<td>$tl</td>";
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Main line
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags( array(
|
|
|
|
|
|
'newpage' => $isnew,
|
2010-12-27 20:02:10 +00:00
|
|
|
|
'minor' => false,
|
2011-05-25 15:39:47 +00:00
|
|
|
|
'unpatrolled' => $unpatrolled,
|
2010-12-27 20:02:10 +00:00
|
|
|
|
'bot' => $bot ,
|
2010-12-27 19:07:28 +00:00
|
|
|
|
) );
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Timestamp
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= ' '.$block[0]->timestamp.' </td><td>';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
|
|
|
|
|
# Article link
|
2008-04-12 03:23:02 +00:00
|
|
|
|
if( $namehidden ) {
|
2009-01-25 16:34:21 +00:00
|
|
|
|
$r .= ' <span class="history-deleted">' . wfMsgHtml( 'rev-deleted-event' ) . '</span>';
|
2011-06-17 16:03:52 +00:00
|
|
|
|
} elseif( $allLogs ) {
|
2008-12-11 21:34:15 +00:00
|
|
|
|
$r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
|
2008-04-01 22:41:19 +00:00
|
|
|
|
} else {
|
2008-11-29 00:17:10 +00:00
|
|
|
|
$this->insertArticleLink( $r, $block[0], $block[0]->unpatrolled, $block[0]->watched );
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
2007-02-28 18:11:09 +00:00
|
|
|
|
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$r .= $this->getLanguage()->getDirMark();
|
2006-12-13 20:08:02 +00:00
|
|
|
|
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$queryParams['curid'] = $curId;
|
2008-04-01 22:41:19 +00:00
|
|
|
|
# Changes message
|
|
|
|
|
|
$n = count($block);
|
|
|
|
|
|
static $nchanges = array();
|
|
|
|
|
|
if ( !isset( $nchanges[$n] ) ) {
|
2011-11-21 16:13:21 +00:00
|
|
|
|
$nchanges[$n] = wfMsgExt( 'nchanges', array( 'parsemag', 'escape' ), $this->getLanguage()->formatNum( $n ) );
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
# Total change link
|
|
|
|
|
|
$r .= ' ';
|
2012-03-01 10:42:02 +00:00
|
|
|
|
$logtext = '';
|
2008-12-11 21:34:15 +00:00
|
|
|
|
if( !$allLogs ) {
|
2011-10-12 15:09:04 +00:00
|
|
|
|
if( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$logtext .= $nchanges[$n];
|
2011-06-17 16:03:52 +00:00
|
|
|
|
} elseif( $isnew ) {
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$logtext .= $nchanges[$n];
|
2005-12-16 23:56:44 +00:00
|
|
|
|
} else {
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$params = $queryParams;
|
|
|
|
|
|
$params['diff'] = $currentRevision;
|
|
|
|
|
|
$params['oldid'] = $oldid;
|
2011-05-25 15:39:47 +00:00
|
|
|
|
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$logtext .= Linker::link(
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$block[0]->getTitle(),
|
|
|
|
|
|
$nchanges[$n],
|
|
|
|
|
|
array(),
|
|
|
|
|
|
$params,
|
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
|
);
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2008-04-01 22:41:19 +00:00
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-11-18 12:54:53 +00:00
|
|
|
|
# History
|
2008-12-11 21:34:15 +00:00
|
|
|
|
if( $allLogs ) {
|
2008-11-18 12:54:53 +00:00
|
|
|
|
// don't show history link for logs
|
2011-06-17 16:03:52 +00:00
|
|
|
|
} elseif( $namehidden || !$block[0]->getTitle()->exists() ) {
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$logtext .= $this->message['pipe-separator'] . $this->message['hist'];
|
2008-11-18 12:54:53 +00:00
|
|
|
|
} else {
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$params = $queryParams;
|
|
|
|
|
|
$params['action'] = 'history';
|
|
|
|
|
|
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$logtext .= $this->message['pipe-separator'] .
|
2011-07-17 09:25:50 +00:00
|
|
|
|
Linker::linkKnown(
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$block[0]->getTitle(),
|
|
|
|
|
|
$this->message['hist'],
|
|
|
|
|
|
array(),
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$params
|
2012-02-28 11:56:59 +00:00
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-03-01 10:42:02 +00:00
|
|
|
|
if( $logtext !== '' ) {
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$r .= $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
|
2008-11-18 12:54:53 +00:00
|
|
|
|
}
|
2012-02-28 11:56:59 +00:00
|
|
|
|
|
2008-11-18 12:54:53 +00:00
|
|
|
|
$r .= ' . . ';
|
|
|
|
|
|
|
2008-04-01 22:41:19 +00:00
|
|
|
|
# Character difference (does not apply if only log items)
|
2008-12-11 21:34:15 +00:00
|
|
|
|
if( $wgRCShowChangedSize && !$allLogs ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$last = 0;
|
|
|
|
|
|
$first = count($block) - 1;
|
|
|
|
|
|
# Some events (like logs) have an "empty" size, so we need to skip those...
|
2009-12-11 21:07:27 +00:00
|
|
|
|
while( $last < $first && $block[$last]->mAttribs['rc_new_len'] === null ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$last++;
|
|
|
|
|
|
}
|
2009-12-11 21:07:27 +00:00
|
|
|
|
while( $first > $last && $block[$first]->mAttribs['rc_old_len'] === null ) {
|
2008-04-01 22:41:19 +00:00
|
|
|
|
$first--;
|
|
|
|
|
|
}
|
|
|
|
|
|
# Get net change
|
|
|
|
|
|
$chardiff = $rcObj->getCharacterDifference( $block[$first]->mAttribs['rc_old_len'],
|
|
|
|
|
|
$block[$last]->mAttribs['rc_new_len'] );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2008-04-01 22:41:19 +00:00
|
|
|
|
if( $chardiff == '' ) {
|
|
|
|
|
|
$r .= ' ';
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$r .= ' ' . $chardiff. ' . . ';
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$r .= $users;
|
2008-04-15 03:55:16 +00:00
|
|
|
|
$r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
# Sub-entries
|
2005-12-16 23:56:44 +00:00
|
|
|
|
foreach( $block as $rcObj ) {
|
2009-02-18 04:39:52 +00:00
|
|
|
|
# Classes to apply -- TODO implement
|
|
|
|
|
|
$classes = array();
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$type = $rcObj->mAttribs['rc_type'];
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= '<tr><td></td><td class="mw-enhanced-rc">';
|
|
|
|
|
|
$r .= $this->recentChangesFlags( array(
|
|
|
|
|
|
'newpage' => $rcObj->mAttribs['rc_new'],
|
2010-12-27 20:02:10 +00:00
|
|
|
|
'minor' => $rcObj->mAttribs['rc_minor'],
|
2011-05-25 15:39:47 +00:00
|
|
|
|
'unpatrolled' => $rcObj->unpatrolled,
|
2010-12-27 20:02:10 +00:00
|
|
|
|
'bot' => $rcObj->mAttribs['rc_bot'],
|
2010-12-27 19:07:28 +00:00
|
|
|
|
) );
|
|
|
|
|
|
$r .= ' </td><td class="mw-enhanced-rc-nested"><span class="mw-enhanced-rc-time">';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$params = $queryParams;
|
|
|
|
|
|
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $rcObj->mAttribs['rc_this_oldid'] != 0 ) {
|
|
|
|
|
|
$params['oldid'] = $rcObj->mAttribs['rc_this_oldid'];
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2009-06-06 22:42:48 +00:00
|
|
|
|
|
2008-04-21 03:20:08 +00:00
|
|
|
|
# Log timestamp
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $type == RC_LOG ) {
|
Update ChangesList output for enhanced changes to use CSS instead of obsolete attrbutes and elements (cellpadding, <tt>, etc.)
The test page I was using successfully validated as HTML 5 :)
Tested for signs of obvious regressions in FF 3.5, IE8, Opera 9.64 and Safari 4.0.
Supposedly, the border-spacing property isn't supported by IE, but I didn't see any obvious issues when testing,
so either the information I got was wrong/outdated, or its not actually necessary here. Needs testing in IE6/7 to verify.
If I did everything right, there shouldn't be any visible changes, save maybe a couple trivial spacing quirks.
2009-08-20 21:06:24 +00:00
|
|
|
|
$link = $rcObj->timestamp;
|
2008-04-21 03:20:08 +00:00
|
|
|
|
# Revision link
|
2011-10-12 15:09:04 +00:00
|
|
|
|
} elseif( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
|
Update ChangesList output for enhanced changes to use CSS instead of obsolete attrbutes and elements (cellpadding, <tt>, etc.)
The test page I was using successfully validated as HTML 5 :)
Tested for signs of obvious regressions in FF 3.5, IE8, Opera 9.64 and Safari 4.0.
Supposedly, the border-spacing property isn't supported by IE, but I didn't see any obvious issues when testing,
so either the information I got was wrong/outdated, or its not actually necessary here. Needs testing in IE6/7 to verify.
If I did everything right, there shouldn't be any visible changes, save maybe a couple trivial spacing quirks.
2009-08-20 21:06:24 +00:00
|
|
|
|
$link = '<span class="history-deleted">'.$rcObj->timestamp.'</span> ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
} else {
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if ( $rcObj->unpatrolled && $type == RC_NEW) {
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$params['rcid'] = $rcObj->mAttribs['rc_id'];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$link = Linker::linkKnown(
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$rcObj->getTitle(),
|
|
|
|
|
|
$rcObj->timestamp,
|
|
|
|
|
|
array(),
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$params
|
Update ChangesList output for enhanced changes to use CSS instead of obsolete attrbutes and elements (cellpadding, <tt>, etc.)
The test page I was using successfully validated as HTML 5 :)
Tested for signs of obvious regressions in FF 3.5, IE8, Opera 9.64 and Safari 4.0.
Supposedly, the border-spacing property isn't supported by IE, but I didn't see any obvious issues when testing,
so either the information I got was wrong/outdated, or its not actually necessary here. Needs testing in IE6/7 to verify.
If I did everything right, there shouldn't be any visible changes, save maybe a couple trivial spacing quirks.
2009-08-20 21:06:24 +00:00
|
|
|
|
);
|
2008-03-16 18:46:09 +00:00
|
|
|
|
if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
|
|
|
|
|
|
$link = '<span class="history-deleted">'.$link.'</span> ';
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
Update ChangesList output for enhanced changes to use CSS instead of obsolete attrbutes and elements (cellpadding, <tt>, etc.)
The test page I was using successfully validated as HTML 5 :)
Tested for signs of obvious regressions in FF 3.5, IE8, Opera 9.64 and Safari 4.0.
Supposedly, the border-spacing property isn't supported by IE, but I didn't see any obvious issues when testing,
so either the information I got was wrong/outdated, or its not actually necessary here. Needs testing in IE6/7 to verify.
If I did everything right, there shouldn't be any visible changes, save maybe a couple trivial spacing quirks.
2009-08-20 21:06:24 +00:00
|
|
|
|
$r .= $link . '</span>';
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if ( !$type == RC_LOG || $type == RC_NEW ) {
|
2012-03-01 10:42:02 +00:00
|
|
|
|
$r .= ' ' . $this->msg( 'parentheses' )->rawParams( $rcObj->curlink . $this->message['pipe-separator'] . $rcObj->lastlink )->escaped();
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
$r .= ' . . ';
|
2006-12-13 20:08:02 +00:00
|
|
|
|
|
|
|
|
|
|
# Character diff
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $wgRCShowChangedSize && $rcObj->getCharacterDifference() ) {
|
|
|
|
|
|
$r .= $rcObj->getCharacterDifference() . ' . . ' ;
|
2006-12-13 20:08:02 +00:00
|
|
|
|
}
|
2010-12-27 19:07:28 +00:00
|
|
|
|
|
2011-09-08 09:15:59 +00:00
|
|
|
|
if ( $rcObj->mAttribs['rc_type'] == RC_LOG ) {
|
|
|
|
|
|
$r .= $this->insertLogEntry( $rcObj );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
# User links
|
|
|
|
|
|
$r .= $rcObj->userlink;
|
|
|
|
|
|
$r .= $rcObj->usertalklink;
|
2011-09-19 12:36:58 +00:00
|
|
|
|
$r .= $this->insertComment( $rcObj );
|
2011-09-08 09:15:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2009-01-20 04:01:59 +00:00
|
|
|
|
# Rollback
|
|
|
|
|
|
$this->insertRollback( $r, $rcObj );
|
2009-02-18 04:39:52 +00:00
|
|
|
|
# Tags
|
|
|
|
|
|
$this->insertTags( $r, $rcObj, $classes );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
|
|
|
|
|
|
$r .= "</td></tr>\n";
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= "</table>\n";
|
2005-09-06 18:43:45 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$this->rcCacheIndex++;
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return $r;
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generate HTML for an arrow or placeholder graphic
|
2010-01-05 21:24:23 +00:00
|
|
|
|
* @param $dir String: one of '', 'd', 'l', 'r'
|
|
|
|
|
|
* @param $alt String: text
|
|
|
|
|
|
* @param $title String: text
|
|
|
|
|
|
* @return String: HTML <img> tag
|
2005-12-16 23:56:44 +00:00
|
|
|
|
*/
|
2008-10-26 02:41:43 +00:00
|
|
|
|
protected function arrow( $dir, $alt='', $title='' ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
global $wgStylePath;
|
|
|
|
|
|
$encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
|
2008-10-26 02:41:43 +00:00
|
|
|
|
$encAlt = htmlspecialchars( $alt );
|
|
|
|
|
|
$encTitle = htmlspecialchars( $title );
|
|
|
|
|
|
return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" title=\"$encTitle\" />";
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
|
2010-12-23 15:03:24 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Generate HTML for a right- or left-facing arrow,
|
|
|
|
|
|
* depending on language direction.
|
|
|
|
|
|
* @return String: HTML <img> tag
|
|
|
|
|
|
*/
|
|
|
|
|
|
protected function sideArrow() {
|
2011-10-13 13:43:02 +00:00
|
|
|
|
global $wgLang;
|
|
|
|
|
|
$dir = $wgLang->isRTL() ? 'l' : 'r';
|
2010-12-23 15:03:24 +00:00
|
|
|
|
return $this->arrow( $dir, '+', wfMsg( 'rc-enhanced-expand' ) );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Generate HTML for a down-facing arrow
|
|
|
|
|
|
* depending on language direction.
|
|
|
|
|
|
* @return String: HTML <img> tag
|
|
|
|
|
|
*/
|
|
|
|
|
|
protected function downArrow() {
|
|
|
|
|
|
return $this->arrow( 'd', '-', wfMsg( 'rc-enhanced-hide' ) );
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Generate HTML for a spacer image
|
|
|
|
|
|
* @return String: HTML <img> tag
|
|
|
|
|
|
*/
|
|
|
|
|
|
protected function spacerArrow() {
|
|
|
|
|
|
return $this->arrow( '', codepointToUtf8( 0xa0 ) ); // non-breaking space
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* Enhanced RC ungrouped line.
|
2011-04-04 21:23:22 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @param $rcObj RecentChange
|
2011-10-04 00:12:09 +00:00
|
|
|
|
* @return String: a HTML formatted line (generated using $r)
|
2005-12-16 23:56:44 +00:00
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlockLine( $rcObj ) {
|
2009-04-07 06:43:39 +00:00
|
|
|
|
global $wgRCShowChangedSize;
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
|
|
|
|
|
wfProfileIn( __METHOD__ );
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$query['curid'] = $rcObj->mAttribs['rc_cur_id'];
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$type = $rcObj->mAttribs['rc_type'];
|
|
|
|
|
|
$logType = $rcObj->mAttribs['rc_log_type'];
|
|
|
|
|
|
if( $logType ) {
|
2010-11-08 21:21:32 +00:00
|
|
|
|
# Log entry
|
2012-01-12 19:03:32 +00:00
|
|
|
|
$classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-'
|
|
|
|
|
|
. $logType . '-' . $rcObj->mAttribs['rc_title'] );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
} else {
|
2012-01-12 19:03:32 +00:00
|
|
|
|
$classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' .
|
|
|
|
|
|
$rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
|
2010-11-08 21:21:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
$r = Html::openElement( 'table', array( 'class' => $classes ) ) .
|
|
|
|
|
|
Html::openElement( 'tr' );
|
|
|
|
|
|
|
2012-02-27 00:03:14 +00:00
|
|
|
|
$r .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
|
2005-12-16 23:56:44 +00:00
|
|
|
|
# Flag and Timestamp
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
|
2010-05-30 17:33:59 +00:00
|
|
|
|
$r .= '    '; // 4 flags -> 4 spaces
|
2005-12-16 23:56:44 +00:00
|
|
|
|
} else {
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= $this->recentChangesFlags( array(
|
|
|
|
|
|
'newpage' => $type == RC_NEW,
|
2011-10-22 19:50:43 +00:00
|
|
|
|
'minor' => $rcObj->mAttribs['rc_minor'],
|
2011-05-25 15:39:47 +00:00
|
|
|
|
'unpatrolled' => $rcObj->unpatrolled,
|
2010-12-27 20:02:10 +00:00
|
|
|
|
'bot' => $rcObj->mAttribs['rc_bot'],
|
2010-12-27 19:07:28 +00:00
|
|
|
|
) );
|
2005-12-16 23:56:44 +00:00
|
|
|
|
}
|
2010-12-27 19:07:28 +00:00
|
|
|
|
$r .= ' '.$rcObj->timestamp.' </td><td>';
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Article or log link
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if( $logType ) {
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$logtitle = SpecialPage::getTitleFor( 'Log', $logType );
|
2011-12-13 21:34:16 +00:00
|
|
|
|
$logname = LogPage::logName( $logType );
|
2012-02-28 11:56:59 +00:00
|
|
|
|
$r .= $this->msg( 'parentheses' )->rawParams( Linker::linkKnown( $logtitle, htmlspecialchars( $logname ) ) )->escaped();
|
2008-03-16 18:46:09 +00:00
|
|
|
|
} else {
|
2008-11-29 00:17:10 +00:00
|
|
|
|
$this->insertArticleLink( $r, $rcObj, $rcObj->unpatrolled, $rcObj->watched );
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Diff and hist links
|
2010-12-27 19:07:28 +00:00
|
|
|
|
if ( $type != RC_LOG ) {
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$query['action'] = 'history';
|
2012-03-01 10:42:02 +00:00
|
|
|
|
$r .= ' ' . $this->msg( 'parentheses' )->rawParams( $rcObj->difflink . $this->message['pipe-separator'] . Linker::linkKnown(
|
2009-06-06 22:42:48 +00:00
|
|
|
|
$rcObj->getTitle(),
|
|
|
|
|
|
$this->message['hist'],
|
|
|
|
|
|
array(),
|
2011-07-17 09:25:50 +00:00
|
|
|
|
$query
|
2012-02-28 11:56:59 +00:00
|
|
|
|
) )->escaped();
|
2008-03-16 18:46:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
$r .= ' . . ';
|
2006-12-13 20:08:02 +00:00
|
|
|
|
# Character diff
|
2008-12-23 23:59:20 +00:00
|
|
|
|
if( $wgRCShowChangedSize && ($cd = $rcObj->getCharacterDifference()) ) {
|
|
|
|
|
|
$r .= "$cd . . ";
|
2006-12-13 20:08:02 +00:00
|
|
|
|
}
|
2011-09-08 09:15:59 +00:00
|
|
|
|
|
|
|
|
|
|
if ( $type == RC_LOG ) {
|
|
|
|
|
|
$r .= $this->insertLogEntry( $rcObj );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$r .= ' '.$rcObj->userlink . $rcObj->usertalklink;
|
2011-09-19 12:36:58 +00:00
|
|
|
|
$r .= $this->insertComment( $rcObj );
|
|
|
|
|
|
$r .= $this->insertRollback( $r, $rcObj );
|
2008-04-04 03:56:48 +00:00
|
|
|
|
}
|
2011-09-08 09:15:59 +00:00
|
|
|
|
|
2009-02-18 04:39:52 +00:00
|
|
|
|
# Tags
|
2011-03-30 14:33:37 +00:00
|
|
|
|
$classes = explode( ' ', $classes );
|
2009-02-18 04:39:52 +00:00
|
|
|
|
$this->insertTags( $r, $rcObj, $classes );
|
2008-04-04 03:56:48 +00:00
|
|
|
|
# Show how many people are watching this if enabled
|
2007-03-14 18:35:23 +00:00
|
|
|
|
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
|
2005-12-16 23:56:44 +00:00
|
|
|
|
|
2008-03-16 18:46:09 +00:00
|
|
|
|
$r .= "</td></tr></table>\n";
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return $r;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* If enhanced RC is in use, this function takes the previously cached
|
|
|
|
|
|
* RC lines, arranges them, and outputs the HTML
|
2011-05-20 22:03:10 +00:00
|
|
|
|
*
|
|
|
|
|
|
* @return string
|
2005-12-16 23:56:44 +00:00
|
|
|
|
*/
|
2008-04-04 13:16:58 +00:00
|
|
|
|
protected function recentChangesBlock() {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( count ( $this->rc_cache ) == 0 ) {
|
|
|
|
|
|
return '';
|
|
|
|
|
|
}
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
|
|
|
|
|
wfProfileIn( __METHOD__ );
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
$blockOut = '';
|
2006-11-29 11:43:58 +00:00
|
|
|
|
foreach( $this->rc_cache as $block ) {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
if( count( $block ) < 2 ) {
|
|
|
|
|
|
$blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$blockOut .= $this->recentChangesBlockGroup( $block );
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2009-02-20 13:00:58 +00:00
|
|
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
|
|
|
|
|
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return '<div>'.$blockOut.'</div>';
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-05-25 15:39:47 +00:00
|
|
|
|
* Returns text for the end of RC
|
2005-12-16 23:56:44 +00:00
|
|
|
|
* If enhanced RC is in use, returns pretty much all the text
|
2012-01-12 19:03:32 +00:00
|
|
|
|
* @return string
|
2005-12-16 23:56:44 +00:00
|
|
|
|
*/
|
2008-04-04 05:08:25 +00:00
|
|
|
|
public function endRecentChangesList() {
|
2005-12-16 23:56:44 +00:00
|
|
|
|
return $this->recentChangesBlock() . parent::endRecentChangesList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2005-09-06 22:16:41 +00:00
|
|
|
|
}
|