http://www.mediawiki.org/wiki/Special:Code/MediaWiki/81427

Revision: 81427
Author:   reedy
Date:     2011-02-02 22:31:48 +0000 (Wed, 02 Feb 2011)
Log Message:
-----------
Followup r67094, factor out code duplication in HistoryPage::getStartBody()

Modified Paths:
--------------
    trunk/phase3/includes/HistoryPage.php

Modified: trunk/phase3/includes/HistoryPage.php
===================================================================
--- trunk/phase3/includes/HistoryPage.php       2011-02-02 22:30:55 UTC (rev 
81426)
+++ trunk/phase3/includes/HistoryPage.php       2011-02-02 22:31:48 UTC (rev 
81427)
@@ -401,44 +401,35 @@
                ) . "\n";
 
                if ( $wgUser->isAllowed( 'deleterevision' ) ) {
-                       $this->preventClickjacking();
-                       $float = $wgContLang->alignEnd();
-                       # Note bug #20966, <button> is non-standard in IE<8
-                       $element = Html::element( 'button',
-                               array(
-                                       'type' => 'submit',
-                                       'name' => 'revisiondelete',
-                                       'value' => '1',
-                                       'style' => "float: $float;",
-                                       'class' => 
'mw-history-revisiondelete-button',
-                               ),
-                               wfMsg( 'showhideselectedversions' )
-                       ) . "\n";
-                       $s .= $element;
-                       $this->buttons .= $element;
+                       $s .= $this->getRevisionButton( 'revisiondelete', 
'showhideselectedversions' );
                }
                if ( $wgUser->isAllowed( 'revisionmove' ) ) {
-                       $this->preventClickjacking();
-                       $float = $wgContLang->alignEnd();
-                       # Note bug #20966, <button> is non-standard in IE<8
-                       $element = Html::element( 'button',
-                               array(
-                                       'type' => 'submit',
-                                       'name' => 'revisionmove',
-                                       'value' => '1',
-                                       'style' => "float: $float;",
-                                       'class' => 
'mw-history-revisionmove-button',
-                               ),
-                               wfMsg( 'revisionmoveselectedversions' )
-                       ) . "\n";
-                       $s .= $element;
-                       $this->buttons .= $element;
+                       $s .= $this->getRevisionButton( 'revisionmove', 
'revisionmoveselectedversions' );
                }
                $this->buttons .= '</div>';
                $s .= '</div><ul id="pagehistory">' . "\n";
                return $s;
        }
 
+       private function getRevisionButton( $name, $msg ) {
+               global $wgContLang;
+               $this->preventClickjacking();
+               $float = $wgContLang->alignEnd();
+               # Note bug #20966, <button> is non-standard in IE<8
+               $element = Html::element( 'button',
+                       array(
+                               'type' => 'submit',
+                               'name' => $name,
+                               'value' => '1',
+                               'style' => "float: $float;",
+                               'class' => "mw-history-$name-button",
+                       ),
+                       wfMsg( 'revisionmoveselectedversions' )
+               ) . "\n";
+               $this->buttons .= $element;
+               return $element;
+       }
+
        function getEndBody() {
                if ( $this->lastRow ) {
                        $latest = $this->counter == 1 && $this->mIsFirst;


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to