2003-12-21 12:01:29 +00:00
|
|
|
<?php
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
|
|
|
|
* Page history
|
2005-06-29 03:37:57 +00:00
|
|
|
*
|
2004-09-02 23:28:24 +00:00
|
|
|
* Split off from Article.php and Skin.php, 2003-12-22
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @file
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2005-06-29 03:37:57 +00:00
|
|
|
* This class handles printing the history page for an article. In order to
|
|
|
|
|
* be efficient, it uses timestamps rather than offsets for paging, to avoid
|
|
|
|
|
* costly LIMIT,offset queries.
|
|
|
|
|
*
|
|
|
|
|
* Construct it by passing in an Article, and call $h->history() to print the
|
|
|
|
|
* history.
|
|
|
|
|
*
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
2009-08-17 05:09:36 +00:00
|
|
|
class HistoryPage {
|
2006-06-06 12:28:44 +00:00
|
|
|
const DIR_PREV = 0;
|
|
|
|
|
const DIR_NEXT = 1;
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2009-08-17 05:09:36 +00:00
|
|
|
var $article, $title, $skin;
|
2005-06-29 03:37:57 +00:00
|
|
|
|
|
|
|
|
/**
|
2009-08-17 05:09:36 +00:00
|
|
|
* Construct a new HistoryPage.
|
2005-06-29 03:37:57 +00:00
|
|
|
*
|
2010-01-17 16:34:22 +00:00
|
|
|
* @param $article Article
|
2005-06-29 03:37:57 +00:00
|
|
|
*/
|
2008-11-08 19:41:38 +00:00
|
|
|
function __construct( $article ) {
|
2006-11-08 07:12:03 +00:00
|
|
|
global $wgUser;
|
2009-08-17 13:41:23 +00:00
|
|
|
$this->article = $article;
|
|
|
|
|
$this->title = $article->getTitle();
|
2009-08-17 05:09:36 +00:00
|
|
|
$this->skin = $wgUser->getSkin();
|
2008-03-09 02:27:03 +00:00
|
|
|
$this->preCacheMessages();
|
|
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-05-23 09:03:49 +00:00
|
|
|
function getArticle() {
|
2009-08-17 05:09:36 +00:00
|
|
|
return $this->article;
|
2008-05-23 09:03:49 +00:00
|
|
|
}
|
2008-08-21 00:45:13 +00:00
|
|
|
|
2008-05-23 16:47:39 +00:00
|
|
|
function getTitle() {
|
2009-08-17 05:09:36 +00:00
|
|
|
return $this->title;
|
2008-05-23 16:47:39 +00:00
|
|
|
}
|
2008-05-23 09:03:49 +00:00
|
|
|
|
2008-03-09 02:27:03 +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
|
|
|
|
|
*/
|
|
|
|
|
function preCacheMessages() {
|
|
|
|
|
// Precache various messages
|
|
|
|
|
if( !isset( $this->message ) ) {
|
2009-10-30 02:14:22 +00:00
|
|
|
$msgs = array( 'cur', 'last', 'pipe-separator' );
|
2009-09-18 11:51:00 +00:00
|
|
|
foreach( $msgs as $msg ) {
|
|
|
|
|
$this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities') );
|
2008-03-09 02:27:03 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-12-21 12:01:29 +00:00
|
|
|
}
|
2004-08-28 18:54:23 +00:00
|
|
|
|
2005-06-29 03:37:57 +00:00
|
|
|
/**
|
|
|
|
|
* Print the history page for an article.
|
|
|
|
|
*/
|
2004-09-02 23:28:24 +00:00
|
|
|
function history() {
|
2009-04-11 23:05:13 +00:00
|
|
|
global $wgOut, $wgRequest, $wgScript;
|
2003-12-21 12:01:29 +00:00
|
|
|
|
2005-06-29 03:37:57 +00:00
|
|
|
/*
|
|
|
|
|
* Allow client caching.
|
|
|
|
|
*/
|
2009-08-17 05:09:36 +00:00
|
|
|
if( $wgOut->checkLastModified( $this->article->getTouched() ) )
|
2008-11-08 19:41:38 +00:00
|
|
|
return; // Client cache fresh and headers sent, nothing more to do.
|
2005-06-29 03:37:57 +00:00
|
|
|
|
2008-03-09 21:08:42 +00:00
|
|
|
wfProfileIn( __METHOD__ );
|
2003-12-21 12:01:29 +00:00
|
|
|
|
2005-06-29 03:37:57 +00:00
|
|
|
/*
|
|
|
|
|
* Setup page variables.
|
|
|
|
|
*/
|
2009-08-17 05:09:36 +00:00
|
|
|
$wgOut->setPageTitle( wfMsg( 'history-title', $this->title->getPrefixedText() ) );
|
2007-07-22 14:45:12 +00:00
|
|
|
$wgOut->setPageTitleActionText( wfMsg( 'history_short' ) );
|
2003-12-21 12:01:29 +00:00
|
|
|
$wgOut->setArticleFlag( false );
|
2004-01-17 09:49:43 +00:00
|
|
|
$wgOut->setArticleRelated( true );
|
2008-07-23 19:05:43 +00:00
|
|
|
$wgOut->setRobotPolicy( 'noindex,nofollow' );
|
2006-05-28 03:47:28 +00:00
|
|
|
$wgOut->setSyndicated( true );
|
2008-01-12 00:13:53 +00:00
|
|
|
$wgOut->setFeedAppendQuery( 'action=history' );
|
2008-05-09 20:51:32 +00:00
|
|
|
$wgOut->addScriptFile( 'history.js' );
|
2006-05-28 03:47:28 +00:00
|
|
|
|
2006-10-30 06:25:31 +00:00
|
|
|
$logPage = SpecialPage::getTitleFor( 'Log' );
|
2009-08-17 05:09:36 +00:00
|
|
|
$logLink = $this->skin->link(
|
2009-06-07 15:02:12 +00:00
|
|
|
$logPage,
|
|
|
|
|
wfMsgHtml( 'viewpagelogs' ),
|
|
|
|
|
array(),
|
2009-08-17 05:09:36 +00:00
|
|
|
array( 'page' => $this->title->getPrefixedText() ),
|
2009-06-07 15:02:12 +00:00
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2007-12-04 11:12:10 +00:00
|
|
|
$wgOut->setSubtitle( $logLink );
|
2006-07-04 04:08:35 +00:00
|
|
|
|
2006-05-28 03:47:28 +00:00
|
|
|
$feedType = $wgRequest->getVal( 'feed' );
|
|
|
|
|
if( $feedType ) {
|
2008-03-09 21:08:42 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
2006-05-28 03:47:28 +00:00
|
|
|
return $this->feed( $feedType );
|
|
|
|
|
}
|
2003-12-21 12:01:29 +00:00
|
|
|
|
2005-06-29 03:37:57 +00:00
|
|
|
/*
|
|
|
|
|
* Fail if article doesn't exist.
|
|
|
|
|
*/
|
2009-08-17 05:09:36 +00:00
|
|
|
if( !$this->title->exists() ) {
|
2008-02-18 07:25:35 +00:00
|
|
|
$wgOut->addWikiMsg( 'nohistory' );
|
2009-09-16 17:17:16 +00:00
|
|
|
# show deletion/move log if there is an entry
|
2009-09-18 11:51:00 +00:00
|
|
|
LogEventsList::showLogExtract(
|
|
|
|
|
$wgOut,
|
|
|
|
|
array( 'delete', 'move' ),
|
|
|
|
|
$this->title->getPrefixedText(),
|
|
|
|
|
'',
|
2009-09-16 17:17:16 +00:00
|
|
|
array( 'lim' => 10,
|
|
|
|
|
'conds' => array( "log_action != 'revision'" ),
|
|
|
|
|
'showIfEmpty' => false,
|
2009-09-18 11:51:00 +00:00
|
|
|
'msgKey' => array( 'moveddeleted-notice' )
|
|
|
|
|
)
|
2009-09-16 17:17:16 +00:00
|
|
|
);
|
2008-03-09 21:08:42 +00:00
|
|
|
wfProfileOut( __METHOD__ );
|
2003-12-21 12:01:29 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2004-08-28 18:54:23 +00:00
|
|
|
|
2008-08-01 22:59:06 +00:00
|
|
|
/**
|
|
|
|
|
* Add date selector to quickly get to a certain time
|
|
|
|
|
*/
|
|
|
|
|
$year = $wgRequest->getInt( 'year' );
|
|
|
|
|
$month = $wgRequest->getInt( 'month' );
|
2009-01-28 19:08:18 +00:00
|
|
|
$tagFilter = $wgRequest->getVal( 'tagfilter' );
|
2009-01-30 23:24:29 +00:00
|
|
|
$tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
|
2009-10-26 18:45:27 +00:00
|
|
|
/**
|
|
|
|
|
* Option to show only revisions that have been (partially) hidden via RevisionDelete
|
|
|
|
|
* Note that this can run a *long* time if there are many revisions to look at.
|
|
|
|
|
* We use "isBigDeletion" to determine if the history is too big to go through.
|
|
|
|
|
* Additionally, only users with 'deleterevision' right can filter for deleted edits.
|
|
|
|
|
*/
|
|
|
|
|
if ( $this->title->userCan( 'deleterevision' ) && ( !$this->article->isBigDeletion() || $this->title->userCan( 'bigdelete' ) ) ) {
|
|
|
|
|
$conds = ( $wgRequest->getBool( 'deleted' ) ) ? array("rev_deleted != '0'") : array();
|
|
|
|
|
$checkDeleted = Xml::checkLabel( wfMsg( 'history-show-deleted' ), 'deleted', '', $wgRequest->getBool( 'deleted' ) ) . "\n";
|
|
|
|
|
}
|
|
|
|
|
else { # Don't filter and don't add the checkbox for filtering
|
|
|
|
|
$conds = array();
|
|
|
|
|
$checkDeleted = '';
|
|
|
|
|
}
|
2008-08-21 00:45:13 +00:00
|
|
|
|
2008-08-01 22:59:06 +00:00
|
|
|
$action = htmlspecialchars( $wgScript );
|
2008-08-03 19:40:37 +00:00
|
|
|
$wgOut->addHTML(
|
2008-10-28 18:05:25 +00:00
|
|
|
"<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
|
2009-09-18 11:51:00 +00:00
|
|
|
Xml::fieldset(
|
|
|
|
|
wfMsg( 'history-fieldset-title' ),
|
|
|
|
|
false,
|
|
|
|
|
array( 'id' => 'mw-history-search' )
|
|
|
|
|
) .
|
2009-08-17 05:09:36 +00:00
|
|
|
Xml::hidden( 'title', $this->title->getPrefixedDBKey() ) . "\n" .
|
2008-11-08 19:41:38 +00:00
|
|
|
Xml::hidden( 'action', 'history' ) . "\n" .
|
2009-10-26 18:45:27 +00:00
|
|
|
Xml::dateMenu( $year, $month ) . ' ' .
|
2009-01-30 23:24:29 +00:00
|
|
|
( $tagSelector ? ( implode( ' ', $tagSelector ) . ' ' ) : '' ) .
|
2009-10-26 18:45:27 +00:00
|
|
|
$checkDeleted .
|
2008-11-08 19:41:38 +00:00
|
|
|
Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
|
|
|
|
|
'</fieldset></form>'
|
|
|
|
|
);
|
2007-12-04 11:12:10 +00:00
|
|
|
|
2009-08-17 05:09:36 +00:00
|
|
|
wfRunHooks( 'PageHistoryBeforeList', array( &$this->article ) );
|
2005-06-29 00:23:42 +00:00
|
|
|
|
2008-11-08 19:41:38 +00:00
|
|
|
/**
|
|
|
|
|
* Do the list
|
|
|
|
|
*/
|
2009-10-26 18:45:27 +00:00
|
|
|
$pager = new HistoryPager( $this, $year, $month, $tagFilter, $conds );
|
2008-11-08 19:41:38 +00:00
|
|
|
$wgOut->addHTML(
|
2008-04-14 07:45:50 +00:00
|
|
|
$pager->getNavigationBar() .
|
2006-11-19 17:16:34 +00:00
|
|
|
$pager->getBody() .
|
2006-07-07 17:11:47 +00:00
|
|
|
$pager->getNavigationBar()
|
2008-11-08 19:41:38 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
wfProfileOut( __METHOD__ );
|
2003-12-21 12:01:29 +00:00
|
|
|
}
|
2008-08-21 00:45:13 +00:00
|
|
|
|
2009-08-17 05:09:36 +00:00
|
|
|
/**
|
|
|
|
|
* Fetch an array of revisions, specified by a given limit, offset and
|
|
|
|
|
* direction. This is now only used by the feeds. It was previously
|
|
|
|
|
* used by the main UI but that's now handled by the pager.
|
2010-01-17 16:34:22 +00:00
|
|
|
*
|
|
|
|
|
* @param $limit Integer: the limit number of revisions to get
|
|
|
|
|
* @param $offset Integer
|
|
|
|
|
* @param $direction Integer: either HistoryPage::DIR_PREV or HistoryPage::DIR_NEXT
|
|
|
|
|
* @return ResultWrapper
|
2009-08-17 05:09:36 +00:00
|
|
|
*/
|
2010-01-17 16:34:22 +00:00
|
|
|
function fetchRevisions( $limit, $offset, $direction ) {
|
2009-08-17 05:09:36 +00:00
|
|
|
$dbr = wfGetDB( DB_SLAVE );
|
|
|
|
|
|
|
|
|
|
if( $direction == HistoryPage::DIR_PREV )
|
|
|
|
|
list($dirs, $oper) = array("ASC", ">=");
|
|
|
|
|
else /* $direction == HistoryPage::DIR_NEXT */
|
|
|
|
|
list($dirs, $oper) = array("DESC", "<=");
|
|
|
|
|
|
|
|
|
|
if( $offset )
|
|
|
|
|
$offsets = array("rev_timestamp $oper '$offset'");
|
|
|
|
|
else
|
|
|
|
|
$offsets = array();
|
|
|
|
|
|
|
|
|
|
$page_id = $this->title->getArticleID();
|
|
|
|
|
|
|
|
|
|
return $dbr->select( 'revision',
|
|
|
|
|
Revision::selectFields(),
|
|
|
|
|
array_merge(array("rev_page=$page_id"), $offsets),
|
|
|
|
|
__METHOD__,
|
2009-09-18 11:51:00 +00:00
|
|
|
array( 'ORDER BY' => "rev_timestamp $dirs",
|
2009-08-17 05:09:36 +00:00
|
|
|
'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Output a subscription feed listing recent edits to this page.
|
2010-01-17 16:34:22 +00:00
|
|
|
*
|
|
|
|
|
* @param $type String: feed type
|
2009-08-17 05:09:36 +00:00
|
|
|
*/
|
|
|
|
|
function feed( $type ) {
|
|
|
|
|
global $wgFeedClasses, $wgRequest, $wgFeedLimit;
|
|
|
|
|
if( !FeedUtils::checkFeedOutput($type) ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$feed = new $wgFeedClasses[$type](
|
2009-09-18 11:51:00 +00:00
|
|
|
$this->title->getPrefixedText() . ' - ' .
|
|
|
|
|
wfMsgForContent( 'history-feed-title' ),
|
|
|
|
|
wfMsgForContent( 'history-feed-description' ),
|
|
|
|
|
$this->title->getFullUrl( 'action=history' )
|
|
|
|
|
);
|
2009-08-17 05:09:36 +00:00
|
|
|
|
|
|
|
|
// Get a limit on number of feed entries. Provide a sane default
|
|
|
|
|
// of 10 if none is defined (but limit to $wgFeedLimit max)
|
|
|
|
|
$limit = $wgRequest->getInt( 'limit', 10 );
|
|
|
|
|
if( $limit > $wgFeedLimit || $limit < 1 ) {
|
|
|
|
|
$limit = 10;
|
|
|
|
|
}
|
|
|
|
|
$items = $this->fetchRevisions($limit, 0, HistoryPage::DIR_NEXT);
|
|
|
|
|
|
|
|
|
|
$feed->outHeader();
|
|
|
|
|
if( $items ) {
|
|
|
|
|
foreach( $items as $row ) {
|
|
|
|
|
$feed->outItem( $this->feedItem( $row ) );
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$feed->outItem( $this->feedEmpty() );
|
|
|
|
|
}
|
|
|
|
|
$feed->outFooter();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function feedEmpty() {
|
|
|
|
|
global $wgOut;
|
|
|
|
|
return new FeedItem(
|
|
|
|
|
wfMsgForContent( 'nohistory' ),
|
|
|
|
|
$wgOut->parse( wfMsgForContent( 'history-feed-empty' ) ),
|
|
|
|
|
$this->title->getFullUrl(),
|
|
|
|
|
wfTimestamp( TS_MW ),
|
2009-09-14 16:38:35 +00:00
|
|
|
'',
|
|
|
|
|
$this->title->getTalkPage()->getFullUrl()
|
|
|
|
|
);
|
2009-08-17 05:09:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generate a FeedItem object from a given revision table row
|
|
|
|
|
* Borrows Recent Changes' feed generation functions for formatting;
|
|
|
|
|
* includes a diff to the previous revision (if any).
|
|
|
|
|
*
|
2010-01-17 16:34:22 +00:00
|
|
|
* @param $row Object: database row
|
2009-08-17 05:09:36 +00:00
|
|
|
* @return FeedItem
|
|
|
|
|
*/
|
|
|
|
|
function feedItem( $row ) {
|
|
|
|
|
$rev = new Revision( $row );
|
|
|
|
|
$rev->setTitle( $this->title );
|
2009-09-14 16:38:35 +00:00
|
|
|
$text = FeedUtils::formatDiffRow(
|
|
|
|
|
$this->title,
|
|
|
|
|
$this->title->getPreviousRevisionID( $rev->getId() ),
|
|
|
|
|
$rev->getId(),
|
|
|
|
|
$rev->getTimestamp(),
|
|
|
|
|
$rev->getComment()
|
|
|
|
|
);
|
2009-08-17 05:09:36 +00:00
|
|
|
if( $rev->getComment() == '' ) {
|
|
|
|
|
global $wgContLang;
|
|
|
|
|
$title = wfMsgForContent( 'history-feed-item-nocomment',
|
2009-10-16 06:59:59 +00:00
|
|
|
$rev->getUserText(),
|
|
|
|
|
$wgContLang->timeanddate( $rev->getTimestamp() ),
|
|
|
|
|
$wgContLang->date( $rev->getTimestamp() ),
|
|
|
|
|
$wgContLang->time( $rev->getTimestamp() )
|
|
|
|
|
);
|
2009-08-17 05:09:36 +00:00
|
|
|
} else {
|
2009-09-18 11:51:00 +00:00
|
|
|
$title = $rev->getUserText() .
|
|
|
|
|
wfMsgForContent( 'colon-separator' ) .
|
|
|
|
|
FeedItem::stripComment( $rev->getComment() );
|
2009-08-17 05:09:36 +00:00
|
|
|
}
|
|
|
|
|
return new FeedItem(
|
|
|
|
|
$title,
|
|
|
|
|
$text,
|
|
|
|
|
$this->title->getFullUrl( 'diff=' . $rev->getId() . '&oldid=prev' ),
|
|
|
|
|
$rev->getTimestamp(),
|
|
|
|
|
$rev->getUserText(),
|
2009-09-14 16:38:35 +00:00
|
|
|
$this->title->getTalkPage()->getFullUrl()
|
|
|
|
|
);
|
2009-08-17 05:09:36 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup Pager
|
|
|
|
|
*/
|
|
|
|
|
class HistoryPager extends ReverseChronologicalPager {
|
2009-10-26 18:45:27 +00:00
|
|
|
public $lastRow = false, $counter, $historyPage, $title, $buttons, $conds;
|
2009-08-17 05:09:36 +00:00
|
|
|
protected $oldIdChecked;
|
|
|
|
|
|
2009-10-26 18:45:27 +00:00
|
|
|
function __construct( $historyPage, $year='', $month='', $tagFilter = '', $conds = array() ) {
|
2009-08-17 05:09:36 +00:00
|
|
|
parent::__construct();
|
|
|
|
|
$this->historyPage = $historyPage;
|
|
|
|
|
$this->title = $this->historyPage->title;
|
|
|
|
|
$this->tagFilter = $tagFilter;
|
|
|
|
|
$this->getDateCond( $year, $month );
|
2009-10-26 18:45:27 +00:00
|
|
|
$this->conds = $conds;
|
2009-08-17 05:09:36 +00:00
|
|
|
}
|
2009-09-18 11:51:00 +00:00
|
|
|
|
2009-08-20 21:31:38 +00:00
|
|
|
// For hook compatibility...
|
|
|
|
|
function getArticle() {
|
|
|
|
|
return $this->historyPage->getArticle();
|
|
|
|
|
}
|
2009-08-17 05:09:36 +00:00
|
|
|
|
|
|
|
|
function getQueryInfo() {
|
|
|
|
|
$queryInfo = array(
|
|
|
|
|
'tables' => array('revision'),
|
2009-12-30 08:01:17 +00:00
|
|
|
'fields' => Revision::selectFields(),
|
2009-10-26 18:45:27 +00:00
|
|
|
'conds' => array_merge( array('rev_page' => $this->historyPage->title->getArticleID() ), $this->conds ),
|
2009-08-17 05:09:36 +00:00
|
|
|
'options' => array( 'USE INDEX' => array('revision' => 'page_timestamp') ),
|
|
|
|
|
'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ),
|
|
|
|
|
);
|
2009-09-18 11:51:00 +00:00
|
|
|
ChangeTags::modifyDisplayQuery(
|
|
|
|
|
$queryInfo['tables'],
|
|
|
|
|
$queryInfo['fields'],
|
|
|
|
|
$queryInfo['conds'],
|
|
|
|
|
$queryInfo['join_conds'],
|
|
|
|
|
$queryInfo['options'],
|
|
|
|
|
$this->tagFilter
|
|
|
|
|
);
|
2009-08-17 05:09:36 +00:00
|
|
|
wfRunHooks( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) );
|
|
|
|
|
return $queryInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getIndexField() {
|
|
|
|
|
return 'rev_timestamp';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formatRow( $row ) {
|
|
|
|
|
if( $this->lastRow ) {
|
2009-09-14 16:38:35 +00:00
|
|
|
$latest = ($this->counter == 1 && $this->mIsFirst);
|
2009-08-17 05:09:36 +00:00
|
|
|
$firstInList = $this->counter == 1;
|
|
|
|
|
$s = $this->historyLine( $this->lastRow, $row, $this->counter++,
|
|
|
|
|
$this->title->getNotificationTimestamp(), $latest, $firstInList );
|
|
|
|
|
} else {
|
|
|
|
|
$s = '';
|
|
|
|
|
}
|
|
|
|
|
$this->lastRow = $row;
|
|
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-11 17:00:12 +00:00
|
|
|
/**
|
|
|
|
|
* Creates begin of history list with a submit button
|
|
|
|
|
*
|
|
|
|
|
* @return string HTML output
|
|
|
|
|
*/
|
2009-08-17 05:09:36 +00:00
|
|
|
function getStartBody() {
|
2009-10-28 18:18:05 +00:00
|
|
|
global $wgScript, $wgUser, $wgOut, $wgContLang;
|
2009-08-17 05:09:36 +00:00
|
|
|
$this->lastRow = false;
|
|
|
|
|
$this->counter = 1;
|
|
|
|
|
$this->oldIdChecked = 0;
|
|
|
|
|
|
2009-08-24 14:30:32 +00:00
|
|
|
$wgOut->wrapWikiMsg( "<div class='mw-history-legend'>\n$1</div>", 'histlegend' );
|
2009-09-02 01:59:36 +00:00
|
|
|
$s = Xml::openElement( 'form', array( 'action' => $wgScript,
|
|
|
|
|
'id' => 'mw-history-compare' ) ) . "\n";
|
|
|
|
|
$s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n";
|
2009-10-06 06:30:24 +00:00
|
|
|
$s .= Xml::hidden( 'action', 'historysubmit' ) . "\n";
|
2009-09-02 01:59:36 +00:00
|
|
|
|
|
|
|
|
$this->buttons = '<div>';
|
2009-10-07 18:06:21 +00:00
|
|
|
if( $wgUser->isAllowed('deleterevision') ) {
|
2009-10-06 18:54:47 +00:00
|
|
|
$float = $wgContLang->alignEnd();
|
2009-10-06 06:30:24 +00:00
|
|
|
# Note bug #20966, <button> is non-standard in IE<8
|
2009-09-18 11:51:00 +00:00
|
|
|
$this->buttons .= Xml::element( 'button',
|
2009-04-11 17:38:21 +00:00
|
|
|
array(
|
2009-09-02 01:59:36 +00:00
|
|
|
'type' => 'submit',
|
2009-10-06 06:30:24 +00:00
|
|
|
'name' => 'revisiondelete',
|
|
|
|
|
'value' => '1',
|
2009-10-02 12:18:43 +00:00
|
|
|
'style' => "float: $float;",
|
|
|
|
|
'class' => 'mw-history-revisiondelete-button',
|
2009-09-02 01:59:36 +00:00
|
|
|
),
|
|
|
|
|
wfMsg( 'showhideselectedversions' )
|
|
|
|
|
) . "\n";
|
2009-04-11 17:38:21 +00:00
|
|
|
}
|
2009-10-28 18:18:05 +00:00
|
|
|
$this->buttons .= $this->submitButton( wfMsg( 'compareselectedversions'),
|
|
|
|
|
array(
|
|
|
|
|
'class' => 'historysubmit',
|
|
|
|
|
'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
|
|
|
|
|
'title' => wfMsg( 'tooltip-compareselectedversions' ),
|
|
|
|
|
)
|
|
|
|
|
) . "\n";
|
2009-09-02 01:59:36 +00:00
|
|
|
$this->buttons .= '</div>';
|
|
|
|
|
$s .= $this->buttons . '<ul id="pagehistory">' . "\n";
|
2003-12-21 12:01:29 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
|
|
|
|
|
2009-08-17 05:09:36 +00:00
|
|
|
function getEndBody() {
|
|
|
|
|
if( $this->lastRow ) {
|
|
|
|
|
$latest = $this->counter == 1 && $this->mIsFirst;
|
|
|
|
|
$firstInList = $this->counter == 1;
|
|
|
|
|
if( $this->mIsBackwards ) {
|
|
|
|
|
# Next row is unknown, but for UI reasons, probably exists if an offset has been specified
|
|
|
|
|
if( $this->mOffset == '' ) {
|
|
|
|
|
$next = null;
|
|
|
|
|
} else {
|
|
|
|
|
$next = 'unknown';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
# The next row is the past-the-end row
|
|
|
|
|
$next = $this->mPastTheEndRow;
|
|
|
|
|
}
|
|
|
|
|
$s = $this->historyLine( $this->lastRow, $next, $this->counter++,
|
|
|
|
|
$this->title->getNotificationTimestamp(), $latest, $firstInList );
|
|
|
|
|
} else {
|
|
|
|
|
$s = '';
|
|
|
|
|
}
|
2009-09-02 01:59:36 +00:00
|
|
|
$s .= "</ul>\n";
|
2009-11-18 23:31:47 +00:00
|
|
|
# Add second buttons only if there is more than one rev
|
|
|
|
|
if( $this->getNumRows() > 2 ) {
|
|
|
|
|
$s .= $this->buttons;
|
|
|
|
|
}
|
2004-08-28 17:34:54 +00:00
|
|
|
$s .= '</form>';
|
2003-12-21 12:01:29 +00:00
|
|
|
return $s;
|
|
|
|
|
}
|
2005-06-29 03:37:57 +00:00
|
|
|
|
2007-12-11 17:00:12 +00:00
|
|
|
/**
|
|
|
|
|
* Creates a submit button
|
|
|
|
|
*
|
2010-01-17 16:34:22 +00:00
|
|
|
* @param $message String: text of the submit button, will be escaped
|
|
|
|
|
* @param $attributes Array: attributes
|
|
|
|
|
* @return String: HTML output for the submit button
|
2007-12-11 17:00:12 +00:00
|
|
|
*/
|
2010-01-17 16:34:22 +00:00
|
|
|
function submitButton( $message, $attributes = array() ) {
|
2007-12-11 17:00:12 +00:00
|
|
|
# Disable submit button if history has 1 revision only
|
2009-08-17 05:09:36 +00:00
|
|
|
if( $this->getNumRows() > 1 ) {
|
2008-08-21 00:45:13 +00:00
|
|
|
return Xml::submitButton( $message , $attributes );
|
2007-12-20 02:40:02 +00:00
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
2005-03-31 11:40:05 +00:00
|
|
|
}
|
2003-12-21 12:01:29 +00:00
|
|
|
|
2006-11-19 17:16:34 +00:00
|
|
|
/**
|
|
|
|
|
* Returns a row from the history printout.
|
|
|
|
|
*
|
|
|
|
|
* @todo document some more, and maybe clean up the code (some params redundant?)
|
|
|
|
|
*
|
2010-01-17 16:34:22 +00:00
|
|
|
* @param $row Object: the database row corresponding to the previous line.
|
|
|
|
|
* @param $next Mixed: the database row corresponding to the next line.
|
|
|
|
|
* @param $counter Integer: apparently a counter of what row number we're at, counted from the top row = 1.
|
2006-11-19 17:16:34 +00:00
|
|
|
* @param $notificationtimestamp
|
2010-01-17 16:34:22 +00:00
|
|
|
* @param $latest Boolean: whether this row corresponds to the page's latest revision.
|
|
|
|
|
* @param $firstInList Boolean: whether this row corresponds to the first displayed on this history page.
|
|
|
|
|
* @return String: HTML output for the row
|
2006-11-19 17:16:34 +00:00
|
|
|
*/
|
2009-03-26 22:24:09 +00:00
|
|
|
function historyLine( $row, $next, $counter = '', $notificationtimestamp = false,
|
|
|
|
|
$latest = false, $firstInList = false )
|
|
|
|
|
{
|
2007-03-09 18:26:33 +00:00
|
|
|
global $wgUser, $wgLang;
|
2006-03-16 19:04:25 +00:00
|
|
|
$rev = new Revision( $row );
|
2009-08-17 05:09:36 +00:00
|
|
|
$rev->setTitle( $this->title );
|
2003-12-21 12:01:29 +00:00
|
|
|
|
2006-03-16 19:04:25 +00:00
|
|
|
$curlink = $this->curLink( $rev, $latest );
|
|
|
|
|
$lastlink = $this->lastLink( $rev, $next, $counter );
|
2009-08-17 05:09:36 +00:00
|
|
|
$diffButtons = $this->diffButtons( $rev, $firstInList, $counter );
|
2009-10-13 15:47:57 +00:00
|
|
|
$histLinks = Html::rawElement(
|
|
|
|
|
'span',
|
|
|
|
|
array( 'class' => 'mw-history-histlinks' ),
|
|
|
|
|
'(' . $curlink . $this->historyPage->message['pipe-separator'] . $lastlink . ') '
|
|
|
|
|
);
|
|
|
|
|
$s = $histLinks . $diffButtons;
|
|
|
|
|
|
2006-03-16 19:04:25 +00:00
|
|
|
$link = $this->revLink( $rev );
|
2009-01-28 19:08:18 +00:00
|
|
|
$classes = array();
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2009-10-24 22:07:59 +00:00
|
|
|
$del = '';
|
2009-10-30 02:14:22 +00:00
|
|
|
// User can delete revisions...
|
2009-10-07 18:06:21 +00:00
|
|
|
if( $wgUser->isAllowed( 'deleterevision' ) ) {
|
2009-10-24 22:07:59 +00:00
|
|
|
// If revision was hidden from sysops, disable the checkbox
|
|
|
|
|
if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
|
|
|
|
|
$del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
|
|
|
|
|
// Otherwise, enable the checkbox...
|
|
|
|
|
} else {
|
|
|
|
|
$del = Xml::check( 'showhiderevisions', false, array( 'name' => 'ids['.$rev->getId().']' ) );
|
|
|
|
|
}
|
|
|
|
|
// User can only view deleted revisions...
|
|
|
|
|
} else if( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) {
|
|
|
|
|
// If revision was hidden from sysops, disable the link
|
|
|
|
|
if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
|
2009-10-30 02:14:22 +00:00
|
|
|
$cdel = $this->getSkin()->revDeleteLinkDisabled( false );
|
2009-04-11 17:38:21 +00:00
|
|
|
// Otherwise, show the link...
|
2006-03-16 19:04:25 +00:00
|
|
|
} else {
|
2009-10-24 22:07:59 +00:00
|
|
|
$query = array( 'type' => 'revision',
|
|
|
|
|
'target' => $this->title->getPrefixedDbkey(), 'ids' => $rev->getId() );
|
2009-10-30 02:14:22 +00:00
|
|
|
$del .= $this->getSkin()->revDeleteLink( $query,
|
|
|
|
|
$rev->isDeleted( Revision::DELETED_RESTRICTED ), false );
|
2006-03-16 19:04:25 +00:00
|
|
|
}
|
2003-12-21 12:01:29 +00:00
|
|
|
}
|
2009-10-24 22:07:59 +00:00
|
|
|
if( $del ) $s .= " $del ";
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-02-05 06:12:31 +00:00
|
|
|
$s .= " $link";
|
2009-08-17 05:09:36 +00:00
|
|
|
$s .= " <span class='history-user'>" . $this->getSkin()->revUserTools( $rev, true ) . "</span>";
|
2008-03-09 21:08:42 +00:00
|
|
|
|
2009-02-09 22:27:25 +00:00
|
|
|
if( $rev->isMinor() ) {
|
2009-08-04 00:28:20 +00:00
|
|
|
$s .= ' ' . ChangesList::flag( 'minor' );
|
2004-05-18 12:36:13 +00:00
|
|
|
}
|
2007-03-08 03:07:58 +00:00
|
|
|
|
2009-02-09 22:27:25 +00:00
|
|
|
if( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
|
2009-08-17 05:09:36 +00:00
|
|
|
$s .= ' ' . $this->getSkin()->formatRevisionSize( $size );
|
2007-03-08 03:07:58 +00:00
|
|
|
}
|
|
|
|
|
|
2009-08-17 05:09:36 +00:00
|
|
|
$s .= $this->getSkin()->revComment( $rev, false, true );
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2008-11-08 19:41:38 +00:00
|
|
|
if( $notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp) ) {
|
2005-08-12 16:14:20 +00:00
|
|
|
$s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
|
2004-12-18 03:47:11 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-07-07 00:17:51 +00:00
|
|
|
$tools = array();
|
2008-12-31 21:16:36 +00:00
|
|
|
|
2009-09-14 16:38:35 +00:00
|
|
|
# Rollback and undo links
|
2008-11-08 19:41:38 +00:00
|
|
|
if( !is_null( $next ) && is_object( $next ) ) {
|
2009-08-17 05:09:36 +00:00
|
|
|
if( $latest && $this->title->userCan( 'rollback' ) && $this->title->userCan( 'edit' ) ) {
|
2009-05-26 12:29:16 +00:00
|
|
|
$tools[] = '<span class="mw-rollback-link">'.
|
2009-08-17 05:09:36 +00:00
|
|
|
$this->getSkin()->buildRollbackLink( $rev ).'</span>';
|
2007-07-12 14:25:48 +00:00
|
|
|
}
|
2008-12-31 21:16:36 +00:00
|
|
|
|
2009-08-17 05:09:36 +00:00
|
|
|
if( $this->title->quickUserCan( 'edit' )
|
2009-05-26 12:29:16 +00:00
|
|
|
&& !$rev->isDeleted( Revision::DELETED_TEXT )
|
|
|
|
|
&& !$next->rev_deleted & Revision::DELETED_TEXT )
|
2008-11-08 19:41:38 +00:00
|
|
|
{
|
2008-08-26 20:06:57 +00:00
|
|
|
# Create undo tooltip for the first (=latest) line only
|
|
|
|
|
$undoTooltip = $latest
|
|
|
|
|
? array( 'title' => wfMsg( 'tooltip-undo' ) )
|
|
|
|
|
: array();
|
2009-08-17 05:09:36 +00:00
|
|
|
$undolink = $this->getSkin()->link(
|
|
|
|
|
$this->title,
|
2008-08-26 20:06:57 +00:00
|
|
|
wfMsgHtml( 'editundo' ),
|
|
|
|
|
$undoTooltip,
|
2009-09-18 11:51:00 +00:00
|
|
|
array(
|
|
|
|
|
'action' => 'edit',
|
|
|
|
|
'undoafter' => $next->rev_id,
|
|
|
|
|
'undo' => $rev->getId()
|
|
|
|
|
),
|
2008-08-26 20:06:57 +00:00
|
|
|
array( 'known', 'noclasses' )
|
2007-12-27 18:05:40 +00:00
|
|
|
);
|
|
|
|
|
$tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
|
|
|
|
|
}
|
2007-07-06 06:52:52 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2007-07-11 17:45:25 +00:00
|
|
|
if( $tools ) {
|
2009-02-09 09:13:30 +00:00
|
|
|
$s .= ' (' . $wgLang->pipeList( $tools ) . ')';
|
2007-07-11 17:45:25 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2009-01-28 19:08:18 +00:00
|
|
|
# Tags
|
|
|
|
|
list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'history' );
|
|
|
|
|
$classes = array_merge( $classes, $newClasses );
|
|
|
|
|
$s .= " $tagSummary";
|
|
|
|
|
|
2010-01-07 01:21:02 +00:00
|
|
|
wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s, &$classes ) );
|
2003-12-21 12:01:29 +00:00
|
|
|
|
2009-08-17 05:09:36 +00:00
|
|
|
$attribs = array();
|
|
|
|
|
if ( $classes ) {
|
|
|
|
|
$attribs['class'] = implode( ' ', $classes );
|
|
|
|
|
}
|
2009-01-28 19:08:18 +00:00
|
|
|
|
2009-08-17 05:09:36 +00:00
|
|
|
return Xml::tags( 'li', $attribs, $s ) . "\n";
|
2003-12-21 12:01:29 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
|
|
|
|
/**
|
2008-08-21 00:45:13 +00:00
|
|
|
* Create a link to view this revision of the page
|
2010-01-17 16:34:22 +00:00
|
|
|
*
|
|
|
|
|
* @param $rev Revision
|
|
|
|
|
* @return String
|
2008-08-21 00:45:13 +00:00
|
|
|
*/
|
2006-03-16 19:04:25 +00:00
|
|
|
function revLink( $rev ) {
|
2006-03-18 01:06:57 +00:00
|
|
|
global $wgLang;
|
2006-03-16 19:04:25 +00:00
|
|
|
$date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
|
2009-05-22 09:35:48 +00:00
|
|
|
$date = htmlspecialchars( $date );
|
2009-05-19 19:19:41 +00:00
|
|
|
if( !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
|
2009-08-17 05:09:36 +00:00
|
|
|
$link = $this->getSkin()->link(
|
|
|
|
|
$this->title,
|
2009-06-07 15:02:12 +00:00
|
|
|
$date,
|
|
|
|
|
array(),
|
|
|
|
|
array( 'oldid' => $rev->getId() ),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2005-03-31 11:40:05 +00:00
|
|
|
} else {
|
2009-05-19 19:19:41 +00:00
|
|
|
$link = "<span class=\"history-deleted\">$date</span>";
|
2005-03-31 11:40:05 +00:00
|
|
|
}
|
2006-03-16 19:04:25 +00:00
|
|
|
return $link;
|
2005-03-31 11:40:05 +00:00
|
|
|
}
|
2005-06-29 03:37:57 +00:00
|
|
|
|
2008-04-14 07:45:50 +00:00
|
|
|
/**
|
2008-08-21 00:45:13 +00:00
|
|
|
* Create a diff-to-current link for this revision for this page
|
2010-01-17 16:34:22 +00:00
|
|
|
*
|
|
|
|
|
* @param $rev Revision
|
|
|
|
|
* @param $latest Boolean: this is the latest revision of the page?
|
|
|
|
|
* @return String
|
2008-08-21 00:45:13 +00:00
|
|
|
*/
|
2006-03-16 19:04:25 +00:00
|
|
|
function curLink( $rev, $latest ) {
|
2009-08-17 05:09:36 +00:00
|
|
|
$cur = $this->historyPage->message['cur'];
|
2009-03-26 22:24:09 +00:00
|
|
|
if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
|
2005-03-31 11:40:05 +00:00
|
|
|
return $cur;
|
|
|
|
|
} else {
|
2009-08-17 05:09:36 +00:00
|
|
|
return $this->getSkin()->link(
|
|
|
|
|
$this->title,
|
2009-06-07 15:02:12 +00:00
|
|
|
$cur,
|
|
|
|
|
array(),
|
|
|
|
|
array(
|
2009-08-17 05:09:36 +00:00
|
|
|
'diff' => $this->title->getLatestRevID(),
|
2009-06-07 15:02:12 +00:00
|
|
|
'oldid' => $rev->getId()
|
|
|
|
|
),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2005-03-31 11:40:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
2005-06-29 03:37:57 +00:00
|
|
|
|
2008-04-14 07:45:50 +00:00
|
|
|
/**
|
2008-08-21 00:45:13 +00:00
|
|
|
* Create a diff-to-previous link for this revision for this page.
|
2010-01-17 16:34:22 +00:00
|
|
|
*
|
|
|
|
|
* @param $prevRev Revision: the previous revision
|
|
|
|
|
* @param $next Mixed: the newer revision
|
|
|
|
|
* @param $counter Integer: what row on the history list this is
|
|
|
|
|
* @return String
|
2008-08-21 00:45:13 +00:00
|
|
|
*/
|
2008-03-15 21:20:41 +00:00
|
|
|
function lastLink( $prevRev, $next, $counter ) {
|
2009-08-17 05:09:36 +00:00
|
|
|
$last = $this->historyPage->message['last'];
|
2008-03-15 21:20:41 +00:00
|
|
|
# $next may either be a Row, null, or "unkown"
|
|
|
|
|
$nextRev = is_object($next) ? new Revision( $next ) : $next;
|
|
|
|
|
if( is_null($next) ) {
|
2006-07-07 03:28:48 +00:00
|
|
|
# Probably no next row
|
|
|
|
|
return $last;
|
2008-03-15 21:20:41 +00:00
|
|
|
} elseif( $next === 'unknown' ) {
|
2006-07-07 03:28:48 +00:00
|
|
|
# Next row probably exists but is unknown, use an oldid=prev link
|
2009-08-17 05:09:36 +00:00
|
|
|
return $this->getSkin()->link(
|
|
|
|
|
$this->title,
|
2009-06-07 15:02:12 +00:00
|
|
|
$last,
|
|
|
|
|
array(),
|
|
|
|
|
array(
|
|
|
|
|
'diff' => $prevRev->getId(),
|
|
|
|
|
'oldid' => 'prev'
|
|
|
|
|
),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2009-03-26 22:24:09 +00:00
|
|
|
} elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
|
2005-03-31 11:40:05 +00:00
|
|
|
return $last;
|
|
|
|
|
} else {
|
2009-08-17 05:09:36 +00:00
|
|
|
return $this->getSkin()->link(
|
|
|
|
|
$this->title,
|
2009-06-07 15:02:12 +00:00
|
|
|
$last,
|
|
|
|
|
array(),
|
|
|
|
|
array(
|
|
|
|
|
'diff' => $prevRev->getId(),
|
|
|
|
|
'oldid' => $next->rev_id
|
|
|
|
|
),
|
|
|
|
|
array( 'known', 'noclasses' )
|
|
|
|
|
);
|
2005-03-31 11:40:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
2005-06-29 03:37:57 +00:00
|
|
|
|
2007-12-04 12:22:23 +00:00
|
|
|
/**
|
|
|
|
|
* Create radio buttons for page history
|
|
|
|
|
*
|
2010-01-17 16:34:22 +00:00
|
|
|
* @param $rev Revision object
|
|
|
|
|
* @param $firstInList Boolean: is this version the first one?
|
|
|
|
|
* @param $counter Integer: a counter of what row number we're at, counted from the top row = 1.
|
|
|
|
|
* @return String: HTML output for the radio buttons
|
2007-12-04 12:22:23 +00:00
|
|
|
*/
|
2006-03-16 19:04:25 +00:00
|
|
|
function diffButtons( $rev, $firstInList, $counter ) {
|
2009-08-17 05:09:36 +00:00
|
|
|
if( $this->getNumRows() > 1 ) {
|
2009-07-19 19:59:12 +00:00
|
|
|
$id = $rev->getId();
|
|
|
|
|
$radio = array( 'type' => 'radio', 'value' => $id );
|
2005-08-12 16:14:20 +00:00
|
|
|
/** @todo: move title texts to javascript */
|
2008-11-08 19:41:38 +00:00
|
|
|
if( $firstInList ) {
|
2009-09-18 11:51:00 +00:00
|
|
|
$first = Xml::element( 'input',
|
2009-07-19 19:59:12 +00:00
|
|
|
array_merge( $radio, array(
|
|
|
|
|
'style' => 'visibility:hidden',
|
|
|
|
|
'name' => 'oldid',
|
|
|
|
|
'id' => 'mw-oldid-null' ) )
|
2009-02-09 07:42:54 +00:00
|
|
|
);
|
2005-03-31 11:40:05 +00:00
|
|
|
$checkmark = array( 'checked' => 'checked' );
|
|
|
|
|
} else {
|
2009-10-24 22:07:59 +00:00
|
|
|
# Check visibility of old revisions
|
2009-03-26 22:24:09 +00:00
|
|
|
if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
|
2009-02-09 07:42:54 +00:00
|
|
|
$radio['disabled'] = 'disabled';
|
|
|
|
|
$checkmark = array(); // We will check the next possible one
|
2009-08-17 05:09:36 +00:00
|
|
|
} else if( $counter == 2 || !$this->oldIdChecked ) {
|
2005-03-31 11:40:05 +00:00
|
|
|
$checkmark = array( 'checked' => 'checked' );
|
2009-08-17 05:09:36 +00:00
|
|
|
$this->oldIdChecked = $id;
|
2005-03-31 11:40:05 +00:00
|
|
|
} else {
|
|
|
|
|
$checkmark = array();
|
|
|
|
|
}
|
2009-07-19 19:59:12 +00:00
|
|
|
$first = Xml::element( 'input',
|
|
|
|
|
array_merge( $radio, $checkmark, array(
|
|
|
|
|
'name' => 'oldid',
|
|
|
|
|
'id' => "mw-oldid-$id" ) ) );
|
2005-03-31 11:40:05 +00:00
|
|
|
$checkmark = array();
|
|
|
|
|
}
|
2009-07-19 19:59:12 +00:00
|
|
|
$second = Xml::element( 'input',
|
|
|
|
|
array_merge( $radio, $checkmark, array(
|
|
|
|
|
'name' => 'diff',
|
|
|
|
|
'id' => "mw-diff-$id" ) ) );
|
2005-03-31 11:40:05 +00:00
|
|
|
return $first . $second;
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-07-07 03:28:48 +00:00
|
|
|
}
|
|
|
|
|
|
2007-04-20 08:55:14 +00:00
|
|
|
/**
|
2009-08-17 05:09:36 +00:00
|
|
|
* Backwards-compatibility aliases
|
2007-04-20 08:55:14 +00:00
|
|
|
*/
|
2009-08-17 05:09:36 +00:00
|
|
|
class PageHistory extends HistoryPage {}
|
|
|
|
|
class PageHistoryPager extends HistoryPager {}
|