f312924b628dfb6cdf2049222751f55d480b92ad
[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 * @package MediaWiki
10 * @subpackage Skins
11 */
12
13 if( !defined( 'MEDIAWIKI' ) )
14 die();
15
16 /** */
17 require_once('includes/SkinTemplate.php');
18
19 /**
20 * Inherit main code from SkinTemplate, set the CSS and template filter.
21 * @todo document
22 * @package MediaWiki
23 * @subpackage Skins
24 */
25 class SkinMonoBook extends SkinTemplate {
26 /** Using monobook. */
27 function initPage( &$out ) {
28 SkinTemplate::initPage( $out );
29 $this->skinname = 'monobook';
30 $this->stylename = 'monobook';
31 $this->template = 'MonoBookTemplate';
32 }
33 }
34
35 /**
36 * @todo document
37 * @package MediaWiki
38 * @subpackage Skins
39 */
40 class MonoBookTemplate extends QuickTemplate {
41 /**
42 * Template filter callback for MonoBook skin.
43 * Takes an associative array of data set from a SkinTemplate-based
44 * class, and a wrapper for MediaWiki's localization database, and
45 * outputs a formatted page.
46 *
47 * @access private
48 */
49 function execute() {
50 // Suppress warnings to prevent notices about missing indexes in $this->data
51 wfSuppressWarnings();
52
53 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
54 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
55 <head>
56 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
57 <?php $this->html('headlinks') ?>
58 <title><?php $this->text('pagetitle') ?></title>
59 <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?5"; /*]]>*/</style>
60 <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css" />
61 <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
62 <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
63 <!--[if gte IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
64 <!--[if IE]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
65 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
66 <?php if($this->data['jsvarurl' ]) { ?>
67 <script type="<?= $this->text('jsmimetype') ?>" src="<?= $this->text('jsvarurl' ) ?>"><!-- site js --></script>
68 <?php } ?>
69 <script type="<?= $this->text('jsmimetype') ?>" src="<?= $this->text('stylepath' ) ?>/common/wikibits.js"><!-- wikibits js --></script>
70 <?php if($this->data['pagecss' ]) { ?>
71 <style type="text/css"><?= $this->html('pagecss' ) ?></style>
72 <?php }
73 if($this->data['usercss' ]) { ?>
74 <style type="text/css"><?= $this->html('usercss' ) ?></style>
75 <?php }
76 if($this->data['userjs' ]) { ?>
77 <script type="<?php $this->text('jsmimetype') ?>" src="<?= $this->text('userjs' ) ?>"></script>
78 <?php }
79 if($this->data['userjsprev']) { ?>
80 <script type="<?php $this->text('jsmimetype') ?>"><?= $this->html('userjsprev') ?></script>
81 <?php }
82 if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
83 </head>
84 <body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
85 <?php if($this->data['body_onload' ]) { ?>onload="<?php $this->text('body_onload') ?>"<?php } ?>
86 <?php if($this->data['nsclass' ]) { ?>class="<?php $this->text('nsclass') ?>"<?php } ?>>
87 <div id="globalWrapper">
88 <div id="column-content">
89 <div id="content">
90 <a name="top" id="top"></a>
91 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
92 <h1 class="firstHeading"><?php $this->text('title') ?></h1>
93 <div id="bodyContent">
94 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
95 <div id="contentSub"><?php $this->html('subtitle') ?></div>
96 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
97 <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk') ?></div><?php } ?>
98 <?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 } ?>
99 <!-- start content -->
100 <?php $this->html('bodytext') ?>
101 <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?>
102 <!-- end content -->
103 <div class="visualClear"></div>
104 </div>
105 </div>
106 </div>
107 <div id="column-one">
108 <div id="p-cactions" class="portlet">
109 <h5><?php $this->msg('views') ?></h5>
110 <ul>
111 <?php foreach($this->data['content_actions'] as $key => $tab) { ?>
112 <li id="ca-<?= htmlspecialchars($key) ?>"<?php
113 if($tab['class']) { ?> class="<?= htmlspecialchars($tab['class']) ?>"<?php }
114 ?>><a href="<?php echo htmlspecialchars($tab['href']) ?>"><?php
115 echo htmlspecialchars($tab['text']) ?></a></li>
116 <?php } ?>
117 </ul>
118 </div>
119 <div class="portlet" id="p-personal">
120 <h5><?php $this->msg('personaltools') ?></h5>
121 <div class="pBody">
122 <ul>
123 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
124 <li id="pt-<?php echo htmlspecialchars($key) ?>"<?php
125 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
126 echo htmlspecialchars($item['href']) ?>"<?php
127 if(!empty($item['class'])) { ?> class="<?php
128 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
129 echo htmlspecialchars($item['text']) ?></a></li>
130 <?php } ?>
131 </ul>
132 </div>
133 </div>
134 <div class="portlet" id="p-logo">
135 <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
136 ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" <?php
137 ?>title="<?php $this->msg('mainpage') ?>"></a>
138 </div>
139 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
140 <?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
141 <div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>
142 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
143 <div class='pBody'>
144 <ul>
145 <?php foreach($cont as $key => $val) { ?>
146 <li id="<?= htmlspecialchars($val['id']) ?>"<?php
147 if ( $val['active'] ) { ?> class="active" <?php }
148 ?>><a href="<?= htmlspecialchars($val['href']) ?>"><?= htmlspecialchars($val['text']) ?></a></li>
149 <?php } ?>
150 </ul>
151 </div>
152 </div>
153 <?php } ?>
154 <div id="p-search" class="portlet">
155 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
156 <div class="pBody">
157 <form action="<?php $this->text('searchaction') ?>" id="searchform"><div>
158 <input id="searchInput" name="search" type="text" <?php
159 if($this->haveMsg('accesskey-search')) {
160 ?>accesskey="<?php $this->msg('accesskey-search') ?>"<?php }
161 if( isset( $this->data['search'] ) ) {
162 ?> value="<?php $this->text('search') ?>"<?php } ?> />
163 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('go') ?>" />&nbsp;
164 <input type='submit' name="fulltext" class="searchButton" value="<?php $this->msg('search') ?>" />
165 </div></form>
166 </div>
167 </div>
168 <div class="portlet" id="p-tb">
169 <h5><?php $this->msg('toolbox') ?></h5>
170 <div class="pBody">
171 <ul>
172 <?php
173 if($this->data['notspecialpage']) { ?>
174 <li id="t-whatlinkshere"><a href="<?php
175 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
176 ?>"><?= $this->msg('whatlinkshere') ?></a></li>
177 <?php
178 if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
179 <li id="t-recentchangeslinked"><a href="<?php
180 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
181 ?>"><?= $this->msg('recentchangeslinked') ?></a></li>
182 <?php }
183 }
184 if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
185 <li id="t-trackbacklink"><a href="<?php
186 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
187 ?>"><?php echo $this->msg('trackbacklink') ?></a></li>
188 <?php }
189 if($this->data['feeds']) { ?>
190 <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
191 ?><span id="feed-<?= htmlspecialchars($key) ?>"><a href="<?php
192 echo htmlspecialchars($feed['href']) ?>"><?= htmlspecialchars($feed['text'])?></a>&nbsp;</span>
193 <?php } ?></li><?php
194 }
195
196 foreach( array('contributions', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
197
198 if($this->data['nav_urls'][$special]) {
199 ?><li id="t-<?= $special ?>"><a href="<?= htmlspecialchars($this->data['nav_urls'][$special]['href'])
200 ?>"><?php $this->msg($special) ?></a></li>
201 <?php }
202 }
203
204 if(!empty($this->data['nav_urls']['print']['href'])) { ?>
205 <li id="t-print"><a href="<?= htmlspecialchars($this->data['nav_urls']['print']['href'])
206 ?>"><?= $this->msg('printableversion') ?></a></li><?php
207 }
208
209 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
210 <li id="t-permalink"><a href="<?= htmlspecialchars($this->data['nav_urls']['permalink']['href'])
211 ?>"><?= $this->msg('permalink') ?></a></li><?php
212 } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
213 <li id="t-ispermalink"><?= $this->msg('permalink') ?></li><?php
214 }
215
216 wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) );
217 ?>
218 </ul>
219 </div>
220 </div>
221 <?php
222 if( $this->data['language_urls'] ) { ?>
223 <div id="p-lang" class="portlet">
224 <h5><?= $this->msg('otherlanguages') ?></h5>
225 <div class="pBody">
226 <ul>
227 <?php foreach($this->data['language_urls'] as $langlink) { ?>
228 <li class="<?= htmlspecialchars($langlink['class'])?>"><?php
229 ?><a href="<?= htmlspecialchars($langlink['href']) ?>"><?= $langlink['text'] ?></a></li>
230 <?php } ?>
231 </ul>
232 </div>
233 </div>
234 <?php } ?>
235 </div><!-- end of the left (by default at least) column -->
236 <div class="visualClear"></div>
237 <div id="footer">
238 <?php
239 if($this->data['poweredbyico']) { ?>
240 <div id="f-poweredbyico"><?php $this->html('poweredbyico') ?></div>
241 <?php }
242 if($this->data['copyrightico']) { ?>
243 <div id="f-copyrightico"><?php $this->html('copyrightico') ?></div>
244 <?php }
245
246 // Generate additional footer links
247 ?>
248 <ul id="f-list">
249 <?php
250 $footerlinks = array(
251 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
252 'privacy', 'about', 'disclaimer', 'tagline',
253 );
254 foreach( $footerlinks as $aLink ) {
255 if( $this->data[$aLink] ) {
256 ?> <li id="<?=$aLink?>"><?= $this->html($aLink) ?></li>
257 <?php }
258 }
259 ?>
260 </ul>
261 </div>
262 <script type="text/javascript"> if (window.runOnloadHook) runOnloadHook();</script>
263 </div>
264 <?= $this->html('reporttime') ?>
265
266 </body></html>
267 <?php
268 wfRestoreWarnings();
269 } // end of execute() method
270 } // end of class
271 ?>