added PPCustomFrame classes to restore ability to use replaceVariables with a custom...
[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;
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 <style type="text/css" media="screen, projection">/*<![CDATA[*/
64 @import "<?php $this->text('stylepath') ?>/common/shared.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
65 @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";
66 /*]]>*/</style>
67 <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('printcss') ?>?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
68 <?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]-->
69 <?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]-->
70 <?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]-->
71 <?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]-->
72 <?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>
73 <?php } ?><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
74
75 <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
76
77 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
78 <!-- Head Scripts -->
79 <?php $this->html('headscripts') ?>
80 <?php if($this->data['jsvarurl']) { ?>
81 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl') ?>"><!-- site js --></script>
82 <?php } ?>
83 <?php if($this->data['pagecss']) { ?>
84 <style type="text/css"><?php $this->html('pagecss') ?></style>
85 <?php }
86 if($this->data['usercss']) { ?>
87 <style type="text/css"><?php $this->html('usercss') ?></style>
88 <?php }
89 if($this->data['userjs']) { ?>
90 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
91 <?php }
92 if($this->data['userjsprev']) { ?>
93 <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
94 <?php }
95 if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
96 </head>
97 <body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
98 <?php if($this->data['body_onload']) { ?> onload="<?php $this->text('body_onload') ?>"<?php } ?>
99 class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">
100 <div id="globalWrapper">
101 <div id="column-content">
102 <div id="content">
103 <a name="top" id="top"></a>
104 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
105 <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
106 <div id="bodyContent">
107 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
108 <div id="contentSub"><?php $this->html('subtitle') ?></div>
109 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
110 <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
111 <?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 } ?>
112 <!-- start content -->
113 <?php $this->html('bodytext') ?>
114 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
115 <!-- end content -->
116 <div class="visualClear"></div>
117 </div>
118 </div>
119 </div>
120 <div id="column-one">
121 <div id="p-cactions" class="portlet">
122 <h5><?php $this->msg('views') ?></h5>
123 <div class="pBody">
124 <ul>
125 <?php foreach($this->data['content_actions'] as $key => $tab) { ?>
126 <li id="ca-<?php echo Sanitizer::escapeId($key) ?>"<?php
127 if($tab['class']) { ?> class="<?php echo htmlspecialchars($tab['class']) ?>"<?php }
128 ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"<?php echo $skin->tooltipAndAccesskey('ca-'.$key) ?>><?php
129 echo htmlspecialchars($tab['text']) ?></a></li>
130 <?php } ?>
131 </ul>
132 </div>
133 </div>
134 <div class="portlet" id="p-personal">
135 <h5><?php $this->msg('personaltools') ?></h5>
136 <div class="pBody">
137 <ul>
138 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
139 <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
140 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
141 echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
142 if(!empty($item['class'])) { ?> class="<?php
143 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
144 echo htmlspecialchars($item['text']) ?></a></li>
145 <?php } ?>
146 </ul>
147 </div>
148 </div>
149 <div class="portlet" id="p-logo">
150 <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
151 ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"<?php
152 echo $skin->tooltipAndAccesskey('n-mainpage') ?>></a>
153 </div>
154 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
155 <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
156 <div class='generated-sidebar portlet' id='p-<?php echo Sanitizer::escapeId($bar) ?>'<?php echo $skin->tooltip('p-'.$bar) ?>>
157 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
158 <div class='pBody'>
159 <ul>
160 <?php foreach($cont as $key => $val) { ?>
161 <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
162 if ( $val['active'] ) { ?> class="active" <?php }
163 ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
164 <?php } ?>
165 </ul>
166 </div>
167 </div>
168 <?php } ?>
169 <div id="p-search" class="portlet">
170 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
171 <div id="searchBody" class="pBody">
172 <form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
173 <input id="searchInput" name="search" type="text"<?php echo $skin->tooltipAndAccesskey('search');
174 if( isset( $this->data['search'] ) ) {
175 ?> value="<?php $this->text('search') ?>"<?php } ?> />
176 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-go' ); ?> />&nbsp;
177 <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
178 </div></form>
179 </div>
180 </div>
181 <div class="portlet" id="p-tb">
182 <h5><?php $this->msg('toolbox') ?></h5>
183 <div class="pBody">
184 <ul>
185 <?php
186 if($this->data['notspecialpage']) { ?>
187 <li id="t-whatlinkshere"><a href="<?php
188 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
189 ?>"<?php echo $skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
190 <?php
191 if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
192 <li id="t-recentchangeslinked"><a href="<?php
193 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
194 ?>"<?php echo $skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked') ?></a></li>
195 <?php }
196 }
197 if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
198 <li id="t-trackbacklink"><a href="<?php
199 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
200 ?>"<?php echo $skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
201 <?php }
202 if($this->data['feeds']) { ?>
203 <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
204 ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
205 echo htmlspecialchars($feed['href']) ?>"<?php echo $skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
206 <?php } ?></li><?php
207 }
208
209 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
210
211 if($this->data['nav_urls'][$special]) {
212 ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
213 ?>"<?php echo $skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
214 <?php }
215 }
216
217 if(!empty($this->data['nav_urls']['print']['href'])) { ?>
218 <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
219 ?>"<?php echo $skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
220 }
221
222 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
223 <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
224 ?>"<?php echo $skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
225 } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
226 <li id="t-ispermalink"<?php echo $skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
227 }
228
229 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
230 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
231 ?>
232 </ul>
233 </div>
234 </div>
235 <?php
236 if( $this->data['language_urls'] ) { ?>
237 <div id="p-lang" class="portlet">
238 <h5><?php $this->msg('otherlanguages') ?></h5>
239 <div class="pBody">
240 <ul>
241 <?php foreach($this->data['language_urls'] as $langlink) { ?>
242 <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
243 ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
244 <?php } ?>
245 </ul>
246 </div>
247 </div>
248 <?php } ?>
249 </div><!-- end of the left (by default at least) column -->
250 <div class="visualClear"></div>
251 <div id="footer">
252 <?php
253 if($this->data['poweredbyico']) { ?>
254 <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
255 <?php }
256 if($this->data['copyrightico']) { ?>
257 <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
258 <?php }
259
260 // Generate additional footer links
261 ?>
262 <ul id="f-list">
263 <?php
264 $footerlinks = array(
265 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
266 'privacy', 'about', 'disclaimer', 'tagline',
267 );
268 foreach( $footerlinks as $aLink ) {
269 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
270 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
271 <?php }
272 }
273 ?>
274 </ul>
275 </div>
276 </div>
277 <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
278 <?php $this->html('reporttime') ?>
279 <?php if ( $this->data['debug'] ): ?>
280 <!-- Debug output:
281 <?php $this->text( 'debug' ); ?>
282
283 -->
284 <?php endif; ?>
285 </body></html>
286 <?php
287 wfRestoreWarnings();
288 } // end of execute() method
289 } // end of class