From: Alex Monk Date: Tue, 8 May 2012 01:32:15 +0000 (+0100) Subject: (bug 20189) Added 'Show/hide selected revisions' button and checkboxes to Special... X-Git-Tag: 1.31.0-rc.0~23689^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=961a8d1e7f766fadcfbdad1a7c549141e7281da3 (bug 20189) Added 'Show/hide selected revisions' button and checkboxes to Special:Log. Change-Id: I2c4d4e1234d5ab9f7d514831351ea3b298811165 --- diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index eccbcdbed9..ef633358dd 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -515,16 +515,9 @@ class LogEventsList { $canHide = $wgUser->isAllowed( 'deleterevision' ); // If event was hidden from sysops if( !self::userCan( $row, LogPage::DELETED_RESTRICTED ) ) { - $del = Linker::revDeleteLinkDisabled( $canHide ); + $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) ); } else { - $target = SpecialPage::getTitleFor( 'Log', $row->log_type ); - $query = array( - 'target' => $target->getPrefixedDBkey(), - 'type' => 'logging', - 'ids' => $row->log_id, - ); - $del = Linker::revDeleteLink( $query, - self::isDeleted( $row, LogPage::DELETED_RESTRICTED ), $canHide ); + $del = Xml::check( 'showhiderevisions', false, array( 'name' => 'ids[' . $row->log_id . ']' ) ); } } } diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php index 64190df187..177b34de4e 100644 --- a/includes/specials/SpecialLog.php +++ b/includes/specials/SpecialLog.php @@ -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