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