Use the new skin tree hierarchy
authorAntoine Musso <hashar@users.mediawiki.org>
Sun, 5 Sep 2004 03:25:58 +0000 (03:25 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sun, 5 Sep 2004 03:25:58 +0000 (03:25 +0000)
16 files changed:
LocalSettings.sample
RELEASE-NOTES
config/index.php
includes/Article.php
includes/OutputPage.php
includes/Skin.php
includes/SkinPHPTal.php
skins/Chick.pt
skins/CologneBlue.php
skins/Mono.php
skins/MonoBook.php
skins/MonoBook.pt
skins/Nostalgia.php
skins/Standard.php
skins/WikimediaWiki.php
skins/WikimediaWiki.pt

index afa47c2..829e968 100644 (file)
@@ -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";
index 45a90f1..6d1628f 100644 (file)
@@ -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 ===
index 09a7b37..c14930d 100644 (file)
@@ -75,7 +75,7 @@ header( "Content-type: text/html; charset=utf-8" );
 <div id="credit">
  <center>
   <a href="http://www.mediawiki.org/"><img
-    src="../stylesheets/images/wiki.png" width="135" height="135" alt="" border="0" /></a>
+    src="../skins/common/images/wiki.png" width="135" height="135" alt="" border="0" /></a>
  </center>
 
  <b><a href="http://www.mediawiki.org/">MediaWiki</a></b> 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\";
index 1f6e0cc..8026cf5 100644 (file)
@@ -816,7 +816,7 @@ class Article {
                                $wgOut->addHTML( '<pre>'.htmlspecialchars($this->mContent)."\n</pre>" );
                        } 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 );
index fdf094d..b018556 100644 (file)
@@ -732,7 +732,7 @@ class OutputPage {
                } else {
                        $media = "media='print'";
                }
-               $printsheet = htmlspecialchars( "$wgStylePath/wikiprintable.css" );
+               $printsheet = htmlspecialchars( "$wgStylePath/common/wikiprintable.css" );
                $ret .= "<link rel='stylesheet' type='text/css' $media href='$printsheet' />\n";
 
                $sk = $wgUser->getSkin();
index b9331da..c3df976 100644 (file)
@@ -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 = "<script type=\"text/javascript\" src=\"{$wgStylePath}/wikibits.js\"></script>\n";
+               $r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\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 = '<a href="http://www.mediawiki.org/"><img src="'.$url.'" alt="MediaWiki" /></a>';
                return $img;
        }
@@ -2019,7 +2019,7 @@ class Skin {
                        } else {
                                $zoomicon =  '<div class="magnify" style="float:'.$magnifyalign.'">'.
                                        '<a href="'.$u.'" class="internal" title="'.$more.'">'.
-                                       '<img src="'.$wgStylePath.'/images/magnify-clip.png" ' .
+                                       '<img src="'.$wgStylePath.'/common/images/magnify-clip.png" ' .
                                        'width="15" height="11" alt="'.$more.'" /></a></div>';
                        }
                }
