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