Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2404,7 +2404,7 @@ |
2405 | 2405 | // Lazy-load ResourceLoader |
2406 | 2406 | // TODO: Should this be a static function of ResourceLoader instead? |
2407 | 2407 | // TODO: Divide off modules starting with "user", and add the user parameter to them |
2408 | | - $query = array( |
| 2408 | + $baseQuery = array( |
2409 | 2409 | 'lang' => $wgLang->getCode(), |
2410 | 2410 | 'debug' => ResourceLoader::inDebugMode() ? 'true' : 'false', |
2411 | 2411 | 'skin' => $skin->getSkinName(), |
— | — | @@ -2412,10 +2412,10 @@ |
2413 | 2413 | ); |
2414 | 2414 | // Propagate printable and handheld parameters if present |
2415 | 2415 | if ( $this->isPrintable() ) { |
2416 | | - $query['printable'] = 1; |
| 2416 | + $baseQuery['printable'] = 1; |
2417 | 2417 | } |
2418 | 2418 | if ( $wgRequest->getBool( 'handheld' ) ) { |
2419 | | - $query['handheld'] = 1; |
| 2419 | + $baseQuery['handheld'] = 1; |
2420 | 2420 | } |
2421 | 2421 | |
2422 | 2422 | if ( !count( $modules ) ) { |
— | — | @@ -2444,7 +2444,7 @@ |
2445 | 2445 | foreach ( (array) $modules as $name ) { |
2446 | 2446 | $module = $resourceLoader->getModule( $name ); |
2447 | 2447 | # Check that we're allowed to include this module on this page |
2448 | | - if( ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) |
| 2448 | + if ( ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_SCRIPTS ) |
2449 | 2449 | && $only == ResourceLoaderModule::TYPE_SCRIPTS ) |
2450 | 2450 | || ( $module->getOrigin() > $this->getAllowedModules( ResourceLoaderModule::TYPE_STYLES ) |
2451 | 2451 | && $only == ResourceLoaderModule::TYPE_STYLES ) |
— | — | @@ -2462,6 +2462,7 @@ |
2463 | 2463 | |
2464 | 2464 | $links = ''; |
2465 | 2465 | foreach ( $groups as $group => $modules ) { |
| 2466 | + $query = $baseQuery; |
2466 | 2467 | // Special handling for user-specific groups |
2467 | 2468 | if ( ( $group === 'user' || $group === 'private' ) && $wgUser->isLoggedIn() ) { |
2468 | 2469 | $query['user'] = $wgUser->getName(); |
— | — | @@ -2816,19 +2817,19 @@ |
2817 | 2818 | public function buildCssLinks( $sk ) { |
2818 | 2819 | $ret = ''; |
2819 | 2820 | // Add ResourceLoader styles |
2820 | | - // Split the styles into three groups |
2821 | | - $styles = array( 'other' => array(), 'user' => array(), 'site' => array() ); |
| 2821 | + // Split the styles into four groups |
| 2822 | + $styles = array( 'other' => array(), 'user' => array(), 'site' => array(), 'private' => array() ); |
2822 | 2823 | $resourceLoader = $this->getResourceLoader(); |
2823 | 2824 | foreach ( $this->getModuleStyles() as $name ) { |
2824 | 2825 | $group = $resourceLoader->getModule( $name )->getGroup(); |
2825 | | - // Modules in groups named "other" or anything different than "user" or "site" will |
2826 | | - // be placed in the "other" group |
| 2826 | + // Modules in groups named "other" or anything different than "user", "site" or "private" |
| 2827 | + // will be placed in the "other" group |
2827 | 2828 | $styles[isset( $styles[$group] ) ? $group : 'other'][] = $name; |
2828 | 2829 | } |
2829 | 2830 | |
2830 | | - // We want site and user styles to override dynamically added styles from modules, but we want |
| 2831 | + // We want site, private and user styles to override dynamically added styles from modules, but we want |
2831 | 2832 | // dynamically added styles to override statically added styles from other modules. So the order |
2832 | | - // has to be other, dynamic, site, user |
| 2833 | + // has to be other, dynamic, site, private, user |
2833 | 2834 | // Add statically added styles for other modules |
2834 | 2835 | $ret .= $this->makeResourceLoaderLink( $sk, $styles['other'], ResourceLoaderModule::TYPE_STYLES ); |
2835 | 2836 | // Add normal styles added through addStyle()/addInlineStyle() here |
— | — | @@ -2836,10 +2837,15 @@ |
2837 | 2838 | // Add marker tag to mark the place where the client-side loader should inject dynamic styles |
2838 | 2839 | // We use a <meta> tag with a made-up name for this because that's valid HTML |
2839 | 2840 | $ret .= Html::element( 'meta', array( 'name' => 'ResourceLoaderDynamicStyles', 'content' => '' ) ); |
2840 | | - // Add site and user styles |
2841 | | - $ret .= $this->makeResourceLoaderLink( |
2842 | | - $sk, array_merge( $styles['site'], $styles['user'] ), ResourceLoaderModule::TYPE_STYLES |
2843 | | - ); |
| 2841 | + |
| 2842 | + // Add site, private and user styles |
| 2843 | + // 'private' at present only contains user.options, so put that before 'user' |
| 2844 | + // Any future private modules will likely have a similar user-specific character |
| 2845 | + foreach ( array( 'site', 'private', 'user' ) as $group ) { |
| 2846 | + $ret .= $this->makeResourceLoaderLink( $sk, $styles[$group], |
| 2847 | + ResourceLoaderModule::TYPE_STYLES |
| 2848 | + ); |
| 2849 | + } |
2844 | 2850 | return $ret; |
2845 | 2851 | } |
2846 | 2852 | |