X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fspecials%2FSpecialUndelete.php;h=740207d6b9bc8b7852621359bb883632fbeeb407;hb=d6551bcbad8e2c0c94af630212433150ac7ff841;hp=fa385060e89dd929a66e57e6351d42a18925cc9f;hpb=325e34477409440b28bbcee04e0447b91b45262b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index fa385060e8..740207d6b9 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -235,36 +235,66 @@ class SpecialUndelete extends SpecialPage { function showSearchForm() { $out = $this->getOutput(); $out->setPageTitle( $this->msg( 'undelete-search-title' ) ); - $out->addHTML( - Xml::openElement( 'form', [ 'method' => 'get', 'action' => wfScript() ] ) . - Xml::fieldset( $this->msg( 'undelete-search-box' )->text() ) . + $fuzzySearch = $this->getRequest()->getVal( 'fuzzy', true ); + + $out->enableOOUI(); + + $fields[] = new OOUI\ActionFieldLayout( + new OOUI\TextInputWidget( [ + 'name' => 'prefix', + 'inputId' => 'prefix', + 'infusable' => true, + 'value' => $this->mSearchPrefix, + 'autofocus' => true, + ] ), + new OOUI\ButtonInputWidget( [ + 'label' => $this->msg( 'undelete-search-submit' )->text(), + 'flags' => [ 'primary', 'progressive' ], + 'inputId' => 'searchUndelete', + 'type' => 'submit', + ] ), + [ + 'label' => new OOUI\HtmlSnippet( + $this->msg( + $fuzzySearch ? 'undelete-search-full' : 'undelete-search-prefix' + )->parse() + ), + 'align' => 'left', + ] + ); + + $fieldset = new OOUI\FieldsetLayout( [ + 'label' => $this->msg( 'undelete-search-box' )->text(), + 'items' => $fields, + ] ); + + $form = new OOUI\FormLayout( [ + 'method' => 'get', + 'action' => wfScript(), + ] ); + + $form->appendContent( + $fieldset, + new OOUI\HtmlSnippet( Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) . - Html::hidden( 'fuzzy', $this->getRequest()->getVal( 'fuzzy' ) ) . - Html::rawElement( - 'label', - [ 'for' => 'prefix' ], - $this->msg( 'undelete-search-prefix' )->parse() - ) . - Xml::input( - 'prefix', - 20, - $this->mSearchPrefix, - [ 'id' => 'prefix', 'autofocus' => '' ] - ) . - ' ' . - Xml::submitButton( - $this->msg( 'undelete-search-submit' )->text(), - [ 'id' => 'searchUndelete' ] - ) . - Xml::closeElement( 'fieldset' ) . - Xml::closeElement( 'form' ) + Html::hidden( 'fuzzy', $fuzzySearch ) + ) + ); + + $out->addHTML( + new OOUI\PanelLayout( [ + 'expanded' => false, + 'padded' => true, + 'framed' => true, + 'content' => $form, + ] ) ); # List undeletable articles if ( $this->mSearchPrefix ) { // For now, we enable search engine match only when specifically asked to // by using fuzzy=1 parameter. - if ( $this->getRequest()->getVal( "fuzzy", false ) ) { + if ( $fuzzySearch ) { $result = PageArchive::listPagesBySearch( $this->mSearchPrefix ); } else { $result = PageArchive::listPagesByPrefix( $this->mSearchPrefix ); @@ -639,13 +669,7 @@ class SpecialUndelete extends SpecialPage { $archive = new PageArchive( $this->mTargetObj, $this->getConfig() ); Hooks::run( 'UndeleteForm::showHistory', [ &$archive, $this->mTargetObj ] ); - /* - $text = $archive->getLastRevisionText(); - if( is_null( $text ) ) { - $out->addWikiMsg( 'nohistory' ); - return; - } - */ + $out->addHTML( '
' ); if ( $this->mAllowed ) { $out->addWikiMsg( 'undeletehistory' ); @@ -683,13 +707,15 @@ class SpecialUndelete extends SpecialPage { } if ( $this->mAllowed ) { + $out->enableOOUI(); + $action = $this->getPageTitle()->getLocalURL( [ 'action' => 'submit' ] ); # Start the form here - $top = Xml::openElement( - 'form', - [ 'method' => 'post', 'action' => $action, 'id' => 'undelete' ] - ); - $out->addHTML( $top ); + $form = new OOUI\FormLayout( [ + 'method' => 'post', + 'action' => $action, + 'id' => 'undelete', + ] ); } # Show relevant lines from the deletion log: @@ -704,68 +730,89 @@ class SpecialUndelete extends SpecialPage { } if ( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) { - # Format the user-visible controls (comment field, submission button) - # in a nice little table + $fields[] = new OOUI\Layout( [ + 'content' => new OOUI\HtmlSnippet( $this->msg( 'undeleteextrahelp' )->parseAsBlock() ) + ] ); + + $fields[] = new OOUI\FieldLayout( + new OOUI\TextInputWidget( [ + 'name' => 'wpComment', + 'inputId' => 'wpComment', + 'infusable' => true, + 'value' => $this->mComment, + 'autofocus' => true, + ] ), + [ + 'label' => $this->msg( 'undeletecomment' )->text(), + 'align' => 'top', + ] + ); + + $fields[] = new OOUI\FieldLayout( + new OOUI\Widget( [ + 'content' => new OOUI\HorizontalLayout( [ + 'items' => [ + new OOUI\ButtonInputWidget( [ + 'name' => 'restore', + 'inputId' => 'mw-undelete-submit', + 'value' => '1', + 'label' => $this->msg( 'undeletebtn' )->text(), + 'flags' => [ 'primary', 'progressive' ], + 'type' => 'submit', + ] ), + new OOUI\ButtonInputWidget( [ + 'name' => 'invert', + 'inputId' => 'mw-undelete-invert', + 'value' => '1', + 'label' => $this->msg( 'undeleteinvert' )->text() + ] ), + ] + ] ) + ] ) + ); + if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) { - $unsuppressBox = - " -   - " . - Xml::checkLabel( $this->msg( 'revdelete-unsuppress' )->text(), - 'wpUnsuppress', 'mw-undelete-unsuppress', $this->mUnsuppress ) . - " - "; - } else { - $unsuppressBox = ''; + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( [ + 'name' => 'wpUnsuppress', + 'inputId' => 'mw-undelete-unsuppress', + 'value' => '1', + ] ), + [ + 'label' => $this->msg( 'revdelete-unsuppress' )->text(), + 'align' => 'inline', + ] + ); } - $table = Xml::fieldset( $this->msg( 'undelete-fieldset-title' )->text() ) . - Xml::openElement( 'table', [ 'id' => 'mw-undelete-table' ] ) . - " - " . - $this->msg( 'undeleteextrahelp' )->parseAsBlock() . - " - - - " . - Xml::label( $this->msg( 'undeletecomment' )->text(), 'wpComment' ) . - " - " . - Xml::input( - 'wpComment', - 50, - $this->mComment, - [ 'id' => 'wpComment', 'autofocus' => '' ] - ) . - " - - -   - " . - Xml::submitButton( - $this->msg( 'undeletebtn' )->text(), - [ 'name' => 'restore', 'id' => 'mw-undelete-submit' ] - ) . ' ' . - Xml::submitButton( - $this->msg( 'undeleteinvert' )->text(), - [ 'name' => 'invert', 'id' => 'mw-undelete-invert' ] - ) . - " - " . - $unsuppressBox . - Xml::closeElement( 'table' ) . - Xml::closeElement( 'fieldset' ); - - $out->addHTML( $table ); + $fieldset = new OOUI\FieldsetLayout( [ + 'label' => $this->msg( 'undelete-fieldset-title' )->text(), + 'id' => 'mw-undelete-table', + 'items' => $fields, + ] ); + + $form->appendContent( + new OOUI\PanelLayout( [ + 'expanded' => false, + 'padded' => true, + 'framed' => true, + 'content' => $fieldset, + ] ), + new OOUI\HtmlSnippet( + Html::hidden( 'target', $this->mTarget ) . + Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) + ) + ); } - $out->addHTML( Xml::element( 'h2', null, $this->msg( 'history' )->text() ) . "\n" ); + $history = ''; + $history .= Xml::element( 'h2', null, $this->msg( 'history' )->text() ) . "\n"; if ( $haveRevisions ) { # Show the page's stored (deleted) history if ( $this->getUser()->isAllowed( 'deleterevision' ) ) { - $out->addHTML( Html::element( + $history .= Html::element( 'button', [ 'name' => 'revdel', @@ -773,39 +820,43 @@ class SpecialUndelete extends SpecialPage { 'class' => 'deleterevision-log-submit mw-log-deleterevision-button' ], $this->msg( 'showhideselectedversions' )->text() - ) . "\n" ); + ) . "\n"; } - $out->addHTML( ''; } else { $out->addWikiMsg( 'nohistory' ); } if ( $haveFiles ) { - $out->addHTML( Xml::element( 'h2', null, $this->msg( 'filehist' )->text() ) . "\n" ); - $out->addHTML( ''; } if ( $this->mAllowed ) { # Slip in the hidden controls here $misc = Html::hidden( 'target', $this->mTarget ); $misc .= Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ); - $misc .= Xml::closeElement( 'form' ); - $out->addHTML( $misc ); + $history .= $misc; + + $form->appendContent( new OOUI\HtmlSnippet( $history ) ); + $out->addHTML( $form ); + } else { + $out->addHTML( $history ); } return true; @@ -1099,9 +1150,11 @@ class SpecialUndelete extends SpecialPage { // Show revision undeletion warnings and errors $status = $archive->getRevisionStatus(); if ( $status && !$status->isGood() ) { - $out->wrapWikiMsg( - "
\n$1\n
", - 'cannotundelete' + $out->addWikiText( '
' . + $status->getWikiText( + 'cannotundelete', + 'cannotundelete' + ) . '
' ); }