From: Ilmari Karonen Date: Fri, 12 Jan 2007 03:36:46 +0000 (+0000) Subject: (bug 3446) Add user preference to hide page content below diffs, can be X-Git-Tag: 1.31.0-rc.0~54484 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=7338549d8d0fe2445e740e9eee46007b1a62a9c2;p=lhc%2Fweb%2Fwiklou.git (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 --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1b4335bcb8..5238041023 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/Article.php b/includes/Article.php index cda171ceb4..c4c6b1ffad 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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(); diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index a72f01535f..4563e6b9a7 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -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( "

{$this->mPagetitle}

\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( "

{$this->mPagetitle}

\n" ); - if( is_object( $this->mNewRev ) ) { - $wgOut->setRevisionId( $this->mNewRev->getId() ); - } - $wgOut->addSecondaryWikiText( $this->mNewtext ); - wfProfileOut( $fname ); } diff --git a/includes/User.php b/includes/User.php index b0fd9a2a00..e8bc7bdebf 100644 --- a/includes/User.php +++ b/includes/User.php @@ -71,6 +71,7 @@ class User { 'watchlisthidebots', 'watchlisthideminor', 'ccmeonemails', + 'diffonly', ); /** diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 71c15ccfb7..e8cb399efc 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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', diff --git a/languages/messages/MessagesFi.php b/languages/messages/MessagesFi.php index fe003ee0c4..e6fcb47d1b 100644 --- a/languages/messages/MessagesFi.php +++ b/languages/messages/MessagesFi.php @@ -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',