Merge "Don't check namespace in SpecialWantedtemplates"
[lhc/web/wiklou.git] / includes / logging / LogEventsList.php
index 8b28821..1b56584 100644 (file)
@@ -26,7 +26,7 @@
 class LogEventsList extends ContextSource {
        const NO_ACTION_LINK = 1;
        const NO_EXTRA_USER_LINKS = 2;
-       const USE_REVDEL_CHECKBOXES = 4;
+       const USE_CHECKBOXES = 4;
 
        public $flags;
 
@@ -35,6 +35,11 @@ class LogEventsList extends ContextSource {
         */
        protected $mDefaultQuery;
 
+       /**
+        * @var bool
+        */
+       protected $showTagEditUI;
+
        /**
         * Constructor.
         * The first two parameters used to be $skin and $out, but now only a context
@@ -44,7 +49,7 @@ class LogEventsList extends ContextSource {
         *   a Skin object. Use of Skin is deprecated.
         * @param null $unused Unused; used to be an OutputPage object.
         * @param int $flags Can be a combination of self::NO_ACTION_LINK,
-        *   self::NO_EXTRA_USER_LINKS or self::USE_REVDEL_CHECKBOXES.
+        *   self::NO_EXTRA_USER_LINKS or self::USE_CHECKBOXES.
         */
        public function __construct( $context, $unused = null, $flags = 0 ) {
                if ( $context instanceof IContextSource ) {
@@ -55,6 +60,7 @@ class LogEventsList extends ContextSource {
                }
 
                $this->flags = $flags;
+               $this->showTagEditUI = ChangeTags::showTagEditingUI( $this->getUser() );
        }
 
        /**
@@ -341,14 +347,27 @@ class LogEventsList extends ContextSource {
         */
        private function getShowHideLinks( $row ) {
                // We don't want to see the links and
+               if ( $this->flags == self::NO_ACTION_LINK ) {
+                       return '';
+               }
+
+               $user = $this->getUser();
+
+               // If change tag editing is available to this user, return the checkbox
+               if ( $this->flags & self::USE_CHECKBOXES && $this->showTagEditUI ) {
+                       return Xml::check(
+                               'showhiderevisions',
+                               false,
+                               array( 'name' => 'ids[' . $row->log_id . ']' )
+                       );
+               }
+
                // no one can hide items from the suppress log.
-               if ( ( $this->flags == self::NO_ACTION_LINK )
-                       || $row->log_type == 'suppress'
-               ) {
+               if ( $row->log_type == 'suppress' ) {
                        return '';
                }
+
                $del = '';
-               $user = $this->getUser();
                // Don't show useless checkbox to people who cannot hide log entries
                if ( $user->isAllowed( 'deletedhistory' ) ) {
                        $canHide = $user->isAllowed( 'deletelogentry' );
@@ -358,7 +377,7 @@ class LogEventsList extends ContextSource {
                        $canViewThisSuppressedEntry = $canViewSuppressedOnly && $entryIsSuppressed;
                        if ( $row->log_deleted || $canHide ) {
                                // Show checkboxes instead of links.
-                               if ( $canHide && $this->flags & self::USE_REVDEL_CHECKBOXES && !$canViewThisSuppressedEntry ) {
+                               if ( $canHide && $this->flags & self::USE_CHECKBOXES && !$canViewThisSuppressedEntry ) {
                                        // If event was hidden from sysops
                                        if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) {
                                                $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );