protected $hideRedirects = false;
- // number of columns in output table
- protected $columns = 3;
-
// Inherit $maxPerPage
function __construct() {
$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(
)
);
- # ## @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() ) ) {
} 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 = '';
}
}
- $footer = '';
- 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,
- 'columns' => $this->columns,
- );
+ $output = $this->getOutput();
- 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;
- }
+ if ( $this->including() ) {
+ // We don't show the nav-links and the form when included into other
+ // pages so let's just finish here.
+ $output->addHTML( $out );
+ return;
+ }
- $nextLink = Linker::linkKnown(
- $self,
- $this->msg( 'nextpage', str_replace( '_', ' ', $s->page_title ) )->escaped(),
- array(),
- $query
- );
+ $topOut = $this->namespacePrefixForm( $namespace, $prefix );
- $out2 .= $nextLink;
+ if ( $res && ( $n == $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) {
+ $query = array(
+ 'from' => $s->page_title,
+ 'prefix' => $prefix,
+ 'hideredirects' => $this->hideRedirects,
+ 'stripprefix' => $this->stripPrefix,
+ );
- $footer = "\n" . Html::element( 'hr' ) .
- Html::rawElement(
- 'div',
- array( 'class' => 'mw-prefixindex-nav' ),
- $nextLink
- );
+ 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;
}
- $out2 .= "</td></tr>" .
- Xml::closeElement( 'table' );
+
+ $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
+ );
+
}
- $this->getOutput()->addHTML( $out2 . $out . $footer );
+ $output->addHTML( $topOut . $out );
}
protected function getGroupName() {