- $form = Xml::openElement( 'form', [ 'method' => 'post', 'action' => $this->getAction(),
- 'id' => 'mw-img-deleteconfirm' ] ) .
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', null, wfMessage( 'filedelete-legend' )->text() ) .
- Html::hidden( 'wpEditToken', $wgUser->getEditToken( $this->oldimage ) ) .
- $this->prepareMessage( 'filedelete-intro' ) .
- Xml::openElement( 'table', [ 'id' => 'mw-img-deleteconfirm-table' ] ) .
- "<tr>
- <td class='mw-label'>" .
- Xml::label( wfMessage( 'filedelete-comment' )->text(), 'wpDeleteReasonList' ) .
- "</td>
- <td class='mw-input'>" .
- Xml::listDropDown(
- 'wpDeleteReasonList',
- wfMessage( 'filedelete-reason-dropdown' )->inContentLanguage()->text(),
- wfMessage( 'filedelete-reason-otherlist' )->inContentLanguage()->text(),
- '',
- 'wpReasonDropDown',
- 1
- ) .
- "</td>
- </tr>
- <tr>
- <td class='mw-label'>" .
- Xml::label( wfMessage( 'filedelete-otherreason' )->text(), 'wpReason' ) .
- "</td>
- <td class='mw-input'>" .
- Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ), [
- 'type' => 'text',
- // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
- // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
- // Unicode codepoints (or 255 UTF-8 bytes for old schema).
- 'maxlength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
- 'tabindex' => '2',
- 'id' => 'wpReason'
- ] ) .
- "</td>
- </tr>
- {$suppress}";
+
+ $wgOut->enableOOUI();
+
+ $options = Xml::listDropDownOptions(
+ $wgOut->msg( 'filedelete-reason-dropdown' )->inContentLanguage()->text(),
+ [ 'other' => $wgOut->msg( 'filedelete-reason-otherlist' )->inContentLanguage()->text() ]
+ );
+ $options = Xml::listDropDownOptionsOoui( $options );
+
+ $fields[] = new OOUI\LabelWidget( [ 'label' => new OOUI\HtmlSnippet(
+ $this->prepareMessage( 'filedelete-intro' ) ) ]
+ );
+
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\DropdownInputWidget( [
+ 'name' => 'wpDeleteReasonList',
+ 'inputId' => 'wpDeleteReasonList',
+ 'tabIndex' => 1,
+ 'infusable' => true,
+ 'value' => '',
+ 'options' => $options,
+ ] ),
+ [
+ 'label' => $wgOut->msg( 'filedelete-comment' )->text(),
+ 'align' => 'top',
+ ]
+ );
+
+ // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP
+ // (e.g. emojis) count for two each. This limit is overridden in JS to instead count
+ // Unicode codepoints (or 255 UTF-8 bytes for old schema).
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\TextInputWidget( [
+ 'name' => 'wpReason',
+ 'inputId' => 'wpReason',
+ 'tabIndex' => 2,
+ 'maxLength' => $oldCommentSchema ? 255 : CommentStore::COMMENT_CHARACTER_LIMIT,
+ 'infusable' => true,
+ 'value' => $wgRequest->getText( 'wpReason' ),
+ 'autofocus' => true,
+ ] ),
+ [
+ 'label' => $wgOut->msg( 'filedelete-otherreason' )->text(),
+ 'align' => 'top',
+ ]
+ );
+
+ if ( $wgUser->isAllowed( 'suppressrevision' ) ) {
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\CheckboxInputWidget( [
+ 'name' => 'wpSuppress',
+ 'inputId' => 'wpSuppress',
+ 'tabIndex' => 3,
+ 'selected' => false,
+ ] ),
+ [
+ 'label' => $wgOut->msg( 'revdelete-suppress' )->text(),
+ 'align' => 'inline',
+ 'infusable' => true,
+ ]
+ );
+ }
+