Sukeesh has uploaded a new change for review.

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

Change subject: Changed to OOUI
......................................................................

Changed to OOUI

Bug: T117747
Change-Id: I3c93d2a2282438f238f22c8b8e5202513676bdf5
---
M includes/specials/SpecialBooksources.php
1 file changed, 21 insertions(+), 42 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/49/277049/1

diff --git a/includes/specials/SpecialBooksources.php 
b/includes/specials/SpecialBooksources.php
index fe90a4f..1794dec 100644
--- a/includes/specials/SpecialBooksources.php
+++ b/includes/specials/SpecialBooksources.php
@@ -43,20 +43,27 @@
         *
         * @param string $isbn ISBN passed as a subpage parameter
         */
-       public function execute( $isbn ) {
-               $this->setHeaders();
-               $this->outputHeader();
-               $this->isbn = self::cleanIsbn( $isbn ?: 
$this->getRequest()->getText( 'isbn' ) );
-               $this->getOutput()->addHTML( $this->makeForm() );
-               if ( $this->isbn !== '' ) {
-                       if ( !self::isValidISBN( $this->isbn ) ) {
-                               $this->getOutput()->wrapWikiMsg(
-                                       "<div class=\"error\">\n$1\n</div>",
-                                       'booksources-invalid-isbn'
-                               );
-                       }
-                       $this->showList();
-               }
+
+       public function execute($isbn) {
+               $hiddenFields = [
+            'title' => $this->getPageTitle()->getPrefixedDBkey(),
+        ];
+        $this->setHeaders();
+        $formDescriptor = array(
+            'simpletextfield' => array(
+                    'label' => 'ISBN', 
+                    'class' => 'HTMLTextField',
+                    'size' => 20,
+            )
+        );
+
+        $htmlForm = HTMLForm::factory( 'ooui',$formDescriptor, 
$this->getContext());
+        $htmlForm->setSubmitText( 'Search' ); 
+        $htmlForm->setWrapperLegendMsg( 'booksources-search-legend' );
+        $htmlForm->addHiddenFields( $hiddenFields );
+        $htmlForm->setAction( wfScript() );
+        $htmlForm->setMethod( 'get' );
+        $htmlForm->prepareForm()->displayForm( false ); 
        }
 
        /**
@@ -118,34 +125,6 @@
         *
         * @return string
         */
-       private function makeForm() {
-               $form = Html::openElement( 'fieldset' ) . "\n";
-               $form .= Html::element(
-                       'legend',
-                       [],
-                       $this->msg( 'booksources-search-legend' )->text()
-               ) . "\n";
-               $form .= Html::openElement( 'form', [ 'method' => 'get', 
'action' => wfScript() ] ) . "\n";
-               $form .= Html::hidden( 'title', 
$this->getPageTitle()->getPrefixedText() ) . "\n";
-               $form .= '<p>' . Xml::inputLabel(
-                       $this->msg( 'booksources-isbn' )->text(),
-                       'isbn',
-                       'isbn',
-                       20,
-                       $this->isbn,
-                       [ 'autofocus' => '', 'class' => 'mw-ui-input-inline' ]
-               );
-
-               $form .= '&#160;' . Html::submitButton(
-                       $this->msg( 'booksources-search' )->text(),
-                       [], [ 'mw-ui-progressive' ]
-               ) . "</p>\n";
-
-               $form .= Html::closeElement( 'form' ) . "\n";
-               $form .= Html::closeElement( 'fieldset' ) . "\n";
-
-               return $form;
-       }
 
        /**
         * Determine where to get the list of book sources from,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c93d2a2282438f238f22c8b8e5202513676bdf5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Sukeesh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to