setHeaders(); $this->outputHeader(); $out = $this->getOutput(); $out->addModules( 'mediawiki.special.newFiles' ); $this->addHelpLink( 'Help:New images' ); $opts = new FormOptions(); $opts->add( 'like', '' ); $opts->add( 'user', '' ); $opts->add( 'showbots', false ); $opts->add( 'hidepatrolled', false ); $opts->add( 'limit', 50 ); $opts->add( 'offset', '' ); $opts->add( 'start', '' ); $opts->add( 'end', '' ); $opts->fetchValuesFromRequest( $this->getRequest() ); if ( $par !== null ) { $opts->setValue( is_numeric( $par ) ? 'limit' : 'like', $par ); } // If start date comes after end date chronologically, swap them. // They are swapped in the interface by JS. $start = $opts->getValue( 'start' ); $end = $opts->getValue( 'end' ); if ( $start !== '' && $end !== '' && $start > $end ) { $temp = $end; $end = $start; $start = $temp; $opts->setValue( 'start', $start, true ); $opts->setValue( 'end', $end, true ); } $opts->validateIntBounds( 'limit', 0, 500 ); $this->opts = $opts; if ( !$this->including() ) { $this->setTopText(); $this->buildForm(); } $pager = new NewFilesPager( $this->getContext(), $opts ); $out->addHTML( $pager->getBody() ); if ( !$this->including() ) { $out->addHTML( $pager->getNavigationBar() ); } } protected function buildForm() { $formDescriptor = [ 'like' => [ 'type' => 'text', 'label-message' => 'newimages-label', 'name' => 'like', ], 'user' => [ 'type' => 'text', 'label-message' => 'newimages-user', 'name' => 'user', ], 'showbots' => [ 'type' => 'check', 'label-message' => 'newimages-showbots', 'name' => 'showbots', ], 'hidepatrolled' => [ 'type' => 'check', 'label-message' => 'newimages-hidepatrolled', 'name' => 'hidepatrolled', ], 'limit' => [ 'type' => 'hidden', 'default' => $this->opts->getValue( 'limit' ), 'name' => 'limit', ], 'offset' => [ 'type' => 'hidden', 'default' => $this->opts->getValue( 'offset' ), 'name' => 'offset', ], 'start' => [ 'type' => 'date', 'label-message' => 'date-range-from', 'name' => 'start', ], 'end' => [ 'type' => 'date', 'label-message' => 'date-range-to', 'name' => 'end', ], ]; if ( $this->getConfig()->get( 'MiserMode' ) ) { unset( $formDescriptor['like'] ); } if ( !$this->getUser()->useFilePatrol() ) { unset( $formDescriptor['hidepatrolled'] ); } HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() ) ->setWrapperLegendMsg( 'newimages-legend' ) ->setSubmitTextMsg( 'ilsubmit' ) ->setMethod( 'get' ) ->prepareForm() ->displayForm( false ); } protected function getGroupName() { return 'changes'; } /** * Send the text to be displayed above the options */ function setTopText() { global $wgContLang; $message = $this->msg( 'newimagestext' )->inContentLanguage(); if ( !$message->isDisabled() ) { $this->getOutput()->addWikiText( Html::rawElement( 'p', [ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ], "\n" . $message->plain() . "\n" ), /* $lineStart */ false, /* $interface */ false ); } } }