Merge "RCFilters: Add 'advanced filters' label to the view selection"
[lhc/web/wiklou.git] / includes / specials / SpecialRecentchanges.php
index 1248007..157c3ed 100644 (file)
@@ -181,10 +181,6 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                                $this->getConfig()->get( 'StructuredChangeFiltersEnableExperimentalViews' );
 
                        $out->addJsConfigVars( 'wgStructuredChangeFilters', $jsData['groups'] );
-                       $out->addJsConfigVars(
-                               'wgStructuredChangeFiltersEnableSaving',
-                               $this->getConfig()->get( 'StructuredChangeFiltersEnableSaving' )
-                       );
                        $out->addJsConfigVars(
                                'wgStructuredChangeFiltersEnableExperimentalViews',
                                $experimentalStructuredChangeFilters
@@ -193,12 +189,10 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                                'wgStructuredChangeFiltersEnableLiveUpdate',
                                $this->getConfig()->get( 'StructuredChangeFiltersEnableLiveUpdate' )
                        );
-                       if ( $experimentalStructuredChangeFilters ) {
-                               $out->addJsConfigVars(
-                                       'wgRCFiltersChangeTags',
-                                       $this->buildChangeTagList()
-                               );
-                       }
+                       $out->addJsConfigVars(
+                               'wgRCFiltersChangeTags',
+                               $this->buildChangeTagList()
+                       );
                }
        }
 
@@ -373,6 +367,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
 
        public function validateOptions( FormOptions $opts ) {
                $opts->validateIntBounds( 'limit', 0, 5000 );
+               $opts->validateBounds( 'days', 0, $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
                parent::validateOptions( $opts );
        }
 
@@ -387,7 +382,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                        $query_options, $join_conds, $opts );
 
                // Calculate cutoff
-               $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
+               $cutoff_unixtime = time() - $opts['days'] * 3600 * 24;
                $cutoff = $dbr->timestamp( $cutoff_unixtime );
 
                $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
@@ -717,17 +712,35 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
 
                $message = $this->msg( 'recentchangestext' )->inContentLanguage();
                if ( !$message->isDisabled() ) {
-                       $this->getOutput()->addWikiText(
-                               Html::rawElement( 'div',
-                                       [
-                                               'class' => 'mw-recentchanges-toplinks',
-                                               'lang' => $wgContLang->getHtmlCode(),
-                                               'dir' => $wgContLang->getDir()
-                                       ],
-                                       "\n" . $message->plain() . "\n"
-                               ),
-                               /* $lineStart */ true,
-                               /* $interface */ false
+                       $content = $message->parse();
+
+                       $langAttributes = [
+                               'lang' => $wgContLang->getHtmlCode(),
+                               'dir' => $wgContLang->getDir(),
+                       ];
+
+                       $topLinksAttributes = [ 'class' => 'mw-recentchanges-toplinks' ];
+
+                       if ( $this->getUser()->getOption( 'rcenhancedfilters' ) ) {
+                               $contentTitle = Html::rawElement( 'div',
+                                       [ 'class' => 'mw-recentchanges-toplinks-title' ],
+                                       $this->msg( 'rcfilters-other-review-tools' )->parse()
+                               );
+                               $contentWrapper = Html::rawElement( 'div',
+                                       array_merge( [ 'class' => 'mw-collapsible-content' ], $langAttributes ),
+                                       $content
+                               );
+                               $content = $contentTitle . $contentWrapper;
+                       } else {
+                               // Language direction should be on the top div only
+                               // if the title is not there. If it is there, it's
+                               // interface direction, and the language/dir attributes
+                               // should be on the content itself
+                               $topLinksAttributes = array_merge( $topLinksAttributes, $langAttributes );
+                       }
+
+                       $this->getOutput()->addHTML(
+                               Html::rawElement( 'div', $topLinksAttributes, $content )
                        );
                }
        }
@@ -954,15 +967,20 @@ class SpecialRecentChanges extends ChangesListSpecialPage {
                        $resetLink = $this->makeOptionsLink( $this->msg( 'rclistfromreset' ),
                                [ 'from' => '' ], $nondefaults );
 
-                       $note .= $this->msg( 'rcnotefrom' )
+                       $noteFromMsg = $this->msg( 'rcnotefrom' )
                                ->numParams( $options['limit'] )
                                ->params(
                                        $lang->userTimeAndDate( $options['from'], $user ),
                                        $lang->userDate( $options['from'], $user ),
                                        $lang->userTime( $options['from'], $user )
                                )
-                               ->numParams( $numRows )
-                               ->parse() . ' ' .
+                               ->numParams( $numRows );
+                       $note .= Html::rawElement(
+                                       'span',
+                                       [ 'class' => 'rcnotefrom' ],
+                                       $noteFromMsg->parse()
+                               ) .
+                               ' ' .
                                Html::rawElement(
                                        'span',
                                        [ 'class' => 'rcoptions-listfromreset' ],