From 9e1fad1826f4e9defe6f1ecbb474a5b26afc65bd Mon Sep 17 00:00:00 2001 From: Guy Van den Broeck Date: Fri, 22 Aug 2008 16:53:56 +0000 Subject: [PATCH] History page with HTML diff enabled now also works when JavaScript is disabled. --- includes/Article.php | 2 +- includes/DefaultSettings.php | 2 +- includes/PageHistory.php | 7 ++---- skins/common/history.js | 48 ------------------------------------ 4 files changed, 4 insertions(+), 55 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 135ad8b16e..19ede2cfb1 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -731,7 +731,7 @@ class Article { $wgOut->setPageTitle( $this->mTitle->getPrefixedText() ); $diff = $wgRequest->getVal( 'diff' ); - $htmldiff = $wgRequest->getVal( 'htmldiff' ); + $htmldiff = $wgRequest->getVal( 'htmldiff' , false); $de = new DifferenceEngine( $this->mTitle, $oldid, $diff, $rcid, $purge, $htmldiff); // DifferenceEngine directly fetched the revision: $this->mRevIdFetched = $de->mNewid; diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 944f7355e2..9fc302dbde 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1382,7 +1382,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '168'; +$wgStyleVersion = '169'; # Server-side caching: diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 5ea8461d9f..35f08f38f7 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -201,10 +201,9 @@ class PageHistory { $s .= Xml::openElement( 'form', array( 'action' => $wgScript ) ); $s .= Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ); if($wgEnableHtmlDiff){ - $s .= Xml::hidden( 'htmldiff', 0 , array('id' => 'htmldiff')); $s .= $this->submitButton( wfMsg( 'visualcomparison'), array( - 'id' => 'submithtmldiff1', + 'name' => 'htmldiff', 'class' => 'historysubmit', 'accesskey' => wfMsg( 'accesskey-visualcomparison' ), 'title' => wfMsg( 'tooltip-compareselectedversions' ), @@ -212,7 +211,6 @@ class PageHistory { ); $s .= $this->submitButton( wfMsg( 'wikicodecomparison'), array( - 'id' => 'submitsourcediff1', 'class' => 'historysubmit', 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), 'title' => wfMsg( 'tooltip-compareselectedversions' ), @@ -242,7 +240,7 @@ class PageHistory { if($wgEnableHtmlDiff){ $s .= $this->submitButton( wfMsg( 'visualcomparison'), array( - 'id' => 'submithtmldiff2', + 'name' => 'htmldiff', 'class' => 'historysubmit', 'accesskey' => wfMsg( 'accesskey-visualcomparison' ), 'title' => wfMsg( 'tooltip-compareselectedversions' ), @@ -250,7 +248,6 @@ class PageHistory { ); $s .= $this->submitButton( wfMsg( 'wikicodecomparison'), array( - 'id' => 'submitsourcediff2', 'class' => 'historysubmit', 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), 'title' => wfMsg( 'tooltip-compareselectedversions' ), diff --git a/skins/common/history.js b/skins/common/history.js index 0611a0a4da..57e6184918 100644 --- a/skins/common/history.js +++ b/skins/common/history.js @@ -80,52 +80,4 @@ function histrowinit() { diffcheck(); } -// attach htmldiff event handler -function htmldiffsubmit() { - var hf = document.getElementById('submithtmldiff1'); - if (!hf) { - return; - } - hf.onclick = enablehtmldiff; - hf = document.getElementById('submithtmldiff2'); - if (!hf) { - return; - } - hf.onclick = enablehtmldiff; -} - -// change hidden field when choosing html compare -function enablehtmldiff() { - var hf = document.getElementById('htmldiff'); - if (!hf) { - return; - } - hf.value = 1; -} - -// attach source diff event handler -function sourcediffsubmit() { - var hf = document.getElementById('submitsourcediff1'); - if (!hf) { - return; - } - hf.onclick = disablehtmldiff; - hf = document.getElementById('submitsourcediff2'); - if (!hf) { - return; - } - hf.onclick = disablehtmldiff; -} - -// change hidden field when choosing source diff -function disablehtmldiff() { - var hf = document.getElementById('htmldiff'); - if (!hf) { - return; - } - hf.value = 0; -} - hookEvent("load", histrowinit); -hookEvent("load", htmldiffsubmit); -hookEvent("load", sourcediffsubmit); -- 2.20.1