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