Fix #1122: "older revision" link displayed when viewing first revision of an article
authorAntoine Musso <hashar@users.mediawiki.org>
Mon, 16 Jan 2006 18:34:11 +0000 (18:34 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Mon, 16 Jan 2006 18:34:11 +0000 (18:34 +0000)
RELEASE-NOTES
includes/Article.php

index 6908afc..7e0a465 100644 (file)
@@ -518,6 +518,7 @@ fully support the editing toolbar, but was found to be too confusing.
   For typical usage this will be a light burden and should reduce confusion
   when the configuration is edited.
 * Fix $wgCacheEpoch's effect on client-side caching.
+* (bug 1122) gray out 'older revision' when viewing first article revision.
 
 
 === Caveats ===
index 82891fc..66fbc2c 100644 (file)
@@ -2231,7 +2231,11 @@ class Article {
        }
 
        /**
-        * @todo document this function
+        * Generate the navigation links when browsing through an article revisions
+        * It shows the information as:
+        *   Revision as of <date>; view current revision
+        *   <- Previous version | Next Version ->
+        *
         * @access private
         * @param string $oldid         Revision ID of this article revision
         */
@@ -2244,7 +2248,10 @@ class Article {
                $lnk = $current
                        ? wfMsg( 'currentrevisionlink' )
                        : $lnk = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'currentrevisionlink' ) );
-               $prevlink = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'previousrevision' ), 'direction=prev&oldid='.$oldid );
+               $prev = $this->mTitle->getPreviousRevisionID( $oldid ) ;
+               $prevlink = $prev
+                       ? $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'previousrevision' ), 'direction=prev&oldid='.$oldid )
+                       : wfMsg( 'previousrevision' );
                $nextlink = $current
                        ? wfMsg( 'nextrevision' )
                        : $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'nextrevision' ), 'direction=next&oldid='.$oldid );