From f30ff156a4932277824ddf940c996b0adb7f1474 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Tue, 11 Dec 2007 17:00:12 +0000 Subject: [PATCH] * (bug 11221) Do not show 'Compare selected versions' button for a history page with one revision only * Use proper XML function * Document a bit --- RELEASE-NOTES | 2 ++ includes/PageHistory.php | 36 +++++++++++++++++++++++++----------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c585c9257d..69e123dc00 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -235,6 +235,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 12145) Add localized names of kk-variants * (bug 12259) Localize the numbers in deleted pages on the sysop view * Set proper page title for successful file deletion +* (bug 11221) Do not show 'Compare selected versions' button for a history page + with one revision only == Parser changes in 1.12 == diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 5f1388ae8b..d81e7ff732 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -114,7 +114,11 @@ class PageHistory { wfProfileOut( $fname ); } - /** @todo document */ + /** + * Creates begin of history list with a submit button + * + * @return string HTML output + */ function beginHistoryList() { global $wgTitle; $this->lastdate = ''; @@ -140,7 +144,11 @@ class PageHistory { return $s; } - /** @todo document */ + /** + * Creates end of history list with a submit button + * + * @return string HTML output + */ function endHistoryList() { $s = ''; $s .= $this->submitButton( array( 'id' => 'historysubmit' ) ); @@ -148,18 +156,24 @@ class PageHistory { return $s; } - /** @todo document */ + /** + * Creates a submit button + * + * @param array $bits optional CSS ID + * @return string HTML output for the submit button + */ function submitButton( $bits = array() ) { - return ( $this->linesonpage > 0 ) - ? wfElement( 'input', array_merge( $bits, - array( + # Disable submit button if history has 1 revision only + if ( $this->linesonpage == 1 ) { + $bits = $bits + array( 'disabled' => 'disabled' ); + } + return Xml::submitButton( wfMsg( 'compareselectedversions' ), + $bits + array( 'class' => 'historysubmit', - 'type' => 'submit', 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), - 'title' => wfMsg( 'tooltip-compareselectedversions' ).' ['.wfMsg( 'accesskey-compareselectedversions' ).']', - 'value' => wfMsg( 'compareselectedversions' ), - ) ) ) - : ''; + 'title' => wfMsg( 'tooltip-compareselectedversions' ), + ) + ); } /** -- 2.20.1