* (bug 11221) Do not show 'Compare selected versions' button for a history page with...
authorRaimond Spekking <raymond@users.mediawiki.org>
Tue, 11 Dec 2007 17:00:12 +0000 (17:00 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Tue, 11 Dec 2007 17:00:12 +0000 (17:00 +0000)
* Use proper XML function
* Document a bit

RELEASE-NOTES
includes/PageHistory.php

index c585c92..69e123d 100644 (file)
@@ -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 ==
 
index 5f1388a..d81e7ff 100644 (file)
@@ -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 = '</ul>';
                $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' ),
+                                       )
+                               );
        }
 
        /**