Glaisher has uploaded a new change for review.

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

Change subject: Cleanup on Special:AllPages and Special:PrefixIndex
......................................................................

Cleanup on Special:AllPages and Special:PrefixIndex

* Move pagination links to the left (on LTR) and below the form
* Drop a few HTML classes
* Minor code cleanups

Follows up I720d34e21950c18de3c6e0b1d6d8a4461db495cb

Bug: T32965
Change-Id: I19018d87b769320761a95410bb3198b31f16544d
---
M includes/specials/SpecialAllPages.php
M includes/specials/SpecialPrefixindex.php
M resources/src/mediawiki.special/mediawiki.special.css
3 files changed, 61 insertions(+), 91 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/12/247312/1

diff --git a/includes/specials/SpecialAllPages.php 
b/includes/specials/SpecialAllPages.php
index 4348b14..52bd947 100644
--- a/includes/specials/SpecialAllPages.php
+++ b/includes/specials/SpecialAllPages.php
@@ -100,7 +100,6 @@
         */
        function namespaceForm( $namespace = NS_MAIN, $from = '', $to = '', 
$hideredirects = false ) {
                $t = $this->getPageTitle();
-
                $out = Xml::openElement( 'div', array( 'class' => 
'namespaceoptions' ) );
                $out .= Xml::openElement(
                        'form',
@@ -148,7 +147,6 @@
                $out .= Xml::closeElement( 'fieldset' );
                $out .= Xml::closeElement( 'form' );
                $out .= Xml::closeElement( 'div' );
-
                return $out;
        }
 
@@ -276,7 +274,7 @@
                $self = $this->getPageTitle();
 
                $topLinks = array(
-                       Linker::link( $self, $this->msg( 'allpages' 
)->escaped() )
+                       Linker::link( $self, $this->msg( 'allpages' 
)->escaped() ) // XXX is this really needed?
                );
                $bottomLinks = array();
 
@@ -325,26 +323,21 @@
                        $bottomLinks[] = $nextLink;
                }
 
-               $nsForm = $this->namespaceForm( $namespace, $from, $to, 
$hideredirects );
-               $out2 = Xml::openElement( 'table', array( 'class' => 
'mw-allpages-table-form' ) ) .
-                       '<tr>
-                                               <td>' .
-                       $nsForm .
-                       '</td>
-                                               <td class="mw-allpages-nav">' .
-                       $this->getLanguage()->pipeList( $topLinks ) .
-                       '</td></tr></table>';
-
-               $output->addHTML( $out2 . $out );
+               $topOut = $this->namespaceForm( $namespace, $from, $to, 
$hideredirects );
+               $topOut .= Html::rawElement( 'div',
+                       array( 'class' => 'mw-allpages-nav' ),
+                       $this->getLanguage()->pipeList( $topLinks )
+               );
 
                if ( count( $bottomLinks ) ) {
-                       $output->addHTML(
-                               Html::element( 'hr' ) .
-                                       Html::rawElement( 'div', array( 'class' 
=> 'mw-allpages-nav' ),
-                                               $this->getLanguage()->pipeList( 
$bottomLinks )
-                                       )
-                       );
+                       $out .= Html::element( 'hr' ) .
+                               Html::rawElement( 'div',
+                                       array( 'class' => 'mw-allpages-nav' ),
+                                       $this->getLanguage()->pipeList( 
$bottomLinks )
+                               );
                }
