3 * Implements Special:Newimages
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup SpecialPage
24 class SpecialNewFiles
extends IncludableSpecialPage
{
25 /** @var FormOptions */
28 public function __construct() {
29 parent
::__construct( 'Newimages' );
32 public function execute( $par ) {
34 $this->outputHeader();
36 $out = $this->getOutput();
37 $this->addHelpLink( 'Help:New images' );
39 $opts = new FormOptions();
41 $opts->add( 'like', '' );
42 $opts->add( 'user', '' );
43 $opts->add( 'showbots', false );
44 $opts->add( 'hidepatrolled', false );
45 $opts->add( 'limit', 50 );
46 $opts->add( 'offset', '' );
48 $opts->fetchValuesFromRequest( $this->getRequest() );
50 if ( $par !== null ) {
51 $opts->setValue( is_numeric( $par ) ?
'limit' : 'like', $par );
54 $opts->validateIntBounds( 'limit', 0, 500 );
58 if ( !$this->including() ) {
63 $pager = new NewFilesPager( $this->getContext(), $opts );
65 $out->addHTML( $pager->getBody() );
66 if ( !$this->including() ) {
67 $out->addHTML( $pager->getNavigationBar() );
71 protected function buildForm() {
75 'label-message' => 'newimages-label',
81 'label-message' => 'newimages-user',
87 'label-message' => 'newimages-showbots',
93 'label-message' => 'newimages-hidepatrolled',
94 'name' => 'hidepatrolled',
99 'default' => $this->opts
->getValue( 'limit' ),
105 'default' => $this->opts
->getValue( 'offset' ),
110 if ( $this->getConfig()->get( 'MiserMode' ) ) {
111 unset( $formDescriptor['like'] );
114 if ( !$this->getUser()->useFilePatrol() ) {
115 unset( $formDescriptor['hidepatrolled'] );
118 HTMLForm
::factory( 'ooui', $formDescriptor, $this->getContext() )
119 ->setWrapperLegendMsg( 'newimages-legend' )
120 ->setSubmitTextMsg( 'ilsubmit' )
123 ->displayForm( false );
126 protected function getGroupName() {
131 * Send the text to be displayed above the options
133 function setTopText() {
136 $message = $this->msg( 'newimagestext' )->inContentLanguage();
137 if ( !$message->isDisabled() ) {
138 $this->getOutput()->addWikiText(
139 Html
::rawElement( 'p',
140 [ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ],
141 "\n" . $message->plain() . "\n"
143 /* $lineStart */ false,
144 /* $interface */ false