(bug 3446) Add user preference to hide page content below diffs, can be
authorIlmari Karonen <vyznev@users.mediawiki.org>
Fri, 12 Jan 2007 03:36:46 +0000 (03:36 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Fri, 12 Jan 2007 03:36:46 +0000 (03:36 +0000)
overridden by adding diffonly=1 or diffonly=0 to the URL of the diff page

RELEASE-NOTES
includes/Article.php
includes/DifferenceEngine.php
includes/User.php
languages/messages/MessagesEn.php
languages/messages/MessagesFi.php

index 1b4335b..5238041 100644 (file)
@@ -50,6 +50,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 8567) Added hook RawPageViewBeforeOutput just before the text is blown out in action=raw,
              so extensions might influence the output.
 * Correct tooltip accesskey hint for Opera on the Macintosh (it uses Shift-Esc-, not Ctrl-).
+* (bug 3446) Add user preference to hide page content below diffs, can be overridden by adding
+             diffonly=1 or diffonly=0 to the URL of the diff page
 
 == Languages updated ==
 
index cda171c..c4c6b1f 100644 (file)
@@ -628,6 +628,7 @@ class Article {
                $diff = $wgRequest->getVal( 'diff' );
                $rcid = $wgRequest->getVal( 'rcid' );
                $rdfrom = $wgRequest->getVal( 'rdfrom' );
+               $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
 
                $wgOut->setArticleFlag( true );
                if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
@@ -648,7 +649,7 @@ class Article {
                        $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid );
                        // DifferenceEngine directly fetched the revision:
                        $this->mRevIdFetched = $de->mNewid;
-                       $de->showDiffPage();
+                       $de->showDiffPage( $diffOnly );
                        
                        // Needed to get the page's current revision
                        $this->loadPageData();
index a72f015..4563e6b 100644 (file)
@@ -63,7 +63,7 @@ class DifferenceEngine {
                $this->mRcidMarkPatrolled = intval($rcid);  # force it to be an integer
        }
 
-       function showDiffPage() {
+       function showDiffPage( $diffOnly = false ) {
                global $wgUser, $wgOut, $wgContLang, $wgUseExternalEditor, $wgUseRCPatrol;
                $fname = 'DifferenceEngine::showDiffPage';
                wfProfileIn( $fname );
@@ -118,6 +118,7 @@ CONTROL;
                # is the first version of that article. In that case, V' does not exist.
                if ( $this->mOldid === false ) {
                        $this->showFirstRevision();
+                       $this->renderNewRevision();  // should we respect $diffOnly here or not?
                        wfProfileOut( $fname );
                        return;
                }
@@ -186,6 +187,21 @@ CONTROL;
                        $nextlink . $patrol;
 
                $this->showDiff( $oldHeader, $newHeader );
+
+               if ( !$diffOnly )
+                       $this->renderNewRevision();
+
+               wfProfileOut( $fname );
+       }
+
+       /**
+        * Show the new revision of the page.
+        */
+       function renderNewRevision() {
+               global $wgOut;
+               $fname = 'DifferenceEngine::renderNewRevision';
+               wfProfileIn( $fname );
+
                $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
 
                if( !$this->mNewRev->isCurrent() ) {
@@ -196,6 +212,7 @@ CONTROL;
                if( is_object( $this->mNewRev ) ) {
                        $wgOut->setRevisionId( $this->mNewRev->getId() );
                }
+
                $wgOut->addSecondaryWikiText( $this->mNewtext );
 
                if( !$this->mNewRev->isCurrent() ) {
@@ -254,15 +271,6 @@ CONTROL;
                $wgOut->setSubtitle( wfMsg( 'difference' ) );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
 
-
-               # Show current revision
-               #
-               $wgOut->addHTML( "<hr /><h2>{$this->mPagetitle}</h2>\n" );
-               if( is_object( $this->mNewRev ) ) {
-                       $wgOut->setRevisionId( $this->mNewRev->getId() );
-               }
-               $wgOut->addSecondaryWikiText( $this->mNewtext );
-
                wfProfileOut( $fname );
        }
 
index b0fd9a2..e8bc7bd 100644 (file)
@@ -71,6 +71,7 @@ class User {
                'watchlisthidebots',
                'watchlisthideminor',
                'ccmeonemails',
+               'diffonly',
        );
 
        /**
index 71c15cc..e8cb399 100644 (file)
@@ -492,6 +492,7 @@ parent class in order maintain consistency across languages.
 'tog-watchlisthideminor' => 'Hide minor edits from the watchlist',
 'tog-nolangconversion'         => 'Disable variants conversion',
 'tog-ccmeonemails' => 'Send me copies of emails I send to other users',
+'tog-diffonly' => "Don't show page content below diffs",
 
 'underline-always' => 'Always',
 'underline-never' => 'Never',
index fe003ee..e6fcb47 100644 (file)
@@ -189,6 +189,7 @@ $messages = array(
 'tog-watchlisthideminor'=> 'Piilota pienet muokkaukset',
 'tog-nolangconversion'  => 'Älä tee muunnoksia kielivarianttien välillä',
 'tog-ccmeonemails'      => 'Lähetä minulle kopio MediaWikin kautta lähetetyistä sähköposteista',
+'tog-diffonly'        => 'Älä näytä sivun sisältöä versioita vertailtaessa',
 
 'underline-always'    => 'Aina',
 'underline-never'     => 'Ei koskaan',