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 public function __construct() {
26 parent
::__construct( 'Newimages' );
29 public function execute( $par ) {
31 $this->outputHeader();
33 $out = $this->getOutput();
34 $this->addHelpLink( 'Help:New images' );
36 $opts = new FormOptions();
38 $opts->add( 'like', '' );
39 $opts->add( 'showbots', false );
40 $opts->add( 'hidepatrolled', false );
41 $opts->add( 'limit', 50 );
42 $opts->add( 'offset', 0 );
44 $opts->fetchValuesFromRequest( $this->getRequest() );
46 if ( $par !== null ) {
47 $opts->setValue( is_numeric( $par ) ?
'limit' : 'like', $par );
50 $opts->validateIntBounds( 'limit', 0, 500 );
54 if ( !$this->including() ) {
58 $pager = new NewFilesPager( $this->getContext(), $opts );
60 $out->addHTML( $pager->getBody() );
61 if ( !$this->including() ) {
62 $out->addHTML( $pager->getNavigationBar() );
66 protected function buildForm() {
70 'label-message' => 'newimages-label',
76 'label-message' => 'newimages-showbots',
82 'label-message' => 'newimages-hidepatrolled',
83 'name' => 'hidepatrolled',
87 if ( $this->getConfig()->get( 'MiserMode' ) ) {
88 unset( $formDescriptor['like'] );
91 if ( !$this->getUser()->useFilePatrol() ) {
92 unset( $formDescriptor['hidepatrolled'] );
95 $form = HTMLForm
::factory( 'ooui', $formDescriptor, $this->getContext() )
96 ->setWrapperLegendMsg( 'newimages-legend' )
97 ->setSubmitTextMsg( 'ilsubmit' )
100 ->displayForm( false );
103 protected function getGroupName() {
108 * Send the text to be displayed above the options
110 function setTopText() {
113 $message = $this->msg( 'newimagestext' )->inContentLanguage();
114 if ( !$message->isDisabled() ) {
115 $this->getOutput()->addWikiText(
116 Html
::rawElement( 'p',
117 [ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ],
118 "\n" . $message->plain() . "\n"
120 /* $lineStart */ false,
121 /* $interface */ false