followup to r63300: add links to /common.css & /common.js to preferences
authorIlmari Karonen <vyznev@users.mediawiki.org>
Sat, 6 Mar 2010 20:42:35 +0000 (20:42 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Sat, 6 Mar 2010 20:42:35 +0000 (20:42 +0000)
includes/Preferences.php
languages/messages/MessagesEn.php
languages/messages/MessagesFi.php
maintenance/language/messages.inc

index a384938..2f8398a 100644 (file)
@@ -446,6 +446,8 @@ class Preferences {
 
        static function skinPreferences( $user, &$defaultPreferences ) {
                ## Skin #####################################
+               global $wgLang, $wgAllowUserCss, $wgAllowUserJs;
+
                $defaultPreferences['skin'] =
                                array(
                                        'type' => 'radio',
@@ -454,6 +456,30 @@ class Preferences {
                                        'section' => 'rendering/skin',
                                );
 
+               # Create links to user CSS/JS pages for all skins
+               # This code is basically copied from generateSkinOptions().  It'd
+               # be nice to somehow merge this back in there to avoid redundancy. 
+               if( $wgAllowUserCss || $wgAllowUserJs ) {
+                       $sk = $user->getSkin();
+                       $linkTools = array();
+                       if( $wgAllowUserCss ) {
+                               $cssPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/common.css' );
+                               $linkTools[] = $sk->link( $cssPage, wfMsgHtml( 'prefs-custom-css' ) );
+                       }
+                       if( $wgAllowUserJs ) {
+                               $jsPage = Title::makeTitleSafe( NS_USER, $user->getName() . '/common.js' );
+                               $linkTools[] = $sk->link( $jsPage, wfMsgHtml( 'prefs-custom-js' ) );
+                       }
+                       $defaultPreferences['commoncssjs'] =
+                               array(
+                                       'type' => 'info',
+                                       'raw' => true,
+                                       'default' => $wgLang->pipeList( $linkTools ),
+                                       'label-message' => 'prefs-common-css-js',
+                                       'section' => 'rendering/skin',
+                               );
+               }
+
                $selectedSkin = $user->getOption( 'skin' );
                if ( in_array( $selectedSkin, array( 'cologneblue', 'standard' ) ) ) {
                        global $wgLang;
index 5c42dd7..4b172c1 100644 (file)
@@ -1749,6 +1749,7 @@ Here's a randomly-generated value you can use: $1",
 'prefs-files'                   => 'Files',
 'prefs-custom-css'              => 'Custom CSS',
 'prefs-custom-js'               => 'Custom JS',
+'prefs-common-css-js'           => 'Shared CSS/JS for all skins:',
 'prefs-reset-intro'             => 'You can use this page to reset your preferences to the site defaults.
 This cannot be undone.',
 'prefs-emailconfirm-label'      => 'E-mail confirmation:',
index 0cbcbb6..854f5a8 100644 (file)
@@ -1297,6 +1297,7 @@ Tässä satunnaisesti tuotettu arvo, jota voit käyttää: $1',
 'prefs-files'                   => 'Tiedostot',
 'prefs-custom-css'              => 'Käyttäjäkohtainen CSS-tyylisivu',
 'prefs-custom-js'               => 'Käyttäjäkohtainen JavaScript-sivu',
+'prefs-common-css-js'           => 'Yhteiset CSS/JS-sivut kaikille ulkoasuille',
 'prefs-reset-intro'             => 'Voit käyttää tätä sivua palauttaaksesi kaikki asetuksesi sivuston oletusasetuksiin. Tätä ei voi kumota.',
 'prefs-emailconfirm-label'      => 'Sähköpostin varmistus',
 'prefs-textboxsize'             => 'Muokkauskentän koko',
index 71e135c..ceac0f9 100644 (file)
@@ -930,6 +930,7 @@ $wgMessageStructure = array(
                'prefs-files',
                'prefs-custom-css',
                'prefs-custom-js',
+               'prefs-common-css-js',
                'prefs-reset-intro',
                'prefs-emailconfirm-label',
                'prefs-textboxsize',