Ladsgroup has uploaded a new change for review. https://gerrit.wikimedia.org/r/325364
Change subject: Make Special:GlobalUsage use OOUI ...................................................................... Make Special:GlobalUsage use OOUI Bug: T152447 Change-Id: Ibf70f86691b07a5c731c9ddf1b1cd09640eec3d1 --- M SpecialGlobalUsage.php M i18n/en.json 2 files changed, 73 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalUsage refs/changes/64/325364/1 diff --git a/SpecialGlobalUsage.php b/SpecialGlobalUsage.php index 75c0506..dabea75 100644 --- a/SpecialGlobalUsage.php +++ b/SpecialGlobalUsage.php @@ -52,40 +52,91 @@ private function showForm() { global $wgScript; + $this->getOutput()->enableOOUI(); /* Build form */ - $html = Xml::openElement( 'form', array( 'action' => $wgScript ) ) . "\n"; - // Name of SpecialPage - $html .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) . "\n"; - // Limit - $html .= Html::hidden( 'limit', $this->getRequest()->getInt( 'limit', 50 ) ); - // Input box with target prefilled if available - $formContent = "\t" . Xml::input( 'target', 40, is_null( $this->target ) ? '' - : $this->target->getText() ) - // Submit button - . "\n\t" . Xml::element( 'input', array( - 'type' => 'submit', - 'value' => $this->msg( 'globalusage-ok' )->text() - ) ) - // Filter local checkbox - . "\n\t<p>" . Xml::checkLabel( $this->msg( 'globalusage-filterlocal' )->text(), - 'filterlocal', 'mw-filterlocal', $this->filterLocal ) . '</p>'; + $form = new OOUI\FormLayout( [ + 'method' => 'get', + 'action' => $wgScript, + ] ); + + $fields = []; + $fields[] = new OOUI\FieldLayout( + new OOUI\TextInputWidget( [ + 'name' => 'target', + 'id' => 'target', + 'maxLength' => 40, + 'infusable' => true, + 'value' => is_null( $this->target ) ? '' : $this->target->getText(), + ] ), + [ + 'label' => $this->msg( 'globalusage-filename' )->text(), + 'align' => 'top', + ] + ); + + // Filter local checkbox + $fields[] = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( [ + 'name' => 'filterlocal', + 'id' => 'mw-filterlocal', + 'value' => '1', + 'selected' => $this->filterLocal, + ] ), + [ + 'align' => 'inline', + 'label' => $this->msg( 'globalusage-filterlocal' )->text(), + ] + ); + + // Submit button + $fields[] = new OOUI\FieldLayout( + new OOUI\ButtonInputWidget( [ + 'value' => $this->msg( 'globalusage-ok' )->text(), + 'label' => $this->msg( 'globalusage-ok' )->text(), + 'flags' => [ 'primary', 'progressive' ], + 'type' => 'submit', + ] ), + [ + 'align' => 'top', + ] + ); + + $fieldset = new OOUI\FieldsetLayout( [ + 'label' => $this->msg( 'globalusage-text' )->text(), + 'id' => 'globalusage-text', + 'items' => $fields, + ] ); + if ( !is_null( $this->target ) && wfFindFile( $this->target ) ) { // Show the image if it exists - $html .= Linker::makeThumbLinkObj( + $html = Linker::makeThumbLinkObj( $this->target, wfFindFile( $this->target ), /* $label */ $this->target->getPrefixedText(), /* $alt */ '', /* $align */ $this->getLanguage()->alignEnd(), - /* $handlerParams */ array(), /* $framed */ false, + /* $handlerParams */ [], /* $framed */ false, /* $manualThumb */ false ); + $this->getOutput()->addHtml( $html ); } - // Wrap the entire form in a nice fieldset - $html .= Xml::fieldSet( $this->msg( 'globalusage-text' )->text(), $formContent ) . "\n</form>"; + $form->appendContent( + $fieldset, + new OOUI\HtmlSnippet( + Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) . + Html::hidden( 'limit', $this->getRequest()->getInt( 'limit', 50 ) ) + ) + ); - $this->getOutput()->addHtml( $html ); + $this->getOutput()->addHTML( + new OOUI\PanelLayout( [ + 'expanded' => false, + 'padded' => true, + 'framed' => true, + 'content' => $form, + ] ) + ); } /** diff --git a/i18n/en.json b/i18n/en.json index 3e8f8b4..d4db06c 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -6,6 +6,7 @@ }, "globalusage": "Global file usage", "globalusage-for": "Global usage for \"$1\"", + "globalusage-filename": "Filename:", "globalusage-desc": "[[Special:GlobalUsage|Special page]] to view global file usage", "globalusage-ok": "Search", "globalusage-text": "Search global file usage", -- To view, visit https://gerrit.wikimedia.org/r/325364 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibf70f86691b07a5c731c9ddf1b1cd09640eec3d1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GlobalUsage Gerrit-Branch: master Gerrit-Owner: Ladsgroup <ladsgr...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits