(bug 3825) Namespace filtering on Special:Newpages
authorRob Church <robchurch@users.mediawiki.org>
Fri, 21 Apr 2006 06:49:23 +0000 (06:49 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Fri, 21 Apr 2006 06:49:23 +0000 (06:49 +0000)
RELEASE-NOTES
includes/QueryPage.php
includes/SpecialNewpages.php

index 6966466..97d7048 100644 (file)
@@ -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 ==
 
index eb1a028..1c9c250 100644 (file)
@@ -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();
index 7c7b97e..4b0110a 100644 (file)
@@ -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();