More style cleanup -- encapsulate the page name class along with the naemspace classes.
[lhc/web/wiklou.git] / skins / Modern.php
index e75e4ae..d37086c 100644 (file)
@@ -21,15 +21,19 @@ class SkinModern extends SkinTemplate {
         * skin L&F.
         */
        function getPoweredBy() {
-       global  $wgVersion;
+               global  $wgVersion;
                return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
        }
 
        function initPage( &$out ) {
-               SkinTemplate::initPage( $out );
+               Skin::initPage( $out );
                $this->skinname  = 'modern';
                $this->stylename = 'modern';
                $this->template  = 'ModernTemplate';
+               
+               $this->addStyle( 'common/shared.css', 'screen' );
+               $this->addStyle( 'modern/main.css', 'screen' );
+               $this->addStyle( 'modern/print.css', 'print' );
        }
 }
 
@@ -48,8 +52,9 @@ class ModernTemplate extends QuickTemplate {
         * @access private
         */
        function execute() {
-               global $wgUser;
-               $this->skin = $skin = $wgUser->getSkin();
+               global $wgRequest;
+               $this->skin = $skin = $this->data['skin'];
+               $action = $wgRequest->getText( 'action' );
 
                // Suppress warnings to prevent notices about missing indexes in $this->data
                wfSuppressWarnings();
@@ -63,13 +68,7 @@ class ModernTemplate extends QuickTemplate {
                <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
                <?php $this->html('headlinks') ?>
                <title><?php $this->text('pagetitle') ?></title>
-               <?php if(empty($this->data['printable']) ) { ?>
-               <style type="text/css" media="screen, projection">/*<![CDATA[*/
-                       @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
-                       @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
-               /*]]>*/</style>
-               <?php } ?>
-               <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/print.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
+               <?php $this->html('csslinks') ?>
                <!--[if lt IE 7]><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
                
                <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
@@ -96,12 +95,10 @@ class ModernTemplate extends QuickTemplate {
        </head>
 <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
 <?php if($this->data['body_onload'    ]) { ?> onload="<?php     $this->text('body_onload')     ?>"<?php } ?>
- class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">
+ class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
 
        <!-- heading -->
-       <div id="mw_header">
-               <h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
-       </div>
+       <div id="mw_header"><h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1></div>
 
        <div id="mw_main">
        <div id="mw_contentwrapper">
@@ -110,12 +107,27 @@ class ModernTemplate extends QuickTemplate {
                <h5><?php $this->msg('views') ?></h5>
                <div class="pBody">
                        <ul>
-       <?php                   foreach($this->data['content_actions'] as $key => $tab) { ?>
-                                <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
-                                               if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
-                                        ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php
-                                        echo htmlspecialchars($tab['text']) ?></a></li>
-       <?php                    } ?>
+       <?php           foreach($this->data['content_actions'] as $key => $tab) {
+                                       echo '
+                                <li id="ca-' . Sanitizer::escapeId($key).'"';
+                                       if( $tab['class'] ) {
+                                               echo ' class="'.htmlspecialchars($tab['class']).'"';
+                                       }
+                                       echo'><a href="'.htmlspecialchars($tab['href']).'"';
+                                       # We don't want to give the watch tab an accesskey if the
+                                       # page is being edited, because that conflicts with the
+                                       # accesskey on the watch checkbox.  We also don't want to
+                                       # give the edit tab an accesskey, because that's fairly su-
+                                       # perfluous and conflicts with an accesskey (Ctrl-E) often
+                                       # used for editing in Safari.
+                                       if( in_array( $action, array( 'edit', 'submit' ) )
+                                       && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
+                                               echo $skin->tooltip( "ca-$key" );
+                                       } else {
+                                               echo $skin->tooltipAndAccesskey( "ca-$key" );
+                                       }
+                                       echo '>'.htmlspecialchars($tab['text']).'</a></li>';
+                               } ?>
                        </ul>
                </div>
        </div>
@@ -144,6 +156,7 @@ class ModernTemplate extends QuickTemplate {
                <?php $this->html('bodytext') ?>
                <div class='mw_clear'></div>
                <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
+               <?php $this->html ('dataAfterContent') ?>
        </div><!-- mw_contentholder -->
        </div><!-- mw_content -->
        </div><!-- mw_contentwrapper -->