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