* (bug 13880) "Printable" link in Modern skin now formats as print mode
[lhc/web/wiklou.git] / skins / Modern.php
1 <?php
2 /**
3 * Modern skin, derived from monobook template.
4 *
5 * @todo document
6 * @addtogroup Skins
7 */
8
9 if( !defined( 'MEDIAWIKI' ) )
10 die( -1 );
11
12 /**
13 * Inherit main code from SkinTemplate, set the CSS and template filter.
14 * @todo document
15 * @addtogroup Skins
16 */
17 class SkinModern extends SkinTemplate {
18 /*
19 * We don't like the default getPoweredBy, the icon clashes with the
20 * skin L&F.
21 */
22 function getPoweredBy() {
23 global $wgVersion;
24 return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
25 }
26
27 function initPage( &$out ) {
28 SkinTemplate::initPage( $out );
29 $this->skinname = 'modern';
30 $this->stylename = 'modern';
31 $this->template = 'ModernTemplate';
32 }
33 }
34
35 /**
36 * @todo document
37 * @addtogroup Skins
38 */
39 class ModernTemplate extends QuickTemplate {
40 /**
41 * Template filter callback for Modern skin.
42 * Takes an associative array of data set from a SkinTemplate-based
43 * class, and a wrapper for MediaWiki's localization database, and
44 * outputs a formatted page.
45 *
46 * @access private
47 */
48 function execute() {
49 global $wgUser;
50 $skin = $wgUser->getSkin();
51
52 // Suppress warnings to prevent notices about missing indexes in $this->data
53 wfSuppressWarnings();
54
55 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
56 <html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
57 foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
58 ?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
59 } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
60 <head>
61 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
62 <?php $this->html('headlinks') ?>
63 <title><?php $this->text('pagetitle') ?></title>
64 <?php if(empty($this->data['printable']) ) { ?>
65 <style type="text/css" media="screen, projection">/*<![CDATA[*/
66 @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
67 @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
68 /*]]>*/</style>
69 <?php } ?>
70 <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'] ?>" />
71 <!--[if lt IE 7]><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
72
73 <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
74
75 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
76 <!-- Head Scripts -->
77 <?php $this->html('headscripts') ?>
78 <?php if($this->data['jsvarurl' ]) { ?>
79 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script>
80 <?php } ?>
81 <?php if($this->data['pagecss' ]) { ?>
82 <style type="text/css"><?php $this->html('pagecss' ) ?></style>
83 <?php }
84 if($this->data['usercss' ]) { ?>
85 <style type="text/css"><?php $this->html('usercss' ) ?></style>
86 <?php }
87 if($this->data['userjs' ]) { ?>
88 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
89 <?php }
90 if($this->data['userjsprev']) { ?>
91 <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
92 <?php }
93 if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
94 </head>
95 <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
96 <?php if($this->data['body_onload' ]) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
97 class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">
98
99 <!-- heading -->
100 <div id="mw_header">
101 <h1 id="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
102 </div>
103
104 <div id="mw_main">
105 <div id="mw_contentwrapper">
106 <!-- navigation portlet -->
107 <div id="p-cactions" class="portlet">
108 <h5><?php $this->msg('views') ?></h5>
109 <div class="pBody">
110 <ul>
111 <?php foreach($this->data['content_actions'] as $key => $tab) { ?>
112 <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
113 if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
114 ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php
115 echo htmlspecialchars($tab['text']) ?></a></li>
116 <?php } ?>
117 </ul>
118 </div>
119 </div>
120
121 <!-- content -->
122 <div id="mw_content">
123 <!-- contentholder does nothing by default, but it allows users to style the text inside
124 the content area without affecting the meaning of 'em' in #mw_content, which is used
125 for the margins -->
126 <div id="mw_contentholder">
127 <div class='mw-topboxes'>
128 <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
129 <?php if($this->data['newtalk'] ) {
130 ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
131 <?php } ?>
132 <?php if($this->data['sitenotice']) {
133 ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div>
134 <?php } ?>
135 </div>
136
137 <div id="contentSub"><?php $this->html('subtitle') ?></div>
138
139 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
140 <?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 } ?>
141
142 <?php $this->html('bodytext') ?>
143 <div class='mw_clear'></div>
144 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
145 </div><!-- mw_contentholder -->
146 </div><!-- mw_content -->
147 </div><!-- mw_contentwrapper -->
148
149 <div id="mw_portlets">
150
151 <!-- other portlets -->
152 <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
153 <div class='generated-sidebar portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $skin->tooltip('p-'.$bar) ?>>
154 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
155 <div class='pBody'>
156 <ul>
157 <?php foreach($cont as $key => $val) { ?>
158 <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
159 if ( $val['active'] ) { ?> class="active" <?php }
160 ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
161 <?php } ?>
162 </ul>
163 </div><!-- pBody -->
164 </div><!-- portlet -->
165 <?php } ?>
166
167 <!-- search -->
168 <div id="p-search" class="portlet">
169 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
170 <div id="searchBody" class="pBody">
171 <form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
172 <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search');
173 if( isset( $this->data['search'] ) ) {
174 ?> value="<?php $this->text('search') ?>"<?php } ?> />
175 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-go' ); ?> />&nbsp;
176 <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
177 </div></form>
178 </div><!-- pBody -->
179 </div><!-- portlet -->
180
181 <!-- toolbox -->
182 <div class="portlet" id="p-tb">
183 <h5><?php $this->msg('toolbox') ?></h5>
184 <div class="pBody">
185 <ul>
186 <?php
187 if($this->data['notspecialpage']) { ?>
188 <li id="t-whatlinkshere"><a href="<?php
189 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
190 ?>"<?php echo $skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
191 <?php
192 if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
193 <li id="t-recentchangeslinked"><a href="<?php
194 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
195 ?>"<?php echo $skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li>
196 <?php }
197 }
198 if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
199 <li id="t-trackbacklink"><a href="<?php
200 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
201 ?>"<?php echo $skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
202 <?php }
203 if($this->data['feeds']) { ?>
204 <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
205 ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
206 echo htmlspecialchars($feed['href']) ?>"<?php echo $skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
207 <?php } ?></li><?php
208 }
209
210 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
211
212 if($this->data['nav_urls'][$special]) {
213 ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
214 ?>"<?php echo $skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
215 <?php }
216 }
217
218 if(!empty($this->data['nav_urls']['print']['href'])) { ?>
219 <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
220 ?>"<?php echo $skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
221 }
222
223 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
224 <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
225 ?>"<?php echo $skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
226 } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
227 <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
228 }
229
230 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
231 ?> </ul>
232 </div><!-- pBody -->
233 </div><!-- portlet -->
234
235 <!-- languages -->
236 <?php
237 if( $this->data['language_urls'] ) { ?>
238 <div id="p-lang" class="portlet">
239 <h5><?php $this->msg('otherlanguages') ?></h5>
240 <div class="pBody">
241 <ul>
242 <?php foreach($this->data['language_urls'] as $langlink) { ?>
243 <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
244 ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
245 <?php } ?>
246 </ul>
247 </div><!-- pBody -->
248 </div><!-- portlet -->
249 <?php } ?>
250
251 </div><!-- mw_portlets -->
252
253
254 </div><!-- main -->
255
256 <div class="mw_clear"></div>
257
258 <!-- personal portlet -->
259 <div class="portlet" id="p-personal">
260 <h5><?php $this->msg('personaltools') ?></h5>
261 <div class="pBody">
262 <ul>
263 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
264 <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
265 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
266 echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
267 if(!empty($item['class'])) { ?> class="<?php
268 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
269 echo htmlspecialchars($item['text']) ?></a></li>
270 <?php } ?>
271 </ul>
272 </div>
273 </div>
274
275
276 <!-- footer -->
277 <div id="footer">
278 <ul id="f-list">
279 <?php
280 $footerlinks = array(
281 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
282 'privacy', 'about', 'disclaimer', 'tagline',
283 );
284 foreach( $footerlinks as $aLink ) {
285 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
286 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
287 <?php }
288 }
289 ?>
290 </ul>
291 <?php echo $this->html("poweredbyico"); ?>
292 </div>
293
294 <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
295 <?php $this->html('reporttime') ?>
296 <?php if ( $this->data['debug'] ): ?>
297 <!-- Debug output:
298 <?php $this->text( 'debug' ); ?>
299 -->
300 <?php endif; ?>
301 </body></html>
302 <?php
303 wfRestoreWarnings();
304 } // end of execute() method
305 } // end of class
306 ?>