* adding <meta name="generator" content="MediaWiki $wgVersion" />
[lhc/web/wiklou.git] / skins / MonoBook.php
1 <?php
2 /**
3 * MonoBook nouveau
4 *
5 * Translated from gwicke's previous TAL template version to remove
6 * dependency on PHPTAL.
7 *
8 * @todo document
9 * @file
10 * @ingroup Skins
11 */
12
13 if( !defined( 'MEDIAWIKI' ) )
14 die( -1 );
15
16 /**
17 * Inherit main code from SkinTemplate, set the CSS and template filter.
18 * @todo document
19 * @ingroup Skins
20 */
21 class SkinMonoBook extends SkinTemplate {
22 /** Using monobook. */
23 function initPage( &$out ) {
24 SkinTemplate::initPage( $out );
25 $this->skinname = 'monobook';
26 $this->stylename = 'monobook';
27 $this->template = 'MonoBookTemplate';
28 # Bug 14520: skins that just include this file shouldn't load nonexis-
29 # tent CSS fix files.
30 $this->cssfiles = array( 'IE', 'IE50', 'IE55', 'IE60', 'IE70', 'rtl' );
31 }
32 }
33
34 /**
35 * @todo document
36 * @ingroup Skins
37 */
38 class MonoBookTemplate extends QuickTemplate {
39 /**
40 * Template filter callback for MonoBook skin.
41 * Takes an associative array of data set from a SkinTemplate-based
42 * class, and a wrapper for MediaWiki's localization database, and
43 * outputs a formatted page.
44 *
45 * @access private
46 */
47 function execute() {
48 global $wgUser, $wgVersion;
49 $skin = $wgUser->getSkin();
50
51 // Suppress warnings to prevent notices about missing indexes in $this->data
52 wfSuppressWarnings();
53
54 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
55 <html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
56 foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
57 ?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
58 } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
59 <head>
60 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
61 <?php $this->html('headlinks') ?>
62 <title><?php $this->text('pagetitle') ?></title>
63 <meta name="generator" content="MediaWiki <?php echo $wgVersion ?>" />
64 <style type="text/css" media="screen, projection">/*<![CDATA[*/
65 @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
66 @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
67 /*]]>*/</style>
68 <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('printcss') ?>?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
69 <?php if( in_array( 'IE50', $skin->cssfiles ) ) { ?><!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
70 <?php } if( in_array( 'IE55', $skin->cssfiles ) ) { ?><!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
71 <?php } if( in_array( 'IE60', $skin->cssfiles ) ) { ?><!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
72 <?php } if( in_array( 'IE70', $skin->cssfiles ) ) { ?><!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
73 <?php } ?><!--[if lt IE 7]><?php if( in_array( 'IE', $skin->cssfiles ) ) { ?><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
74 <?php } ?><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
75
76 <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
77
78 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
79 <!-- Head Scripts -->
80 <?php $this->html('headscripts') ?>
81 <?php if($this->data['jsvarurl']) { ?>
82 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl') ?>"><!-- site js --></script>
83 <?php } ?>
84 <?php if($this->data['pagecss']) { ?>
85 <style type="text/css"><?php $this->html('pagecss') ?></style>
86 <?php }
87 if($this->data['usercss']) { ?>
88 <style type="text/css"><?php $this->html('usercss') ?></style>
89 <?php }
90 if($this->data['userjs']) { ?>
91 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
92 <?php }
93 if($this->data['userjsprev']) { ?>
94 <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
95 <?php }
96 if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
97 </head>
98 <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
99 <?php if($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
100 class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">
101 <div id="globalWrapper">
102 <div id="column-content">
103 <div id="content">
104 <a name="top" id="top"></a>
105 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
106 <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
107 <div id="bodyContent">
108 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
109 <div id="contentSub"><?php $this->html('subtitle') ?></div>
110 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
111 <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
112 <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
113 <!-- start content -->
114 <?php $this->html('bodytext') ?>
115 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
116 <!-- end content -->
117 <div class="visualClear"></div>
118 </div>
119 </div>
120 </div>
121 <div id="column-one">
122 <div id="p-cactions" class="portlet">
123 <h5><?php $this->msg('views') ?></h5>
124 <div class="pBody">
125 <ul>
126 <?php foreach($this->data['content_actions'] as $key => $tab) { ?>
127 <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
128 if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
129 ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php
130 echo htmlspecialchars($tab['text']) ?></a></li>
131 <?php } ?>
132 </ul>
133 </div>
134 </div>
135 <div class="portlet" id="p-personal">
136 <h5><?php $this->msg('personaltools') ?></h5>
137 <div class="pBody">
138 <ul>
139 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
140 <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
141 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
142 echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
143 if(!empty($item['class'])) { ?> class="<?php
144 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
145 echo htmlspecialchars($item['text']) ?></a></li>
146 <?php } ?>
147 </ul>
148 </div>
149 </div>
150 <div class="portlet" id="p-logo">
151 <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
152 ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
153 echo $skin->tooltipAndAccesskey('n-mainpage') ?>></a>
154 </div>
155 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
156 <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
157 <div class='generated-sidebar portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $skin->tooltip('p-'.$bar) ?>>
158 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
159 <div class='pBody'>
160 <ul>
161 <?php foreach($cont as $key => $val) { ?>
162 <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
163 if ( $val['active'] ) { ?> class="active" <?php }
164 ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
165 <?php } ?>
166 </ul>
167 </div>
168 </div>
169 <?php } ?>
170 <div id="p-search" class="portlet">
171 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
172 <div id="searchBody" class="pBody">
173 <form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
174 <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search');
175 if( isset( $this->data['search'] ) ) {
176 ?> value="<?php $this->text('search') ?>"<?php } ?> />
177 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-go' ); ?> />&nbsp;
178 <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
179 </div></form>
180 </div>
181 </div>
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( 'MonoBookTemplateToolboxEnd', array( &$this ) );
231 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
232 ?>
233 </ul>
234 </div>
235 </div>
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>
248 </div>
249 <?php } ?>
250 </div><!-- end of the left (by default at least) column -->
251 <div class="visualClear"></div>
252 <div id="footer">
253 <?php
254 if($this->data['poweredbyico']) { ?>
255 <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
256 <?php }
257 if($this->data['copyrightico']) { ?>
258 <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
259 <?php }
260
261 // Generate additional footer links
262 ?>
263 <ul id="f-list">
264 <?php
265 $footerlinks = array(
266 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
267 'privacy', 'about', 'disclaimer', 'tagline',
268 );
269 foreach( $footerlinks as $aLink ) {
270 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
271 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
272 <?php }
273 }
274 ?>
275 </ul>
276 </div>
277 </div>
278 <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
279 <?php $this->html('reporttime') ?>
280 <?php if ( $this->data['debug'] ): ?>
281 <!-- Debug output:
282 <?php $this->text( 'debug' ); ?>
283
284 -->
285 <?php endif; ?>
286 </body></html>
287 <?php
288 wfRestoreWarnings();
289 } // end of execute() method
290 } // end of class