X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FArticle.php;h=d13fb3c11e85a39527da33e24ddc3b3eb890207f;hb=eaefbf99c8183f543c766272fc1a73480d28e004;hp=dc4096c438ab27ee1c1bdf6caaff97e4655e33d9;hpb=8e185ecb2b53217665ea53f63119a28b3f80ff56;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/Article.php b/includes/page/Article.php index dc4096c438..d13fb3c11e 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -1673,11 +1673,20 @@ class Article implements Page { $outputPage->setPageTitle( wfMessage( 'delete-confirm', $title->getPrefixedText() ) ); $outputPage->addBacklinkSubtitle( $title ); $outputPage->setRobotPolicy( 'noindex,nofollow' ); + $backlinkCache = $title->getBacklinkCache(); if ( $backlinkCache->hasLinks( 'pagelinks' ) || $backlinkCache->hasLinks( 'templatelinks' ) ) { $outputPage->wrapWikiMsg( "
' . $link . '
'; + + $outputPage->enableOOUI(); + + $options = []; + $options[] = [ + 'data' => 'other', + 'label' => $ctx->msg( 'deletereasonotherlist' )->inContentLanguage()->text(), + ]; + $list = $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text(); + foreach ( explode( "\n", $list ) as $option ) { + $value = trim( $option ); + if ( $value == '' ) { + continue; + } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) { + $options[] = [ 'optgroup' => trim( substr( $value, 1 ) ) ]; + } elseif ( substr( $value, 0, 2 ) == '**' ) { + $options[] = [ 'data' => trim( substr( $value, 2 ) ) ]; + } else { + $options[] = [ 'data' => trim( $value ) ]; } + } + + $fields[] = new OOUI\FieldLayout( + new OOUI\DropdownInputWidget( [ + 'name' => 'wpDeleteReasonList', + 'inputId' => 'wpDeleteReasonList', + 'tabIndex' => 1, + 'infusable' => true, + 'value' => '', + 'options' => $options + ] ), + [ + 'label' => $ctx->msg( 'deletecomment' )->text(), + 'align' => 'top', + ] + ); + + $fields[] = new OOUI\FieldLayout( + new OOUI\TextInputWidget( [ + 'name' => 'wpReason', + 'inputId' => 'wpReason', + 'tabIndex' => 2, + 'maxLength' => 255, + 'infusable' => true, + 'value' => $reason, + 'autofocus' => true, + ] ), + [ + 'label' => $ctx->msg( 'deleteotherreason' )->text(), + 'align' => 'top', + ] + ); - $outputPage->addHTML( $form ); + if ( $user->isLoggedIn() ) { + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( [ + 'name' => 'wpWatch', + 'inputId' => 'wpWatch', + 'tabIndex' => 3, + 'selected' => $checkWatch, + ] ), + [ + 'label' => $ctx->msg( 'watchthis' )->text(), + 'align' => 'inline', + 'infusable' => true, + ] + ); + } + + $fields[] = new OOUI\FieldLayout( + new OOUI\ButtonInputWidget( [ + 'name' => 'wpConfirmB', + 'inputId' => 'wpConfirmB', + 'tabIndex' => 5, + 'value' => $ctx->msg( 'deletepage' )->text(), + 'label' => $ctx->msg( 'deletepage' )->text(), + 'flags' => [ 'primary', 'destructive' ], + 'type' => 'submit', + ] ), + [ + 'align' => 'top', + ] + ); + + $fieldset = new OOUI\FieldsetLayout( [ + 'label' => $ctx->msg( 'delete-legend' )->text(), + 'id' => 'mw-delete-table', + 'items' => $fields, + ] ); + + $form = new OOUI\FormLayout( [ + 'method' => 'post', + 'action' => $title->getLocalURL( 'action=delete' ), + 'id' => 'deleteconfirm', + ] ); + $form->appendContent( + $fieldset, + new OOUI\HtmlSnippet( + Html::hidden( 'wpEditToken', $user->getEditToken( [ 'delete', $title->getPrefixedText() ] ) ) + ) + ); + + $outputPage->addHTML( + new OOUI\PanelLayout( [ + 'classes' => [ 'deletepage-wrapper' ], + 'expanded' => false, + 'padded' => true, + 'framed' => true, + 'content' => $form, + ] ) + ); + + if ( $user->isAllowed( 'editinterface' ) ) { + $link = Linker::linkKnown( + $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->getTitle(), + wfMessage( 'delete-edit-reasonlist' )->escaped(), + [], + [ 'action' => 'edit' ] + ); + $outputPage->addHTML( '' . $link . '
' ); + } $deleteLogPage = new LogPage( 'delete' ); $outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );