From: Bartosz DziewoƄski Date: Mon, 30 Nov 2015 14:59:02 +0000 (+0100) Subject: SpecialMovepage: Use hidden form fields to set hidden data, not the submit button X-Git-Tag: 1.31.0-rc.0~8131^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=e5617c00179c32b1a19cfbcfa50818e1e2d74a1f;p=lhc%2Fweb%2Fwiklou.git SpecialMovepage: Use hidden form fields to set hidden data, not the submit button This lets us send more than one thing. Change-Id: I0ef71d576b817cdb04ac1025e05afc5ee4c61a8c --- diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 27d2304ba1..a7e5e02037 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -117,9 +117,9 @@ class MovePageForm extends UnlistedSpecialPage { $this->moveTalk = $request->getBool( 'wpMovetalk', $def ); $this->fixRedirects = $request->getBool( 'wpFixRedirects', $def ); $this->leaveRedirect = $request->getBool( 'wpLeaveRedirect', $def ); - $this->moveSubpages = $request->getBool( 'wpMovesubpages', false ); - $this->deleteAndMove = $request->getBool( 'wpDeleteAndMove' ) && $request->getBool( 'wpConfirm' ); - $this->moveOverShared = $request->getBool( 'wpMoveOverSharedFile', false ); + $this->moveSubpages = $request->getBool( 'wpMovesubpages' ); + $this->deleteAndMove = $request->getBool( 'wpDeleteAndMove' ); + $this->moveOverShared = $request->getBool( 'wpMoveOverSharedFile' ); $this->watch = $request->getCheck( 'wpWatch' ) && $user->isLoggedIn(); if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted() @@ -166,8 +166,8 @@ class MovePageForm extends UnlistedSpecialPage { ); } - $submitVar = 'wpMove'; - $confirm = false; + $deleteAndMove = false; + $moveOverShared = false; $newTitle = $this->newTitle; @@ -194,8 +194,7 @@ class MovePageForm extends UnlistedSpecialPage { "
\n$1\n
\n", array( 'delete_and_move_text', $newTitle->getPrefixedText() ) ); - $submitVar = 'wpDeleteAndMove'; - $confirm = true; + $deleteAndMove = true; $err = array(); } @@ -209,7 +208,7 @@ class MovePageForm extends UnlistedSpecialPage { $newTitle->getPrefixedText() ) ); - $submitVar = 'wpMoveOverSharedFile'; + $moveOverShared = true; $err = array(); } @@ -440,11 +439,16 @@ class MovePageForm extends UnlistedSpecialPage { ); } - if ( $confirm ) { + $hiddenFields = ''; + if ( $moveOverShared ) { + $hiddenFields .= Html::hidden( 'wpMoveOverSharedFile', '1' ); + } + + if ( $deleteAndMove ) { $fields[] = new OOUI\FieldLayout( new OOUI\CheckboxInputWidget( array( - 'name' => 'wpConfirm', - 'id' => 'wpConfirm', + 'name' => 'wpDeleteAndMove', + 'id' => 'wpDeleteAndMove', 'value' => '1', ) ), array( @@ -456,7 +460,7 @@ class MovePageForm extends UnlistedSpecialPage { $fields[] = new OOUI\FieldLayout( new OOUI\ButtonInputWidget( array( - 'name' => $submitVar, + 'name' => 'wpMove', 'value' => $this->msg( 'movepagebtn' )->text(), 'label' => $this->msg( 'movepagebtn' )->text(), 'flags' => array( 'constructive', 'primary' ), @@ -481,6 +485,7 @@ class MovePageForm extends UnlistedSpecialPage { $form->appendContent( $fieldset, new OOUI\HtmlSnippet( + $hiddenFields . Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) . Html::hidden( 'wpEditToken', $user->getEditToken() ) )