From 05ea81fa004b239f5218d9f8f0f0f222be3fa538 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sat, 4 Aug 2007 12:20:41 +0000 Subject: [PATCH] * (bug 10798) Exclude MediaWiki namespace from filtering options on Special:Protectedpages (implicit protection, doesn't make sense to have it) * Introduce a fourth evil parameter to Xml::namespaceSelector() to exclude namespaces. Pure coincidence, not at all related to the above... --- RELEASE-NOTES | 4 +++- includes/SpecialProtectedpages.php | 15 ++++++++++++--- includes/Xml.php | 6 ++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 53c0e0bc86..3132897757 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/SpecialProtectedpages.php b/includes/SpecialProtectedpages.php index 7b982110e6..8f3fa7b5ec 100644 --- a/includes/SpecialProtectedpages.php +++ b/includes/SpecialProtectedpages.php @@ -119,10 +119,19 @@ class ProtectedPagesForm { ""; } - function getNamespaceMenu( $namespace=NULL ) { - return "" . 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' ) + . ' ' + . Xml::namespaceSelector( $namespace, '', false, array( NS_MEDIAWIKI, NS_MEDIAWIKI_TALK ) ); } - + /** * @return string Formatted HTML * @private diff --git a/includes/Xml.php b/includes/Xml.php index b28df9fde6..8f178f5d94 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -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'); -- 2.20.1