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