exclude immovable namespaces from the namespace selector on Special:MovePage
authorjeroendedauw <jeroendedauw@gmail.com>
Fri, 11 May 2012 14:32:52 +0000 (16:32 +0200)
committerjeroendedauw <jeroendedauw@gmail.com>
Fri, 11 May 2012 14:32:52 +0000 (16:32 +0200)
Change-Id: Icd5645921e95bfd4b3a04c40d4b9bba3600d2f07

includes/specials/SpecialMovepage.php

index 6b817d2..a512ee6 100644 (file)
@@ -246,6 +246,14 @@ class MovePageForm extends UnlistedSpecialPage {
                // Byte limit (not string length limit) for wpReason and wpNewTitleMain
                // is enforced in the mediawiki.special.movePage module
 
+               $immovableNamespaces = array();
+
+               foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
+                       if ( !MWNamespace::isMovable( $nsId ) ) {
+                               $immovableNamespaces[] = $nsId;
+                       }
+               }
+
                $out->addHTML(
                         Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getTitle()->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
                         Xml::openElement( 'fieldset' ) .
@@ -265,7 +273,10 @@ class MovePageForm extends UnlistedSpecialPage {
                                "</td>
                                <td class='mw-input'>" .
                                        Html::namespaceSelector(
-                                               array( 'selected' => $newTitle->getNamespace() ),
+                                               array(
+                                                       'selected' => $newTitle->getNamespace(),
+                                                       'exclude' => $immovableNamespaces
+                                               ),
                                                array( 'name' => 'wpNewTitleNs', 'id' => 'wpNewTitleNs' )
                                        ) .
                                        Xml::input( 'wpNewTitleMain', 60, $wgContLang->recodeForEdit( $newTitle->getText() ), array(