Remove space in <div id="content" > to unbreak certain screenscraping clients. (Yes...
[lhc/web/wiklou.git] / skins / Modern.php
1 <?php
2 /**
3 * Modern skin, derived from monobook template.
4 *
5 * @todo document
6 * @file
7 * @ingroup Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) )
11 die( -1 );
12
13 require( dirname(__FILE__) . '/MonoBook.php' );
14
15 /**
16 * Inherit main code from SkinTemplate, set the CSS and template filter.
17 * @todo document
18 * @ingroup Skins
19 */
20 class SkinModern extends SkinTemplate {
21 var $skinname = 'modern', $stylename = 'modern',
22 $template = 'ModernTemplate', $useHeadElement = true;
23
24 /*
25 * We don't like the default getPoweredBy, the icon clashes with the
26 * skin L&F.
27 */
28 function getPoweredBy() {
29 global $wgVersion;
30 return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
31 }
32
33 function setupSkinUserCss( OutputPage $out ){
34 global $wgStyleVersion, $wgJsMimeType, $wgStylePath;
35
36 // Do not call parent::setupSkinUserCss(), we have our own print style
37 $out->addStyle( 'common/shared.css', 'screen' );
38 $out->addStyle( 'modern/main.css', 'screen' );
39 $out->addStyle( 'modern/print.css', 'print' );
40 $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' );
41 }
42 }
43
44 /**
45 * @todo document
46 * @ingroup Skins
47 */
48 class ModernTemplate extends MonoBookTemplate {
49 var $skin;
50 /**
51 * Template filter callback for Modern skin.
52 * Takes an associative array of data set from a SkinTemplate-based
53 * class, and a wrapper for MediaWiki's localization database, and
54 * outputs a formatted page.
55 *
56 * @access private
57 */
58 function execute() {
59 global $wgRequest, $wgOut;
60 $this->skin = $skin = $this->data['skin'];
61 $action = $wgRequest->getText( 'action' );
62
63 // Suppress warnings to prevent notices about missing indexes in $this->data
64 wfSuppressWarnings();
65
66 $this->html( 'headelement' );
67 ?>
68
69 <!-- heading -->
70 <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
71
72 <div id="mw_main">
73 <div id="mw_contentwrapper">
74 <!-- navigation portlet -->
75 <div id="p-cactions" class="portlet">
76 <h5><?php $this->msg('views') ?></h5>
77 <div class="pBody">
78 <ul>
79 <?php foreach($this->data['content_actions'] as $key => $tab) {
80 echo '
81 <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
82 if( $tab['class'] ) {
83 echo ' class="'.htmlspecialchars($tab['class']).'"';
84 }
85 echo'><a href="'.htmlspecialchars($tab['href']).'"';
86 # We don't want to give the watch tab an accesskey if the
87 # page is being edited, because that conflicts with the
88 # accesskey on the watch checkbox. We also don't want to
89 # give the edit tab an accesskey, because that's fairly su-
90 # perfluous and conflicts with an accesskey (Ctrl-E) often
91 # used for editing in Safari.
92 if( in_array( $action, array( 'edit', 'submit' ) )
93 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
94 echo $skin->tooltip( "ca-$key" );
95 } else {
96 echo $skin->tooltipAndAccesskey( "ca-$key" );
97 }
98 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
99 } ?>
100 </ul>
101 </div>
102 </div>
103
104 <!-- content -->
105 <div id="mw_content">
106 <!-- contentholder does nothing by default, but it allows users to style the text inside
107 the content area without affecting the meaning of 'em' in #mw_content, which is used
108 for the margins -->
109 <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
110 <div class='mw-topboxes'>
111 <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes')?>></div>
112 <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
113 <?php if($this->data['newtalk'] ) {
114 ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
115 <?php } ?>
116 <?php if($this->data['sitenotice']) {
117 ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div>
118 <?php } ?>
119 </div>
120
121 <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
122
123 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
124 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#mw_portlets"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
125
126 <?php $this->html('bodytext') ?>
127 <div class='mw_clear'></div>
128 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
129 <?php $this->html ('dataAfterContent') ?>
130 </div><!-- mw_contentholder -->
131 </div><!-- mw_content -->
132 </div><!-- mw_contentwrapper -->
133
134 <div id="mw_portlets"<?php $this->html("userlangattributes") ?>>
135
136 <!-- portlets -->
137 <?php
138 $sidebar = $this->data['sidebar'];
139 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
140 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
141 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
142
143 foreach ($sidebar as $boxName => $cont) {
144 if ( $boxName == 'SEARCH' ) {
145 $this->searchBox();
146 } elseif ( $boxName == 'TOOLBOX' ) {
147 $this->toolbox();
148 } elseif ( $boxName == 'LANGUAGES' ) {
149 $this->languageBox();
150 } else {
151 $this->customBox( $boxName, $cont );
152 }
153 }
154 ?>
155
156 </div><!-- mw_portlets -->
157
158
159 </div><!-- main -->
160
161 <div class="mw_clear"></div>
162
163 <!-- personal portlet -->
164 <div class="portlet" id="p-personal">
165 <h5><?php $this->msg('personaltools') ?></h5>
166 <div class="pBody">
167 <ul>
168 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
169 <li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>"<?php
170 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
171 echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
172 if(!empty($item['class'])) { ?> class="<?php
173 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
174 echo htmlspecialchars($item['text']) ?></a></li>
175 <?php } ?>
176 </ul>
177 </div>
178 </div>
179
180
181 <!-- footer -->
182 <div id="footer"<?php $this->html('userlangattributes') ?>>
183 <ul id="f-list">
184 <?php
185 $footerlinks = array(
186 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
187 'privacy', 'about', 'disclaimer', 'tagline',
188 );
189 foreach( $footerlinks as $aLink ) {
190 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
191 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
192 <?php }
193 }
194 ?>
195 </ul>
196 <?php echo $this->html("poweredbyico"); ?>
197 </div>
198
199 <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
200 <?php $this->html('reporttime') ?>
201 <?php if ( $this->data['debug'] ): ?>
202 <!-- Debug output:
203 <?php $this->text( 'debug' ); ?>
204 -->
205 <?php endif; ?>
206 </body></html>
207 <?php
208 wfRestoreWarnings();
209 } // end of execute() method
210 } // end of class
211
212