@@ -2112,7 +2112,7 @@ class Skin {
                # Spacer image
                $r = '' ;
 
-               $r .= '<img src="'.$wgStylePath.'/images/Arr_.png" width="12" height="12" border="0" />' ;
+               $r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" border="0" />' ;
                $r .= '<tt>' ;
 
                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  = '<span id="'.$rcm.'"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/images/Arr_'.$arrowdir.'.png" width="12" height="12" /></a></span>' ;
-               $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/images/Arr_d.png" width="12" height="12" /></a></span>' ;
+               $tl  = '<span id="'.$rcm.'"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_'.$arrowdir.'.png" width="12" height="12" /></a></span>' ;
+               $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'"><img src="'.$wgStylePath.'/common/images/Arr_d.png" width="12" height="12" /></a></span>' ;
                $r .= $tl ;
 
                # Main line
@@ -2246,7 +2246,7 @@ class Skin {
                        # Get rc_xxxx variables
                        extract( $rcObj->mAttribs );
 
-                       $r .= '<img src="'.$wgStylePath.'/images/Arr_.png" width="12" height="12" />';
+                       $r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" />';
                        $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;' ;
                        if ( $rc_new ) $r .= $N ;
                        else $r .= '&nbsp;' ;
@@ -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(\"<div id='toolbar'>\");\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'] );
index b291300..0000dfc 100644 (file)
@@ -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) {
index 24943f3..d632f05 100644 (file)
@@ -4,9 +4,9 @@
     <meta http-equiv="Content-Type" content="${mimetype}; charset=${charset}" />
     ${headlinks}
     <title tal:content="pagetitle">Exciting xhtml slimfast</title>
-    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${skinname}/main.css"; /*]]>*/</style>
+    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style>
     <script type="text/javascript" tal:attributes="src jsvarurl"></script>
-    <script type="text/javascript" src="${stylepath}/wikibits.js"></script>
+    <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
     <style tal:condition="usercss" type="text/css">/*<![CDATA[*/ ${usercss} /*]]>*/</style>
     <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script
       tal:condition="userjsprev" type="text/javascript">/*<![CDATA[*/${userjsprev}/*]]>*/</script>
index 871eff5..64501b7 100644 (file)
@@ -15,7 +15,7 @@
 class SkinCologneBlue extends Skin {
 
        function getStylesheet() {
-               return "cologneblue.css";
+               return "common/cologneblue.css";
        }
        function getSkinName() {
                return "cologneblue";
index 0c8b813..b69b50d 100644 (file)
@@ -20,6 +20,7 @@ class SkinMono extends SkinPHPTal {
        function initPage( &$out ) {
                SkinPHPTal::initPage( $out );
                $this->skinname = 'mono';
+               $this->stylename = 'monobook';
                $this->template = 'MonoBook';
        }
 }
index 4fb9673..62dea25 100644 (file)
@@ -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';
        }
 }
 
index 33b6b8f..edacf4c 100644 (file)
@@ -4,13 +4,13 @@
     <meta http-equiv="Content-Type" content="${mimetype}; charset=${charset}" />
     ${headlinks}
     <title tal:content="pagetitle">Exciting xhtml slimfast</title>
-    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${skinname}/main.css"; /*]]>*/</style>
-    <link rel="stylesheet" type="text/css" media="print" href="${stylepath}/commonPrint.css" />
-    <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${skinname}/IEFixes.css";</style>
-    <script type="text/javascript" src="${stylepath}/IEFixes.js"></script>
+    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style>
+    <link rel="stylesheet" type="text/css" media="print" href="${stylepath}/common/commonPrint.css" />
+    <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/IEFixes.css";</style>
+    <script type="text/javascript" src="${stylepath}/common/IEFixes.js"></script>
     <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
     <script type="text/javascript" tal:attributes="src jsvarurl"></script>
-    <script type="text/javascript" src="${stylepath}/wikibits.js"></script>
+    <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
     <style tal:condition="usercss" type="text/css">/*<![CDATA[*/ ${usercss} /*]]>*/</style>
     <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script 
       tal:condition="userjsprev" type="text/javascript">/*<![CDATA[*/${userjsprev}/*]]>*/</script>
index 0fceccc..0b914bd 100644 (file)
@@ -19,7 +19,7 @@ class SkinNostalgia extends Skin {
        }
 
        function getStylesheet() {
-               return 'nostalgia.css';
+               return 'common/nostalgia.css';
        }
        function getSkinName() {
                return "nostalgia";
index 3c9d368..d4dd53d 100644 (file)
@@ -23,7 +23,7 @@ class SkinStandard extends Skin {
                $s = parent::getHeadScripts();
                if ( 3 == $this->qbSetting() ) { # Floating left
                        $s .= "<script language='javascript' type='text/javascript' " .
-                         "src='{$wgStylePath}/sticky.js'></script>\n";
+                         "src='{$wgStylePath}/common/sticky.js'></script>\n";
                }
                return $s;
        }
@@ -36,7 +36,7 @@ class SkinStandard extends Skin {
                $s = '';
                if ( 3 == $this->qbSetting() ) { # Floating left
                        $s .= "<style type='text/css'>\n" .
-                         "@import '{$wgStylePath}/quickbar.css';\n</style>\n";
+                         "@import '{$wgStylePath}/common/quickbar.css';\n</style>\n";
                }
                $s .= parent::getUserStyles();
                return $s;
index b84e424..2977ac4 100644 (file)
@@ -25,6 +25,7 @@ class SkinWikimediawiki extends SkinMonoBook {
        function initPage( &$out ) {
                SkinPHPTal::initPage( $out );
                $this->skinname = 'wikimediawiki';
+               $this->stylename = 'monobook';
                $this->template = 'WikimediaWiki';
        }
 
index ba442c0..82b94a8 100644 (file)
@@ -4,13 +4,13 @@
     <meta http-equiv="Content-Type" content="${mimetype}; charset=${charset}" />
     ${headlinks}
     <title tal:content="pagetitle">Exciting xhtml slimfast</title>
-    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${skinname}/main.css"; /*]]>*/</style>
-    <link rel="stylesheet" type="text/css" media="print" href="${stylepath}/commonPrint.css" />
-    <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${skinname}/IEFixes.css";</style>
+    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "${stylepath}/${stylename}/main.css"; /*]]>*/</style>
+    <link rel="stylesheet" type="text/css" media="print" href="${stylepath}/common/commonPrint.css" />
+    <!--[if IE]><style type="text/css" media="all">@import "${stylepath}/${stylename}/common/IEFixes.css";</style>
     <script type="text/javascript" src="${stylepath}/IEFixes.js"></script>
     <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
     <script type="text/javascript" tal:attributes="src jsvarurl"></script>
-    <script type="text/javascript" src="${stylepath}/wikibits.js"></script>
+    <script type="text/javascript" src="${stylepath}/common/wikibits.js"></script>
     <style tal:condition="usercss" type="text/css">/*<![CDATA[*/ ${usercss} /*]]>*/</style>
     <script tal:condition="userjs" type="text/javascript" tal:attributes="src userjs"></script><script 
       tal:condition="userjsprev" type="text/javascript">/*<![CDATA[*/${userjsprev}/*]]>*/</script>