Put the watch icon part of the changes reverted in r57125 back in.
[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;
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, $wgStylePath;
63 global $wgDisableLangConversion, $wgVectorUseIconWatch;
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 * 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 if ( $wgVectorUseIconWatch ) {
286 $class = 'icon ';
287 $place = 'views';
288 } else {
289 $class = '';
290 $place = 'actions';
291 }
292 $mode = $this->mTitle->userIsWatching() ? 'unwatch' : 'watch';
293 $links[$place][$mode] = array(
294 'class' => $class . ( ( $action == 'watch' || $action == 'unwatch' ) ? ' selected' : false ),
295 'text' => wfMsg( $mode ), // uses 'watch' or 'unwatch' message
296 'href' => $this->mTitle->getLocalUrl( 'action=' . $mode )
297 );
298 }
299 // This is instead of SkinTemplateTabs - which uses a flat array
300 wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) );
301
302 // If it's not content, it's got to be a special page
303 } else {
304 $links['namespaces']['special'] = array(
305 'class' => 'selected',
306 'text' => wfMsg( 'vector-namespace-special' ),
307 'href' => $wgRequest->getRequestURL()
308 );
309 }
310
311 // Gets list of language variants
312 $variants = $wgContLang->getVariants();
313 // Checks that language conversion is enabled and variants exist
314 if( !$wgDisableLangConversion && count( $variants ) > 1 ) {
315 // Gets preferred variant
316 $preferred = $wgContLang->getPreferredVariant();
317 // Loops over each variant
318 foreach( $variants as $code ) {
319 // Gets variant name from language code
320 $varname = $wgContLang->getVariantname( $code );
321 // Checks if the variant is marked as disabled
322 if( $varname == 'disable' ) {
323 // Skips this variant
324 continue;
325 }
326 // Appends variant link
327 $links['variants'][] = array(
328 'class' => ( $code == $preferred ) ? 'selected' : false,
329 'text' => $varname,
330 'href' => $this->mTitle->getLocalURL( '', $code )
331 );
332 }
333 }
334
335 wfProfileOut( __METHOD__ );
336
337 return $links;
338 }
339 }
340
341 /**
342 * QuickTemplate class for Vector skin
343 * @ingroup Skins
344 */
345 class VectorTemplate extends QuickTemplate {
346
347 /* Members */
348
349 /**
350 * @var Cached skin object
351 */
352 var $skin;
353
354 /* Functions */
355
356 /**
357 * Outputs the entire contents of the XHTML page
358 */
359 public function execute() {
360 global $wgRequest, $wgOut, $wgContLang;
361
362 $this->skin = $this->data['skin'];
363 $action = $wgRequest->getText( 'action' );
364
365 // Build additional attributes for navigation urls
366 $nav = $this->skin->buildNavigationUrls();
367 foreach ( $nav as $section => $links ) {
368 foreach ( $links as $key => $link ) {
369 $xmlID = $key;
370 if ( isset( $link['context'] ) && $link['context'] == 'subject' ) {
371 $xmlID = 'ca-nstab-' . $xmlID;
372 } else if ( isset( $link['context'] ) && $link['context'] == 'talk' ) {
373 $xmlID = 'ca-talk';
374 } else {
375 $xmlID = 'ca-' . $xmlID;
376 }
377 $nav[$section][$key]['attributes'] =
378 ' id="' . Sanitizer::escapeId( $xmlID ) . '"';
379 if ( $nav[$section][$key]['class'] ) {
380 $nav[$section][$key]['attributes'] .=
381 ' class="' . htmlspecialchars( $link['class'] ) . '"';
382 unset( $nav[$section][$key]['class'] );
383 }
384 // We don't want to give the watch tab an accesskey if the page
385 // is being edited, because that conflicts with the accesskey on
386 // the watch checkbox. We also don't want to give the edit tab
387 // an accesskey, because that's fairly superfluous and conflicts
388 // with an accesskey (Ctrl-E) often used for editing in Safari.
389 if (
390 in_array( $action, array( 'edit', 'submit' ) ) &&
391 in_array( $key, array( 'edit', 'watch', 'unwatch' ) )
392 ) {
393 $nav[$section][$key]['key'] =
394 $this->skin->tooltip( $xmlID );
395 } else {
396 $nav[$section][$key]['key'] =
397 $this->skin->tooltipAndAccesskey( $xmlID );
398 }
399 }
400 }
401 $this->data['namespace_urls'] = $nav['namespaces'];
402 $this->data['view_urls'] = $nav['views'];
403 $this->data['action_urls'] = $nav['actions'];
404 $this->data['variant_urls'] = $nav['variants'];
405 // Build additional attributes for personal_urls
406 foreach ( $this->data['personal_urls'] as $key => $item) {
407 $this->data['personal_urls'][$key]['attributes'] =
408 ' id="' . Sanitizer::escapeId( "pt-$key" ) . '"';
409 if ( isset( $item['active'] ) && $item['active'] ) {
410 $this->data['personal_urls'][$key]['attributes'] .=
411 ' class="active"';
412 }
413 $this->data['personal_urls'][$key]['key'] =
414 $this->skin->tooltipAndAccesskey('pt-'.$key);
415 }
416
417 // Generate additional footer links
418 $footerlinks = array(
419 'info' => array(
420 'lastmod',
421 'viewcount',
422 'numberofwatchingusers',
423 'credits',
424 'copyright',
425 'tagline',
426 ),
427 'places' => array(
428 'privacy',
429 'about',
430 'disclaimer',
431 ),
432 );
433 // Reduce footer links down to only those which are being used
434 $validFooterLinks = array();
435 foreach( $footerlinks as $category => $links ) {
436 $validFooterLinks[$category] = array();
437 foreach( $links as $link ) {
438 if( isset( $this->data[$link] ) && $this->data[$link] ) {
439 $validFooterLinks[$category][] = $link;
440 }
441 }
442 }
443 // Reverse horizontally rendered navigation elements
444 if ( $wgContLang->isRTL() ) {
445 $this->data['view_urls'] =
446 array_reverse( $this->data['view_urls'] );
447 $this->data['namespace_urls'] =
448 array_reverse( $this->data['namespace_urls'] );
449 $this->data['personal_urls'] =
450 array_reverse( $this->data['personal_urls'] );
451 }
452 // Output HTML Page
453 $this->html( 'headelement' );
454 ?>
455 <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' ) ?>">
456 <div id="page-base" class="noprint"></div>
457 <div id="head-base" class="noprint"></div>
458 <!-- content -->
459 <div id="content">
460 <a id="top"></a>
461 <div id="mw-js-message" style="display:none;"></div>
462 <?php if ( $this->data['sitenotice'] ): ?>
463 <!-- sitenotice -->
464 <div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
465 <!-- /sitenotice -->
466 <?php endif; ?>
467 <!-- firstHeading -->
468 <h1 id="firstHeading" class="firstHeading"><?php $this->html( 'title' ) ?></h1>
469 <!-- /firstHeading -->
470 <!-- bodyContent -->
471 <div id="bodyContent">
472 <!-- tagline -->
473 <h3 id="siteSub"><?php $this->msg( 'tagline' ) ?></h3>
474 <!-- /tagline -->
475 <!-- subtitle -->
476 <div id="contentSub"><?php $this->html( 'subtitle' ) ?></div>
477 <!-- /subtitle -->
478 <?php if ( $this->data['undelete'] ): ?>
479 <!-- undelete -->
480 <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
481 <!-- /undelete -->
482 <?php endif; ?>
483 <?php if($this->data['newtalk'] ): ?>
484 <!-- newtalk -->
485 <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
486 <!-- /newtalk -->
487 <?php endif; ?>
488 <?php if ( $this->data['showjumplinks'] ): ?>
489 <!-- jumpto -->
490 <div id="jump-to-nav">
491 <?php $this->msg( 'jumpto' ) ?><a href="#head"><?php $this->msg( 'jumptonavigation' ) ?></a>,
492 <a href="#p-search"><?php $this->msg( 'jumptosearch' ) ?></a>
493 </div>
494 <!-- /jumpto -->
495 <?php endif; ?>
496 <!-- bodytext -->
497 <?php $this->html( 'bodytext' ) ?>
498 <!-- /bodytext -->
499 <?php if ( $this->data['catlinks'] ): ?>
500 <!-- catlinks -->
501 <?php $this->html( 'catlinks' ); ?>
502 <!-- /catlinks -->
503 <?php endif; ?>
504 <?php if ( $this->data['dataAfterContent'] ): ?>
505 <!-- dataAfterContent -->
506 <?php $this->html( 'dataAfterContent' ); ?>
507 <!-- /dataAfterContent -->
508 <?php endif; ?>
509 <div class="visualClear"></div>
510 </div>
511 <!-- /bodyContent -->
512 </div>
513 <!-- /content -->
514 <!-- header -->
515 <div id="head" class="noprint">
516 <?php $this->renderNavigation( 'PERSONAL' ); ?>
517 <div id="left-navigation">
518 <?php $this->renderNavigation( array( 'NAMESPACES', 'VARIANTS' ) ); ?>
519 </div>
520 <div id="right-navigation">
521 <?php $this->renderNavigation( array( 'VIEWS', 'ACTIONS', 'SEARCH' ) ); ?>
522 </div>
523 </div>
524 <!-- /header -->
525 <!-- panel -->
526 <div id="panel" class="noprint">
527 <!-- logo -->
528 <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>
529 <!-- /logo -->
530 <?php $this->renderPortals( $this->data['sidebar'] ); ?>
531 </div>
532 <!-- /panel -->
533 <!-- footer -->
534 <div id="footer">
535 <?php foreach( $validFooterLinks as $category => $links ): ?>
536 <?php if ( count( $links ) > 0 ): ?>
537 <ul id="footer-<?php echo $category ?>">
538 <?php foreach( $links as $link ): ?>
539 <?php if( isset( $this->data[$link] ) && $this->data[$link] ): ?>
540 <li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
541 <?php endif; ?>
542 <?php endforeach; ?>
543 </ul>
544 <?php endif; ?>
545 <?php endforeach; ?>
546 <ul id="footer-icons" class="noprint">
547 <?php if ( $this->data['poweredbyico'] ): ?>
548 <li id="footer-icon-poweredby"><?php $this->html( 'poweredbyico' ) ?></li>
549 <?php endif; ?>
550 <?php if ( $this->data['copyrightico'] ): ?>
551 <li id="footer-icon-copyright"><?php $this->html( 'copyrightico' ) ?></li>
552 <?php endif; ?>
553 </ul>
554 <div style="clear:both"></div>
555 </div>
556 <!-- /footer -->
557 <!-- fixalpha -->
558 <script type="<?php $this->text('jsmimetype') ?>"> if ( window.isMSIE55 ) fixalpha(); </script>
559 <!-- /fixalpha -->
560 <?php $this->html( 'bottomscripts' ); /* JS call to runBodyOnloadHook */ ?>
561 <?php $this->html( 'reporttime' ) ?>
562 <?php if ( $this->data['debug'] ): ?>
563 <!-- Debug output: <?php $this->text( 'debug' ); ?> -->
564 <?php endif; ?>
565 </body>
566 </html>
567 <?php
568 }
569
570 /**
571 * Render a series of portals
572 */
573 private function renderPortals( $portals ) {
574 // Force the rendering of the following portals
575 if ( !isset( $portals['SEARCH'] ) ) $portals['SEARCH'] = true;
576 if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true;
577 if ( !isset( $portals['LANGUAGES'] ) ) $portals['LANGUAGES'] = true;
578 // Render portals
579 foreach ( $portals as $name => $content ) {
580 echo "\n<!-- {$name} -->\n";
581 switch( $name ) {
582 case 'SEARCH':
583 break;
584 case 'TOOLBOX':
585 ?>
586 <div class="portal" id="p-tb">
587 <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5>
588 <div class="body">
589 <ul>
590 <?php if( $this->data['notspecialpage'] ): ?>
591 <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>
592 <?php if( $this->data['nav_urls']['recentchangeslinked'] ): ?>
593 <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>
594 <?php endif; ?>
595 <?php endif; ?>
596 <?php if( isset( $this->data['nav_urls']['trackbacklink'] ) ): ?>
597 <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>
598 <?php endif; ?>
599 <?php if( $this->data['feeds']): ?>
600 <li id="feedlinks">
601 <?php foreach( $this->data['feeds'] as $key => $feed ): ?>
602 <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>
603 <?php endforeach; ?>
604 </li>
605 <?php endif; ?>
606 <?php foreach( array( 'contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages' ) as $special ): ?>
607 <?php if( $this->data['nav_urls'][$special]): ?>
608 <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>
609 <?php endif; ?>
610 <?php endforeach; ?>
611 <?php if( !empty( $this->data['nav_urls']['print']['href'] ) ): ?>
612 <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>
613 <?php endif; ?>
614 <?php if ( !empty( $this->data['nav_urls']['permalink']['href'] ) ): ?>
615 <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>
616 <?php elseif ( $this->data['nav_urls']['permalink']['href'] === '' ): ?>
617 <li id="t-ispermalink"<?php echo $this->skin->tooltip( 't-ispermalink' ) ?>><?php $this->msg( 'permalink' ) ?></li>
618 <?php endif; ?>
619 <?php wfRunHooks( 'VectorTemplateToolboxEnd', array( &$this ) ); ?>
620 <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?>
621 </ul>
622 </div>
623 </div>
624 <?php
625 break;
626 case 'LANGUAGES':
627 if ( $this->data['language_urls'] ) {
628 ?>
629 <div class="portal" id="p-lang">
630 <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5>
631 <div class="body">
632 <ul>
633 <?php foreach ( $this->data['language_urls'] as $langlink ): ?>
634 <li class="<?php echo htmlspecialchars( $langlink['class'] ) ?>"><a href="<?php echo htmlspecialchars( $langlink['href'] ) ?>"><?php echo $langlink['text'] ?></a></li>
635 <?php endforeach; ?>
636 </ul>
637 </div>
638 </div>
639 <?php
640 }
641 break;
642 default:
643 ?>
644 <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $name ) ?>>
645 <h5 <?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $name ); if ( wfEmptyMsg( $name, $out ) ) echo htmlspecialchars( $name ); else echo htmlspecialchars( $out ); ?></h5>
646 <div class="body">
647 <?php if ( is_array( $content ) ): ?>
648 <ul>
649 <?php foreach( $content as $key => $val ): ?>
650 <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>
651 <?php endforeach; ?>
652 </ul>
653 <?php else: ?>
654 <?php echo $content; /* Allow raw HTML block to be defined by extensions */ ?>
655 <?php endif; ?>
656 </div>
657 </div>
658 <?php
659 break;
660 }
661 echo "\n<!-- /{$name} -->\n";
662 }
663 }
664
665 /**
666 * Render one or more navigations elements by name, automatically reveresed
667 * when UI is in RTL mode
668 */
669 private function renderNavigation( $elements ) {
670 global $wgContLang, $wgVectorUseSimpleSearch, $wgStylePath;
671
672 // If only one element was given, wrap it in an array, allowing more
673 // flexible arguments
674 if ( !is_array( $elements ) ) {
675 $elements = array( $elements );
676 // If there's a series of elements, reverse them when in RTL mode
677 } else if ( $wgContLang->isRTL() ) {
678 $elements = array_reverse( $elements );
679 }
680 // Render elements
681 foreach ( $elements as $name => $element ) {
682 echo "\n<!-- {$name} -->\n";
683 switch ( $element ) {
684 case 'NAMESPACES':
685 ?>
686 <div id="p-namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
687 <h5><?php $this->msg('namespaces') ?></h5>
688 <ul <?php $this->html('userlangattributes') ?>>
689 <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
690 <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>
691 <?php endforeach; ?>
692 </ul>
693 </div>
694 <?php
695 break;
696 case 'VARIANTS':
697 ?>
698 <div id="p-variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
699 <h5><span><?php $this->msg('variants') ?></span><a href="#"></a></h5>
700 <div class="menu">
701 <ul <?php $this->html('userlangattributes') ?>>
702 <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
703 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
704 <?php endforeach; ?>
705 </ul>
706 </div>
707 </div>
708 <?php
709 break;
710 case 'VIEWS':
711 ?>
712 <div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
713 <h5><?php $this->msg('views') ?></h5>
714 <ul <?php $this->html('userlangattributes') ?>>
715 <?php foreach ($this->data['view_urls'] as $key => $link ): ?>
716 <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>
717 <?php endforeach; ?>
718 </ul>
719 </div>
720 <?php
721 break;
722 case 'ACTIONS':
723 ?>
724 <div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
725 <h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5>
726 <div class="menu">
727 <ul <?php $this->html('userlangattributes') ?>>
728 <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
729 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
730 <?php endforeach; ?>
731 </ul>
732 </div>
733 </div>
734 <?php
735 break;
736 case 'PERSONAL':
737 ?>
738 <div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
739 <h5><?php $this->msg('personaltools') ?></h5>
740 <ul <?php $this->html('userlangattributes') ?>>
741 <?php foreach($this->data['personal_urls'] as $key => $item): ?>
742 <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>
743 <?php endforeach; ?>
744 </ul>
745 </div>
746 <?php
747 break;
748 case 'SEARCH':
749 ?>
750 <div id="p-search">
751 <h5 <?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
752 <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
753 <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
754 <?php if ( $wgVectorUseSimpleSearch ): ?>
755 <div id="simpleSearch">
756 <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; ?> />
757 <button id="searchButton" type='submit' name='button' <?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?>>&nbsp;</button>
758 </div>
759 <?php else: ?>
760 <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; ?> />
761 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
762 <input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
763 <?php endif; ?>
764 </form>
765 </div>
766 <?php
767
768 break;
769 }
770 echo "\n<!-- /{$name} -->\n";
771 }
772 }
773 }