Merge "Use responsive CSS columns on Special:PrefixIndex and Special:AllPages"
[lhc/web/wiklou.git] / includes / specials / SpecialPrefixindex.php
index 2e67e2b..bc5dfd0 100644 (file)
@@ -36,9 +36,6 @@ class SpecialPrefixindex extends SpecialAllPages {
 
        protected $hideRedirects = false;
 
-       // number of columns in output table
-       protected $columns = 3;
-
        // Inherit $maxPerPage
 
        function __construct() {
@@ -66,7 +63,6 @@ class SpecialPrefixindex extends SpecialAllPages {
                $namespace = (int)$ns; // if no namespace given, use 0 (NS_MAIN).
                $this->hideRedirects = $request->getBool( 'hideredirects', $this->hideRedirects );
                $this->stripPrefix = $request->getBool( 'stripprefix', $this->stripPrefix );
-               $this->columns = $request->getInt( 'columns', $this->columns );
 
                $namespaces = $wgContLang->getNamespaces();
                $out->setPageTitle(
@@ -102,7 +98,10 @@ class SpecialPrefixindex extends SpecialAllPages {
         */
        protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) {
                $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) );
-               $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $this->getConfig()->get( 'Script' ) ) );
+               $out .= Xml::openElement(
+                       'form',
+                       array( 'method' => 'get', 'action' => $this->getConfig()->get( 'Script' ) )
+               );
                $out .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
                $out .= Xml::openElement( 'fieldset' );
                $out .= Xml::element( 'legend', null, $this->msg( 'allpages' )->text() );
@@ -177,7 +176,7 @@ class SpecialPrefixindex extends SpecialAllPages {
                        list( $namespace, $prefixKey, $prefix ) = $prefixList;
                        list( /* $fromNS */, $fromKey, ) = $fromList;
 
-                       ### @todo FIXME: Should complain if $fromNs != $namespace
+                       # ## @todo FIXME: Should complain if $fromNs != $namespace
 
                        $dbr = wfGetDB( DB_SLAVE );
 
@@ -202,11 +201,12 @@ class SpecialPrefixindex extends SpecialAllPages {
                                )
                        );
 
-                       ### @todo FIXME: Side link to previous
+                       # ## @todo FIXME: Side link to previous
 
                        $n = 0;
                        if ( $res->numRows() > 0 ) {
-                               $out = Xml::openElement( 'table', array( 'class' => 'mw-prefixindex-list-table' ) );
+                               $out = Html::openElement( 'div', array( 'class' => 'mw-prefixindex-body' ) );
+                               $out .= Html::openElement( 'ul', array( 'class' => 'mw-prefixindex-list' ) );
 
                                $prefixLength = strlen( $prefix );
                                while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
@@ -227,21 +227,13 @@ class SpecialPrefixindex extends SpecialAllPages {
                                        } else {
                                                $link = '[[' . htmlspecialchars( $s->page_title ) . ']]';
                                        }
-                                       if ( $n % $this->columns == 0 ) {
-                                               $out .= '<tr>';
-                                       }
-                                       $out .= "<td>$link</td>";
+
+                                       $out .= "<li> $link </li>\n";
                                        $n++;
-                                       if ( $n % $this->columns == 0 ) {
-                                               $out .= '</tr>';
-                                       }
-                               }
 
-                               if ( $n % $this->columns != 0 ) {
-                                       $out .= '</tr>';
                                }
-
-                               $out .= Xml::closeElement( 'table' );
+                               $out .= Html::closeElement( 'ul' );
+                               $out .= Html::closeElement( 'div' );
                        } else {
                                $out = '';
                        }
@@ -266,7 +258,6 @@ class SpecialPrefixindex extends SpecialAllPages {
                                        'prefix' => $prefix,
                                        'hideredirects' => $this->hideRedirects,
                                        'stripprefix' => $this->stripPrefix,
-                                       'columns' => $this->columns,
                                );
 
                                if ( $namespace || $prefix == '' ) {