Followup r94421 which, per CR, broke in non-English content languages because of...
authorRoan Kattouw <catrope@users.mediawiki.org>
Wed, 17 Aug 2011 14:55:06 +0000 (14:55 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Wed, 17 Aug 2011 14:55:06 +0000 (14:55 +0000)
includes/OutputPage.php
includes/resourceloader/ResourceLoaderUserModule.php

index 1f09798..33e4bbd 100644 (file)
@@ -2574,7 +2574,7 @@ $templates
                                // We're on a preview of a JS subpage
                                // Exclude this page from the user module in case it's in there (bug 26283)
                                $scripts .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
-                                       array( 'excludepage' => $this->getTitle()->getPrefixedText() )
+                                       array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
                                );
                                // Load the previewed JS
                                $scripts .= Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
@@ -2979,10 +2979,10 @@ $templates
                                // We're on a preview of a CSS subpage
                                // Exclude this page from the user module in case it's in there (bug 26283)
                                $otherTags .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_STYLES, false,
-                                       array( 'excludepage' => $this->getTitle()->getPrefixedText() )
+                                       array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
                                );
                                // Load the previewed CSS
-                               $otherTags .= Html::inlineStyle( $this->getRequest()->getText( 'wpTextbox1' ) );;
+                               $otherTags .= Html::inlineStyle( $this->getRequest()->getText( 'wpTextbox1' ) );
                        } else {
                                // Load the user styles normally
                                $moduleStyles[] = 'user';
index e70aa51..3c6f61e 100644 (file)
@@ -34,13 +34,17 @@ class ResourceLoaderUserModule extends ResourceLoaderWikiModule {
         */
        protected function getPages( ResourceLoaderContext $context ) {
                if ( $context->getUser() ) {
+                       // Get the normalized title of the user's user page
                        $username = $context->getUser();
+                       $userpageTitle = Title::makeTitleSafe( NS_USER, $username );
+                       $userpage = $userpageTitle->getPrefixedDBkey(); // Needed so $excludepages works
+                       
                        $pages = array(
-                               "User:$username/common.js" => array( 'type' => 'script' ),
-                               "User:$username/" . $context->getSkin() . '.js' => 
+                               "$userpage/common.js" => array( 'type' => 'script' ),
+                               "$userpage/" . $context->getSkin() . '.js' => 
                                        array( 'type' => 'script' ),
-                               "User:$username/common.css" => array( 'type' => 'style' ),
-                               "User:$username/" . $context->getSkin() . '.css' => 
+                               "$userpage/common.css" => array( 'type' => 'style' ),
+                               "$userpage/" . $context->getSkin() . '.css' => 
                                        array( 'type' => 'style' ),
                        );
                        
@@ -49,6 +53,8 @@ class ResourceLoaderUserModule extends ResourceLoaderWikiModule {
                        // parameter will be set to the name of the page we need to exclude.
                        $excludepage = $context->getRequest()->getVal( 'excludepage' );
                        if ( isset( $pages[$excludepage] ) ) {
+                               // This works because $excludepage is generated with getPrefixedDBkey(),
+                               // just like the keys in $pages[] above
                                unset( $pages[$excludepage] );
                        }
                        return $pages;