Remove body_onload, was always set false anyway
[lhc/web/wiklou.git] / skins / Modern.php
1 <?php
2 /**
3 * Modern skin, derived from monobook template.
4 *
5 * @todo document
6 * @file
7 * @ingroup Skins
8 */
9
10 if( !defined( 'MEDIAWIKI' ) )
11 die( -1 );
12
13 /**
14 * Inherit main code from SkinTemplate, set the CSS and template filter.
15 * @todo document
16 * @ingroup Skins
17 */
18 class SkinModern extends SkinTemplate {
19 var $skinname = 'modern', $stylename = 'modern',
20 $template = 'ModernTemplate', $useHeadElement = true;
21
22 /*
23 * We don't like the default getPoweredBy, the icon clashes with the
24 * skin L&F.
25 */
26 function getPoweredBy() {
27 global $wgVersion;
28 return "<div class='mw_poweredby'>Powered by MediaWiki $wgVersion</div>";
29 }
30
31 function setupSkinUserCss( OutputPage $out ){
32 global $wgStyleVersion, $wgJsMimeType, $wgStylePath;
33
34 // Do not call parent::setupSkinUserCss(), we have our own print style
35 $out->addStyle( 'common/shared.css', 'screen' );
36 $out->addStyle( 'modern/main.css', 'screen' );
37 $out->addStyle( 'modern/print.css', 'print' );
38 $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' );
39 }
40 }
41
42 /**
43 * @todo document
44 * @ingroup Skins
45 */
46 class ModernTemplate extends QuickTemplate {
47 var $skin;
48 /**
49 * Template filter callback for Modern skin.
50 * Takes an associative array of data set from a SkinTemplate-based
51 * class, and a wrapper for MediaWiki's localization database, and
52 * outputs a formatted page.
53 *
54 * @access private
55 */
56 function execute() {
57 global $wgRequest, $wgOut;
58 $this->skin = $skin = $this->data['skin'];
59 $action = $wgRequest->getText( 'action' );
60
61 // Suppress warnings to prevent notices about missing indexes in $this->data
62 wfSuppressWarnings();
63
64 $this->html( 'headelement' );
65 ?><body<?php if($this->data['body_ondblclick']) { ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
66 class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
67
68 <!-- heading -->
69 <div id="mw_header"><h1 id="firstHeading"><?php $this->html('title') ?></h1></div>
70
71 <div id="mw_main">
72 <div id="mw_contentwrapper">
73 <!-- navigation portlet -->
74 <div id="p-cactions" class="portlet">
75 <h5><?php $this->msg('views') ?></h5>
76 <div class="pBody">
77 <ul>
78 <?php foreach($this->data['content_actions'] as $key => $tab) {
79 echo '
80 <li id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
81 if( $tab['class'] ) {
82 echo ' class="'.htmlspecialchars($tab['class']).'"';
83 }
84 echo'><a href="'.htmlspecialchars($tab['href']).'"';
85 # We don't want to give the watch tab an accesskey if the
86 # page is being edited, because that conflicts with the
87 # accesskey on the watch checkbox. We also don't want to
88 # give the edit tab an accesskey, because that's fairly su-
89 # perfluous and conflicts with an accesskey (Ctrl-E) often
90 # used for editing in Safari.
91 if( in_array( $action, array( 'edit', 'submit' ) )
92 && in_array( $key, array( 'edit', 'watch', 'unwatch' ))) {
93 echo $skin->tooltip( "ca-$key" );
94 } else {
95 echo $skin->tooltipAndAccesskey( "ca-$key" );
96 }
97 echo '>'.htmlspecialchars($tab['text']).'</a></li>';
98 } ?>
99 </ul>
100 </div>
101 </div>
102
103 <!-- content -->
104 <div id="mw_content">
105 <!-- contentholder does nothing by default, but it allows users to style the text inside
106 the content area without affecting the meaning of 'em' in #mw_content, which is used
107 for the margins -->
108 <div id="mw_contentholder" <?php $this->html("specialpageattributes") ?>>
109 <div class='mw-topboxes'>
110 <div id="mw-js-message" style="display:none;" <?php $this->html('userlangattributes')?>></div>
111 <div class="mw-topbox" id="siteSub"><?php $this->msg('tagline') ?></div>
112 <?php if($this->data['newtalk'] ) {
113 ?><div class="usermessage mw-topbox"><?php $this->html('newtalk') ?></div>
114 <?php } ?>
115 <?php if($this->data['sitenotice']) {
116 ?><div class="mw-topbox" id="siteNotice"><?php $this->html('sitenotice') ?></div>
117 <?php } ?>
118 </div>
119
120 <div id="contentSub" <?php $this->html('userlangattributes') ?>><?php $this->html('subtitle') ?></div>
121
122 <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php $this->html('undelete') ?></div><?php } ?>
123 <?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 } ?>
124
125 <?php $this->html('bodytext') ?>
126 <div class='mw_clear'></div>
127 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
128 <?php $this->html ('dataAfterContent') ?>
129 </div><!-- mw_contentholder -->
130 </div><!-- mw_content -->
131 </div><!-- mw_contentwrapper -->
132
133 <div id="mw_portlets" <?php $this->html("userlangattributes") ?>>
134
135 <!-- portlets -->
136 <?php
137 $sidebar = $this->data['sidebar'];
138 if ( !isset( $sidebar['SEARCH'] ) ) $sidebar['SEARCH'] = true;
139 if ( !isset( $sidebar['TOOLBOX'] ) ) $sidebar['TOOLBOX'] = true;
140 if ( !isset( $sidebar['LANGUAGES'] ) ) $sidebar['LANGUAGES'] = true;
141
142 foreach ($sidebar as $boxName => $cont) {
143 if ( $boxName == 'SEARCH' ) {
144 $this->searchBox();
145 } elseif ( $boxName == 'TOOLBOX' ) {
146 $this->toolbox();
147 } elseif ( $boxName == 'LANGUAGES' ) {
148 $this->languageBox();
149 } else {
150 $this->customBox( $boxName, $cont );
151 }
152 }
153 ?>
154
155 </div><!-- mw_portlets -->
156
157
158 </div><!-- main -->
159
160 <div class="mw_clear"></div>
161
162 <!-- personal portlet -->
163 <div class="portlet" id="p-personal">
164 <h5><?php $this->msg('personaltools') ?></h5>
165 <div class="pBody">
166 <ul>
167 <?php foreach($this->data['personal_urls'] as $key => $item) { ?>
168 <li id="<?php echo Sanitizer::escapeId( "pt-$key" ) ?>"<?php
169 if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php
170 echo htmlspecialchars($item['href']) ?>"<?php echo $skin->tooltipAndAccesskey('pt-'.$key) ?><?php
171 if(!empty($item['class'])) { ?> class="<?php
172 echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
173 echo htmlspecialchars($item['text']) ?></a></li>
174 <?php } ?>
175 </ul>
176 </div>
177 </div>
178
179
180 <!-- footer -->
181 <div id="footer" <?php $this->html('userlangattributes') ?>>
182 <ul id="f-list">
183 <?php
184 $footerlinks = array(
185 'lastmod', 'viewcount', 'numberofwatchingusers', 'credits', 'copyright',
186 'privacy', 'about', 'disclaimer', 'tagline',
187 );
188 foreach( $footerlinks as $aLink ) {
189 if( isset( $this->data[$aLink] ) && $this->data[$aLink] ) {
190 ?> <li id="<?php echo$aLink?>"><?php $this->html($aLink) ?></li>
191 <?php }
192 }
193 ?>
194 </ul>
195 <?php echo $this->html("poweredbyico"); ?>
196 </div>
197
198 <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
199 <?php $this->html('reporttime') ?>
200 <?php if ( $this->data['debug'] ): ?>
201 <!-- Debug output:
202 <?php $this->text( 'debug' ); ?>
203 -->
204 <?php endif; ?>
205 </body></html>
206 <?php
207 wfRestoreWarnings();
208 } // end of execute() method
209
210 /*************************************************************************************************/
211 function searchBox() {
212 global $wgUseTwoButtonsSearchForm;
213 ?>
214 <!-- search -->
215 <div id="p-search" class="portlet">
216 <h5><label for="searchInput"><?php $this->msg('search') ?></label></h5>
217 <div id="searchBody" class="pBody">
218 <form action="<?php $this->text('wgScript') ?>" id="searchform">
219 <input type='hidden' name="title" value="<?php $this->text('searchtitle') ?>"/>
220 <input id="searchInput" name="search" type="text"<?php echo $this->skin->tooltipAndAccesskey('search');
221 if( isset( $this->data['search'] ) ) {
222 ?> value="<?php $this->text('search') ?>"<?php } ?> />
223 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg('searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /><?php if ($wgUseTwoButtonsSearchForm) { ?>&nbsp;
224 <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg('searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /><?php } else { ?>
225
226 <div><a href="<?php $this->text('searchaction') ?>" rel="search"><?php $this->msg('powersearch-legend') ?></a></div><?php } ?>
227
228 </form>
229 </div>
230 </div>
231 <?php
232 }
233
234 /*************************************************************************************************/
235 function toolbox() {
236 ?>
237 <!-- toolbox -->
238 <div class="portlet" id="p-tb">
239 <h5><?php $this->msg('toolbox') ?></h5>
240 <div class="pBody">
241 <ul>
242 <?php
243 if($this->data['notspecialpage']) { ?>
244 <li id="t-whatlinkshere"><a href="<?php
245 echo htmlspecialchars($this->data['nav_urls']['whatlinkshere']['href'])
246 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-whatlinkshere') ?>><?php $this->msg('whatlinkshere') ?></a></li>
247 <?php
248 if( $this->data['nav_urls']['recentchangeslinked'] ) { ?>
249 <li id="t-recentchangeslinked"><a href="<?php
250 echo htmlspecialchars($this->data['nav_urls']['recentchangeslinked']['href'])
251 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-recentchangeslinked') ?>><?php $this->msg('recentchangeslinked-toolbox') ?></a></li>
252 <?php }
253 }
254 if(isset($this->data['nav_urls']['trackbacklink'])) { ?>
255 <li id="t-trackbacklink"><a href="<?php
256 echo htmlspecialchars($this->data['nav_urls']['trackbacklink']['href'])
257 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-trackbacklink') ?>><?php $this->msg('trackbacklink') ?></a></li>
258 <?php }
259 if($this->data['feeds']) { ?>
260 <li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
261 ?><a id="<?php echo Sanitizer::escapeId( "feed-$key" ) ?>" href="<?php
262 echo htmlspecialchars($feed['href']) ?>" rel="alternate" type="application/<?php echo $key ?>+xml" class="feedlink"<?php echo $this->skin->tooltipAndAccesskey('feed-'.$key) ?>><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;
263 <?php } ?></li><?php
264 }
265
266 foreach( array('contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) {
267
268 if($this->data['nav_urls'][$special]) {
269 ?><li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
270 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-'.$special) ?>><?php $this->msg($special) ?></a></li>
271 <?php }
272 }
273
274 if(!empty($this->data['nav_urls']['print']['href'])) { ?>
275 <li id="t-print"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['print']['href'])
276 ?>" rel="alternate"<?php echo $this->skin->tooltipAndAccesskey('t-print') ?>><?php $this->msg('printableversion') ?></a></li><?php
277 }
278
279 if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
280 <li id="t-permalink"><a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
281 ?>"<?php echo $this->skin->tooltipAndAccesskey('t-permalink') ?>><?php $this->msg('permalink') ?></a></li><?php
282 } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
283 <li id="t-ispermalink"<?php echo $this->skin->tooltip('t-ispermalink') ?>><?php $this->msg('permalink') ?></li><?php
284 }
285
286 wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) );
287 ?>
288 </ul>
289 </div>
290 </div>
291 <?php
292 }
293
294 /*************************************************************************************************/
295 function languageBox() {
296 if( $this->data['language_urls'] ) {
297 ?>
298 <div id="p-lang" class="portlet">
299 <h5><?php $this->msg('otherlanguages') ?></h5>
300 <div class="pBody">
301 <ul>
302 <?php foreach($this->data['language_urls'] as $langlink) { ?>
303 <li class="<?php echo htmlspecialchars($langlink['class'])?>"><?php
304 ?><a href="<?php echo htmlspecialchars($langlink['href']) ?>"><?php echo $langlink['text'] ?></a></li>
305 <?php } ?>
306 </ul>
307 </div>
308 </div>
309 <?php
310 }
311 }
312
313 /*************************************************************************************************/
314 function customBox( $bar, $cont ) {
315 ?>
316 <div class='generated-sidebar portlet' id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo $this->skin->tooltip('p-'.$bar) ?>>
317 <h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
318 <div class='pBody'>
319 <?php if ( is_array( $cont ) ) { ?>
320 <ul>
321 <?php foreach($cont as $key => $val) { ?>
322 <li id="<?php echo Sanitizer::escapeId($val['id']) ?>"<?php
323 if ( $val['active'] ) { ?> class="active" <?php }
324 ?>><a href="<?php echo htmlspecialchars($val['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey($val['id']) ?>><?php echo htmlspecialchars($val['text']) ?></a></li>
325 <?php } ?>
326 </ul>
327 <?php } else {
328 # allow raw HTML block to be defined by extensions
329 print $cont;
330 }
331 ?>
332 </div>
333 </div>
334 <?php
335 }
336
337 } // end of class
338
339