X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMovepage.php;h=8091f1b0dceaed5c73006d6c753e511bb570e321;hb=ee734d0d3c7533bd9a690dbd71f5151da55c32ad;hp=eb8a274e8cd24d2bef0f3666ef8db2a1dcd07d81;hpb=e3a3f2293b4401772508456fc83afc94ea179b31;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index eb8a274e8c..8091f1b0dc 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -147,6 +147,7 @@ class MovePageForm extends UnlistedSpecialPage { $out = $this->getOutput(); $out->setPageTitle( $this->msg( 'move-page', $this->oldTitle->getPrefixedText() ) ); $out->addModules( 'mediawiki.special.movePage' ); + $out->addModuleStyles( 'mediawiki.special.movePage.styles' ); $this->addHelpLink( 'Help:Moving a page' ); $newTitle = $this->newTitle; @@ -290,7 +291,6 @@ class MovePageForm extends UnlistedSpecialPage { // is enforced in the mediawiki.special.movePage module $immovableNamespaces = array(); - foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) { if ( !MWNamespace::isMovable( $nsId ) ) { $immovableNamespaces[] = $nsId; @@ -299,202 +299,207 @@ class MovePageForm extends UnlistedSpecialPage { $handler = ContentHandler::getForTitle( $this->oldTitle ); - $out->addHTML( - Xml::openElement( - 'form', - array( - 'method' => 'post', - 'action' => $this->getPageTitle()->getLocalURL( 'action=submit' ), - 'id' => 'movepage' - ) - ) . - Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, $this->msg( 'move-page-legend' )->text() ) . - Xml::openElement( 'table', array( 'id' => 'mw-movepage-table' ) ) + $out->enableOOUI(); + $fields = array(); + + $fields[] = new OOUI\FieldLayout( + new OOUI\LabelWidget( array( + 'label' => new OOUI\HtmlSnippet( "$oldTitleLink" ) + ) ), + array( + 'label' => $this->msg( 'movearticle' )->text(), + 'align' => 'top', + ) ); - $out->addHTML( - " - " . - $this->msg( 'movearticle' )->escaped() . - " - - {$oldTitleLink} - - - - " . - Xml::label( $this->msg( 'newtitle' )->text(), 'wpNewTitleMain' ) . - " - " . - Html::namespaceSelector( - array( - 'selected' => $newTitle->getNamespace(), - 'exclude' => $immovableNamespaces - ), - array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' ) - ) . - Xml::input( - 'wpNewTitleMain', - 60, - $wgContLang->recodeForEdit( $newTitle->getText() ), - array( - 'type' => 'text', - 'id' => 'wpNewTitleMain', - 'maxlength' => 255 - ) - ) . - Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) . - " - - - " . - Xml::label( $this->msg( 'movereason' )->text(), 'wpReason' ) . - " - " . - Xml::input( 'wpReason', 60, $this->reason, array( - 'type' => 'text', - 'id' => 'wpReason', - 'maxlength' => 200, - ) ) . - " - " + $fields[] = new OOUI\FieldLayout( + new MediaWiki\Widget\ComplexTitleInputWidget( array( + 'id' => 'wpNewTitle', + 'namespace' => array( + 'id' => 'wpNewTitleNs', + 'name' => 'wpNewTitleNs', + 'value' => $newTitle->getNamespace(), + 'exclude' => $immovableNamespaces, + ), + 'title' => array( + 'id' => 'wpNewTitleMain', + 'name' => 'wpNewTitleMain', + 'value' => $wgContLang->recodeForEdit( $newTitle->getText() ), + // Inappropriate, since we're expecting the user to input a non-existent page's title + 'suggestions' => false, + ), + 'infusable' => true, + ) ), + array( + 'label' => $this->msg( 'newtitle' )->text(), + 'align' => 'top', + ) + ); + + $fields[] = new OOUI\FieldLayout( + new OOUI\TextInputWidget( array( + 'name' => 'wpReason', + 'id' => 'wpReason', + 'maxLength' => 200, + 'infusable' => true, + ) ), + array( + 'label' => $this->msg( 'movereason' )->text(), + 'align' => 'top', + ) ); if ( $considerTalk ) { - $out->addHTML( " - - - " . - Xml::checkLabel( - $this->msg( 'movetalk' )->text(), - 'wpMovetalk', - 'wpMovetalk', - $this->moveTalk - ) . - " - " + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( array( + 'name' => 'wpMovetalk', + 'id' => 'wpMovetalk', + 'value' => '1', + 'selected' => $this->moveTalk, + ) ), + array( + 'label' => $this->msg( 'movetalk' )->text(), + 'align' => 'inline', + ) ); } if ( $user->isAllowed( 'suppressredirect' ) ) { if ( $handler->supportsRedirects() ) { $isChecked = $this->leaveRedirect; - $options = array(); + $isDisabled = false; } else { $isChecked = false; - $options = array( - 'disabled' => 'disabled' - ); + $isDisabled = true; } - $out->addHTML( " - - - " . - Xml::checkLabel( - $this->msg( 'move-leave-redirect' )->text(), - 'wpLeaveRedirect', - 'wpLeaveRedirect', - $isChecked, - $options - ) . - " - " + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( array( + 'name' => 'wpLeaveRedirect', + 'id' => 'wpLeaveRedirect', + 'value' => '1', + 'selected' => $isChecked, + 'disabled' => $isDisabled, + ) ), + array( + 'label' => $this->msg( 'move-leave-redirect' )->text(), + 'align' => 'inline', + ) ); } if ( $hasRedirects ) { - $out->addHTML( " - - - " . - Xml::checkLabel( - $this->msg( 'fix-double-redirects' )->text(), - 'wpFixRedirects', - 'wpFixRedirects', - $this->fixRedirects - ) . - " - " + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( array( + 'name' => 'wpFixRedirects', + 'id' => 'wpFixRedirects', + 'value' => '1', + 'selected' => $this->fixRedirects, + ) ), + array( + 'label' => $this->msg( 'fix-double-redirects' )->text(), + 'align' => 'inline', + ) ); } if ( $canMoveSubpage ) { $maximumMovedPages = $this->getConfig()->get( 'MaximumMovedPages' ); - $out->addHTML( " - - - " . - Xml::check( - 'wpMovesubpages', - # Don't check the box if we only have talk subpages to - # move and we aren't moving the talk page. - $this->moveSubpages && ( $this->oldTitle->hasSubpages() || $this->moveTalk ), - array( 'id' => 'wpMovesubpages' ) - ) . ' ' . - Xml::tags( - 'label', - array( 'for' => 'wpMovesubpages' ), - $this->msg( - ( $this->oldTitle->hasSubpages() - ? 'move-subpages' - : 'move-talk-subpages' ) - )->numParams( $maximumMovedPages )->params( $maximumMovedPages )->parse() - ) . - " - " + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( array( + 'name' => 'wpMovesubpages', + 'id' => 'wpMovesubpages', + 'value' => '1', + # Don't check the box if we only have talk subpages to + # move and we aren't moving the talk page. + 'selected' => $this->moveSubpages && ( $this->oldTitle->hasSubpages() || $this->moveTalk ), + ) ), + array( + 'label' => new OOUI\HtmlSnippet( + $this->msg( + ( $this->oldTitle->hasSubpages() + ? 'move-subpages' + : 'move-talk-subpages' ) + )->numParams( $maximumMovedPages )->params( $maximumMovedPages )->parse() + ), + 'align' => 'inline', + ) ); } - $watchChecked = $user->isLoggedIn() && ( $this->watch || $user->getBoolOption( 'watchmoves' ) - || $user->isWatched( $this->oldTitle ) ); # Don't allow watching if user is not logged in if ( $user->isLoggedIn() ) { - $out->addHTML( " - - - " . - Xml::checkLabel( - $this->msg( 'move-watch' )->text(), - 'wpWatch', - 'watch', - $watchChecked - ) . - " - " + $watchChecked = $user->isLoggedIn() && ( $this->watch || $user->getBoolOption( 'watchmoves' ) + || $user->isWatched( $this->oldTitle ) ); + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( array( + 'name' => 'wpWatch', + 'id' => 'watch', # ew + 'value' => '1', + 'selected' => $watchChecked, + ) ), + array( + 'label' => $this->msg( 'move-watch' )->text(), + 'align' => 'inline', + ) ); } if ( $confirm ) { - $out->addHTML( " - - - " . - Xml::checkLabel( - $this->msg( 'delete_and_move_confirm' )->text(), - 'wpConfirm', - 'wpConfirm' - ) . - " - " + $watchChecked = $user->isLoggedIn() && ( $this->watch || $user->getBoolOption( 'watchmoves' ) + || $user->isWatched( $this->oldTitle ) ); + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( array( + 'name' => 'wpConfirm', + 'id' => 'wpConfirm', + 'value' => '1', + ) ), + array( + 'label' => $this->msg( 'delete_and_move_confirm' )->text(), + 'align' => 'inline', + ) ); } - $out->addHTML( " - - - " . - Xml::submitButton( $movepagebtn, array( 'name' => $submitVar ) ) . - " - " + $fields[] = new OOUI\FieldLayout( + new OOUI\ButtonInputWidget( array( + 'name' => $submitVar, + 'value' => $movepagebtn, + 'label' => $movepagebtn, + 'flags' => array( 'progressive', 'primary' ), + 'type' => 'submit', + ) ), + array( + 'align' => 'top', + ) + ); + + $fieldset = new OOUI\FieldsetLayout( array( + 'label' => $this->msg( 'move-page-legend' )->text(), + 'id' => 'mw-movepage-table', + 'items' => $fields, + ) ); + + $form = new OOUI\FormLayout( array( + 'method' => 'post', + 'action' => $this->getPageTitle()->getLocalURL( 'action=submit' ), + 'id' => 'movepage', + ) ); + $form->appendContent( + $fieldset, + new OOUI\HtmlSnippet( + Html::hidden( 'wpOldTitle', $this->oldTitle->getPrefixedText() ) . + Html::hidden( 'wpEditToken', $user->getEditToken() ) + ) ); $out->addHTML( - Xml::closeElement( 'table' ) . - Html::hidden( 'wpEditToken', $user->getEditToken() ) . - Xml::closeElement( 'fieldset' ) . - Xml::closeElement( 'form' ) . - "\n" + new OOUI\PanelLayout( array( + 'classes' => array( 'movepage-wrapper' ), + 'expanded' => false, + 'padded' => true, + 'framed' => true, + 'content' => $form, + ) ) ); $this->showLogFragment( $this->oldTitle );