Ricordisamoa has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/235999

Change subject: Convert SpecialItemByTitle to HTMLForm in 'ooui' mode
......................................................................

Convert SpecialItemByTitle to HTMLForm in 'ooui' mode

Bug: T48248
Change-Id: Ic6e10a007ffb68a8ba9dc150360293e426090a65
---
M repo/includes/specials/SpecialItemByTitle.php
1 file changed, 28 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/99/235999/1

diff --git a/repo/includes/specials/SpecialItemByTitle.php 
b/repo/includes/specials/SpecialItemByTitle.php
index 23289ea..0e77d71 100644
--- a/repo/includes/specials/SpecialItemByTitle.php
+++ b/repo/includes/specials/SpecialItemByTitle.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase\Repo\Specials;
 
+use HTMLForm;
 use Html;
 use Site;
 use SiteStore;
@@ -175,70 +176,36 @@
 
                $this->getOutput()->addModules( 'wikibase.special.itemByTitle' 
);
 
-               $this->getOutput()->addHTML(
-                       Html::openElement(
-                               'form',
-                               array(
-                                       'method' => 'get',
-                                       'action' => 
$this->getPageTitle()->getFullUrl(),
-                                       'name' => 'itembytitle',
-                                       'id' => 'wb-itembytitle-form1'
-                               )
+               $formDescriptor = array(
+                       'site' => array(
+                               'name' => 'site',
+                               'default' => htmlspecialchars( $siteId ),
+                               'type' => 'text',
+                               'cssclass' => 'wb-input',
+                               'id' => 'wb-itembytitle-sitename',
+                               'size' => 12,
+                               'label-message' => 
'wikibase-itembytitle-lookup-site'
+                       ),
+                       'page' => array(
+                               'name' => 'page',
+                               'default' => $page ? htmlspecialchars( $page ) 
: '',
+                               'type' => 'text',
+                               'cssclass' => 'wb-input',
+                               'id' => 'pagename',
+                               'size' => 36,
+                               'label-message' => 
'wikibase-itembytitle-lookup-page'
                        )
-                       . Html::openElement( 'fieldset' )
-                       . Html::element(
-                               'legend',
-                               array(),
-                               $this->msg( 
'wikibase-itembytitle-lookup-fieldset' )->text()
-                       )
-                       . Html::label(
-                               $this->msg( 'wikibase-itembytitle-lookup-site' 
)->text(),
-                               'wb-itembytitle-sitename',
-                               array(
-                                       'class' => 'wb-label'
-                               )
-                       )
-                       . Html::input(
-                               'site',
-                               htmlspecialchars( $siteId ),
-                               'text',
-                               array(
-                                       'class' => 'wb-input',
-                                       'id' => 'wb-itembytitle-sitename',
-                                       'size' => 12
-                               )
-                       )
-                       . ' '
-                       . Html::label(
-                               $this->msg( 'wikibase-itembytitle-lookup-page' 
)->text(),
-                               'pagename',
-                               array(
-                                       'class' => 'wb-label'
-                               )
-                       )
-                       . Html::input(
-                               'page',
-                               $page ? htmlspecialchars( $page ) : '',
-                               'text',
-                               array(
-                                       'class' => 'wb-input',
-                                       'id' => 'pagename',
-                                       'size' => 36
-                               )
-                       )
-                       . Html::input(
-                               '',
-                               $this->msg( 'wikibase-itembytitle-submit' 
)->text(),
-                               'submit',
-                               array(
-                                       'id' => 'wb-itembytitle-submit',
-                                       'class' => 'wb-button'
-                               )
-                       )
-                       . Html::closeElement( 'fieldset' )
-                       . Html::closeElement( 'form' )
                );
 
+               HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() 
)
+                       ->setId( 'wb-itembytitle-form1' )
+                       ->setMethod( 'get' )
+                       ->setSubmitID( 'wb-itembytitle-submit' )
+                       ->setSubmitTextMsg( 'wikibase-itembytitle-submit' )
+                       ->setWrapperLegendMsg( 
'wikibase-itembytitle-lookup-fieldset' )
+                       ->setSubmitCallback( function () {// no-op
+                       } )->show();
+
                if ( $siteId && !$siteExists ) {
                        $this->showErrorHTML( $this->msg( 
'wikibase-itembytitle-error-site' ) );
                } elseif ( $siteExists && $page ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/235999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6e10a007ffb68a8ba9dc150360293e426090a65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <ricordisa...@openmailbox.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to