X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialProtectedtitles.php;h=fa12f507f9b0276875b95785c4c7f545017007e4;hb=278ae11ae78d282949a00e1026b60facfff817ac;hp=fa9033cb3148c55f0cefd39a49889a74836baec1;hpb=dfaa26a7b19ab65190a76cd32259a3637cc3e2fd;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialProtectedtitles.php b/includes/specials/SpecialProtectedtitles.php index fa9033cb31..fa12f507f9 100644 --- a/includes/specials/SpecialProtectedtitles.php +++ b/includes/specials/SpecialProtectedtitles.php @@ -85,10 +85,8 @@ class SpecialProtectedtitles extends SpecialPage { } $link = $this->getLinkRenderer()->makeLink( $title ); - $description_items = []; // Messages: restriction-level-sysop, restriction-level-autoconfirmed - $protType = $this->msg( 'restriction-level-' . $row->pt_create_perm )->escaped(); - $description_items[] = $protType; + $description = $this->msg( 'restriction-level-' . $row->pt_create_perm )->escaped(); $lang = $this->getLanguage(); $expiry = strlen( $row->pt_expiry ) ? $lang->formatExpiry( $row->pt_expiry, TS_MW ) : @@ -96,7 +94,7 @@ class SpecialProtectedtitles extends SpecialPage { if ( $expiry !== 'infinity' ) { $user = $this->getUser(); - $description_items[] = $this->msg( + $description .= $this->msg( 'comma-separator' )->escaped() . $this->msg( 'protect-expiring-local', $lang->userTimeAndDate( $expiry, $user ), $lang->userDate( $expiry, $user ), @@ -104,8 +102,7 @@ class SpecialProtectedtitles extends SpecialPage { )->escaped(); } - // @todo i18n: This should use a comma separator instead of a hard coded comma, right? - return '
  • ' . $lang->specialList( $link, implode( $description_items, ', ' ) ) . "
  • \n"; + return '
  • ' . $lang->specialList( $link, $description ) . "
  • \n"; } /** @@ -116,39 +113,25 @@ class SpecialProtectedtitles extends SpecialPage { * @private */ function showOptions( $namespace, $type = 'edit', $level ) { - $action = htmlspecialchars( wfScript() ); - $title = $this->getPageTitle(); - $special = htmlspecialchars( $title->getPrefixedDBkey() ); - - return "
    \n" . - '
    ' . - Xml::element( 'legend', [], $this->msg( 'protectedtitles' )->text() ) . - Html::hidden( 'title', $special ) . " \n" . - $this->getNamespaceMenu( $namespace ) . " \n" . - $this->getLevelMenu( $level ) . " \n" . - " " . Xml::submitButton( $this->msg( 'protectedtitles-submit' )->text() ) . "\n" . - "
    "; - } - - /** - * Prepare the namespace filter drop-down; standard namespace - * selector, sans the MediaWiki namespace - * - * @param string|null $namespace Pre-select namespace - * @return string - */ - function getNamespaceMenu( $namespace = null ) { - return Html::namespaceSelector( - [ - 'selected' => $namespace, - 'all' => '', - 'label' => $this->msg( 'namespace' )->text() - ], [ + $formDescriptor = [ + 'namespace' => [ + 'class' => 'HTMLSelectNamespace', 'name' => 'namespace', 'id' => 'namespace', - 'class' => 'namespaceselector', - ] - ); + 'cssclass' => 'namespaceselector', + 'all' => '', + 'label' => $this->msg( 'namespace' )->text() + ], + 'levelmenu' => $this->getLevelMenu( $level ) + ]; + + $htmlForm = new HTMLForm( $formDescriptor, $this->getContext() ); + $htmlForm + ->setMethod( 'get' ) + ->setWrapperLegendMsg( 'protectedtitles' ) + ->setSubmitText( $this->msg( 'protectedtitles-submit' )->text() ); + + return $htmlForm->prepareForm()->getHTML( false ); } /** @@ -176,14 +159,16 @@ class SpecialProtectedtitles extends SpecialPage { } // Third pass generates sorted XHTML content foreach ( $m as $text => $type ) { - $selected = ( $type == $pr_level ); - $options[] = Xml::option( $text, $type, $selected ); + $options[ $text ] = $type; } - return Xml::label( $this->msg( 'restriction-level' )->text(), $this->IdLevel ) . ' ' . - Xml::tags( 'select', - [ 'id' => $this->IdLevel, 'name' => $this->IdLevel ], - implode( "\n", $options ) ); + return [ + 'type' => 'select', + 'options' => $options, + 'label' => $this->msg( 'restriction-level' )->text(), + 'name' => $this->IdLevel, + 'id' => $this->IdLevel + ]; } protected function getGroupName() {