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