From 037dab1a29391ba09ea794334e36072d62945d4b Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Mon, 4 Aug 2008 19:33:14 +0000 Subject: [PATCH] Follow up for r38587: Thanks to VasilievVV for pointing out that not every wiki allows userCSS/JS. --- includes/specials/SpecialPreferences.php | 27 ++++++++++++++++++------ languages/messages/MessagesEn.php | 4 +++- maintenance/language/messages.inc | 2 ++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index b08e774584..a04c3e8fe4 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -814,11 +814,17 @@ class PreferencesForm { # Skin # + global $wgAllowUserCss, $wgAllowUserJs; $wgOut->addHTML( Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, wfMsg( 'skin' ) ) . "\n" . - wfMsg( 'skin-header' ) . "

" + Xml::element( 'legend', null, wfMsg( 'skin' ) ) . "\n" ); + $wgOut->addWikiMsg( 'skin-header' ); + if ( $wgAllowUserCss ) + $wgOut->addWikiMsg( 'skin-header-css' ); + + if ( $wgAllowUserJs ) + $wgOut->addWikiMsg( 'skin-header-js' ); $mptitle = Title::newMainPage(); $previewtext = wfMsg('skin-preview'); @@ -837,14 +843,21 @@ class PreferencesForm { if ( in_array( $skinkey, $wgSkipSkins ) ) { continue; } - $pageCSS = Title::makeTitle( NS_USER, $wgUser->getName() . '/' . $skinkey . '.css' ); - $pageJS = Title::makeTitle( NS_USER, $wgUser->getName() . '/' . $skinkey . '.js' ); - $linkToCSS = $sk->link( $pageCSS, wfMsg( 'skin-link-to-css' ) ); - $linkToJS = $sk->link( $pageJS, wfMsg( 'skin-link-to-js' ) ); + + $linkToCSS = $linkToJS = ''; + if ( $wgAllowUserCss ) { + $pageCSS = Title::makeTitle( NS_USER, $wgUser->getName() . '/' . $skinkey . '.css' ); + $linkToCSS = ' | ' . $sk->link( $pageCSS, wfMsg( 'skin-link-to-css' ) ); + } + if ( $wgAllowUserJs ) { + $pageJS = Title::makeTitle( NS_USER, $wgUser->getName() . '/' . $skinkey . '.js' ); + $linkToJS = ' | ' . $sk->link( $pageJS, wfMsg( 'skin-link-to-js' ) ); + } + $checked = $skinkey == $this->mSkin ? ' checked="checked"' : ''; $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey")); - $linkLine = " ($previewtext | " . $linkToCSS . " | " . $linkToJS . ')'; + $linkLine = " ($previewtext" . $linkToCSS . $linkToJS . ')'; if( $skinkey == $wgDefaultSkin ) { $sn .= ' (' . wfMsg( 'default' ) . ')'; } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index bbd7a6f7b6..dfd91a6d73 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1403,7 +1403,9 @@ Note that their indexes of {{SITENAME}} content may be out of date.', 'qbsettings-floatingright' => 'Floating right', 'changepassword' => 'Change password', 'skin' => 'Skin', -'skin-header' => 'Available skins. You can customize each skin with the associated cascading style sheet (CSS) and JavaScript pages.', +'skin-header' => 'Available skins.', +'skin-header-css' => '* With the associated cascading style sheets (CSS) pages you can customize each skin.', +'skin-header-js' => '* With the associated JavaScript (JS) pages you can add own scripts to each skin.', 'skin-preview' => 'Preview', 'skin-link-to-css' => 'associated CSS', 'skin-link-to-js' => 'associated JS', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index c8bd6e1765..c9e5b27464 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -752,6 +752,8 @@ $wgMessageStructure = array( 'changepassword', 'skin', 'skin-header', + 'skin-header-css', + 'skin-header-js' 'skin-preview', 'skin-link-to-css', 'skin-link-to-js', -- 2.20.1