Revert "Use OOUI HTMLForm for Special:Watchlist"
authorLegoktm <legoktm.wikipedia@gmail.com>
Thu, 30 Jul 2015 18:55:20 +0000 (18:55 +0000)
committerLegoktm <legoktm.wikipedia@gmail.com>
Thu, 30 Jul 2015 18:55:20 +0000 (18:55 +0000)
Issues with spacing (T107311), probably shouldn't have
been merged right before the branch cut.

This reverts commit 9508c5bd576ee4206eb8e89b7d2ba82985f4e151.

Change-Id: Ibf2ca5a33b8ab0f7381c720c6c92fbfd7a7c819d

autoload.php
includes/htmlform/HTMLAdvancedSelectNamespace.php [deleted file]
includes/htmlform/HTMLAdvancedSelectNamespaceWithButton.php [deleted file]
includes/htmlform/HTMLCheckField.php
includes/htmlform/HTMLForm.php
includes/specials/SpecialWatchlist.php
resources/Resources.php
resources/src/mediawiki.special/mediawiki.special.watchlist.css [deleted file]

index 4109740..a8940c4 100644 (file)
@@ -478,8 +478,6 @@ $wgAutoloadLocalClasses = array(
        'GitInfo' => __DIR__ . '/includes/GitInfo.php',
        'GlobalDependency' => __DIR__ . '/includes/cache/CacheDependency.php',
        'GlobalVarConfig' => __DIR__ . '/includes/config/GlobalVarConfig.php',
-       'HTMLAdvancedSelectNamespace' => __DIR__ . '/includes/htmlform/HTMLAdvancedSelectNamespace.php',
-       'HTMLAdvancedSelectNamespaceWithButton' => __DIR__ . '/includes/htmlform/HTMLAdvancedSelectNamespaceWithButton.php',
        'HTMLApiField' => __DIR__ . '/includes/htmlform/HTMLApiField.php',
        'HTMLAutoCompleteSelectField' => __DIR__ . '/includes/htmlform/HTMLAutoCompleteSelectField.php',
        'HTMLButtonField' => __DIR__ . '/includes/htmlform/HTMLButtonField.php',
diff --git a/includes/htmlform/HTMLAdvancedSelectNamespace.php b/includes/htmlform/HTMLAdvancedSelectNamespace.php
deleted file mode 100644 (file)
index 348d170..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-/**
- * Creates a Html::namespaceSelector input field with a button assigned to the input field.
- * @since 1.26
- */
-class HTMLAdvancedSelectNamespace extends HTMLSelectNamespace {
-       function getInputHTML( $value ) {
-               $allValue = ( isset( $this->mParams['all'] ) ? $this->mParams['all'] : '' );
-
-               return parent::getInputHTML( $value ) . '&#160;' .
-                       Xml::checkLabel(
-                               $this->msg( 'invert' )->text(),
-                               $this->mParams['invertname'],
-                               $this->mParams['invertid'],
-                               $this->mParams['invertdefault'],
-                               array( 'title' => $this->msg( 'tooltip-invert' )->text() )
-                       ) . '&#160;' .
-                       Xml::checkLabel(
-                               $this->msg( 'namespace_association' )->text(),
-                               $this->mParams['associatedname'],
-                               $this->mParams['associatedid'],
-                               $this->mParams['associateddefault'],
-                               array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
-                       );
-       }
-
-       /**
-        * Get the OOUI version of this field.
-        * @since 1.26
-        * @param string $value
-        * @return MediaWiki\\Widget\\NamespaceInputWidget A layout with all widget.
-        */
-       public function getInputOOUI( $value ) {
-               # There are more fields in this Widget as only one, so there are more values instead of only once.
-               # Filter the data from the request before creating the form to set the correct values to the
-               # Widget elements.
-               # Get WebRequest only, if there is an instance of HTMLForm, use default data instead
-               $invertdefault = false;
-               $associateddefault = false;
-               if ( $this->mParent instanceof HTMLForm ) {
-                       $request = $this->mParent->getRequest();
-                       if ( $request->getCheck( $this->mParams['associatedname'] ) ) {
-                               $associateddefault = true;
-                       }
-                       if ( $request->getCheck( $this->mParams['invertname'] ) ) {
-                               $invertdefault = true;
-                       }
-               }
-
-               // Unsupported: invertid, associatedid
-               return new MediaWiki\Widget\NamespaceInputWidget( array(
-                       'valueNamespace' => $value,
-                       'nameNamespace' => $this->mName,
-                       'id' => $this->mID,
-                       'includeAllValue' => $this->mAllValue,
-                       'nameInvert' => $this->mParams['invertname'],
-                       'labelInvert' => $this->msg( 'invert' )->text(),
-                       'valueInvert' => $invertdefault,
-                       'nameAssociated' => $this->mParams['associatedname'],
-                       'valueAssociated' => $associateddefault,
-                       'labelAssociated' => $this->msg( 'namespace_association' )->text(),
-               ) );
-       }
-}
diff --git a/includes/htmlform/HTMLAdvancedSelectNamespaceWithButton.php b/includes/htmlform/HTMLAdvancedSelectNamespaceWithButton.php
deleted file mode 100644 (file)
index 71c9509..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-/**
- * Creates a Html::namespaceSelector input field with a button assigned to the input field.
- */
-class HTMLAdvancedSelectNamespaceWithButton extends HTMLAdvancedSelectNamespace {
-       /** @var HTMLFormClassWithButton $mClassWithButton */
-       protected $mClassWithButton = null;
-
-       public function __construct( $info ) {
-               $this->mClassWithButton = new HTMLFormFieldWithButton( $info );
-               parent::__construct( $info );
-       }
-
-       public function getInputHTML( $value ) {
-               return $this->mClassWithButton->getElement( parent::getInputHTML( $value ) );
-       }
-}
index 646b0d5..9666c4e 100644 (file)
@@ -14,7 +14,7 @@ class HTMLCheckField extends HTMLFormField {
                $attr = $this->getTooltipAndAccessKey();
                $attr['id'] = $this->mID;
 
-               $attr += $this->getAttributes( array( 'disabled', 'tabindex', 'title' ) );
+               $attr += $this->getAttributes( array( 'disabled', 'tabindex' ) );
 
                if ( $this->mClass !== '' ) {
                        $attr['class'] = $this->mClass;
index b10d789..a56b398 100644 (file)
@@ -140,8 +140,6 @@ class HTMLForm extends ContextSource {
                'selectandother' => 'HTMLSelectAndOtherField',
                'namespaceselect' => 'HTMLSelectNamespace',
                'namespaceselectwithbutton' => 'HTMLSelectNamespaceWithButton',
-               'advancednamespaceselect' => 'HTMLAdvancedSelectNamespace',
-               'advancednamespaceselectwithbutton' => 'HTMLAdvancedSelectNamespaceWithButton',
                'tagfilter' => 'HTMLTagFilter',
                'submit' => 'HTMLSubmitField',
                'hidden' => 'HTMLHiddenField',
index 211798e..20f5776 100644 (file)
@@ -396,8 +396,6 @@ class SpecialWatchlist extends ChangesListSpecialPage {
         */
        public function doHeader( $opts, $numRows ) {
                $user = $this->getUser();
-               $out = $this->getOutput();
-               $out->addModules( 'mediawiki.special.watchlist' );
 
                $this->getOutput()->addSubtitle(
                        $this->msg( 'watchlistfor2', $user->getName() )
@@ -452,34 +450,39 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $form .= $wlInfo;
                $form .= $cutofflinks;
                $form .= $lang->pipeList( $links ) . "\n";
-               $form .= "<hr />\n";
-               $out->addHtml( $form );
-
-               $formDescriptor = array(
-                       'namespace' => array(
-                               'class' => 'HTMLAdvancedSelectNamespaceWithButton',
-                               'label-message' => 'namespace',
-                               'default' => $opts['namespace'],
+               $form .= "<hr />\n<p>";
+               $form .= Html::namespaceSelector(
+                       array(
+                               'selected' => $opts['namespace'],
+                               'all' => '',
+                               'label' => $this->msg( 'namespace' )->text()
+                       ), array(
                                'name' => 'namespace',
                                'id' => 'namespace',
-                               'invertdefault' => $opts['invert'],
-                               'invertname' => 'invert',
-                               'invertid' => 'nsinvert',
-                               'associateddefault' => $opts['associated'],
-                               'associatedname' => 'associated',
-                               'associatedid' => 'nsassociated',
-                               'buttondefault' => $this->msg( 'allpagessubmit' )->text(),
-                       ),
-               );
-               $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
-               $htmlForm->suppressDefaultSubmit();
-               $htmlForm->addHiddenFields( $hiddenFields );
-               $htmlForm->prepareForm()->displayForm( false );
-
-               $form = '';
+                               'class' => 'namespaceselector',
+                       )
+               ) . '&#160;';
+               $form .= Xml::checkLabel(
+                       $this->msg( 'invert' )->text(),
+                       'invert',
+                       'nsinvert',
+                       $opts['invert'],
+                       array( 'title' => $this->msg( 'tooltip-invert' )->text() )
+               ) . '&#160;';
+               $form .= Xml::checkLabel(
+                       $this->msg( 'namespace_association' )->text(),
+                       'associated',
+                       'nsassociated',
+                       $opts['associated'],
+                       array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
+               ) . '&#160;';
+               $form .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . "</p>\n";
+               foreach ( $hiddenFields as $key => $value ) {
+                       $form .= Html::hidden( $key, $value ) . "\n";
+               }
                $form .= Xml::closeElement( 'fieldset' ) . "\n";
                $form .= Xml::closeElement( 'form' ) . "\n";
-               $out->addHtml( $form );
+               $this->getOutput()->addHTML( $form );
 
                $this->setBottomText( $opts );
        }
@@ -488,7 +491,6 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                $nondefaults = $opts->getChangedValues();
                $form = "";
                $user = $this->getUser();
-               $out = $this->getOutput();
 
                $dbr = $this->getDB();
                $numItems = $this->countItems( $dbr );
@@ -511,25 +513,19 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                }
                $form .= "</p>";
 
-               $out->addHTML( $form );
-
                if ( $numItems > 0 && $showUpdatedMarker ) {
-                       $formDescriptor = array(
-                               'resetbutton' => array(
-                                       'type' => 'submit',
-                                       'name' => 'dummy',
-                                       'default' => $this->msg( 'enotif_reset' )->text(),
-                               ),
-                       );
-                       $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
-                       $htmlForm->suppressDefaultSubmit();
-                       $htmlForm->setId( 'mw-watchlist-resetbutton' );
-                       $nondefaults['reset'] = 'all';
-                       $htmlForm->addHiddenFields( $nondefaults );
-                       $htmlForm->prepareForm()->displayForm( false );
+                       $form .= Xml::openElement( 'form', array( 'method' => 'post',
+                               'action' => $this->getPageTitle()->getLocalURL(),
+                               'id' => 'mw-watchlist-resetbutton' ) ) . "\n" .
+                       Xml::submitButton( $this->msg( 'enotif_reset' )->text(), array( 'name' => 'dummy' ) ) . "\n" .
+                       Html::hidden( 'reset', 'all' ) . "\n";
+                       foreach ( $nondefaults as $key => $value ) {
+                               $form .= Html::hidden( $key, $value ) . "\n";
+                       }
+                       $form .= Xml::closeElement( 'form' ) . "\n";
                }
 
-               $form = Xml::openElement( 'form', array(
+               $form .= Xml::openElement( 'form', array(
                        'method' => 'post',
                        'action' => $this->getPageTitle()->getLocalURL(),
                        'id' => 'mw-watchlist-form'
@@ -542,7 +538,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
 
                $form .= SpecialRecentChanges::makeLegend( $this->getContext() );
 
-               $out->addHTML( $form );
+               $this->getOutput()->addHTML( $form );
        }
 
        protected function showHideLink( $options, $message, $name, $value ) {
index 46b44a6..fb0971e 100644 (file)
@@ -1655,10 +1655,6 @@ return array(
        'mediawiki.special.version' => array(
                'styles' => 'resources/src/mediawiki.special/mediawiki.special.version.css',
        ),
-       'mediawiki.special.watchlist' => array(
-               'position' => 'top',
-               'styles' => 'resources/src/mediawiki.special/mediawiki.special.watchlist.css',
-       ),
 
        /* MediaWiki Installer */
 
diff --git a/resources/src/mediawiki.special/mediawiki.special.watchlist.css b/resources/src/mediawiki.special/mediawiki.special.watchlist.css
deleted file mode 100644 (file)
index c802f8c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-.mw-htmlform-ooui-wrapper {
-       /* We're gonna need a bigger form! */
-       width: 60em;
-}