X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2Fpagers%2FUsersPager.php;h=7fa03bae341014974a326b9ca528ed178165dedb;hb=dbad540cd37617879aff6f28ce9c016dd8049d4e;hp=d599599031c5f67e6af31b1ee9e5faac532c2671;hpb=32b80f38ffc0baeabfff203bd6095a844da31048;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/pagers/UsersPager.php b/includes/specials/pagers/UsersPager.php index d599599031..45d9a7fc84 100644 --- a/includes/specials/pagers/UsersPager.php +++ b/includes/specials/pagers/UsersPager.php @@ -33,7 +33,7 @@ class UsersPager extends AlphabeticPager { /** - * @var array A array with user ids as key and a array of groups as value + * @var array[] A array with user ids as key and a array of groups as value */ protected $userGroupCache; @@ -112,9 +112,7 @@ class UsersPager extends AlphabeticPager { if ( $this->requestedGroup != '' ) { $conds['ug_group'] = $this->requestedGroup; - if ( !$this->getConfig()->get( 'DisableUserGroupExpiry' ) ) { - $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() ); - } + $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() ); } if ( $this->requestedUser != '' ) { @@ -272,71 +270,89 @@ class UsersPager extends AlphabeticPager { function getPageHeader() { list( $self ) = explode( '/', $this->getTitle()->getPrefixedDBkey() ); - $this->getOutput()->addModules( 'mediawiki.userSuggest' ); - - # Form tag - $out = Xml::openElement( - 'form', - [ 'method' => 'get', 'action' => wfScript(), 'id' => 'mw-listusers-form' ] - ) . - Xml::fieldset( $this->msg( 'listusers' )->text() ) . - Html::hidden( 'title', $self ); - - # Username field (with autocompletion support) - $out .= Xml::label( $this->msg( 'listusersfrom' )->text(), 'offset' ) . ' ' . - Html::input( - 'username', - $this->requestedUser, - 'text', - [ - 'class' => 'mw-autocomplete-user', - 'id' => 'offset', - 'size' => 20, - 'autofocus' => $this->requestedUser === '' - ] - ) . ' '; - - # Group drop-down list - $sel = new XmlSelect( 'group', 'group', $this->requestedGroup ); - $sel->addOption( $this->msg( 'group-all' )->text(), '' ); + $groupOptions = [ $this->msg( 'group-all' )->text() => '' ]; foreach ( $this->getAllGroups() as $group => $groupText ) { - $sel->addOption( $groupText, $group ); + $groupOptions[ $groupText ] = $group; } - $out .= Xml::label( $this->msg( 'group' )->text(), 'group' ) . ' '; - $out .= $sel->getHTML() . '
'; - $out .= Xml::checkLabel( - $this->msg( 'listusers-editsonly' )->text(), - 'editsOnly', - 'editsOnly', - $this->editsOnly - ); - $out .= ' '; - $out .= Xml::checkLabel( - $this->msg( 'listusers-creationsort' )->text(), - 'creationSort', - 'creationSort', - $this->creationSort - ); - $out .= ' '; - $out .= Xml::checkLabel( - $this->msg( 'listusers-desc' )->text(), - 'desc', - 'desc', - $this->mDefaultDirection - ); - $out .= '
'; + $formDescriptor = [ + 'user' => [ + 'class' => 'HTMLUserTextField', + 'label' => $this->msg( 'listusersfrom' )->text(), + 'name' => 'username', + 'default' => $this->requestedUser, + ], + 'dropdown' => [ + 'label' => $this->msg( 'group' )->text(), + 'name' => 'group', + 'default' => $this->requestedGroup, + 'class' => 'HTMLSelectField', + 'options' => $groupOptions, + ], + 'editsOnly' => [ + 'type' => 'check', + 'label' => $this->msg( 'listusers-editsonly' )->text(), + 'name' => 'editsOnly', + 'id' => 'editsOnly', + 'default' => $this->editsOnly + ], + 'creationSort' => [ + 'type' => 'check', + 'label' => $this->msg( 'listusers-creationsort' )->text(), + 'name' => 'creationSort', + 'id' => 'creationSort', + 'default' => $this->creationSort + ], + 'desc' => [ + 'type' => 'check', + 'label' => $this->msg( 'listusers-desc' )->text(), + 'name' => 'desc', + 'id' => 'desc', + 'default' => $this->mDefaultDirection + ], + 'limithiddenfield' => [ + 'class' => 'HTMLHiddenField', + 'name' => 'limit', + 'default' => $this->mLimit + ] + ]; + + $beforeSubmitButtonHookOut = ''; + Hooks::run( 'SpecialListusersHeaderForm', [ $this, &$beforeSubmitButtonHookOut ] ); + + if ( $beforeSubmitButtonHookOut !== '' ) { + $formDescriptior[ 'beforeSubmitButtonHookOut' ] = [ + 'class' => 'HTMLInfoField', + 'raw' => true, + 'default' => $beforeSubmitButtonHookOut + ]; + } + + $formDescriptor[ 'submit' ] = [ + 'class' => 'HTMLSubmitField', + 'buttonlabel-message' => 'listusers-submit', + ]; - Hooks::run( 'SpecialListusersHeaderForm', [ $this, &$out ] ); + $beforeClosingFieldsetHookOut = ''; + Hooks::run( 'SpecialListusersHeader', [ $this, &$beforeClosingFieldsetHookOut ] ); - # Submit button and form bottom - $out .= Html::hidden( 'limit', $this->mLimit ); - $out .= Xml::submitButton( $this->msg( 'listusers-submit' )->text() ); - Hooks::run( 'SpecialListusersHeader', [ $this, &$out ] ); - $out .= Xml::closeElement( 'fieldset' ) . - Xml::closeElement( 'form' ); + if ( $beforeClosingFieldsetHookOut !== '' ) { + $formDescriptior[ 'beforeClosingFieldsetHookOut' ] = [ + 'class' => 'HTMLInfoField', + 'raw' => true, + 'default' => $beforeClosingFieldsetHookOut + ]; + } - return $out; + $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() ); + $htmlForm + ->setMethod( 'get' ) + ->setAction( Title::newFromText( $self )->getLocalURL() ) + ->setId( 'mw-listusers-form' ) + ->setFormIdentifier( 'mw-listusers-form' ) + ->suppressDefaultSubmit() + ->setWrapperLegendMsg( 'listusers' ); + return $htmlForm->prepareForm()->getHTML( true ); } /** @@ -375,8 +391,8 @@ class UsersPager extends AlphabeticPager { * and the relevant UserGroupMembership objects * * @param int $uid User id - * @param array|null $cache - * @return array (group name => UserGroupMembership object) + * @param array[]|null $cache + * @return UserGroupMembership[] (group name => UserGroupMembership object) */ protected static function getGroupMemberships( $uid, $cache = null ) { if ( $cache === null ) {