+
+               $output->addHTML( $topOut . $out );
        }
 
        /**
diff --git a/includes/specials/SpecialPrefixindex.php 
b/includes/specials/SpecialPrefixindex.php
index bc5dfd0..4975bde 100644
--- a/includes/specials/SpecialPrefixindex.php
+++ b/includes/specials/SpecialPrefixindex.php
@@ -105,7 +105,7 @@
                $out .= Html::hidden( 'title', 
$this->getPageTitle()->getPrefixedText() );
                $out .= Xml::openElement( 'fieldset' );
                $out .= Xml::element( 'legend', null, $this->msg( 'allpages' 
)->text() );
-               $out .= Xml::openElement( 'table', array( 'id' => 'nsselect', 
'class' => 'allpages' ) );
+               $out .= Xml::openElement( 'table', array( 'id' => 'nsselect', 
'class' => 'allpages mw-prefixindex-nav-table' ) );
                $out .= "<tr>
                                <td class='mw-label'>" .
                        Xml::label( $this->msg( 'allpagesprefix' )->text(), 
'nsfrom' ) .
@@ -201,7 +201,7 @@
                                )
                        );
 
-                       # ## @todo FIXME: Side link to previous
+                       // @todo FIXME: Side link to previous
 
                        $n = 0;
                        if ( $res->numRows() > 0 ) {
@@ -239,54 +239,55 @@
                        }
                }
 
-               $footer = '';
+               $output = $this->getOutput();
+
                if ( $this->including() ) {
-                       $out2 = '';
-               } else {
-                       $nsForm = $this->namespacePrefixForm( $namespace, 
$prefix );
-                       $self = $this->getPageTitle();
-                       $out2 = Xml::openElement( 'table', array( 'id' => 
'mw-prefixindex-nav-table' ) ) .
-                               '<tr>
-                                       <td>' .
-                               $nsForm .
-                               '</td>
-                               <td id="mw-prefixindex-nav-form" 
class="mw-prefixindex-nav">';
-
-                       if ( $res && ( $n == $this->maxPerPage ) && ( $s = 
$res->fetchObject() ) ) {
-                               $query = array(
-                                       'from' => $s->page_title,
-                                       'prefix' => $prefix,
-                                       'hideredirects' => $this->hideRedirects,
-                                       'stripprefix' => $this->stripPrefix,
-                               );
-
-                               if ( $namespace || $prefix == '' ) {
-                                       // Keep the namespace even if it's 0 
for empty prefixes.
-                                       // This tells us we're not just a 
holdover from old links.
-                                       $query['namespace'] = $namespace;
-                               }
-
-                               $nextLink = Linker::linkKnown(
-                                       $self,
-                                       $this->msg( 'nextpage', str_replace( 
'_', ' ', $s->page_title ) )->escaped(),
-                                       array(),
-                                       $query
-                               );
-
-                               $out2 .= $nextLink;
-
-                               $footer = "\n" . Html::element( 'hr' ) .
-                                       Html::rawElement(
-                                               'div',
-                                               array( 'class' => 
'mw-prefixindex-nav' ),
-                                               $nextLink
-                                       );
-                       }
-                       $out2 .= "</td></tr>" .
-                               Xml::closeElement( 'table' );
+                       // We don't show the nav-links and the form when 
included onto other
+                       // pages so let's just finish here.
+                       $output->addHTML( $out );
+                       return;
                }
 
-               $this->getOutput()->addHTML( $out2 . $out . $footer );
+               $topOut = $this->namespacePrefixForm( $namespace, $prefix );
+
+               if ( $res && ( $n == $this->maxPerPage ) && ( $s = 
$res->fetchObject() ) ) {
+                       $query = array(
+                               'from' => $s->page_title,
+                               'prefix' => $prefix,
+                               'hideredirects' => $this->hideRedirects,
+                               'stripprefix' => $this->stripPrefix,
+                       );
+
+                       if ( $namespace || $prefix == '' ) {
+                               // Keep the namespace even if it's 0 for empty 
prefixes.
+                               // This tells us we're not just a holdover from 
old links.
+                               $query['namespace'] = $namespace;
+                       }
+
+                       $nextLink = Linker::linkKnown(
+                               $this->getPageTitle(),
+                               $this->msg( 'nextpage', str_replace( '_', ' ', 
$s->page_title ) )->escaped(),
+                               array(),
+                               $query
+                       );
+
+                       // Link shown at the top of the page below the form
+                       $topOut .= Html::rawElement( 'div',
+                               array( 'class' => 'mw-prefixindex-nav' ),
+                               $nextLink
+                       );
+
+                       // Link shown at the footer
+                       $out .= "\n" . Html::element( 'hr' ) .
+                               Html::rawElement(
+                                       'div',
+                                       array( 'class' => 'mw-prefixindex-nav' 
),
+                                       $nextLink
+                               );
+
+               }
+
+               $output->addHTML( $topOut . $out );
        }
 
        protected function getGroupName() {
diff --git a/resources/src/mediawiki.special/mediawiki.special.css 
b/resources/src/mediawiki.special/mediawiki.special.css
index 2b028ae..15f4e4d 100644
--- a/resources/src/mediawiki.special/mediawiki.special.css
+++ b/resources/src/mediawiki.special/mediawiki.special.css
@@ -28,30 +28,6 @@
        font-style: italic;
 }
 
-/* Special:Allpages */
-.mw-allpages-nav {
-       text-align: right;
-       margin-bottom: 1em;
-}
-table.mw-allpages-table-form {
-       width: 100%;
-}
-table.mw-allpages-table-form tr {
-       vertical-align: top;
-}
-
-/* Special:Prefixindex */
-.mw-prefixindex-nav {
-       text-align: right;
-}
-table#mw-prefixindex-nav-table {
-       width: 100%;
-}
-td#mw-prefixindex-nav-form {
-       margin-bottom: 1em;
-       vertical-align: top;
-}
-
 /* Special:Block */
 p.mw-ipb-conveniencelinks {
        font-size: 90%;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I19018d87b769320761a95410bb3198b31f16544d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Glaisher <glaisher.w...@gmail.com>

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

Reply via email to