*/
function namespaceForm( $namespace = NS_MAIN, $from = '', $to = '', $hideredirects = false ) {
$t = $this->getPageTitle();
-
$out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) );
$out .= Xml::openElement(
'form',
$out .= Xml::closeElement( 'fieldset' );
$out .= Xml::closeElement( 'form' );
$out .= Xml::closeElement( 'div' );
-
return $out;
}
return;
}
+ $navLinks = array();
$self = $this->getPageTitle();
- $topLinks = array(
- Linker::link( $self, $this->msg( 'allpages' )->escaped() )
- );
- $bottomLinks = array();
-
- # Do we put a previous link ?
+ // Generate a "previous page" link if needed
if ( $prevTitle ) {
$query = array( 'from' => $prevTitle->getText() );
$query['hideredirects'] = $hideredirects;
}
- $prevLink = Linker::linkKnown(
+ $navLinks[] = Linker::linkKnown(
$self,
$this->msg( 'prevpage', $prevTitle->getText() )->escaped(),
array(),
$query
);
- $topLinks[] = $prevLink;
- $bottomLinks[] = $prevLink;
+
}
+ // Generate a "next page" link if needed
if ( $n == $this->maxPerPage && $s = $res->fetchObject() ) {
# $s is the first link of the next chunk
$t = Title::makeTitle( $namespace, $s->page_title );
$query['hideredirects'] = $hideredirects;
}
- $nextLink = Linker::linkKnown(
+ $navLinks[] = Linker::linkKnown(
$self,
$this->msg( 'nextpage', $t->getText() )->escaped(),
array(),
$query
);
- $topLinks[] = $nextLink;
- $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 );
-
- if ( count( $bottomLinks ) ) {
- $output->addHTML(
- Html::element( 'hr' ) .
- Html::rawElement( 'div', array( 'class' => 'mw-allpages-nav' ),
- $this->getLanguage()->pipeList( $bottomLinks )
- )
+ $topOut = $this->namespaceForm( $namespace, $from, $to, $hideredirects );
+
+ if ( count( $navLinks ) ) {
+ // Add pagination links
+ $pagination = Html::rawElement( 'div',
+ array( 'class' => 'mw-allpages-nav' ),
+ $this->getLanguage()->pipeList( $navLinks )
);
+
+ $topOut .= $pagination;
+ $out .= Html::element( 'hr' ) . $pagination; // Footer
}
+
+ $output->addHTML( $topOut . $out );
}
/**
)
);
- # ## @todo FIXME: Side link to previous
+ // @todo FIXME: Side link to previous
$n = 0;
if ( $res->numRows() > 0 ) {
}
}
- $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,
- );
+ $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() {
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%;