*/
function __construct( $article ) {
global $wgUser;
- $this->article =& $article;
- $this->title =& $article->getTitle();
+ $this->article = $article;
+ $this->title = $article->getTitle();
$this->skin = $wgUser->getSkin();
$this->preCacheMessages();
}
*/
if( !$this->title->exists() ) {
$wgOut->addWikiMsg( 'nohistory' );
+ # show deletion/move log if there is an entry
+ LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->title->getPrefixedText(), '',
+ array( 'lim' => 10,
+ 'conds' => array( "log_action != 'revision'" ),
+ 'showIfEmpty' => false,
+ 'msgKey' => array( 'moveddeleted-notice' ) )
+ );
wfProfileOut( __METHOD__ );
return;
}
$wgOut->parse( wfMsgForContent( 'history-feed-empty' ) ),
$this->title->getFullUrl(),
wfTimestamp( TS_MW ),
- '',
- $this->title->getTalkPage()->getFullUrl() );
+ '',
+ $this->title->getTalkPage()->getFullUrl()
+ );
}
/**
function feedItem( $row ) {
$rev = new Revision( $row );
$rev->setTitle( $this->title );
- $text = FeedUtils::formatDiffRow( $this->title,
- $this->title->getPreviousRevisionID( $rev->getId() ),
- $rev->getId(),
- $rev->getTimestamp(),
- $rev->getComment() );
-
+ $text = FeedUtils::formatDiffRow(
+ $this->title,
+ $this->title->getPreviousRevisionID( $rev->getId() ),
+ $rev->getId(),
+ $rev->getTimestamp(),
+ $rev->getComment()
+ );
if( $rev->getComment() == '' ) {
global $wgContLang;
$title = wfMsgForContent( 'history-feed-item-nocomment',
} else {
$title = $rev->getUserText() . wfMsgForContent( 'colon-separator' ) . FeedItem::stripComment( $rev->getComment() );
}
-
return new FeedItem(
$title,
$text,
$this->title->getFullUrl( 'diff=' . $rev->getId() . '&oldid=prev' ),
$rev->getTimestamp(),
$rev->getUserText(),
- $this->title->getTalkPage()->getFullUrl() );
+ $this->title->getTalkPage()->getFullUrl()
+ );
}
}
* @ingroup Pager
*/
class HistoryPager extends ReverseChronologicalPager {
- public $lastRow = false, $counter, $historyPage, $title;
+ public $lastRow = false, $counter, $historyPage, $title, $buttons;
protected $oldIdChecked;
function __construct( $historyPage, $year='', $month='', $tagFilter = '' ) {
$this->tagFilter = $tagFilter;
$this->getDateCond( $year, $month );
}
+
+ // For hook compatibility...
+ function getArticle() {
+ return $this->historyPage->getArticle();
+ }
function getQueryInfo() {
$queryInfo = array(
function formatRow( $row ) {
if( $this->lastRow ) {
- $latest = $this->counter == 1 && $this->mIsFirst;
+ $latest = ($this->counter == 1 && $this->mIsFirst);
$firstInList = $this->counter == 1;
$s = $this->historyLine( $this->lastRow, $row, $this->counter++,
$this->title->getNotificationTimestamp(), $latest, $firstInList );
* @return string HTML output
*/
function getStartBody() {
- global $wgScript, $wgEnableHtmlDiff, $wgUser;
+ global $wgScript, $wgEnableHtmlDiff, $wgUser, $wgOut;
$this->lastRow = false;
$this->counter = 1;
$this->oldIdChecked = 0;
- $s = wfMsgExt( 'histlegend', array( 'parse') );
- if( $this->getNumRows() > 1 && $wgUser->isAllowed('deleterevision') ) {
- $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
- $s .= Xml::openElement( 'form',
+ $wgOut->wrapWikiMsg( "<div class='mw-history-legend'>\n$1</div>", 'histlegend' );
+ $s = Xml::openElement( 'form', array( 'action' => $wgScript,
+ 'id' => 'mw-history-compare' ) ) . "\n";
+ $s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() ) . "\n";
+
+ $this->buttons = '<div>';
+ if( $wgUser->isAllowed('deleterevision') ) {
+ $this->buttons .= Xml::element( 'button',
array(
- 'action' => $revdel->getLocalURL( array(
- 'type' => 'revision',
- 'target' => $this->title->getPrefixedDbKey()
- ) ),
- 'method' => 'post',
- 'id' => 'mw-history-revdeleteform',
- 'style' => 'visibility:hidden;float:right;'
- )
- );
- $s .= Xml::hidden( 'ids', '', array('id'=>'revdel-oldid') );
- $s .= Xml::submitButton( wfMsg( 'showhideselectedversions' ) );
- $s .= Xml::closeElement( 'form' );
+ 'type' => 'submit',
+ 'name' => 'action',
+ 'value' => 'revisiondelete',
+ 'style' => 'float: right',
+ ),
+ wfMsg( 'showhideselectedversions' )
+ ) . "\n";
}
- $s .= Xml::openElement( 'form', array( 'action' => $wgScript,
- 'id' => 'mw-history-compare' ) );
- $s .= Xml::hidden( 'title', $this->title->getPrefixedDbKey() );
if( $wgEnableHtmlDiff ) {
- $s .= $this->submitButton( wfMsg( 'visualcomparison'),
+ $this->buttons .= Xml::element( 'button',
array(
- 'name' => 'htmldiff',
+ 'type' => 'submit',
+ 'name' => 'htmldiff',
+ 'value' => '1',
'class' => 'historysubmit',
'accesskey' => wfMsg( 'accesskey-visualcomparison' ),
'title' => wfMsg( 'tooltip-compareselectedversions' ),
- )
- );
- $s .= $this->submitButton( wfMsg( 'wikicodecomparison'),
+ ),
+ wfMsg( 'visualcomparison')
+ ) . "\n";
+ $this->buttons .= $this->submitButton( wfMsg( 'wikicodecomparison'),
array(
'class' => 'historysubmit',
'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
'title' => wfMsg( 'tooltip-compareselectedversions' ),
)
- );
+ ) . "\n";
} else {
- $s .= $this->submitButton( wfMsg( 'compareselectedversions'),
+ $this->buttons .= $this->submitButton( wfMsg( 'compareselectedversions'),
array(
'class' => 'historysubmit',
'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
'title' => wfMsg( 'tooltip-compareselectedversions' ),
)
- );
+ ) . "\n";
}
- $s .= '<ul id="pagehistory">' . "\n";
+ $this->buttons .= '</div>';
+ $s .= $this->buttons . '<ul id="pagehistory">' . "\n";
return $s;
}
function getEndBody() {
-
if( $this->lastRow ) {
$latest = $this->counter == 1 && $this->mIsFirst;
$firstInList = $this->counter == 1;
} else {
$s = '';
}
-
- global $wgEnableHtmlDiff;
- $s .= '</ul>';
- if( $wgEnableHtmlDiff ) {
- $s .= $this->submitButton( wfMsg( 'visualcomparison'),
- array(
- 'name' => 'htmldiff',
- 'class' => 'historysubmit',
- 'accesskey' => wfMsg( 'accesskey-visualcomparison' ),
- 'title' => wfMsg( 'tooltip-compareselectedversions' ),
- )
- );
- $s .= $this->submitButton( wfMsg( 'wikicodecomparison'),
- array(
- 'class' => 'historysubmit',
- 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
- 'title' => wfMsg( 'tooltip-compareselectedversions' ),
- )
- );
- } else {
- $s .= $this->submitButton( wfMsg( 'compareselectedversions'),
- array(
- 'class' => 'historysubmit',
- 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
- 'title' => wfMsg( 'tooltip-compareselectedversions' ),
- )
- );
- }
+ $s .= "</ul>\n";
+ $s .= $this->buttons;
$s .= '</form>';
return $s;
}
$s = "($curlink) ($lastlink) $diffButtons";
if( $wgUser->isAllowed( 'deleterevision' ) ) {
- // Hide JS by default for non-JS browsing
- $hidden = array( 'style' => 'display:none' );
// If revision was hidden from sysops
if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
- $del = Xml::check( 'deleterevisions', false,
- $hidden + array('disabled' => 'disabled') );
- $del .= Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
- '(' . $this->historyPage->message['rev-delundel'] . ')' );
+ $del = Xml::check( 'deleterevisions', false, array('disabled' => 'disabled') );
// Otherwise, show the link...
} else {
$id = $rev->getId();
- $jsCall = "updateShowHideForm($id,this.checked)";
- $del = Xml::check( 'showhiderevisions', false,
- $hidden + array(
- 'onchange' => $jsCall,
- 'id' => "mw-revdel-$id" ) );
- $query = array(
- 'type' => 'revision',
- 'target' => $this->title->getPrefixedDbkey(),
- 'ids' => $rev->getId() );
- $del .= $this->getSkin()->revDeleteLink( $query,
- $rev->isDeleted( Revision::DELETED_RESTRICTED ) );
+ $del = Xml::check( 'showhiderevisions', false, array( 'name' => "ids[$id]" ) );
}
$s .= " $del ";
}
$tools = array();
+ # Rollback and undo links
if( !is_null( $next ) && is_object( $next ) ) {
if( $latest && $this->title->userCan( 'rollback' ) && $this->title->userCan( 'edit' ) ) {
$tools[] = '<span class="mw-rollback-link">'.