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