From e2d46d0c04203ce1e577321db6a8d6c97d62e938 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 15 Aug 2008 19:02:48 +0000 Subject: [PATCH] Decouple from allpages a little to avoid E_STRICT notices --- includes/specials/SpecialPrefixindex.php | 51 +++++++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 9c88034906..49dc6c72b6 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -26,13 +26,13 @@ function wfSpecialPrefixIndex( $par=NULL, $specialPage ) { ); if ( isset($par) ) { - $indexPage->showChunk( $namespace, $par, $specialPage->including(), $from ); + $indexPage->showPrefixChunk( $namespace, $par, $specialPage->including(), $from ); } elseif ( isset($prefix) ) { - $indexPage->showChunk( $namespace, $prefix, $specialPage->including(), $from ); + $indexPage->showPrefixChunk( $namespace, $prefix, $specialPage->including(), $from ); } elseif ( isset($from) ) { - $indexPage->showChunk( $namespace, $from, $specialPage->including(), $from ); + $indexPage->showPrefixChunk( $namespace, $from, $specialPage->including(), $from ); } else { - $wgOut->addHtml($indexPage->namespaceForm ( $namespace, null )); + $wgOut->addHtml( $indexPage->namespacePrefixForm( $namespace, null ) ); } } @@ -46,12 +46,51 @@ class SpecialPrefixindex extends SpecialAllpages { // Define other properties protected $name = 'Prefixindex'; protected $nsfromMsg = 'allpagesprefix'; + + /** + * HTML for the top form + * @param integer $namespace A namespace constant (default NS_MAIN). + * @param string $from dbKey we are starting listing at. + */ + function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) { + global $wgScript; + $t = SpecialPage::getTitleFor( $this->name ); + + $out = Xml::openElement( 'div', array( 'class' => 'namespaceoptions' ) ); + $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); + $out .= Xml::hidden( 'title', $t->getPrefixedText() ); + $out .= Xml::openElement( 'fieldset' ); + $out .= Xml::element( 'legend', null, wfMsg( 'allpages' ) ); + $out .= Xml::openElement( 'table', array( 'id' => 'nsselect', 'class' => 'allpages' ) ); + $out .= " + " . + Xml::label( wfMsg( 'allpagesfrom' ), 'nsfrom' ) . + " + " . + Xml::input( 'from', 30, str_replace('_',' ',$from), array( 'id' => 'nsfrom' ) ) . + " + + + " . + Xml::label( wfMsg( 'namespace' ), 'namespace' ) . + " + " . + Xml::namespaceSelector( $namespace, null ) . ' ' . + Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . + " + "; + $out .= Xml::closeElement( 'table' ); + $out .= Xml::closeElement( 'fieldset' ); + $out .= Xml::closeElement( 'form' ); + $out .= Xml::closeElement( 'div' ); + return $out; + } /** * @param integer $namespace (Default NS_MAIN) * @param string $from list all pages from this name (default FALSE) */ - function showChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = null ) { + function showPrefixChunk( $namespace = NS_MAIN, $prefix, $including = false, $from = null ) { global $wgOut, $wgUser, $wgContLang; $fname = 'indexShowChunk'; @@ -130,7 +169,7 @@ class SpecialPrefixindex extends SpecialAllpages { if ( $including ) { $out2 = ''; } else { - $nsForm = $this->namespaceForm ( $namespace, $prefix ); + $nsForm = $this->namespacePrefixForm( $namespace, $prefix ); $out2 = ''; $out2 .= '
' . $nsForm; $out2 .= '' . -- 2.20.1