X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialProtectedtitles.php;h=00bfba946da6972c6c6faa52f22e4981fda84710;hb=ec46d1e8a5147a71dbba0ac3abb82b9773c4ad3f;hp=c800d96c783682d67bdd57b7a16054877b0f9eae;hpb=f5fc9f21ead83bbc50544772281996f37f64d17c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialProtectedtitles.php b/includes/specials/SpecialProtectedtitles.php index c800d96c78..00bfba946d 100644 --- a/includes/specials/SpecialProtectedtitles.php +++ b/includes/specials/SpecialProtectedtitles.php @@ -84,11 +84,9 @@ class SpecialProtectedtitles extends SpecialPage { ) . "\n"; } - $link = Linker::link( $title ); - $description_items = []; + $link = $this->getLinkRenderer()->makeLink( $title ); // 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"; } /** @@ -115,40 +112,26 @@ class SpecialProtectedtitles extends SpecialPage { * @return string * @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() - ], [ + function showOptions( $namespace, $type, $level ) { + $formDescriptor = [ + 'namespace' => [ + 'class' => 'HTMLSelectNamespace', 'name' => 'namespace', 'id' => 'namespace', - 'class' => 'namespaceselector', - ] - ); + 'cssclass' => 'namespaceselector', + 'all' => '', + 'label' => $this->msg( 'namespace' )->text() + ], + 'levelmenu' => $this->getLevelMenu( $level ) + ]; + + $htmlForm = HTMLForm::factory( 'ooui', $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() {