(bug 20189) Added 'Show/hide selected revisions' button and checkboxes to Special...
[lhc/web/wiklou.git] / includes / specials / SpecialLog.php
index 0c670f5..177b34d 100644 (file)
@@ -38,7 +38,7 @@ class SpecialLog extends SpecialPage {
        private $typeOnUser = array(
                'block',
                'newusers',
-               'right',
+               'rights',
        );
 
        public function __construct() {
@@ -152,9 +152,7 @@ class SpecialLog extends SpecialPage {
                if ( $logBody ) {
                        $this->getOutput()->addHTML(
                                $pager->getNavigationBar() .
-                               $loglist->beginLogEventsList() .
-                               $logBody .
-                               $loglist->endLogEventsList() .
+                               $this->getRevisionButton( $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList() ) .
                                $pager->getNavigationBar()
                        );
                } else {
@@ -162,6 +160,29 @@ class SpecialLog extends SpecialPage {
                }
        }
 
+       private function getRevisionButton( $formcontents ) {
+               # If the user doesn't have the ability to delete revisions, don't bother showing him/her the button.
+               if ( !$this->getUser()->isAllowed( 'deleterevision' ) ) {
+                       return $formcontents;
+               }
+
+               # Show button to hide log entries
+               global $wgScript;
+               $s = Html::openElement( 'form', array( 'action' => $wgScript, 'id' => 'mw-log-deleterevision-submit' ) ) . "\n";
+               $s .= Html::hidden( 'title', SpecialPage::getTitleFor( 'Revisiondelete' ) ) . "\n";
+               $s .= Html::hidden( 'target', SpecialPage::getTitleFor( 'Log' ) ) . "\n";
+               $s .= Html::hidden( 'type', 'logging' ) . "\n";
+               $button = Html::element( 'button',
+                       array( 'type' => 'submit', 'class' => "deleterevision-log-submit mw-log-deleterevision-button" ),
+                       $this->msg( 'showhideselectedversions' )->text()
+               ) . "\n";
+               $s .= $button . $formcontents . $button;
+               $s .= Html::closeElement( 'form' );
+
+               return $s;
+       }
+
+
        /**
         * Set page title and show header for this log type
         * @param $type string