From: Daniel De Marco Date: Mon, 3 Feb 2014 20:00:53 +0000 (-0500) Subject: Add columns option to Special:PrefixIndex X-Git-Tag: 1.31.0-rc.0~16232^2 X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=commitdiff_plain;h=0903545203a1f603e17fb478db53122e605b21fd;p=lhc%2Fweb%2Fwiklou.git Add columns option to Special:PrefixIndex Adds support for specifying the number of output columns to use in the table generated by Special:PrefixIndex. Can be used as follows: {{Special:PrefixIndex/{{FULLPAGENAME}}/|columns=2}} Bug: 60759 Change-Id: Ic824351132ec8bf7c35116f6ab19f23386ead33e --- diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 4548b634cd..16e6843c6d 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -36,6 +36,9 @@ class SpecialPrefixindex extends SpecialAllpages { protected $hideRedirects = false; + // number of columns in output table + protected $columns = 3; + // Inherit $maxPerPage function __construct() { @@ -63,6 +66,7 @@ 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( @@ -224,17 +228,17 @@ class SpecialPrefixindex extends SpecialAllpages { } else { $link = '[[' . htmlspecialchars( $s->page_title ) . ']]'; } - if ( $n % 3 == 0 ) { + if ( $n % $this->columns == 0 ) { $out .= ''; } $out .= "$link"; $n++; - if ( $n % 3 == 0 ) { + if ( $n % $this->columns == 0 ) { $out .= ''; } } - if ( $n % 3 != 0 ) { + if ( $n % $this->columns != 0 ) { $out .= ''; } @@ -265,6 +269,7 @@ class SpecialPrefixindex extends SpecialAllpages { 'prefix' => $prefix, 'hideredirects' => $this->hideRedirects, 'stripprefix' => $this->stripPrefix, + 'columns' => $this->columns, ); if ( $namespace || $prefix == '' ) {