Saurabhsuniljain has uploaded a new change for review.
https://gerrit.wikimedia.org/r/276975
Change subject: Convert SpecialProtectedtitles.php to use OOUI
......................................................................
Convert SpecialProtectedtitles.php to use OOUI
Bug: T117723
Change-Id: Idb9a918998a97e682aa6456859a2716c25849dd0
---
M includes/specials/SpecialProtectedtitles.php
1 file changed, 28 insertions(+), 19 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/75/276975/1
diff --git a/includes/specials/SpecialProtectedtitles.php
b/includes/specials/SpecialProtectedtitles.php
index 5df425a..4e2b958 100644
--- a/includes/specials/SpecialProtectedtitles.php
+++ b/includes/specials/SpecialProtectedtitles.php
@@ -120,14 +120,31 @@
$title = $this->getPageTitle();
$special = htmlspecialchars( $title->getPrefixedDBkey() );
- return "<form action=\"$action\" method=\"get\">\n" .
- '<fieldset>' .
- 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" .
- "</fieldset></form>";
+ $formDescriptor = array(
+ 'namespace' => array(
+ 'class' => 'HTMLSelectField',
+ 'label' => $this->msg( 'namespace' )->text(),
+ 'options' => array_flip(
$this->getNamespaceMenu( $namespace ) ),
+ ),
+ 'level' => array(
+ 'class' => 'HTMLSelectField',
+ 'label' => $this->msg( 'restriction-level'
)->text(),
+ 'options' => array_flip( $this->getLevelMenu(
$level ) ),
+ ),
+ );
+
+ $hiddenFields = [
+ 'title' => $special,
+ ];
+ $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor,
$this->getContext() );
+ $htmlForm->addHiddenFields( $hiddenFields );
+ $htmlForm->setSubmitTextMsg( 'protectedtitles-submit' );
+ $htmlForm->setSubmitCallback( array( 'SpecialTestForm',
'trySubmit' ) );
+ $htmlForm->setWrapperLegendMsg( 'protectedtitles' );
+ $htmlForm->setAction( $action );
+ $htmlForm->setMethod( 'get' );
+ $htmlForm->prepareForm()->displayForm( false );
+
}
/**
@@ -138,15 +155,11 @@
* @return string
*/
function getNamespaceMenu( $namespace = null ) {
- return Html::namespaceSelector(
+ return Html::namespaceSelectorOptions(
[
'selected' => $namespace,
'all' => '',
'label' => $this->msg( 'namespace' )->text()
- ], [
- 'name' => 'namespace',
- 'id' => 'namespace',
- 'class' => 'namespaceselector',
]
);
}
@@ -177,13 +190,9 @@
// Third pass generates sorted XHTML content
foreach ( $m as $text => $type ) {
$selected = ( $type == $pr_level );
- $options[] = Xml::option( $text, $type, $selected );
+ $options[] = $text;
}
-
- return Xml::label( $this->msg( 'restriction-level' )->text(),
$this->IdLevel ) . ' ' .
- Xml::tags( 'select',
- [ 'id' => $this->IdLevel, 'name' =>
$this->IdLevel ],
- implode( "\n", $options ) );
+ return $options;
}
protected function getGroupName() {
--
To view, visit https://gerrit.wikimedia.org/r/276975
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb9a918998a97e682aa6456859a2716c25849dd0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Saurabhsuniljain <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits