Revert r52410 (Put the [edit] link after the section header instead of before, and...
[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 // Append to the default screen common & print styles...
39 $out->addStyle( 'vector/main.css', 'screen' );
40 // Add common styles
41 parent::setupSkinUserCss( $out );
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, $wgArticle;
51 global $wgDisableLangConversion;
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, 'vector-namespace-' . $subjectId, !$isTalk, '', true
87 );
88 $links['namespaces'][$talkId] = $this->tabAction(
89 $talkPage, 'vector-namespace-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 'vector-view-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( 'vector-view-edit' )
125 : wfMsg( 'vector-view-create' ),
126 'href' =>
127 $this->mTitle->getLocalUrl( $this->editUrlOptions() )
128 );
129 // Checks if this is a current rev of talk page and we should show a new
130 // section link
131 if ( ( $isTalk && $wgArticle->isCurrent() ) || ( $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( 'vector-action-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( 'vector-view-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( 'vector-view-history' ),
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( 'vector-action-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( 'vector-action-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( 'vector-action-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( 'vector-action-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 'vector-action-undelete',
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( 'vector-action-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( 'vector-action-unprotect' ),
250 'href' =>
251 $this->mTitle->getLocalUrl( 'action=unprotect' )
252 );
253 }
254 }
255 }
256 wfProfileOut( __METHOD__ . '-live' );
257
258 /**
259 * The following actions use messages which, if made particular to
260 * the Vector skin, would break the Ajax code which makes this
261 * action happen entirely inline. Skin::makeGlobalVariablesScript
262 * defines a set of messages in a javascript object - and these
263 * messages are assumed to be global for all skins. Without making
264 * a change to that procedure these messages will have to remain as
265 * the global versions.
266 */
267 // Checks if the user is logged in
268 if( $this->loggedin ) {
269 // Checks if the user is watching this page
270 if( !$this->mTitle->userIsWatching() ) {
271 // Adds watch action link
272 $links['actions']['watch'] = array(
273 'class' =>
274 ( $action == 'watch' or $action == 'unwatch' ) ?
275 'selected' : false,
276 'text' => wfMsg( 'watch' ),
277 'href' => $this->mTitle->getLocalUrl( 'action=watch' )
278 );
279 } else {
280 // Adds unwatch action link
281 $links['actions']['unwatch'] = array(
282 'class' =>
283 ($action == 'unwatch' or $action == 'watch') ?
284 'selected' : false,
285 'text' => wfMsg( 'unwatch' ),
286 'href' => $this->mTitle->getLocalUrl( 'action=unwatch' )
287 );
288 }
289 }
290
291 // If it's not content, it's got to be a special page
292 } else {
293 $links['namespaces']['special'] = array(
294 'class' => 'selected',
295 'text' => wfMsg( 'vector-namespace-special' ),
296 'href' => $wgRequest->getRequestURL()
297 );
298 }
299
300 // Gets list of language variants
301 $variants = $wgContLang->getVariants();
302 // Checks that language conversion is enabled and variants exist
303 if( !$wgDisableLangConversion && count( $variants ) > 1 ) {
304 // Gets preferred variant
305 $preferred = $wgContLang->getPreferredVariant();
306 // Loops over each variant
307 $vcount = 0;
308 foreach( $variants as $code ) {
309 // Gets variant name from language code
310 $varname = $wgContLang->getVariantname( $code );
311 // Checks if the variant is marked as disabled
312 if( $varname == 'disable' ) {
313 // Skips this variant
314 continue;
315 }
316 // Appends variant link
317 $links['variants'][$vcount] = array(
318 'class' => ( $code == $preferred ) ? 'selected' : false,
319 'text' => $varname,
320 'href' => $this->mTitle->getLocalURL( '', $code )
321 );
322 $vcount ++;
323 }
324 }
325
326 wfProfileOut( __METHOD__ );
327
328 return $links;
329 }
330 }
331
332 /**
333 * QuickTemplate class for Vector skin
334 * @ingroup Skins
335 */
336 class VectorTemplate extends QuickTemplate {
337
338 /* Members */
339
340 /**
341 * @var Cached skin object
342 */
343 var $skin;
344
345 /* Functions */
346
347 /**
348 * Outputs the entire contents of the XHTML page
349 */
350 public function execute() {
351 global $wgRequest, $wgUseTwoButtonsSearchForm;
352
353 $this->skin = $this->data['skin'];
354 $action = $wgRequest->getText( 'action' );
355
356 // Suppress warnings to prevent notices about missing indexes in
357 // $this->data (is this really the best way to handle this?)
358 wfSuppressWarnings();
359
360 // Build additional attributes for navigation urls
361 $nav = $this->skin->buildNavigationUrls();
362 foreach ( $nav as $section => $links ) {
363 foreach ( $links as $key => $link ) {
364 $nav[$section][$key]['attributes'] =
365 ' id="' . Sanitizer::escapeId( "ca-$key" ) . '"';
366 if ( $nav[$section][$key]['class'] ) {
367 $nav[$section][$key]['attributes'] .=
368 ' class="' . htmlspecialchars( $link['class'] ) . '"';
369 }
370 // We don't want to give the watch tab an accesskey if the page is
371 // being edited, because that conflicts with the accesskey on the
372 // watch checkbox. We also don't want to give the edit tab an
373 // accesskey, because that's fairly superfluous and conflicts with
374 // an accesskey (Ctrl-E) often used for editing in Safari.
375 if (
376 in_array( $action, array( 'edit', 'submit' ) ) &&
377 in_array( $key, array( 'edit', 'watch', 'unwatch' ) )
378 ) {
379 $nav[$section][$key]['key'] =
380 $this->skin->tooltip( "ca-$key" );
381 } else {
382 $nav[$section][$key]['key'] =
383 $this->skin->tooltipAndAccesskey( "ca-$key" );
384 }
385 }
386 }
387 $this->data['namespace_urls'] = $nav['namespaces'];
388 $this->data['view_urls'] = $nav['views'];
389 $this->data['action_urls'] = $nav['actions'];
390 $this->data['variant_urls'] = $nav['variants'];
391
392 // Build additional attributes for personal_urls
393 foreach ( $this->data['personal_urls'] as $key => $item) {
394 $this->data['personal_urls'][$key]['attributes'] =
395 ' id="' . Sanitizer::escapeId( "pt-$key" ) . '"';
396 if ( $item['active'] ) {
397 $this->data['personal_urls'][$key]['attributes'] .=
398 ' class="active"';
399 }
400 $this->data['personal_urls'][$key]['key'] =
401 $this->skin->tooltipAndAccesskey('pt-'.$key);
402 }
403
404 // Generate additional footer links
405 $footerlinks = array(
406 'info' => array(
407 'lastmod',
408 'viewcount',
409 'numberofwatchingusers',
410 'credits',
411 'copyright',
412 'tagline',
413 ),
414 'places' => array(
415 'privacy',
416 'about',
417 'disclaimer',
418 ),
419 );
420
421 // Build list of valid footer links
422 $validFooterLinks = array();
423 foreach( $footerlinks as $category => $links ) {
424 $validFooterLinks[$category] = array();
425 foreach( $links as $link ) {
426 if( isset( $this->data[$link] ) && $this->data[$link] ) {
427 $validFooterLinks[$category][] = $link;
428 }
429 }
430 }
431
432 // Begin content output
433 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
434 <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') ?>">
435 <head>
436 <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
437 <title><?php $this->text('pagetitle') ?></title>
438 <!-- headlinks -->
439 <?php $this->html('headlinks') ?>
440 <!-- /headlinks -->
441 <!-- csslinks -->
442 <?php $this->html('csslinks') ?>
443 <!-- /csslinks -->
444 <!-- IEFixes -->
445 <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
446 <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
447 <style type="text/css">body{behavior:url("<?php $this->text('stylepath') ?>/vector/csshover.htc")}</style>
448 <!-- /IEFixes -->
449 <!-- globalVariablesScript -->
450 <?php echo Skin::makeGlobalVariablesScript( $this->data ); ?>
451 <!-- /globalVariablesScript -->
452 <!-- wikibits -->
453 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
454 <!-- /wikibits -->
455 <!-- headscripts -->
456 <?php $this->html('headscripts') ?>
457 <!-- /headscripts -->
458 <?php if($this->data['jsvarurl']): ?>
459 <!-- jsvarurl -->
460 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl') ?>"><!-- site js --></script>
461 <!-- /jsvarurl -->
462 <?php endif; ?>
463 <?php if($this->data['pagecss']): ?>
464 <!-- pagecss -->
465 <style type="text/css"><?php $this->html('pagecss') ?></style>
466 <!-- /pagecss -->
467 <?php endif; ?>
468 <?php if($this->data['usercss']): ?>
469 <!-- usercss -->
470 <style type="text/css"><?php $this->html('usercss') ?></style>
471 <!-- /usercss -->
472 <?php endif; ?>
473 <?php if($this->data['userjs']): ?>
474 <!-- userjs -->
475 <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
476 <!-- /userjs -->
477 <?php endif; ?>
478 <?php if($this->data['userjsprev']): ?>
479 <!-- userjsprev -->
480 <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
481 <!-- /userjsprev -->
482 <?php endif; ?>
483 <?php if($this->data['trackbackhtml']): ?>
484 <!-- trackbackhtml -->
485 <?php echo $this->data['trackbackhtml']; ?>
486 <!-- /trackbackhtml -->
487 <?php endif; ?>
488 </head>
489 <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') ?>">
490 <div id="page-base" class="noprint"></div>
491 <div id="head-base" class="noprint"></div>
492 <!-- content -->
493 <div id="content">
494 <a name="top" id="top"></a>
495 <!-- sitenotice -->
496 <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
497 <!-- /sitenotice -->
498 <!-- firstHeading -->
499 <h1 id="firstHeading" class="firstHeading"><?php $this->html('title') ?></h1>
500 <!-- /firstHeading -->
501 <!-- bodyContent -->
502 <div id="bodyContent">
503 <!-- tagline -->
504 <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
505 <!-- /tagline -->
506 <!-- subtitle -->
507 <div id="contentSub"><?php $this->html('subtitle') ?></div>
508 <!-- /subtitle -->
509 <?php if($this->data['undelete']): ?>
510 <!-- undelete -->
511 <div id="contentSub2"><?php $this->html('undelete') ?></div>
512 <!-- /undelete -->
513 <?php endif; ?>
514 <?php if($this->data['newtalk'] ): ?>
515 <!-- newtalk -->
516 <div class="usermessage"><?php $this->html('newtalk') ?></div>
517 <!-- /newtalk -->
518 <?php endif; ?>
519 <?php if($this->data['showjumplinks']): ?>
520 <!-- jumpto -->
521 <div id="jump-to-nav">
522 <?php $this->msg('jumpto') ?> <a href="#head"><?php $this->msg('jumptonavigation') ?></a>,
523 <a href="#search"><?php $this->msg('jumptosearch') ?></a>
524 </div>
525 <!-- /jumpto -->
526 <?php endif; ?>
527 <!-- bodytext -->
528 <?php $this->html('bodytext') ?>
529 <!-- /bodytext -->
530 <!-- catlinks -->
531 <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
532 <!-- /catlinks -->
533 <!-- dataAfterContent -->
534 <?php if($this->data['dataAfterContent']) { $this->html('dataAfterContent'); } ?>
535 <!-- /dataAfterContent -->
536 <div class="visualClear"></div>
537 </div>
538 <!-- /bodyContent -->
539 </div>
540 <!-- /content -->
541 <!-- header -->
542 <div id="head" class="noprint">
543 <!-- personal -->
544 <div id="personal">
545 <h5><?php $this->msg('personaltools') ?></h5>
546 <ul <?php $this->html('userlangattributes') ?>>
547 <?php foreach($this->data['personal_urls'] as $key => $item): ?>
548 <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>
549 <?php endforeach; ?>
550 </ul>
551 </div>
552 <!-- /personal -->
553 <div id="left-navigation">
554 <!-- namespaces -->
555 <div id="namespaces">
556 <h5><?php $this->msg('namespaces') ?></h5>
557 <ul <?php $this->html('userlangattributes') ?>>
558 <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
559 <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>
560 <?php endforeach; ?>
561 </ul>
562 </div>
563 <!-- /namespaces -->
564 <!-- variants -->
565 <?php if ( count( $this->data['variant_urls'] ) > 0 ): ?>
566 <div id="variants">
567 <h5><div class="icon"><span><?php $this->msg('variants') ?></span></div></h5>
568 <div class="menu">
569 <ul <?php $this->html('userlangattributes') ?>>
570 <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
571 <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>
572 <?php endforeach; ?>
573 </ul>
574 </div>
575 </div>
576 <?php endif; ?>
577 <!-- /variants -->
578 </div>
579 <div id="right-navigation">
580 <!-- views -->
581 <?php if ( count( $this->data['view_urls'] ) > 0 ): ?>
582 <div id="views">
583 <h5><?php $this->msg('views') ?></h5>
584 <ul <?php $this->html('userlangattributes') ?>>
585 <?php foreach ($this->data['view_urls'] as $key => $link ): ?>
586 <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>
587 <?php endforeach; ?>
588 </ul>
589 </div>
590 <?php endif; ?>
591 <!-- /views -->
592 <!-- actions -->
593 <?php if ( count( $this->data['action_urls'] ) > 0 ): ?>
594 <div id="actions">
595 <h5><span><?php $this->msg('actions') ?></span><a href="#">&nbsp;</a></h5>
596 <div class="menu">
597 <ul <?php $this->html('userlangattributes') ?>>
598 <?php foreach ($this->data['action_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'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
600 <?php endforeach; ?>
601 </ul>
602 </div>
603 </div>
604 <?php endif; ?>
605 <!-- /actions -->
606 <!-- search -->
607 <div id="search">
608 <h5 <?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
609 <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
610 <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
611 <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; ?> />
612 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
613 <?php if ( $wgUseTwoButtonsSearchForm ): ?>
614 <input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
615 <?php else: ?>
616 <div><a href="<?php $this->text( 'searchaction' ) ?>" rel="search"><?php $this->msg( 'powersearch-legend' ) ?></a></div>
617 <?php endif; ?>
618 </form>
619 </div>
620 <!-- /search -->
621 </div>
622 </div>
623 <!-- /header -->
624 <!-- panel -->
625 <div id="panel" class="noprint">
626 <!-- sidebar -->
627 <?php
628 $sidebar = $this->data['sidebar'];
629 $sidebar['TOOLBOX'] = ( !isset( $sidebar['TOOLBOX'] ) );
630 $sidebar['LANGUAGES'] = ( !isset( $sidebar['LANGUAGES'] ) );
631 foreach ( $sidebar as $name => $content ) {
632 switch( $name ) {
633 case 'SEARCH':
634 break;
635 case 'TOOLBOX':
636 $this->toolBox();
637 break;
638 case 'LANGUAGES':
639 $this->languageBox();
640 break;
641 default:
642 $this->customBox( $name, $content );
643 break;
644 }
645 }
646 ?>
647 <!-- /sidebar -->
648 </div>
649 <!-- /panel -->
650 <div class="break"></div>
651 <!-- foot -->
652 <div id="foot">
653 <?php foreach( $validFooterLinks as $category => $links ): ?>
654 <?php if ( count( $links ) > 0 ): ?>
655 <ul id="foot-<?php echo $category ?>">
656 <?php foreach( $links as $link ): ?>
657 <?php if( isset( $this->data[$link] ) && $this->data[$link] ): ?>
658 <li id="foot-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
659 <?php endif; ?>
660 <?php endforeach; ?>
661 </ul>
662 <?php endif; ?>
663 <?php endforeach; ?>
664 <ul id="foot-icons" class="noprint">
665 <?php if( $this->data['poweredbyico'] ): ?>
666 <li id="foot-icon-poweredby"><?php $this->html( 'poweredbyico' ) ?></li>
667 <?php endif; ?>
668 <?php if( $this->data['copyrightico'] ): ?>
669 <li id="foot-icon-copyright"><?php $this->html( 'copyrightico' ) ?></li>
670 <?php endif; ?>
671 </ul>
672 <div style="clear:both"></div>
673 </div>
674 <!-- /foot -->
675 <!-- logo -->
676 <div id="logo">
677 <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>
678 </div>
679 <!-- /logo -->
680 <!-- fixalpha -->
681 <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha( 'logo' ); </script>
682 <!-- /fixalpha -->
683 <?php $this->html( 'bottomscripts' ); /* JS call to runBodyOnloadHook */ ?>
684 <?php $this->html( 'reporttime' ) ?>
685 <?php if ( $this->data['debug'] ): ?>
686 <!-- Debug output:
687 <?php $this->text( 'debug' ); ?>
688 -->
689 <?php endif; ?>
690 </body>
691 </html>
692 <?php
693 // We're done with abusing arrays now...
694 wfRestoreWarnings();
695 }
696
697 /**
698 * Outputs a box with a list of tools
699 */
700 private function toolBox() {
701 ?>
702 <div class="portal" id="p-tb">
703 <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5>
704 <div class="body">
705 <ul>
706 <?php if( $this->data['notspecialpage'] ): ?>
707 <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>
708 <?php if( $this->data['nav_urls']['recentchangeslinked'] ): ?>
709 <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>
710 <?php endif; ?>
711 <?php endif; ?>
712 <?php if( isset( $this->data['nav_urls']['trackbacklink'] ) ): ?>
713 <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>
714 <?php endif; ?>
715 <?php if( $this->data['feeds']): ?>
716 <li id="feedlinks">
717 <?php foreach( $this->data['feeds'] as $key => $feed ): ?>
718 <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>
719 <?php endforeach; ?>
720 </li>
721 <?php endif; ?>
722 <?php foreach( array( 'contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages' ) as $special ): ?>
723 <?php if( $this->data['nav_urls'][$special]): ?>
724 <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>
725 <?php endif; ?>
726 <?php endforeach; ?>
727 <?php if( !empty( $this->data['nav_urls']['print']['href'] ) ): ?>
728 <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>
729 <?php endif; ?>
730 <?php if ( !empty( $this->data['nav_urls']['permalink']['href'] ) ): ?>
731 <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>
732 <?php elseif ( $this->data['nav_urls']['permalink']['href'] === '' ): ?>
733 <li id="t-ispermalink"<?php echo $this->skin->tooltip( 't-ispermalink' ) ?>><?php $this->msg( 'permalink' ) ?></li>
734 <?php endif; ?>
735 <?php wfRunHooks( 'VectorTemplateToolboxEnd', array( &$this ) ); ?>
736 <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?>
737 </ul>
738 </div>
739 </div>
740 <?php
741 }
742
743 /**
744 * Outputs a box with a list of alternative languages for this page
745 */
746 private function languageBox() {
747 if( $this->data['language_urls'] ) {
748 ?>
749 <div class="portal" id="p-lang">
750 <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5>
751 <div class="body">
752 <ul>
753 <?php foreach ( $this->data['language_urls'] as $langlink ): ?>
754 <li class="<?php echo htmlspecialchars( $langlink['class'] ) ?>"><a href="<?php echo htmlspecialchars( $langlink['href'] ) ?>"><?php echo $langlink['text'] ?></a></li>
755 <?php endforeach; ?>
756 </ul>
757 </div>
758 </div>
759 <?php
760 }
761 }
762
763 /**
764 * Outputs a box with a custom list of items or HTML content
765 * @param string $bar Message name for title of box
766 * @param mixed $content HTML or array of items to build a list from
767 */
768 private function customBox( $bar, $content ) {
769 ?>
770 <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $bar ) ?>>
771 <h5 <?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $bar ); if ( wfEmptyMsg( $bar, $out ) ) echo htmlspecialchars( $bar ); else echo htmlspecialchars( $out ); ?></h5>
772 <div class="body">
773 <?php if ( is_array( $content ) ): ?>
774 <ul>
775 <?php foreach( $content as $key => $val ): ?>
776 <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>
777 <?php endforeach; ?>
778 </ul>
779 <?php else: ?>
780 <?php echo $content; /* Allow raw HTML block to be defined by extensions */ ?>
781 <?php endif; ?>
782 </div>
783 </div>
784 <?php
785 }
786 }