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