Set taborder for Special:ListFiles
authorAlex Monk <krenair@gmail.com>
Sun, 17 Feb 2013 22:52:28 +0000 (22:52 +0000)
committerAlex Monk <krenair@gmail.com>
Mon, 1 Jul 2013 01:42:15 +0000 (02:42 +0100)
Order: Items per page, name prefix (if there's no miser mode), username, and submit button

Bug: 43556
Change-Id: Ic0ce1893c3da8e127584cbc90a400d45e3d715f6

includes/Pager.php
includes/Xml.php
includes/specials/SpecialListfiles.php

index c2bd364..c7f51a3 100644 (file)
@@ -1172,11 +1172,15 @@ abstract class TablePager extends IndexPager {
        /**
         * Get a "<select>" element which has options for each of the allowed limits
         *
+        * @param $attribs String: Extra attributes to set
         * @return String: HTML fragment
         */
-       public function getLimitSelect() {
+       public function getLimitSelect( $attribs = array() ) {
                $select = new XmlSelect( 'limit', false, $this->mLimit );
                $select->addOptions( $this->getLimitSelectList() );
+               foreach ( $attribs as $name => $value ) {
+                       $select->setAttribute( $name, $value );
+               }
                return $select->getHTML();
        }
 
index 223061a..d5501fe 100644 (file)
@@ -741,9 +741,10 @@ class Xml {
         * Output optionally includes a submit button.
         * @param array $fields Associative array, key is the name of a message that contains a description for the field, value is an HTML string containing the appropriate input.
         * @param string $submitLabel The name of a message containing a label for the submit button.
+        * @param array $submitAttribs The attributes to add to the submit button
         * @return string HTML form.
         */
-       public static function buildForm( $fields, $submitLabel = null ) {
+       public static function buildForm( $fields, $submitLabel = null, $submitAttribs = array() ) {
                $form = '';
                $form .= "<table><tbody>";
 
@@ -763,7 +764,7 @@ class Xml {
                if ( $submitLabel ) {
                        $form .= Xml::openElement( 'tr' );
                        $form .= Xml::tags( 'td', array(), '' );
-                       $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMessage( $submitLabel )->text() ) . Xml::closeElement( 'td' );
+                       $form .= Xml::openElement( 'td', array( 'class' => 'mw-submit' ) ) . Xml::submitButton( wfMessage( $submitLabel )->text(), $submitAttribs ) . Xml::closeElement( 'td' );
                        $form .= Xml::closeElement( 'tr' );
                }
 
index f508b7c..070cdea 100644 (file)
@@ -255,7 +255,7 @@ class ImageListPager extends TablePager {
        function getForm() {
                global $wgScript, $wgMiserMode;
                $inputForm = array();
-               $inputForm['table_pager_limit_label'] = $this->getLimitSelect();
+               $inputForm['table_pager_limit_label'] = $this->getLimitSelect( array( 'tabindex' => 1 ) );
                if ( !$wgMiserMode ) {
                        $inputForm['listfiles_search_for'] = Html::input(
                                'ilsearch',
@@ -265,6 +265,7 @@ class ImageListPager extends TablePager {
                                        'size' => '40',
                                        'maxlength' => '255',
                                        'id' => 'mw-ilsearch',
+                                       'tabindex' => 2,
                                )
                        );
                }
@@ -272,6 +273,7 @@ class ImageListPager extends TablePager {
                        'size' => '40',
                        'maxlength' => '255',
                        'id' => 'mw-listfiles-user',
+                       'tabindex' => 3,
                ) );
 
                return Html::openElement( 'form',
@@ -279,7 +281,7 @@ class ImageListPager extends TablePager {
                ) .
                        Xml::fieldset( $this->msg( 'listfiles' )->text() ) .
                        Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
-                       Xml::buildForm( $inputForm, 'table_pager_limit_submit' ) .
+                       Xml::buildForm( $inputForm, 'table_pager_limit_submit', array( 'tabindex' => 4 ) ) .
                        $this->getHiddenFields( array( 'limit', 'ilsearch', 'user', 'title' ) ) .
                        Html::closeElement( 'fieldset' ) .
                        Html::closeElement( 'form' ) . "\n";