$t = $this->mTitle->getPrefixedText();
if ( isset( $oldid ) ) {
$oldid = IntVal( $oldid );
+ if ( $wgRequest->getVal( 'direction' ) == 'next' ) {
+ $nextid = $this->mTitle->getNextRevisionID( $oldid );
+ if ( $nextid ) {
+ $oldid = $nextid;
+ } else {
+ $wgOut->redirect( $this->mTitle->getFullURL( 'redirect=no' ) );
+ }
+ } elseif ( $wgRequest->getVal( 'direction' ) == 'prev' ) {
+ $previd = $this->mTitle->getPreviousRevisionID( $oldid );
+ if ( $previd ) {
+ $oldid = $previd;
+ } else {
+ # TODO
+ }
+ }
+ }
+ if ( isset( $oldid ) ) {
$t .= ',oldid='.$oldid;
}
if ( isset( $redirect ) ) {
# We're looking at an old revision
if ( !empty( $oldid ) ) {
- $this->setOldSubtitle();
+ $this->setOldSubtitle( $oldid );
$wgOut->setRobotpolicy( 'noindex,follow' );
}
if ( '' != $this->mRedirectedFrom ) {
/**
* @todo document this function
* @private
+ * @param string $oldid Revision ID of this article revision
*/
- function setOldSubtitle() {
+ function setOldSubtitle( $oldid=0 ) {
global $wgLang, $wgOut, $wgUser;
$td = $wgLang->timeanddate( $this->mTimestamp, true );
$sk = $wgUser->getSkin();
$lnk = $sk->makeKnownLinkObj ( $this->mTitle, wfMsg( 'currentrevisionlink' ) );
- $r = wfMsg( 'revisionasofwithlink', $td, $lnk );
+ $prevlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'previousrevision' ), 'direction=prev&oldid='.$oldid );
+ $nextlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'nextrevision' ), 'direction=next&oldid='.$oldid );
+ $r = wfMsg( 'revisionasofwithlink', $td, $lnk, $prevlink, $nextlink );
$wgOut->setSubtitle( $r );
}
$this->mNewid = intval($old);
$this->mOldid = $wgTitle->getPreviousRevisionID( $this->mNewid );
- #$dbr =& wfGetDB( DB_SLAVE );
- #$this->mOldid = $dbr->selectField( 'old', 'old_id',
- #"old_title='" . $wgTitle->getDBkey() . "'" .
- #' AND old_namespace=' . $wgTitle->getNamespace() .
- #" AND old_id<{$this->mNewid} ORDER BY old_id DESC" );
} elseif ( 'next' == $new ) {
#
$this->mOldid = intval($old);
$this->mNewid = $wgTitle->getNextRevisionID( $this->mOldid );
- #$dbr =& wfGetDB( DB_SLAVE );
- #$this->mNewid = $dbr->selectField( 'old', 'old_id',
- # "old_title='" . $wgTitle->getDBkey() . "'" .
- # ' AND old_namespace=' . $wgTitle->getNamespace() .
- # " AND old_id>{$this->mOldid} ORDER BY old_id " );
if ( false === $this->mNewid ) {
# if no result, NewId points to the newest old revision. The only newer
# revision is cur, which is "0".
'loadhist' => 'Loading page history',
'currentrev' => 'Current revision',
'revisionasof' => 'Revision as of $1',
-'revisionasofwithlink' => '(Revision as of $1; $2)',
+'revisionasofwithlink' => 'Revision as of $1; $2<br />$3 | $4',
+'previousrevision' => '←Older revision',
+'nextrevision' => 'Newer revision→',
'currentrevisionlink' => 'view current revision',
'cur' => 'cur',
'next' => 'next',
"loadhist" => "Lade Liste mit früheren Versionen",
"currentrev" => "Aktuelle Version",
"revisionasof" => "Version vom $1",
+'revisionasofwithlink' => 'Version vom $1; $2<br />$3 | $4',
+'nextrevision' => '←Nächstjüngere Version',
+'previousrevision' => 'Nächstältere Version→',
"cur" => "Aktuell",
"next" => "Nächste",
"last" => "Letzte",