From 39ea0467d4d8a9cd53276a65b1207ef6b2a998a1 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Fri, 21 Apr 2006 06:49:23 +0000 Subject: [PATCH] (bug 3825) Namespace filtering on Special:Newpages --- RELEASE-NOTES | 2 +- includes/QueryPage.php | 11 +++++++++++ includes/SpecialNewpages.php | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6966466dab..97d7048ffc 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -108,7 +108,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 5422) Stub for Romani (rmy) language which extends ro * Fix linktrail for LanguageSr * (bug 5664) Fix Bosnian linktrail - +* (bug 3825) Namespace filtering on Special:Newpages == Compatibility == diff --git a/includes/QueryPage.php b/includes/QueryPage.php index eb1a02848d..1c9c2506d2 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -63,6 +63,14 @@ class QueryPage { * @var bool */ var $listoutput = false; + + /** + * The offset and limit in use, as passed to the query() function + * + * @var integer + */ + var $offset = 0; + var $limit = 0; /** * A mutator for $this->listoutput; @@ -264,6 +272,9 @@ class QueryPage { function doQuery( $offset, $limit, $shownavigation=true ) { global $wgUser, $wgOut, $wgLang, $wgContLang; + $this->offset = $offset; + $this->limit = $limit; + $sname = $this->getName(); $fname = get_class($this) . '::doQuery'; $sql = $this->getSQL(); diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index 7c7b97e63a..4b0110a0b9 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -106,6 +106,34 @@ class NewPagesPage extends QueryPage { } return parent::feedItemDesc( $row ); } + + /** + * Show a namespace selection form for filtering + * + * @return string + */ + function getPageHeader() { + $thisTitle = Title::makeTitle( NS_SPECIAL, $this->getName() ); + $form = wfElement( 'form', array( 'method' => 'post', 'action' => $thisTitle->escapeLocalUrl() ), NULL ); + $form .= wfElement( 'label', array( 'for' => 'namespace' ), wfMsgHtml( 'namespace' ) ) . ' '; + $form .= HtmlNamespaceSelector( $this->namespace ); + # Preserve the offset and limit + $form .= wfElement( 'input', array( 'type' => 'hidden', 'name' => 'offset', 'value' => $this->offset ), '' ); + $form .= wfElement( 'input', array( 'type' => 'hidden', 'name' => 'limit', 'value' => $this->limit ), '' ); + $form .= wfElement( 'input', array( 'type' => 'submit', 'name' => 'submit', 'id' => 'submit', 'value' => wfMsgHtml( 'allpagessubmit' ) ), '' ); + $form .= wfCloseElement( 'form' ); + return( $form ); + } + + /** + * Link parameters + * + * @return array + */ + function linkParameters() { + return( array( 'namespace' => $this->namespace ) ); + } + } /** @@ -136,7 +164,11 @@ function wfSpecialNewpages($par, $specialPage) { } } } + } else { + if( $ns = $wgRequest->getVal( 'namespace', 0 ) ) + $namespace = $ns; } + if ( ! isset( $shownavigation ) ) $shownavigation = ! $specialPage->including(); -- 2.20.1