* (bug 18958) Added ability to disable entire variant conversion engine per user...
[lhc/web/wiklou.git] / skins / Vector.php
1 <?php
2 /**
3 * Vector - Branch of MonoBook which has many usability improvements and
4 * somewhat cleaner code.
5 *
6 * @todo document
7 * @file
8 * @ingroup Skins
9 */
10
11 if( !defined( 'MEDIAWIKI' ) )
12 die( -1 );
13
14 /**
15 * SkinTemplate class for Vector skin
16 * @ingroup Skins
17 */
18 class SkinVector extends SkinTemplate {
19
20 /* Functions */
21
22 /**
23 * Intializes output page and sets up skin-specific parameters
24 * @param object $out Output page object to initialize
25 */
26 public function initPage( OutputPage $out ) {
27 parent::initPage( $out );
28 $this->skinname = 'vector';
29 $this->stylename = 'vector';
30 $this->template = 'VectorTemplate';
31 }
32
33 /**
34 * Defines CSS files to be included
35 * @param object $out Output page to add styles to
36 */
37 public function setupSkinUserCss( OutputPage $out ) {
38 global $wgHandheldStyle;
39
40 parent::setupSkinUserCss( $out );
41
42 // Append to the default screen common & print styles...
43 $out->addStyle( 'vector/main.css', 'screen' );
44 }
45
46 /**
47 * A structured array of edit links by default used for the tabs
48 * @return array
49 * @private
50 */
51 function buildNavigationUrls() {
52 global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest;
53 global $wgEnableVariants;
54
55 wfProfileIn( __METHOD__ );
56
57 $links = array(
58 'namespaces' => array(),
59 'views' => array(),
60 'actions' => array(),
61 'variants' => array()
62 );
63
64 // Detects parameters
65 $action = $wgRequest->getVal( 'action', 'view' );
66 $section = $wgRequest->getVal( 'section' );
67
68 // Checks if page is some kind of content
69 if( $this->iscontent ) {
70
71 // Gets page objects for the related namespaces
72 $subjectPage = $this->mTitle->getSubjectPage();
73 $talkPage = $this->mTitle->getTalkPage();
74
75 // Determines if this is a talk page
76 $isTalk = $this->mTitle->isTalkPage();
77
78 // Generates XML IDs from namespace names
79 $subjectId = $wgContLang->lc( $this->mTitle->getSubjectNsText() );
80 if ( $subjectId == '' ) {
81 $subjectId = 'main';
82 }
83 $talkId = "{$subjectId}_talk";
84 $currentId = $isTalk ? $talkId : $subjectId;
85
86 // Adds namespace links
87 $links['namespaces'][$subjectId] = $this->tabAction(
88 $subjectPage, 'nstab-' . $subjectId, !$isTalk, '', true
89 );
90 $links['namespaces'][$talkId] = $this->tabAction(
91 $talkPage, 'talk', $isTalk, '', true
92 );
93
94 // Adds view view link
95 if ( $this->mTitle->exists() ) {
96 $links['views']['view'] = $this->tabAction(
97 $isTalk ? $talkPage : $subjectPage,
98 'view', ( $action == 'view' ), '', true
99 );
100 }
101
102 wfProfileIn( __METHOD__ . '-edit' );
103
104 // Checks if user can...
105 if (
106 // edit the current page
107 $this->mTitle->quickUserCan( 'edit' ) &&
108 (
109 // if it exists
110 $this->mTitle->exists() ||
111 // or they can create one here
112 $this->mTitle->quickUserCan( 'create' )
113 )
114 ) {
115 // Builds CSS class for talk page links
116 $isTalkClass = $isTalk ? ' istalk' : '';
117
118 // Determines if we're in edit mode
119 $selected = (
120 ( $action == 'edit' || $action == 'submit' ) &&
121 ( $section != 'new' )
122 );
123 $links['views']['edit'] = array(
124 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass,
125 'text' => $this->mTitle->exists()
126 ? wfMsg( 'edit' )
127 : wfMsg( 'create' ),
128 'href' =>
129 $this->mTitle->getLocalUrl( $this->editUrlOptions() )
130 );
131 // Checks if this is a talk page and we should show a new
132 // section link
133 if ( $isTalk || $wgOut->showNewSectionLink() ) {
134 // Checks if we should ever show a new section link
135 if ( !$wgOut->forceHideNewSectionLink() ) {
136 // Adds new section link
137 $links['actions']['addsection'] = array(
138 'class' => $section == 'new' ? 'selected' : false,
139 'text' => wfMsg( 'addsection' ),
140 'href' => $this->mTitle->getLocalUrl(
141 'action=edit&section=new'
142 )
143 );
144 }
145 }
146 // Checks if the page is known (some kind of viewable content)
147 } elseif ( $this->mTitle->isKnown() ) {
148 // Adds view source view link
149 $links['views']['viewsource'] = array(
150 'class' => ( $action == 'edit') ? 'selected' : false,
151 'text' => wfMsg( 'viewsource' ),
152 'href' =>
153 $this->mTitle->getLocalUrl( $this->editUrlOptions() )
154 );
155 }
156 wfProfileOut( __METHOD__ . '-edit' );
157
158 wfProfileIn( __METHOD__ . '-live' );
159
160 // Checks if the page exists
161 if ( $this->mTitle->exists() ) {
162 // Adds history view link
163 $links['views']['history'] = array(
164 'class' => ($action == 'history') ? 'selected' : false,
165 'text' => wfMsg( 'history_short' ),
166 'href' => $this->mTitle->getLocalUrl( 'action=history' ),
167 'rel' => 'archives',
168 );
169
170 if( $wgUser->isAllowed( 'delete' ) ) {
171 $links['actions']['delete'] = array(
172 'class' => ($action == 'delete') ? 'selected' : false,
173 'text' => wfMsg( 'delete' ),
174 'href' => $this->mTitle->getLocalUrl( 'action=delete' )
175 );
176 }
177 if ( $this->mTitle->quickUserCan( 'move' ) ) {
178 $moveTitle = SpecialPage::getTitleFor(
179 'Movepage', $this->thispage
180 );
181 $links['actions']['move'] = array(
182 'class' => $this->mTitle->isSpecial( 'Movepage' ) ?
183 'selected' : false,
184 'text' => wfMsg( 'move' ),
185 'href' => $moveTitle->getLocalUrl()
186 );
187 }
188
189 if (
190 $this->mTitle->getNamespace() !== NS_MEDIAWIKI &&
191 $wgUser->isAllowed( 'protect' )
192 ) {
193 if ( !$this->mTitle->isProtected() ){
194 $links['actions']['protect'] = array(
195 'class' => ($action == 'protect') ?
196 'selected' : false,
197 'text' => wfMsg( 'protect' ),
198 'href' =>
199 $this->mTitle->getLocalUrl( 'action=protect' )
200 );
201
202 } else {
203 $links['actions']['unprotect'] = array(
204 'class' => ($action == 'unprotect') ?
205 'selected' : false,
206 'text' => wfMsg( 'unprotect' ),
207 'href' =>
208 $this->mTitle->getLocalUrl( 'action=unprotect' )
209 );
210 }
211 }
212 } else {
213 // article doesn't exist or is deleted
214 if (
215 $wgUser->isAllowed( 'deletedhistory' ) &&
216 $wgUser->isAllowed( 'undelete' )
217 ) {
218 if( $n = $this->mTitle->isDeleted() ) {
219 $undelTitle = SpecialPage::getTitleFor( 'Undelete' );
220 $links['actions']['undelete'] = array(
221 'class' => false,
222 'text' => wfMsgExt(
223 'undelete_short',
224 array( 'parsemag' ),
225 $wgLang->formatNum( $n )
226 ),
227 'href' => $undelTitle->getLocalUrl(
228 'target=' . urlencode( $this->thispage )
229 )
230 );
231 }
232 }
233
234 if (
235 $this->mTitle->getNamespace() !== NS_MEDIAWIKI &&
236 $wgUser->isAllowed( 'protect' )
237 ) {
238 if ( !$this->mTitle->getRestrictions( 'create' ) ) {
239 $links['actions']['protect'] = array(
240 'class' => ($action == 'protect') ?
241 'selected' : false,
242 'text' => wfMsg( 'protect' ),
243 'href' =>
244 $this->mTitle->getLocalUrl( 'action=protect' )
245 );
246
247 } else {
248 $links['actions']['unprotect'] = array(
249 'class' => ($action == 'unprotect') ?
250 'selected' : false,
251 'text' => wfMsg( 'unprotect' ),
252 'href' =>
253 $this->mTitle->getLocalUrl( 'action=unprotect' )
254 );
255 }
256 }
257 }
258 wfProfileOut( __METHOD__ . '-live' );
259
260 // Checks if the user is logged in
261 if( $this->loggedin ) {
262 // Checks if the user is watching this page
263 if( !$this->mTitle->userIsWatching() ) {
264 // Adds watch action link
265 $links['actions']['watch'] = array(
266 'class' =>
267 ( $action == 'watch' or $action == 'unwatch') ?
268 'selected' : false,
269 'text' => wfMsg( 'watch' ),
270 'href' => $this->mTitle->getLocalUrl( 'action=watch' )
271 );
272 } else {
273 // Adds unwatch action link
274 $links['actions']['unwatch'] = array(
275 'class' =>
276 ($action == 'unwatch' or $action == 'watch') ?
277 'selected' : false,
278 'text' => wfMsg( 'unwatch' ),
279 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' )
280 );
281 }
282 }
283
284 // If it's not content, it's got to be a special page
285 } else {
286 $links['namespaces']['special'] = array(
287 'class' => 'selected',
288 'text' => wfMsg('nstab-special'),
289 'href' => $wgRequest->getRequestURL()
290 );
291 }
292
293 // Gets list of language variants
294 $variants = $wgContLang->getVariants();
295 // Checks that language conversion is enabled and variants exist
296 if( $wgEnableVariants && count( $variants ) > 1 ) {
297 // Gets preferred variant
298 $preferred = $wgContLang->getPreferredVariant();
299 // Loops over each variant
300 $vcount = 0;
301 foreach( $variants as $code ) {
302 // Gets variant name from language code
303 $varname = $wgContLang->getVariantname( $code );
304 // Checks if the variant is marked as disabled
305 if( $varname == 'disable' ) {
306 // Skips this variant
307 continue;
308 }
309 // Appends variant link
310 $links['variants'][$vcount] = array(
311 'class' => ( $code == $preferred )? 'selected' : false,
312 'text' => $varname,
313 'href' => $this->mTitle->getLocalURL( '', $code )
314 );
315 $vcount ++;
316 }
317 }
318
319 wfProfileOut( __METHOD__ );
320
321 return $links;
322 }
323 }
324
325 /**
326 * QuickTemplate class for Vector skin
327 * @ingroup Skins
328 */
329 class VectorTemplate extends QuickTemplate {
330
331 /* Members */
332
333 /**
334 * @var Cached skin object
335 */
336 var $skin;
337
338 /* Functions */
339
340 /**
341 * Outputs the entire contents of the XHTML page
342 */
343 public function execute() {
344 global $wgRequest, $wgUseTwoButtonsSearchForm;
345
346 $this->skin = $this->data['skin'];
347 $action = $wgRequest->getText( 'action' );
348
349 // Suppress warnings to prevent notices about missing indexes in
350 // $this->data (is this really the best way to handle this?)
351 wfSuppressWarnings();
352
353 // Build additional attributes for navigation urls
354 $nav = $this->skin->buildNavigationUrls();
355 foreach ( $nav as $section => $links ) {
356 foreach ( $links as $key => $link ) {
357 $nav[$section][$key]['attributes'] =
358 ' id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
359 if ( $nav[$section][$key]['class'] ) {
360 $nav[$section][$key]['attributes'] .=
361 ' class="' . htmlspecialchars( $link['class'] ) . '"';
362 }
363 // We don't want to give the watch tab an accesskey if the page is
364 // being edited, because that conflicts with the accesskey on the
365 // watch checkbox. We also don't want to give the edit tab an
366 // accesskey, because that's fairly superfluous and conflicts with
367 // an accesskey (Ctrl-E) often used for editing in Safari.
368 if (
369 in_array( $action, array( 'edit', 'submit' ) ) &&
370 in_array( $key, array( 'edit', 'watch', 'unwatch' ) )
371 ) {
372 $nav[$section][$key]['key'] =
373 $this->skin->tooltip( "ca-$key" );
374 } else {
375 $nav[$section][$key]['key'] =
376 $this->skin->tooltipAndAccesskey( "ca-$key" );
377 }
378 }
379 }
380 $this->data['namespace_urls'] = $nav['namespaces'];
381 $this->data['view_urls'] = $nav['views'];
382 $this->data['action_urls'] = $nav['actions'];
383 $this->data['variant_urls'] = $nav['variants'];
384
385 // Build additional attributes for personal_urls
386 foreach ( $this->data['personal_urls'] as $key => $item) {
387 $this->data['personal_urls'][$key]['attributes'] =
388 ' id="' . Sanitizer::escapeId( "pt-$key" ) . '"';
389 if ( $item['active'] ) {
390 $this->data['personal_urls'][$key]['attributes'] .=
391 ' class="active"';
392 }
393 $this->data['personal_urls'][$key]['key'] =
394 $this->skin->tooltipAndAccesskey('pt-'.$key);
395 }
396
397 // Generate additional footer links
398 $footerlinks = array(
399 'info' => array(
400 'lastmod',
401 'viewcount',
402 'numberofwatchingusers',
403 'credits',
404 'copyright',
405 'tagline',
406 ),
407 'places' => array(
408 'privacy',
409 'about',
410 'disclaimer',
411 ),
412 );
413
414 // Build list of valid footer links
415 $validFooterLinks = array();
416 foreach( $footerlinks as $category => $links ) {
417 $validFooterLinks[$category] = array();
418 foreach( $links as $link ) {
419 if( isset( $this->data[$link] ) && $this->data[$link] ) {
420 $validFooterLinks[$category][] = $link;
421 }
422 }
423 }
424
425 // Begin content output
426 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
427 <html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php foreach($this->data['xhtmlnamespaces'] as $tag => $ns): ?>xmlns:<?php echo "{$tag}=\"{$ns}\" "; ?><?php endforeach ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">
428 <head>
429 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
430 <title><?php $this->text('pagetitle') ?></title>
431 <!-- headlinks -->
432 <?php $this->html('headlinks') ?>
433 <!-- /headlinks -->
434 <!-- csslinks -->
435 <?php $this->html('csslinks') ?>
436 <!-- /csslinks -->
437 <!-- IEFixes -->
438 <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
439 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
440 <!-- /IEFixes -->
441 <!-- globalVariablesScript -->
442 <?php echo Skin::makeGlobalVariablesScript( $this->data ); ?>
443 <!-- /globalVariablesScript -->
444 <!-- wikibits -->
445 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
446 <!-- /wikibits -->
447 <!-- headscripts -->
448 <?php $this->html('headscripts') ?>
449 <!-- /headscripts -->
450 <?php if($this->data['jsvarurl']): ?>
451 <!-- jsvarurl -->
452 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl') ?>"><!-- site js --></script>
453 <!-- /jsvarurl -->
454 <?php endif; ?>
455 <?php if($this->data['pagecss']): ?>
456 <!-- pagecss -->
457 <style type="text/css"><?php $this->html('pagecss') ?></style>
458 <!-- /pagecss -->
459 <?php endif; ?>
460 <?php if($this->data['usercss']): ?>
461 <!-- usercss -->
462 <style type="text/css"><?php $this->html('usercss') ?></style>
463 <!-- /usercss -->
464 <?php endif; ?>
465 <?php if($this->data['userjs']): ?>
466 <!-- userjs -->
467 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
468 <!-- /userjs -->
469 <?php endif; ?>
470 <?php if($this->data['userjsprev']): ?>
471 <!-- userjsprev -->
472 <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
473 <!-- /userjsprev -->
474 <?php endif; ?>
475 <?php if($this->data['trackbackhtml']): ?>
476 <!-- trackbackhtml -->
477 <?php echo $this->data['trackbackhtml']; ?>
478 <!-- /trackbackhtml -->
479 <?php endif; ?>
480 </head>
481 <body<?php if($this->data['body_ondblclick']): ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php endif; ?> <?php if($this->data['body_onload']): ?> onload="<?php $this->text('body_onload') ?>"<?php endif; ?> class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
482 <div id="content-base"><div></div></div>
483 <div id="panel-base"></div>
484 <!-- page -->
485 <div id="page">
486 <!-- content -->
487 <div id="content">
488 <div class="buffer">
489 <a name="top" id="top"></a>
490 <!-- sitenotice -->
491 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
492 <!-- /sitenotice -->
493 <!-- firstHeading -->
494 <h1 id="firstHeading" class="firstHeading"><?php $this->html('title') ?></h1>
495 <!-- /firstHeading -->
496 <!-- bodyContent -->
497 <div id="bodyContent">
498 <!-- tagline -->
499 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
500 <!-- /tagline -->
501 <!-- subtitle -->
502 <div id="contentSub"><?php $this->html('subtitle') ?></div>
503 <!-- /subtitle -->
504 <?php if($this->data['undelete']): ?>
505 <!-- undelete -->
506 <div id="contentSub2"><?php $this->html('undelete') ?></div>
507 <!-- /undelete -->
508 <?php endif; ?>
509 <?php if($this->data['newtalk'] ): ?>
510 <!-- newtalk -->
511 <div class="usermessage"><?php $this->html('newtalk') ?></div>
512 <!-- /newtalk -->
513 <?php endif; ?>
514 <?php if($this->data['showjumplinks']): ?>
515 <!-- jumpto -->
516 <div id="jump-to-nav">
517 <?php $this->msg('jumpto') ?> <a href="#head"><?php $this->msg('jumptonavigation') ?></a>,
518 <a href="#search"><?php $this->msg('jumptosearch') ?></a>
519 </div>
520 <!-- /jumpto -->
521 <?php endif; ?>
522 <!-- bodytext -->
523 <?php $this->html('bodytext') ?>
524 <!-- /bodytext -->
525 <!-- catlinks -->
526 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
527 <!-- /catlinks -->
528 <!-- dataAfterContent -->
529 <?php if($this->data['dataAfterContent']) { $this->html ('dataAfterContent'); } ?>
530 <!-- /dataAfterContent -->
531 <div class="visualClear"></div>
532 </div>
533 <!-- /bodyContent -->
534 </div>
535 </div>
536 <!-- /content -->
537 <!-- header -->
538 <div id="head">
539 <div class="buffer">
540 <div class="top">
541 <!-- personal -->
542 <div id="personal">
543 <div class="buffer">
544 <h5><?php $this->msg('personaltools') ?></h5>
545 <ul <?php echo $this->langAttributes() ?>>
546 <?php foreach($this->data['personal_urls'] as $key => $item): ?>
547 <li <?= $item['attributes'] ?>><a href="<?php echo htmlspecialchars($item['href']) ?>"<?php echo $item['key'] ?><?php if(!empty($item['class'])): ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php endif; ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
548 <?php endforeach; ?>
549 </ul>
550 </div>
551 </div>
552 <!-- /personal -->
553 </div>
554 <div class="middle">
555 <!-- namespaces -->
556 <div id="namespaces">
557 <h5><?php $this->msg('namespaces') ?></h5>
558 <ul <?php echo $this->langAttributes() ?>>
559 <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
560 <li <?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
561 <?php endforeach; ?>
562 </ul>
563 </div>
564 <!-- /namespaces -->
565 <!-- variants -->
566 <?php if ( count( $this->data['variant_urls'] ) > 0 ): ?>
567 <div id="variants">
568 <h5><div class="icon"><span><?php $this->msg('variants') ?></span></div></h5>
569 <div class="menu">
570 <ul <?php echo $this->langAttributes() ?>>
571 <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
572 <li<?php echo $link['attributes'] ?><?php if(!empty($link['class'])): ?> class="<?php echo htmlspecialchars($link['class']) ?>"<?php endif; ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
573 <?php endforeach; ?>
574 </ul>
575 </div>
576 </div>
577 <?php endif; ?>
578 <!-- /variants -->
579 </div>
580 <div class="bottom">
581 <!-- views -->
582 <?php if ( count( $this->data['view_urls'] ) > 0 ): ?>
583 <div id="views">
584 <h5><?php $this->msg('views') ?></h5>
585 <ul <?php echo $this->langAttributes() ?>>
586 <?php foreach ($this->data['view_urls'] as $key => $link ): ?>
587 <li<?php echo $link['attributes'] ?><?php if(!empty($link['class'])): ?> class="<?php echo htmlspecialchars($link['class']) ?>"<?php endif; ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
588 <?php endforeach; ?>
589 </ul>
590 </div>
591 <?php endif; ?>
592 <!-- /views -->
593 <!-- actions -->
594 <?php if ( count( $this->data['action_urls'] ) > 0 ): ?>
595 <div id="actions">
596 <h5><div class="icon"><span><?php $this->msg('actions') ?></span></div></h5>
597 <div class="menu">
598 <ul <?php echo $this->langAttributes() ?>>
599 <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
600 <li<?php echo $link['attributes'] ?><?php if(!empty($link['class'])): ?> class="<?php echo htmlspecialchars($link['class']) ?>"<?php endif; ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
601 <?php endforeach; ?>
602 </ul>
603 </div>
604 </div>
605 <?php endif; ?>
606 <!-- /actions -->
607 <!-- search -->
608 <div id="search">
609 <div class="buffer">
610 <h5 <?php echo $this->langAttributes( ) ?>><label for="searchInput"><?php $this->msg( 'search') ?></label></h5>
611 <form action="<?php $this->text( 'wgScript') ?>" id="searchform">
612 <div>
613 <input type='hidden' name="title" value="<?php $this->text( 'searchtitle') ?>"/>
614 <input id="searchInput" name="search" type="text" <?php echo $this->skin->tooltipAndAccesskey( 'search'); ?> <?php if( isset( $this->data['search'] ) ): ?> value="<?php $this->text( 'search') ?>"<?php endif; ?> />
615 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
616 <?php if ( $wgUseTwoButtonsSearchForm ): ?>
617 <input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton') ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
618 <?php else: ?>
619 <div><a href="<?php $this->text( 'searchaction') ?>" rel="search"><?php $this->msg( 'powersearch-legend') ?></a></div>
620 <?php endif; ?>
621 </div>
622 </form>
623 </div>
624 </div>
625 <!-- /search -->
626 </div>
627 </div>
628 </div>
629 <!-- /header -->
630 <!-- panel -->
631 <div id="panel">
632 <div class="buffer">
633 <!-- fixalpha -->
634 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
635 <!-- /fixalpha -->
636 <!-- sidebar -->
637 <?php
638 $sidebar = $this->data['sidebar'];
639 $sidebar['TOOLBOX'] = ( !isset( $sidebar['TOOLBOX'] ) );
640 $sidebar['LANGUAGES'] = ( !isset( $sidebar['LANGUAGES'] ) );
641 foreach ( $sidebar as $name => $content ) {
642 switch( $name ) {
643 case 'SEARCH':
644 break;
645 case 'TOOLBOX':
646 $this->toolBox();
647 break;
648 case 'LANGUAGES':
649 $this->languageBox();
650 break;
651 default:
652 $this->customBox( $name, $content );
653 break;
654 }
655 }
656 ?>
657 <!-- /sidebar -->
658 </div>
659 </div>
660 <!-- /panel -->
661 <div class="break"></div>
662 <!-- foot -->
663 <div id="foot">
664 <div class="buffer">
665 <ul id="foot-icons">
666 <?php if( $this->data['poweredbyico']): ?>
667 <li id="foot-icon-poweredby"><?php $this->html( 'poweredbyico') ?></li>
668 <?php endif; ?>
669 <?php if( $this->data['copyrightico']): ?>
670 <li id="foot-icon-copyright"><?php $this->html( 'copyrightico') ?></li>
671 <?php endif; ?>
672 </ul>
673 <?php foreach( $validFooterLinks as $category => $links ): ?>
674 <?php if ( count( $links ) > 0 ): ?>
675 <ul id="foot-<?php echo $category ?>">
676 <?php foreach( $links as $link ): ?>
677 <?php if( isset( $this->data[$link] ) && $this->data[$link] ): ?>
678 <li id="foot-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link) ?></li>
679 <?php endif; ?>
680 <?php endforeach; ?>
681 </ul>
682 <?php endif; ?>
683 <?php endforeach; ?>
684 <div style="clear:both"></div>
685 </div>
686 </div>
687 <!-- /foot -->
688 </div>
689 <!-- /page -->
690 <!-- logo -->
691 <div id="logo">
692 <a style="background-image: url(<?php $this->text('logopath') ?>);" href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>" <?php echo $this->skin->tooltipAndAccesskey('p-logo') ?>></a>
693 </div>
694 <!-- /logo -->
695 <?php $this->html( 'bottomscripts'); /* JS call to runBodyOnloadHook */ ?>
696 <?php $this->html( 'reporttime') ?>
697 <?php if ( $this->data['debug'] ): ?>
698 <!-- Debug output:
699 <?php $this->text( 'debug' ); ?>
700 -->
701 <?php endif; ?>
702 </body>
703 </html>
704 <?php
705 // We're done with abusing arrays now...
706 wfRestoreWarnings( );
707 }
708
709 /**
710 * Outputs a box with a list of tools
711 */
712 private function toolBox( ) {
713 ?>
714 <div class="portal" id="p-tb">
715 <h5 <?php echo $this->langAttributes( ) ?>><?php $this->msg( 'toolbox') ?></h5>
716 <div class="body">
717 <ul>
718 <?php if( $this->data['notspecialpage']): ?>
719 <li id="t-whatlinkshere"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['whatlinkshere']['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-whatlinkshere') ?>><?php $this->msg( 'whatlinkshere') ?></a></li>
720 <?php if( $this->data['nav_urls']['recentchangeslinked'] ): ?>
721 <li id="t-recentchangeslinked"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['recentchangeslinked']['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-recentchangeslinked') ?>><?php $this->msg( 'recentchangeslinked') ?></a></li>
722 <?php endif; ?>
723 <?php endif; ?>
724 <?php if( isset( $this->data['nav_urls']['trackbacklink'])): ?>
725 <li id="t-trackbacklink"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['trackbacklink']['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-trackbacklink') ?>><?php $this->msg( 'trackbacklink') ?></a></li>
726 <?php endif; ?>
727 <?php if( $this->data['feeds']): ?>
728 <li id="feedlinks">
729 <?php foreach( $this->data['feeds'] as $key => $feed): ?>
730 <a id="<?php echo Sanitizer::escapeId( "feed-$key" ) ?>" href="<?php 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>
731 <?php endforeach; ?>
732 </li>
733 <?php endif; ?>
734 <?php foreach( array( 'contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ): ?>
735 <?php if( $this->data['nav_urls'][$special]): ?>
736 <li id="t-<?php echo $special ?>"><a href="<?php echo htmlspecialchars( $this->data['nav_urls'][$special]['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-'.$special) ?>><?php $this->msg( $special) ?></a></li>
737 <?php endif; ?>
738 <?php endforeach; ?>
739 <?php if( !empty( $this->data['nav_urls']['print']['href'])): ?>
740 <li id="t-print"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['print']['href']) ?>" rel="alternate"<?php echo $this->skin->tooltipAndAccesskey( 't-print') ?>><?php $this->msg( 'printableversion') ?></a></li>
741 <?php endif; ?>
742 <?php if ( !empty( $this->data['nav_urls']['permalink']['href'] ) ): ?>
743 <li id="t-permalink"><a href="<?php echo htmlspecialchars( $this->data['nav_urls']['permalink']['href']) ?>"<?php echo $this->skin->tooltipAndAccesskey( 't-permalink') ?>><?php $this->msg( 'permalink') ?></a></li>
744 <?php elseif ( $this->data['nav_urls']['permalink']['href'] === ''): ?>
745 <li id="t-ispermalink"<?php echo $this->skin->tooltip( 't-ispermalink') ?>><?php $this->msg( 'permalink') ?></li>
746 <?php endif; ?>
747 <?php wfRunHooks( 'VectorTemplateToolboxEnd', array( &$this ) ); ?>
748 <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?>
749 </ul>
750 </div>
751 </div>
752 <?php
753 }
754
755 /**
756 * Outputs a box with a list of alternative languages for this page
757 */
758 private function languageBox( ) {
759 if( $this->data['language_urls'] ) {
760 ?>
761 <div class="portal" id="p-lang">
762 <h5 <?php echo $this->langAttributes( ) ?>><?php $this->msg( 'otherlanguages') ?></h5>
763 <div class="body">
764 <ul>
765 <?php foreach ( $this->data['language_urls'] as $langlink ): ?>
766 <li class="<?php echo htmlspecialchars( $langlink['class'] ) ?>"><a href="<?php echo htmlspecialchars( $langlink['href'] ) ?>"><?php echo $langlink['text'] ?></a></li>
767 <?php endforeach; ?>
768 </ul>
769 </div>
770 </div>
771 <?php
772 }
773 }
774
775 /**
776 * Ouptus a box with a custom list of items or HTML content
777 * @param string $bar Message name for title of box
778 * @param mixed $content HTML or array of items to build a list from
779 */
780 private function customBox( $bar, $content ) {
781 ?>
782 <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo $this->skin->tooltip( 'p-'.$bar) ?>>
783 <h5 <?php echo $this->langAttributes( ) ?>><?php $out = wfMsg( $bar ); if ( wfEmptyMsg( $bar, $out)) echo htmlspecialchars( $bar); else echo htmlspecialchars( $out); ?></h5>
784 <div class='body'>
785 <?php if ( is_array( $content ) ): ?>
786 <ul>
787 <?php foreach( $content as $key => $val): ?>
788 <li id="<?php echo Sanitizer::escapeId( $val['id']) ?>"<?php if ( $val['active'] ): ?> class="active" <?php endif; ?>><a href="<?php echo htmlspecialchars( $val['href'] ) ?>"<?php echo $this->skin->tooltipAndAccesskey( $val['id']) ?>><?php echo htmlspecialchars( $val['text']) ?></a></li>
789 <?php endforeach; ?>
790 </ul>
791 <?php else: ?>
792 <?php echo $content; /* Allow raw HTML block to be defined by extensions */ ?>
793 <?php endif; ?>
794 </div>
795 </div>
796 <?php
797 }
798
799 /**
800 * Build attributes describing user language
801 * @return HTML and XML Language attributes
802 */
803 private function langAttributes( ) {
804 return 'lang="' . $this->data['userlang'] . '" xml:lang="' . $this->data['userlang'] . '"';
805 }
806 }