Merge "jquery.ui.datepicker: Add translations in de-AT and de-CH"
[lhc/web/wiklou.git] / includes / specials / SpecialLog.php
index bec871b..7132207 100644 (file)
@@ -49,6 +49,7 @@ class SpecialLog extends SpecialPage {
                $opts->add( 'offset', '' );
                $opts->add( 'dir', '' );
                $opts->add( 'offender', '' );
+               $opts->add( 'subtype', '' );
 
                // Set values
                $opts->fetchValuesFromRequest( $this->getRequest() );
@@ -167,6 +168,26 @@ class SpecialLog extends SpecialPage {
                        null,
                        LogEventsList::USE_CHECKBOXES
                );
+
+               $action = '';
+               // Allow to filter the log by actions
+               $type = $opts->getValue( 'type' );
+               if ( $type !== '' ) {
+                       $actions = $this->getConfig()->get( 'ActionFilteredLogs' );
+                       if ( isset( $actions[$type] ) ) {
+                               // log type can be filtered by actions
+                               $loglist->setAllowedActions( array_keys( $actions[$type] ) );
+                               $action = $opts->getValue( 'subtype' );
+                               if ( $action !== '' && isset( $actions[$type][$action] ) ) {
+                                       // add condition to query
+                                       $extraConds['log_action'] = $actions[$type][$action];
+                               } else {
+                                       // no action or invalid action
+                                       $action = '';
+                               }
+                       }
+               }
+
                $pager = new LogPager(
                        $loglist,
                        $opts->getValue( 'type' ),
@@ -195,7 +216,8 @@ class SpecialLog extends SpecialPage {
                        $pager->getYear(),
                        $pager->getMonth(),
                        $pager->getFilterParams(),
-                       $opts->getValue( 'tagfilter' )
+                       $opts->getValue( 'tagfilter' ),
+                       $action
                );
 
                # Insert list
@@ -259,31 +281,7 @@ class SpecialLog extends SpecialPage {
                        ) . "\n";
                }
 
-               // Select: All, None, Invert
-               $links = [];
-               $links[] = Html::element(
-                       'a', [ 'href' => '#', 'class' => 'mw-checkbox-all' ],
-                       $this->msg( 'checkbox-all' )->text()
-               );
-               $links[] = Html::element(
-                       'a', [ 'href' => '#', 'class' => 'mw-checkbox-none' ],
-                       $this->msg( 'checkbox-none' )->text()
-               );
-               $links[] = Html::element(
-                       'a', [ 'href' => '#', 'class' => 'mw-checkbox-invert' ],
-                       $this->msg( 'checkbox-invert' )->text()
-               );
-
-               $buttons .= Html::rawElement( 'p',
-                       [
-                               'class' => "mw-checkbox-toggle-controls"
-                       ],
-                       $this->msg( 'checkbox-select' )
-                               ->rawParams( $this->getLanguage()->commaList( $links ) )->escaped()
-               );
-
-               $this->getOutput()->addModules( 'mediawiki.checkboxtoggle' );
-               $this->getOutput()->addModuleStyles( 'mediawiki.checkboxtoggle.styles' );
+               $buttons .= ( new ListToggle( $this->getOutput() ) )->getHTML();
 
                $s .= $buttons . $formcontents . $buttons;
                $s .= Html::closeElement( 'form' );