Florianschmidtwelzow has uploaded a new change for review. https://gerrit.wikimedia.org/r/225536
Change subject: WIP: Use OOUI for Special:UserRights ...................................................................... WIP: Use OOUI for Special:UserRights Change-Id: I518a29aa82d9bb6626ae5fb692b34f895cab4b36 --- M includes/specials/SpecialUserrights.php M resources/Resources.php A resources/src/mediawiki.special/mediawiki.special.userrights.css 3 files changed, 106 insertions(+), 54 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/36/225536/1 diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index 0158fdb..d5f449f 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -421,9 +421,35 @@ * Output a form to allow searching for a user */ function switchForm() { - $this->getOutput()->addModules( 'mediawiki.userSuggest' ); + $out = $this->getOutput(); + $out->enableOOUI(); + $out->addModules( array( + 'mediawiki.widgets', + 'mediawiki.special.userrights', + ) ); - $this->getOutput()->addHTML( + $fieldset = new OOUI\FieldsetLayout( array( + 'label' => $this->msg( 'userrights-lookup-user' )->text(), + 'items' => array( + new OOUI\LabelWidget( array( + 'input' => 'userrights-username', + 'label' => $this->msg( 'userrights-user-editname' )->text(), + 'classes' => array( 'userrights-label' ), + ) ), + new MediaWiki\Widget\UserInputWidget( array( + 'id' => 'username', + 'name' => 'user', + 'value' => str_replace( '_', ' ', $this->mTarget ), + 'autofocus' => true, + ) ), + new OOUI\ButtonInputWidget( array( + 'type' => 'submit', + 'label' => $this->msg( 'editusergroup' )->text(), + 'flags' => array( 'progressive', 'primary' ), + ) ), + ), + ) ); + $out->addHTML( Html::openElement( 'form', array( @@ -434,20 +460,13 @@ ) ) . Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) . - Xml::fieldset( $this->msg( 'userrights-lookup-user' )->text() ) . - Xml::inputLabel( - $this->msg( 'userrights-user-editname' )->text(), - 'user', - 'username', - 30, - str_replace( '_', ' ', $this->mTarget ), - array( - 'autofocus' => '', - 'class' => 'mw-autocomplete-user', // used by mediawiki.userSuggest - ) - ) . ' ' . - Xml::submitButton( $this->msg( 'editusergroup' )->text() ) . - Html::closeElement( 'fieldset' ) . + new OOUI\PanelLayout( array( + 'classes' => array( 'mw-userrights-ooui-wrapper' ), + 'expanded' => false, + 'padded' => true, + 'framed' => true, + 'content' => $fieldset, + ) ) . Html::closeElement( 'form' ) . "\n" ); } @@ -536,6 +555,33 @@ Linker::TOOL_LINKS_EMAIL /* Add "send e-mail" link */ ); + $fieldset = new OOUI\FieldsetLayout( array( + 'label' => $this->msg( 'userrights-editusergroup', $user->getName() )->text(), + ) ); + $fieldset->group->appendContent( new OOUI\HtmlSnippet( + $this->msg( 'editinguser' )->params( wfEscapeWikiText( $user->getName() ) ) + ->rawParams( $userToolLinks )->parse() . + $this->msg( 'userrights-groups-help', $user->getName() )->parse() . + $grouplist . + $this->groupCheckboxes( $groups, $user ) . + new OOUI\FieldLayout( + new OOUI\TextInputWidget( array( + 'name' => 'user-reason', + 'value' => $this->getRequest()->getVal( 'user-reason', false ), + 'id' => 'wpReason', + 'maxlength' => 255, + ) ), + array( + 'align' => 'left', + 'label' => $this->msg( 'userrights-reason' )->text(), + ) + ) . + new OOUI\ButtonInputWidget( array( + 'label' => $this->msg( 'saveusergroups' )->text(), + 'name' => 'saveusergroups', + 'flags' => array( 'constructive', 'primary' ), + ) + Linker::tooltipAndAccesskeyAttribs( 'userrights-set' ) ) + ) ); $this->getOutput()->addHTML( Xml::openElement( 'form', @@ -552,38 +598,13 @@ 'conflictcheck-originalgroups', implode( ',', $user->getGroups() ) ) . // Conflict detection - Xml::openElement( 'fieldset' ) . - Xml::element( - 'legend', - array(), - $this->msg( 'userrights-editusergroup', $user->getName() )->text() - ) . - $this->msg( 'editinguser' )->params( wfEscapeWikiText( $user->getName() ) ) - ->rawParams( $userToolLinks )->parse() . - $this->msg( 'userrights-groups-help', $user->getName() )->parse() . - $grouplist . - $this->groupCheckboxes( $groups, $user ) . - Xml::openElement( 'table', array( 'id' => 'mw-userrights-table-outer' ) ) . - "<tr> - <td class='mw-label'>" . - Xml::label( $this->msg( 'userrights-reason' )->text(), 'wpReason' ) . - "</td> - <td class='mw-input'>" . - Xml::input( 'user-reason', 60, $this->getRequest()->getVal( 'user-reason', false ), - array( 'id' => 'wpReason', 'maxlength' => 255 ) ) . - "</td> - </tr> - <tr> - <td></td> - <td class='mw-submit'>" . - Xml::submitButton( $this->msg( 'saveusergroups' )->text(), - array( 'name' => 'saveusergroups' ) + - Linker::tooltipAndAccesskeyAttribs( 'userrights-set' ) - ) . - "</td> - </tr>" . - Xml::closeElement( 'table' ) . "\n" . - Xml::closeElement( 'fieldset' ) . + new OOUI\PanelLayout( array( + 'classes' => array( 'mw-userrights-ooui-wrapper' ), + 'expanded' => false, + 'padded' => true, + 'framed' => true, + 'content' => $fieldset, + ) ) . Xml::closeElement( 'form' ) . "\n" ); } @@ -686,12 +707,28 @@ } else { $text = $member; } - $checkboxHtml = Xml::checkLabel( $text, "wpGroup-" . $group, - "wpGroup-" . $group, $checkbox['set'], $attr ); - $ret .= "\t\t" . ( $checkbox['disabled'] - ? Xml::tags( 'span', array( 'class' => 'mw-userrights-disabled' ), $checkboxHtml ) - : $checkboxHtml - ) . "<br />\n"; + $checkboxHtml = new OOUI\FieldLayout( + new OOUI\CheckboxInputWidget( array( + 'name' => 'wpGroup-' . $group, + 'id' => 'wgGroup-' . $group, + 'selected' => $checkbox['set'], + 'disabled' => $checkbox['disabled'], + ) ), + array( + 'align' => 'inline', + 'label' => $text, + ) + ); + if ( $checkbox['disabled'] ) { + $tag = new OOUI\Tag( 'span' ); + $tag + ->addClasses( array( 'mw-userrights-disabled' ) ) + ->appendContent( $checkboxHtml ); + + $ret .= $tag; + } else { + $ret .= $checkboxHtml; + } } $ret .= "\t</td>\n"; } diff --git a/resources/Resources.php b/resources/Resources.php index 0fc8ade..42a193c 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -1591,6 +1591,10 @@ 'jquery.throttle-debounce', ), ), + 'mediawiki.special.userrights' => array( + 'position' => 'top', + 'styles' => 'resources/src/mediawiki.special/mediawiki.special.userrights.css', + ), 'mediawiki.special.unwatchedPages' => array( 'scripts' => 'resources/src/mediawiki.special/mediawiki.special.unwatchedPages.js', 'styles' => 'resources/src/mediawiki.special/mediawiki.special.unwatchedPages.css', diff --git a/resources/src/mediawiki.special/mediawiki.special.userrights.css b/resources/src/mediawiki.special/mediawiki.special.userrights.css new file mode 100644 index 0000000..add63c4 --- /dev/null +++ b/resources/src/mediawiki.special/mediawiki.special.userrights.css @@ -0,0 +1,11 @@ +#username { + display: inline-block; +} + +.mw-userrights-ooui-wrapper { + margin-bottom: 1em; +} + +.userrights-label { + margin-right: 0.5em; +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/225536 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I518a29aa82d9bb6626ae5fb692b34f895cab4b36 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits