3 * Redirect from Special:NewSection/$1 to index.php?title=$1&action=edit§ion=new.
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
23 class SpecialNewSection
extends RedirectSpecialPage
{
24 public function __construct() {
25 parent
::__construct( 'NewSection' );
26 $this->mAllowedRedirectParams
= [ 'preloadtitle', 'nosummary', 'editintro',
27 'preload', 'preloadparams[]', 'summary' ];
33 public function getRedirect( $subpage ) {
34 if ( $subpage === null ||
$subpage === '' ) {
37 $this->mAddedRedirectParams
['title'] = $subpage;
38 $this->mAddedRedirectParams
['action'] = 'edit';
39 $this->mAddedRedirectParams
['section'] = 'new';
43 protected function showNoRedirectPage() {
45 $this->outputHeader();
49 private function showForm() {
50 $form = HTMLForm
::factory( 'ooui', [
54 'label-message' => 'newsection-page',
56 ], $this->getContext(), 'newsection' );
57 $form->setSubmitTextMsg( 'newsection-submit' );
58 $form->setSubmitCallback( [ $this, 'onFormSubmit' ] );
62 public function onFormSubmit( $formData ) {
63 $page = $formData['page'];
64 $query = [ 'action' => 'edit', 'section' => 'new' ];
65 $url = $page->getFullUrlForRedirect( $query );
66 $this->getOutput()->redirect( $url );
69 public function isListed() {
73 protected function getGroupName() {