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