some merge fixes per comments on r53282
[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
22 /**
23 * Initializes output page and sets up skin-specific parameters
24 * @param object $out Output page object to initialize
25 */
26 public function initPage( OutputPage $out ) {
27 global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
28
29 parent::initPage( $out );
30 $this->skinname = 'vector';
31 $this->stylename = 'vector';
32 $this->template = 'VectorTemplate';
33
34 // Append skin-specific styles
35 $out->addStyle( 'vector/main-rtl.css', 'screen', '', 'rtl' );
36 $out->addStyle( 'vector/main-ltr.css', 'screen', '', 'ltr' );
37 // Append CSS which includes IE only behavior fixes for hover support -
38 // this is better than including this in a CSS fille since it doesn't
39 // wait for the CSS file to load before fetching the HTC file.
40 $out->addScript(
41 '<!--[if lt IE 7]><style type="text/css">body{behavior:url("' .
42 $wgStylePath .
43 '/vector/csshover.htc")}</style><![endif]-->'
44 );
45 // Append common IE fixes, which perhaps should be included in all
46 // skins, but for now it seems each skin needs to include them
47 // explicitly
48 $out->addScript(
49 '<!--[if lt IE 7]><script type="' . $wgJsMimeType . '" src="' .
50 $wgStylePath .
51 '/common/IEFixes.js?' .
52 $wgStyleVersion .
53 '"></script>' .
54 '<meta http-equiv="imagetoolbar" content="no" /><![endif]-->'
55 );
56 }
57 /**
58 * Builds a structured array of links used for tabs and menus
59 * @return array
60 * @private
61 */
62 function buildNavigationUrls() {
63 global $wgContLang, $wgLang, $wgOut, $wgUser, $wgRequest, $wgArticle;
64 global $wgDisableLangConversion;
65
66 wfProfileIn( __METHOD__ );
67
68 $links = array(
69 'namespaces' => array(),
70 'views' => array(),
71 'actions' => array(),
72 'variants' => array()
73 );
74
75 // Detects parameters
76 $action = $wgRequest->getVal( 'action', 'view' );
77 $section = $wgRequest->getVal( 'section' );
78
79 // Checks if page is some kind of content
80 if( $this->iscontent ) {
81
82 // Gets page objects for the related namespaces
83 $subjectPage = $this->mTitle->getSubjectPage();
84 $talkPage = $this->mTitle->getTalkPage();
85
86 // Determines if this is a talk page
87 $isTalk = $this->mTitle->isTalkPage();
88
89 // Generates XML IDs from namespace names
90 $subjectId = $this->mTitle->getNamespaceKey( '' );
91
92 if ( $subjectId == 'main' ) {
93 $talkId = 'talk';
94 } else {
95 $talkId = "{$subjectId}_talk";
96 }
97 $currentId = $isTalk ? $talkId : $subjectId;
98
99 // Adds namespace links
100 $links['namespaces'][$subjectId] = $this->tabAction(
101 $subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true
102 );
103 $links['namespaces'][$subjectId]['context'] = 'subject';
104 $links['namespaces'][$talkId] = $this->tabAction(
105 $talkPage, 'vector-namespace-talk', $isTalk, '', true
106 );
107 $links['namespaces'][$talkId]['context'] = 'talk';
108
109 // Adds view view link
110 if ( $this->mTitle->exists() ) {
111 $links['views']['view'] = $this->tabAction(
112 $isTalk ? $talkPage : $subjectPage,
113 'vector-view-view', ( $action == 'view' ), '', true
114 );
115 }
116
117 wfProfileIn( __METHOD__ . '-edit' );
118
119 // Checks if user can...
120 if (
121 // edit the current page
122 $this->mTitle->quickUserCan( 'edit' ) &&
123 (
124 // if it exists
125 $this->mTitle->exists() ||
126 // or they can create one here
127 $this->mTitle->quickUserCan( 'create' )
128 )
129 ) {
130 // Builds CSS class for talk page links
131 $isTalkClass = $isTalk ? ' istalk' : '';
132
133 // Determines if we're in edit mode
134 $selected = (
135 ( $action == 'edit' || $action == 'submit' ) &&
136 ( $section != 'new' )
137 );
138 $links['views']['edit'] = array(
139 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass,
140 'text' => $this->mTitle->exists()
141 ? wfMsg( 'vector-view-edit' )
142 : wfMsg( 'vector-view-create' ),
143 'href' =>
144 $this->mTitle->getLocalUrl( $this->editUrlOptions() )
145 );
146 // Checks if this is a current rev of talk page and we should show a new
147 // section link
148 if ( ( $isTalk && $wgArticle->isCurrent() ) || ( $wgOut->showNewSectionLink() ) ) {
149 // Checks if we should ever show a new section link
150 if ( !$wgOut->forceHideNewSectionLink() ) {
151 // Adds new section link
152 $links['actions']['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 // Suppress warnings to prevent notices about missing indexes in
375 // $this->data (is this really the best way to handle this?)
376 wfSuppressWarnings();
377
378 // Build additional attributes for navigation urls
379 $nav = $this->skin->buildNavigationUrls();
380 foreach ( $nav as $section => $links ) {
381 foreach ( $links as $key => $link ) {
382 $xmlID = $key;
383 if ( isset( $link['context'] ) && $link['context'] == 'subject' ) {
384 $xmlID = 'ca-nstab-' . $xmlID;
385 } else if ( isset( $link['context'] ) && $link['context'] == 'talk' ) {
386 $xmlID = 'ca-talk';
387 } else {
388 $xmlID = 'ca-' . $xmlID;
389 }
390 $nav[$section][$key]['attributes'] =
391 ' id="' . Sanitizer::escapeId( $xmlID ) . '"';
392 if ( $nav[$section][$key]['class'] ) {
393 $nav[$section][$key]['attributes'] .=
394 ' class="' . htmlspecialchars( $link['class'] ) . '"';
395 unset( $nav[$section][$key]['class'] );
396 }
397 // We don't want to give the watch tab an accesskey if the page
398 // is being edited, because that conflicts with the accesskey on
399 // the watch checkbox. We also don't want to give the edit tab
400 // an accesskey, because that's fairly superfluous and conflicts
401 // with an accesskey (Ctrl-E) often used for editing in Safari.
402 if (
403 in_array( $action, array( 'edit', 'submit' ) ) &&
404 in_array( $key, array( 'edit', 'watch', 'unwatch' ) )
405 ) {
406 $nav[$section][$key]['key'] =
407 $this->skin->tooltip( $xmlID );
408 } else {
409 $nav[$section][$key]['key'] =
410 $this->skin->tooltipAndAccesskey( $xmlID );
411 }
412 }
413 }
414 $this->data['namespace_urls'] = $nav['namespaces'];
415 $this->data['view_urls'] = $nav['views'];
416 $this->data['action_urls'] = $nav['actions'];
417 $this->data['variant_urls'] = $nav['variants'];
418 // Build additional attributes for personal_urls
419 foreach ( $this->data['personal_urls'] as $key => $item) {
420 $this->data['personal_urls'][$key]['attributes'] =
421 ' id="' . Sanitizer::escapeId( "pt-$key" ) . '"';
422 if ( $item['active'] ) {
423 $this->data['personal_urls'][$key]['attributes'] .=
424 ' class="active"';
425 }
426 $this->data['personal_urls'][$key]['key'] =
427 $this->skin->tooltipAndAccesskey('pt-'.$key);
428 }
429
430 // Generate additional footer links
431 $footerlinks = array(
432 'info' => array(
433 'lastmod',
434 'viewcount',
435 'numberofwatchingusers',
436 'credits',
437 'copyright',
438 'tagline',
439 ),
440 'places' => array(
441 'privacy',
442 'about',
443 'disclaimer',
444 ),
445 );
446 // Reduce footer links down to only those which are being used
447 $validFooterLinks = array();
448 foreach( $footerlinks as $category => $links ) {
449 $validFooterLinks[$category] = array();
450 foreach( $links as $link ) {
451 if( isset( $this->data[$link] ) && $this->data[$link] ) {
452 $validFooterLinks[$category][] = $link;
453 }
454 }
455 }
456 // Reverse horizontally rendered navigation elements
457 if ( $wgContLang->isRTL() ) {
458 $this->data['view_urls'] =
459 array_reverse( $this->data['view_urls'] );
460 $this->data['namespace_urls'] =
461 array_reverse( $this->data['namespace_urls'] );
462 $this->data['personal_urls'] =
463 array_reverse( $this->data['personal_urls'] );
464 }
465 // Output HTML Page
466 echo $wgOut->headElement( $this->skin );
467 ?>
468 <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' ) ?>">
469 <div id="page-base" class="noprint"></div>
470 <div id="head-base" class="noprint"></div>
471 <!-- content -->
472 <div id="content">
473 <a id="top"></a>
474 <div id="mw-js-message" style="display:none;"></div>
475 <?php if ( $this->data['sitenotice'] ): ?>
476 <!-- sitenotice -->
477 <div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
478 <!-- /sitenotice -->
479 <?php endif; ?>
480 <!-- firstHeading -->
481 <h1 id="firstHeading" class="firstHeading"><?php $this->html( 'title' ) ?></h1>
482 <!-- /firstHeading -->
483 <!-- bodyContent -->
484 <div id="bodyContent">
485 <!-- tagline -->
486 <h3 id="siteSub"><?php $this->msg( 'tagline' ) ?></h3>
487 <!-- /tagline -->
488 <!-- subtitle -->
489 <div id="contentSub"><?php $this->html( 'subtitle' ) ?></div>
490 <!-- /subtitle -->
491 <?php if ( $this->data['undelete'] ): ?>
492 <!-- undelete -->
493 <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
494 <!-- /undelete -->
495 <?php endif; ?>
496 <?php if($this->data['newtalk'] ): ?>
497 <!-- newtalk -->
498 <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
499 <!-- /newtalk -->
500 <?php endif; ?>
501 <?php if ( $this->data['showjumplinks'] ): ?>
502 <!-- jumpto -->
503 <div id="jump-to-nav">
504 <?php $this->msg( 'jumpto' ) ?><a href="#head"><?php $this->msg( 'jumptonavigation' ) ?></a>,
505 <a href="#search"><?php $this->msg( 'jumptosearch' ) ?></a>
506 </div>
507 <!-- /jumpto -->
508 <?php endif; ?>
509 <!-- bodytext -->
510 <?php $this->html( 'bodytext' ) ?>
511 <!-- /bodytext -->
512 <?php if ( $this->data['catlinks'] ): ?>
513 <!-- catlinks -->
514 <?php $this->html( 'catlinks' ); ?>
515 <!-- /catlinks -->
516 <?php endif; ?>
517 <?php if ( $this->data['dataAfterContent'] ): ?>
518 <!-- dataAfterContent -->
519 <?php $this->html( 'dataAfterContent' ); ?>
520 <!-- /dataAfterContent -->
521 <?php endif; ?>
522 <div class="visualClear"></div>
523 </div>
524 <!-- /bodyContent -->
525 </div>
526 <!-- /content -->
527 <!-- header -->
528 <div id="head" class="noprint">
529 <?php $this->renderNavigation( 'PERSONAL' ); ?>
530 <div id="left-navigation">
531 <?php $this->renderNavigation( array( 'NAMESPACES', 'VARIANTS' ) ); ?>
532 </div>
533 <div id="right-navigation">
534 <?php $this->renderNavigation( array( 'VIEWS', 'ACTIONS', 'SEARCH' ) ); ?>
535 </div>
536 </div>
537 <!-- /header -->
538 <!-- panel -->
539 <div id="panel" class="noprint">
540 <?php $this->renderPortals( $this->data['sidebar'] ); ?>
541 </div>
542 <!-- /panel -->
543 <!-- foot -->
544 <div id="foot">
545 <?php foreach( $validFooterLinks as $category => $links ): ?>
546 <?php if ( count( $links ) > 0 ): ?>
547 <ul id="foot-<?php echo $category ?>">
548 <?php foreach( $links as $link ): ?>
549 <?php if( isset( $this->data[$link] ) && $this->data[$link] ): ?>
550 <li id="foot-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
551 <?php endif; ?>
552 <?php endforeach; ?>
553 </ul>
554 <?php endif; ?>
555 <?php endforeach; ?>
556 <ul id="foot-icons" class="noprint">
557 <?php if ( $this->data['poweredbyico'] ): ?>
558 <li id="foot-icon-poweredby"><?php $this->html( 'poweredbyico' ) ?></li>
559 <?php endif; ?>
560 <?php if ( $this->data['copyrightico'] ): ?>
561 <li id="foot-icon-copyright"><?php $this->html( 'copyrightico' ) ?></li>
562 <?php endif; ?>
563 </ul>
564 <div style="clear:both"></div>
565 </div>
566 <!-- /foot -->
567 <!-- logo -->
568 <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>
569 <!-- /logo -->
570 <!-- fixalpha -->
571 <script type="<?php $this->text('jsmimetype') ?>"> if ( window.isMSIE55 ) fixalpha(); </script>
572 <!-- /fixalpha -->
573 <?php $this->html( 'bottomscripts' ); /* JS call to runBodyOnloadHook */ ?>
574 <?php $this->html( 'reporttime' ) ?>
575 <?php if ( $this->data['debug'] ): ?>
576 <!-- Debug output: <?php $this->text( 'debug' ); ?> -->
577 <?php endif; ?>
578 </body>
579 </html>
580 <?php
581 // We're done with abusing arrays now...
582 wfRestoreWarnings();
583 }
584
585 /**
586 * Render a series of portals
587 */
588 private function renderPortals( $portals ) {
589 // Force the rendering of the following portals
590 if ( !isset( $portals['SEARCH'] ) ) $portals['SEARCH'] = true;
591 if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true;
592 if ( !isset( $portals['LANGUAGES'] ) ) $portals['LANGUAGES'] = true;
593 // Render portals
594 foreach ( $portals as $name => $content ) {
595 echo "\n<!-- {$name} -->\n";
596 switch( $name ) {
597 case 'SEARCH':
598 break;
599 case 'TOOLBOX':
600 ?>
601 <div class="portal" id="p-tb">
602 <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5>
603 <div class="body">
604 <ul>
605 <?php if( $this->data['notspecialpage'] ): ?>
606 <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>
607 <?php if( $this->data['nav_urls']['recentchangeslinked'] ): ?>
608 <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>
609 <?php endif; ?>
610 <?php endif; ?>
611 <?php if( isset( $this->data['nav_urls']['trackbacklink'] ) ): ?>
612 <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>
613 <?php endif; ?>
614 <?php if( $this->data['feeds']): ?>
615 <li id="feedlinks">
616 <?php foreach( $this->data['feeds'] as $key => $feed ): ?>
617 <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>
618 <?php endforeach; ?>
619 </li>
620 <?php endif; ?>
621 <?php foreach( array( 'contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages' ) as $special ): ?>
622 <?php if( $this->data['nav_urls'][$special]): ?>
623 <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>
624 <?php endif; ?>
625 <?php endforeach; ?>
626 <?php if( !empty( $this->data['nav_urls']['print']['href'] ) ): ?>
627 <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>
628 <?php endif; ?>
629 <?php if ( !empty( $this->data['nav_urls']['permalink']['href'] ) ): ?>
630 <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>
631 <?php elseif ( $this->data['nav_urls']['permalink']['href'] === '' ): ?>
632 <li id="t-ispermalink"<?php echo $this->skin->tooltip( 't-ispermalink' ) ?>><?php $this->msg( 'permalink' ) ?></li>
633 <?php endif; ?>
634 <?php wfRunHooks( 'VectorTemplateToolboxEnd', array( &$this ) ); ?>
635 <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?>
636 </ul>
637 </div>
638 </div>
639 <?php
640 break;
641 case 'LANGUAGES':
642 if ( $this->data['language_urls'] ) {
643 ?>
644 <div class="portal" id="p-lang">
645 <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5>
646 <div class="body">
647 <ul>
648 <?php foreach ( $this->data['language_urls'] as $langlink ): ?>
649 <li class="<?php echo htmlspecialchars( $langlink['class'] ) ?>"><a href="<?php echo htmlspecialchars( $langlink['href'] ) ?>"><?php echo $langlink['text'] ?></a></li>
650 <?php endforeach; ?>
651 </ul>
652 </div>
653 </div>
654 <?php
655 }
656 break;
657 default:
658 ?>
659 <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $name ) ?>>
660 <h5 <?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $name ); if ( wfEmptyMsg( $name, $out ) ) echo htmlspecialchars( $name ); else echo htmlspecialchars( $out ); ?></h5>
661 <div class="body">
662 <?php if ( is_array( $content ) ): ?>
663 <ul>
664 <?php foreach( $content as $key => $val ): ?>
665 <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>
666 <?php endforeach; ?>
667 </ul>
668 <?php else: ?>
669 <?php echo $content; /* Allow raw HTML block to be defined by extensions */ ?>
670 <?php endif; ?>
671 </div>
672 </div>
673 <?php
674 break;
675 }
676 echo "\n<!-- /{$name} -->\n";
677 }
678 }
679
680 /**
681 * Render one or more navigations elements by name, automatically reveresed
682 * when UI is in RTL mode
683 */
684 private function renderNavigation( $elements ) {
685 global $wgContLang, $wgVectorUseSimpleSearch, $wgStylePath;
686
687 // If only one element was given, wrap it in an array, allowing more
688 // flexible arguments
689 if ( !is_array( $elements ) ) {
690 $elements = array( $elements );
691 // If there's a series of elements, reverse them when in RTL mode
692 } else if ( $wgContLang->isRTL() ) {
693 $elements = array_reverse( $elements );
694 }
695 // Render elements
696 foreach ( $elements as $name => $element ) {
697 echo "\n<!-- {$name} -->\n";
698 switch ( $element ) {
699 case 'NAMESPACES':
700 if ( count( $this->data[ 'namespace_urls' ] ) > 0 ) {
701 ?>
702 <div id="namespaces" class="vectorTabs">
703 <h5><?php $this->msg('namespaces') ?></h5>
704 <ul <?php $this->html('userlangattributes') ?>>
705 <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
706 <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>
707 <?php endforeach; ?>
708 </ul>
709 </div>
710 <?php
711 }
712 break;
713 case 'VARIANTS':
714 if ( count( $this->data[ 'variant_urls' ] ) > 0 ) {
715 ?>
716 <div id="variants" class="vectorMenu">
717 <h5><span><?php $this->msg('variants') ?></span><a href="#"></a></h5>
718 <div class="menu">
719 <ul <?php $this->html('userlangattributes') ?>>
720 <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
721 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
722 <?php endforeach; ?>
723 </ul>
724 </div>
725 </div>
726 <?php
727 }
728 break;
729 case 'VIEWS':
730 if ( count( $this->data[ 'view_urls' ] ) > 0 ) {
731 ?>
732 <div id="views" class="vectorTabs">
733 <h5><?php $this->msg('views') ?></h5>
734 <ul <?php $this->html('userlangattributes') ?>>
735 <?php foreach ($this->data['view_urls'] as $key => $link ): ?>
736 <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>
737 <?php endforeach; ?>
738 </ul>
739 </div>
740 <?php
741 }
742 break;
743 case 'ACTIONS':
744 if ( count( $this->data[ 'action_urls' ] ) > 0 ) {
745 ?>
746 <div id="p-cactions" class="vectorMenu">
747 <h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5>
748 <div class="menu">
749 <ul <?php $this->html('userlangattributes') ?>>
750 <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
751 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
752 <?php endforeach; ?>
753 </ul>
754 </div>
755 </div>
756 <?php
757 }
758 break;
759 case 'PERSONAL':
760 if ( count( $this->data['personal_urls'] ) > 0 ) {
761 ?>
762 <div id="p-personal">
763 <h5><?php $this->msg('personaltools') ?></h5>
764 <ul <?php $this->html('userlangattributes') ?>>
765 <?php foreach($this->data['personal_urls'] as $key => $item): ?>
766 <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>
767 <?php endforeach; ?>
768 </ul>
769 </div>
770 <?php
771 }
772 break;
773 case 'SEARCH':
774 ?>
775 <div id="p-search">
776 <h5 <?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
777 <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
778 <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
779 <?php if ( $wgVectorUseSimpleSearch ): ?>
780 <div id="simpleSearch">
781 <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; ?> />
782 <input id="searchButton" type='image' name='fulltext' src="<?php echo $wgStylePath ?>/vector/images/search.png" <?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> align="top" />
783 </div>
784 <?php else: ?>
785 <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; ?> />
786 <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
787 <input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
788 <?php endif; ?>
789 </form>
790 </div>
791 <?php
792
793 break;
794 }
795 echo "\n<!-- /{$name} -->\n";
796 }
797 }
798 }