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