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