* (bug 10798) Exclude MediaWiki namespace from filtering options on Special:Protected...
authorRob Church <robchurch@users.mediawiki.org>
Sat, 4 Aug 2007 12:20:41 +0000 (12:20 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 4 Aug 2007 12:20:41 +0000 (12:20 +0000)
* Introduce a fourth evil parameter to Xml::namespaceSelector() to exclude namespaces. Pure coincidence, not at all related to the above...

RELEASE-NOTES
includes/SpecialProtectedpages.php
includes/Xml.php

index 53c0e0b..3132897 100644 (file)
@@ -161,7 +161,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 10701) Link to Special:Listusers in default Special:Statistics messages
 * Improved file history presentation
 * (bug 10739) Users can now enter comments when reverting files
-* Improved handling of permissions errors.
+* Improved handling of permissions errors
+* (bug 10798) Exclude MediaWiki namespace from filtering options on
+  Special:Protectedpages (implicit protection, doesn't make sense to have it)
 
 == Bugfixes since 1.10 ==
 
index 7b98211..8f3fa7b 100644 (file)
@@ -119,10 +119,19 @@ class ProtectedPagesForm {
                        "</fieldset></form>";
        }
        
-       function getNamespaceMenu( $namespace=NULL ) {
-               return "<label for='namespace'>" . wfMsgHtml('namespace') . "</label>" . HTMLnamespaceselector($namespace, '');
+       /**
+        * Prepare the namespace filter drop-down; standard namespace
+        * selector, sans the MediaWiki namespace
+        *
+        * @param mixed $namespace Pre-select namespace
+        * @return string
+        */
+       function getNamespaceMenu( $namespace = null ) {
+               return Xml::label( wfMsg( 'namespace' ), 'namespace' )
+                       . '&nbsp;'
+                       . Xml::namespaceSelector( $namespace, '', false, array( NS_MEDIAWIKI, NS_MEDIAWIKI_TALK ) );
        }
-
+       
        /**
         * @return string Formatted HTML
         * @private
index b28df9f..8f178f5 100644 (file)
@@ -96,9 +96,10 @@ class Xml {
         * @param $selected Mixed: the namespace which should be selected, default ''
         * @param $allnamespaces String: value of a special item denoting all namespaces. Null to not include (default)
         * @param $includehidden Bool: include hidden namespaces?
+        * @param array $exclude Array of namespace indexes to exclude
         * @return String: Html string containing the namespace selector
         */
-       public static function namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false) {
+       public static function namespaceSelector($selected = '', $allnamespaces = null, $includehidden=false, $exclude = array() ) {
                global $wgContLang;
                if( is_null( $selected ) )
                        $selected = '';
@@ -108,7 +109,8 @@ class Xml {
                        $arr = array($allnamespaces => wfMsg('namespacesall')) + $arr;
                }
                foreach ($arr as $index => $name) {
-                       if ($index < NS_MAIN) continue;
+                       if( $index < NS_MAIN || in_array( $index, $exclude ) )
+                               continue;
 
                        $name = $index !== 0 ? $name : wfMsg('blanknamespace');