From a0d30b1e0365a84d407ec54b4e51d050410d1fad Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 5 Sep 2004 03:25:58 +0000 Subject: [PATCH] Use the new skin tree hierarchy --- LocalSettings.sample | 4 ++-- RELEASE-NOTES | 1 + config/index.php | 10 +++++----- includes/Article.php | 2 +- includes/OutputPage.php | 2 +- includes/Skin.php | 22 +++++++++++----------- includes/SkinPHPTal.php | 34 ++++++++++++++++++++++++++++++---- skins/Chick.pt | 4 ++-- skins/CologneBlue.php | 2 +- skins/Mono.php | 1 + skins/MonoBook.php | 7 ++++++- skins/MonoBook.pt | 10 +++++----- skins/Nostalgia.php | 2 +- skins/Standard.php | 4 ++-- skins/WikimediaWiki.php | 1 + skins/WikimediaWiki.pt | 8 ++++---- 16 files changed, 74 insertions(+), 40 deletions(-) diff --git a/LocalSettings.sample b/LocalSettings.sample index afa47c251a..829e9686cc 100644 --- a/LocalSettings.sample +++ b/LocalSettings.sample @@ -65,8 +65,8 @@ $wgArticlePath = "{$wgScript}/$1"; ## Normally you don't need to change these once the above are set... # -$wgStylePath = "{$wgScriptPath}/style"; -$wgStyleSheetDirectory = "{$IP}/style"; +$wgStylePath = "{$wgScriptPath}/skins"; +$wgStyleSheetDirectory = "{$IP}/skins"; $wgUploadPath = "{$wgScriptPath}/upload"; $wgUploadDirectory = "{$IP}/upload"; diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 45a90f1de2..6d1628fbee 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -17,6 +17,7 @@ Major changes from 1.3.x: * Support for faster C++ diff module (WikiDiff extension) * More scary link caching modes * Old manually maintained log pages replaced with searchable Special:Log +* Skins system more modular : templates and css are now in /skins/ * ... and more! === Caveats === diff --git a/config/index.php b/config/index.php index 09a7b37699..c14930da77 100644 --- a/config/index.php +++ b/config/index.php @@ -75,7 +75,7 @@ header( "Content-type: text/html; charset=utf-8" );
+ src="../skins/common/images/wiki.png" width="135" height="135" alt="" border="0" />
MediaWiki is @@ -353,7 +353,7 @@ if( $conf->License == "gfdl" ) { $conf->RightsUrl = "http://www.gnu.org/copyleft/fdl.html"; $conf->RightsText = "GNU Free Documentation License 1.2"; $conf->RightsCode = "gfdl"; - $conf->RightsIcon = '${wgStylePath}/images/gnu-fdl.png'; + $conf->RightsIcon = '${wgStylePath}/common/images/gnu-fdl.png'; } elseif( $conf->License == "none" ) { $conf->RightsUrl = $conf->RightsText = $conf->RightsCode = $conf->RightsIcon = ""; } else { @@ -844,9 +844,9 @@ if ( \$wgCommandLineMode ) { {$pretty}\$wgArticlePath = \"\$wgScript/\$1\"; {$ugly}\$wgArticlePath = \"\$wgScript?title=\$1\"; -\$wgStylePath = \"\$wgScriptPath/stylesheets\"; -\$wgStyleDirectory = \"\$IP/stylesheets\"; -\$wgLogo = \"\$wgStylePath/images/wiki.png\"; +\$wgStylePath = \"\$wgScriptPath/skins\"; +\$wgStyleDirectory = \"\$IP/skins\"; +\$wgLogo = \"\$wgStylePath/common/images/wiki.png\"; \$wgUploadPath = \"\$wgScriptPath/images\"; \$wgUploadDirectory = \"\$IP/images\"; diff --git a/includes/Article.php b/includes/Article.php index 1f6e0ccaf3..8026cf5ee2 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -816,7 +816,7 @@ class Article { $wgOut->addHTML( '
'.htmlspecialchars($this->mContent)."\n
" ); } else if ( $rt = Title::newFromRedirect( $text ) ) { # Display redirect - $imageUrl = $wgStylePath.'/images/redirect.png'; + $imageUrl = $wgStylePath.'/common/images/redirect.png'; $targetUrl = $rt->escapeLocalURL(); $titleText = htmlspecialchars( $rt->getPrefixedText() ); $link = $sk->makeLinkObj( $rt ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index fdf094d718..b0185565df 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -732,7 +732,7 @@ class OutputPage { } else { $media = "media='print'"; } - $printsheet = htmlspecialchars( "$wgStylePath/wikiprintable.css" ); + $printsheet = htmlspecialchars( "$wgStylePath/common/wikiprintable.css" ); $ret .= "\n"; $sk = $wgUser->getSkin(); diff --git a/includes/Skin.php b/includes/Skin.php index b9331da340..c3df976a06 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -105,7 +105,7 @@ class Skin { } function getStylesheet() { - return 'wikistandard.css'; + return 'common/wikistandard.css'; } function getSkinName() { @@ -206,7 +206,7 @@ class Skin { function getHeadScripts() { global $wgStylePath, $wgUser, $wgLang, $wgAllowUserJs; - $r = "\n"; + $r = "\n"; if( $wgAllowUserJs && $wgUser->getID() != 0 ) { # logged in $userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName(); $userjs = htmlspecialchars($this->makeUrl($userpage.'/'.$this->getSkinName().'.js', 'action=raw&ctype=text/javascript')); @@ -221,7 +221,7 @@ class Skin { $sheet = $this->getStylesheet(); $action = $wgRequest->getText('action'); $s = "@import \"$wgStylePath/$sheet\";\n"; - if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common_rtl.css\";\n"; + if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css\";\n"; if( $wgAllowUserCss && $wgUser->getID() != 0 ) { # logged in if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { $s .= $wgRequest->getText('wpTextbox1'); @@ -913,7 +913,7 @@ class Skin { function getPoweredBy() { global $wgStylePath; - $url = htmlspecialchars( "$wgStylePath/images/poweredby_mediawiki_88x31.png" ); + $url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" ); $img = 'MediaWiki'; return $img; } @@ -2019,7 +2019,7 @@ class Skin { } else { $zoomicon = '
'. ''. - ''.$more.'
'; } } @@ -2112,7 +2112,7 @@ class Skin { # Spacer image $r = '' ; - $r .= '' ; + $r .= '' ; $r .= '' ; if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { @@ -2203,8 +2203,8 @@ class Skin { $rcm = 'RCM'.$this->rcCacheIndex ; $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')" ; $arrowdir = $wgLang->isRTL() ? 'l' : 'r'; - $tl = '' ; - $tl .= '' ; + $tl = '' ; + $tl .= '' ; $r .= $tl ; # Main line @@ -2246,7 +2246,7 @@ class Skin { # Get rc_xxxx variables extract( $rcObj->mAttribs ); - $r .= ''; + $r .= ''; $r .= '       ' ; if ( $rc_new ) $r .= $N ; else $r .= ' ' ; @@ -2756,7 +2756,7 @@ class Skin { * This function is called by EditPage.php and shows a bulletin board style * toolbar for common editing functions. It can be disabled in the user * preferences. - * The necsesary JavaScript code can be found in style/wikibits.js. + * The necessary JavaScript code can be found in style/wikibits.js. */ function getEditToolbar() { global $wgStylePath, $wgLang, $wgMimeType; @@ -2856,7 +2856,7 @@ class Skin { $toolbar.="document.writeln(\"
\");\n"; foreach($toolarray as $tool) { - $image=$wgStylePath.'/images/'.$tool['image']; + $image=$wgStylePath.'/common/images/'.$tool['image']; $open=$tool['open']; $close=$tool['close']; $sample = addslashes( $tool['sample'] ); diff --git a/includes/SkinPHPTal.php b/includes/SkinPHPTal.php index b2913008d3..0000dfc52b 100644 --- a/includes/SkinPHPTal.php +++ b/includes/SkinPHPTal.php @@ -41,7 +41,7 @@ global $IP; require_once $IP.'/PHPTAL-NP-0.7.0/libs/PHPTAL.php'; /** - * + * @todo document * @package MediaWiki */ class MediaWiki_I18N extends PHPTAL_I18N { @@ -70,12 +70,36 @@ class MediaWiki_I18N extends PHPTAL_I18N { * @package MediaWiki */ class SkinPHPTal extends Skin { + /**#@+ + * @access private + */ + + /** + * Name of our skin, set in initPage() + * It probably need to be all lower case. + */ + var $skinname; + + /** + * Stylesheets set to use + * Sub directory in ./skins/ where various stylesheets are located + */ + var $stylename; + + /** + * PHPTal template to be used. + * '.pt' will be automaticly added to it on PHPTAL object creation + */ var $template; + /**#@-*/ + + /** */ function initPage( &$out ) { parent::initPage( $out ); - $this->skinname = 'monobook'; - $this->template = 'MonoBook'; + $this->skinname = 'monobook'; + $this->stylename = 'monobook'; + $this->template = 'MonoBook'; } /** @@ -143,7 +167,9 @@ class SkinPHPTal extends Skin { $tpl->setRef( 'mimetype', $wgMimeType ); $tpl->setRef( 'charset', $wgOutputEncoding ); $tpl->set( 'headlinks', $out->getHeadLinks() ); + $tpl->setRef( 'wgScript', $wgScript ); $tpl->setRef( 'skinname', $this->skinname ); + $tpl->setRef( 'stylename', $this->stylename ); $tpl->setRef( 'loggedin', $this->loggedin ); $tpl->set('nsclass', 'ns-'.$wgTitle->getNamespace()); /* XXX currently unused, might get useful later @@ -617,7 +643,7 @@ class SkinPHPTal extends Skin { $action = $wgRequest->getText('action'); $maxage = $wgRequest->getText('maxage'); $s = "/* generated user stylesheet */\n"; - if($wgLang->isRTL()) $s .= '@import "'.$wgStylePath.'/'.$this->skinname.'/rtl.css";'."\n"; + if($wgLang->isRTL()) $s .= '@import "'.$wgStylePath.'/'.$this->stylename.'/rtl.css";'."\n"; $s .= '@import "'. $this->makeNSUrl(ucfirst($this->skinname).'.css', 'action=raw&ctype=text/css&smaxage='.$wgSquidMaxage, NS_MEDIAWIKI)."\";\n"; if($wgUser->getID() != 0) { diff --git a/skins/Chick.pt b/skins/Chick.pt index 24943f3eb9..d632f05c82 100644 --- a/skins/Chick.pt +++ b/skins/Chick.pt @@ -4,9 +4,9 @@ ${headlinks} Exciting xhtml slimfast - + - + diff --git a/skins/CologneBlue.php b/skins/CologneBlue.php index 871eff555a..64501b713c 100644 --- a/skins/CologneBlue.php +++ b/skins/CologneBlue.php @@ -15,7 +15,7 @@ class SkinCologneBlue extends Skin { function getStylesheet() { - return "cologneblue.css"; + return "common/cologneblue.css"; } function getSkinName() { return "cologneblue"; diff --git a/skins/Mono.php b/skins/Mono.php index 0c8b813298..b69b50d966 100644 --- a/skins/Mono.php +++ b/skins/Mono.php @@ -20,6 +20,7 @@ class SkinMono extends SkinPHPTal { function initPage( &$out ) { SkinPHPTal::initPage( $out ); $this->skinname = 'mono'; + $this->stylename = 'monobook'; $this->template = 'MonoBook'; } } diff --git a/skins/MonoBook.php b/skins/MonoBook.php index 4fb9673d74..62dea25b2a 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -12,14 +12,19 @@ if ($wgUsePHPTal) { require_once('includes/SkinPHPTal.php'); /** + * Inherit everything from SkinPHPTal + * This is a dummy skin as MonoBook is the default PHPTal skin. * @todo document * @package MediaWiki * @subpackage Skins */ class SkinMonoBook extends SkinPHPTal { + /** Using monobook. */ function initPage( &$out ) { SkinPHPTal::initPage( $out ); - $this->skinname = 'monobook'; + $this->skinname = 'monobook'; + $this->stylename = 'monobook'; + $this->template = 'MonoBook'; } } diff --git a/skins/MonoBook.pt b/skins/MonoBook.pt index 33b6b8f966..edacf4c263 100644 --- a/skins/MonoBook.pt +++ b/skins/MonoBook.pt @@ -4,13 +4,13 @@ ${headlinks} Exciting xhtml slimfast - - - - + diff --git a/skins/Nostalgia.php b/skins/Nostalgia.php index 0fceccc9bc..0b914bdc86 100644 --- a/skins/Nostalgia.php +++ b/skins/Nostalgia.php @@ -19,7 +19,7 @@ class SkinNostalgia extends Skin { } function getStylesheet() { - return 'nostalgia.css'; + return 'common/nostalgia.css'; } function getSkinName() { return "nostalgia"; diff --git a/skins/Standard.php b/skins/Standard.php index 3c9d368437..d4dd53db9e 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -23,7 +23,7 @@ class SkinStandard extends Skin { $s = parent::getHeadScripts(); if ( 3 == $this->qbSetting() ) { # Floating left $s .= "\n"; + "src='{$wgStylePath}/common/sticky.js'>\n"; } return $s; } @@ -36,7 +36,7 @@ class SkinStandard extends Skin { $s = ''; if ( 3 == $this->qbSetting() ) { # Floating left $s .= "\n"; + "@import '{$wgStylePath}/common/quickbar.css';\n\n"; } $s .= parent::getUserStyles(); return $s; diff --git a/skins/WikimediaWiki.php b/skins/WikimediaWiki.php index b84e42415c..2977ac4c5f 100644 --- a/skins/WikimediaWiki.php +++ b/skins/WikimediaWiki.php @@ -25,6 +25,7 @@ class SkinWikimediawiki extends SkinMonoBook { function initPage( &$out ) { SkinPHPTal::initPage( $out ); $this->skinname = 'wikimediawiki'; + $this->stylename = 'monobook'; $this->template = 'WikimediaWiki'; } diff --git a/skins/WikimediaWiki.pt b/skins/WikimediaWiki.pt index ba442c00d4..82b94a8743 100644 --- a/skins/WikimediaWiki.pt +++ b/skins/WikimediaWiki.pt @@ -4,13 +4,13 @@ ${headlinks} Exciting xhtml slimfast - - - - + -- 2.20.1