X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialProtectedtitles.php;h=00bfba946da6972c6c6faa52f22e4981fda84710;hb=ec46d1e8a5147a71dbba0ac3abb82b9773c4ad3f;hp=af2b81f1528aba6b0028c4f9ba91420a6cb69c77;hpb=236488d398046838059f758b0915341648b64c7b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialProtectedtitles.php b/includes/specials/SpecialProtectedtitles.php index af2b81f152..00bfba946d 100644 --- a/includes/specials/SpecialProtectedtitles.php +++ b/includes/specials/SpecialProtectedtitles.php @@ -112,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 ); } /** @@ -173,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() {