r79347 didn't update other callers to mungeQuery(), so let's just take the easy way...
[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
405 // Reverse horizontally rendered navigation elements
406 if ( $wgLang->isRTL() ) {
407 $this->data['view_urls'] =
408 array_reverse( $this->data['view_urls'] );
409 $this->data['namespace_urls'] =
410 array_reverse( $this->data['namespace_urls'] );
411 $this->data['personal_urls'] =
412 array_reverse( $this->data['personal_urls'] );
413 }
414 // Output HTML Page
415 $this->html( 'headelement' );
416 ?>
417 <div id="mw-page-base" class="noprint"></div>
418 <div id="mw-head-base" class="noprint"></div>
419 <!-- content -->
420 <div id="content"<?php $this->html('specialpageattributes') ?>>
421 <a id="top"></a>
422 <div id="mw-js-message" style="display:none;"<?php $this->html('userlangattributes') ?>></div>
423 <?php if ( $this->data['sitenotice'] ): ?>
424 <!-- sitenotice -->
425 <div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
426 <!-- /sitenotice -->
427 <?php endif; ?>
428 <!-- firstHeading -->
429 <h1 id="firstHeading" class="firstHeading"><?php $this->html( 'title' ) ?></h1>
430 <!-- /firstHeading -->
431 <!-- bodyContent -->
432 <div id="bodyContent">
433 <!-- tagline -->
434 <div id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
435 <!-- /tagline -->
436 <!-- subtitle -->
437 <div id="contentSub"<?php $this->html('userlangattributes') ?>><?php $this->html( 'subtitle' ) ?></div>
438 <!-- /subtitle -->
439 <?php if ( $this->data['undelete'] ): ?>
440 <!-- undelete -->
441 <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
442 <!-- /undelete -->
443 <?php endif; ?>
444 <?php if($this->data['newtalk'] ): ?>
445 <!-- newtalk -->
446 <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
447 <!-- /newtalk -->
448 <?php endif; ?>
449 <?php if ( $this->data['showjumplinks'] ): ?>
450 <!-- jumpto -->
451 <div id="jump-to-nav">
452 <?php $this->msg( 'jumpto' ) ?> <a href="#mw-head"><?php $this->msg( 'jumptonavigation' ) ?></a>,
453 <a href="#p-search"><?php $this->msg( 'jumptosearch' ) ?></a>
454 </div>
455 <!-- /jumpto -->
456 <?php endif; ?>
457 <!-- bodytext -->
458 <?php $this->html( 'bodytext' ) ?>
459 <!-- /bodytext -->
460 <?php if ( $this->data['catlinks'] ): ?>
461 <!-- catlinks -->
462 <?php $this->html( 'catlinks' ); ?>
463 <!-- /catlinks -->
464 <?php endif; ?>
465 <?php if ( $this->data['dataAfterContent'] ): ?>
466 <!-- dataAfterContent -->
467 <?php $this->html( 'dataAfterContent' ); ?>
468 <!-- /dataAfterContent -->
469 <?php endif; ?>
470 <div class="visualClear"></div>
471 </div>
472 <!-- /bodyContent -->
473 </div>
474 <!-- /content -->
475 <!-- header -->
476 <div id="mw-head" class="noprint">
477 <?php $this->renderNavigation( 'PERSONAL' ); ?>
478 <div id="left-navigation">
479 <?php $this->renderNavigation( array( 'NAMESPACES', 'VARIANTS' ) ); ?>
480 </div>
481 <div id="right-navigation">
482 <?php $this->renderNavigation( array( 'VIEWS', 'ACTIONS', 'SEARCH' ) ); ?>
483 </div>
484 </div>
485 <!-- /header -->
486 <!-- panel -->
487 <div id="mw-panel" class="noprint">
488 <!-- logo -->
489 <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>
490 <!-- /logo -->
491 <?php $this->renderPortals( $this->data['sidebar'] ); ?>
492 </div>
493 <!-- /panel -->
494 <!-- footer -->
495 <div id="footer"<?php $this->html('userlangattributes') ?>>
496 <?php foreach( $this->getFooterLinks() as $category => $links ): ?>
497 <ul id="footer-<?php echo $category ?>">
498 <?php foreach( $links as $link ): ?>
499 <li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li>
500 <?php endforeach; ?>
501 </ul>
502 <?php endforeach; ?>
503 <?php $footericons = $this->getFooterIcons("icononly");
504 if ( count( $footericons ) > 0 ): ?>
505 <ul id="footer-icons" class="noprint">
506 <?php foreach ( $footericons as $blockName => $footerIcons ): ?>
507 <li id="footer-<?php echo htmlspecialchars($blockName); ?>ico">
508 <?php foreach ( $footerIcons as $icon ): ?>
509 <?php echo $this->skin->makeFooterIcon( $icon ); ?>
510
511 <?php endforeach; ?>
512 </li>
513 <?php endforeach; ?>
514 </ul>
515 <?php endif; ?>
516 <div style="clear:both"></div>
517 </div>
518 <!-- /footer -->
519 <?php $this->html( 'bottomscripts' ); /* JS call to runBodyOnloadHook */ ?>
520 <!-- fixalpha -->
521 <script type="<?php $this->text('jsmimetype') ?>"> if ( window.isMSIE55 ) fixalpha(); </script>
522 <!-- /fixalpha -->
523 <?php $this->html( 'reporttime' ) ?>
524 <?php if ( $this->data['debug'] ): ?>
525 <!-- Debug output: <?php $this->text( 'debug' ); ?> -->
526 <?php endif; ?>
527 </body>
528 </html>
529 <?php
530 }
531
532 /**
533 * Render a series of portals
534 */
535 private function renderPortals( $portals ) {
536 // Force the rendering of the following portals
537 if ( !isset( $portals['SEARCH'] ) ) $portals['SEARCH'] = true;
538 if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true;
539 if ( !isset( $portals['LANGUAGES'] ) ) $portals['LANGUAGES'] = true;
540 // Render portals
541 foreach ( $portals as $name => $content ) {
542 echo "\n<!-- {$name} -->\n";
543 switch( $name ) {
544 case 'SEARCH':
545 break;
546 case 'TOOLBOX':
547 $this->renderPortal( "tb", $this->getToolbox(), "toolbox", "SkinTemplateToolboxEnd" );
548 break;
549 case 'LANGUAGES':
550 if ( $this->data['language_urls'] ) {
551 $this->renderPortal("lang", $this->data['language_urls'], "otherlanguages");
552 }
553 break;
554 default:
555 $this->renderPortal($name, $content);
556 break;
557 }
558 echo "\n<!-- /{$name} -->\n";
559 }
560 }
561
562 private function renderPortal($name, $content, $msg=null, $hook=null) {
563 if ( !isset($msg) ) {
564 $msg = $name;
565 }
566 ?>
567 <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $name ) ?>>
568 <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $msg ); if ( wfEmptyMsg( $msg, $out ) ) echo htmlspecialchars( $msg ); else echo htmlspecialchars( $out ); ?></h5>
569 <div class="body">
570 <?php
571 if ( is_array( $content ) ): ?>
572 <ul>
573 <?php
574 foreach( $content as $key => $val ): ?>
575 <?php echo $this->makeListItem($key, $val); ?>
576
577 <?php
578 endforeach;
579 if ( isset($hook) ) {
580 wfRunHooks( $hook, array( &$this ) );
581 }
582 ?>
583 </ul>
584 <?php
585 else: ?>
586 <?php echo $content; /* Allow raw HTML block to be defined by extensions */ ?>
587 <?php
588 endif; ?>
589 </div>
590 </div>
591 <?php
592 }
593
594 /**
595 * Render one or more navigations elements by name, automatically reveresed
596 * when UI is in RTL mode
597 */
598 private function renderNavigation( $elements ) {
599 global $wgVectorUseSimpleSearch, $wgVectorShowVariantName, $wgUser;
600
601 // If only one element was given, wrap it in an array, allowing more
602 // flexible arguments
603 if ( !is_array( $elements ) ) {
604 $elements = array( $elements );
605 // If there's a series of elements, reverse them when in RTL mode
606 } else if ( wfUILang()->isRTL() ) {
607 $elements = array_reverse( $elements );
608 }
609 // Render elements
610 foreach ( $elements as $name => $element ) {
611 echo "\n<!-- {$name} -->\n";
612 switch ( $element ) {
613 case 'NAMESPACES':
614 ?>
615 <div id="p-namespaces" class="vectorTabs<?php if ( count( $this->data['namespace_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
616 <h5><?php $this->msg('namespaces') ?></h5>
617 <ul<?php $this->html('userlangattributes') ?>>
618 <?php foreach ($this->data['namespace_urls'] as $link ): ?>
619 <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>
620 <?php endforeach; ?>
621 </ul>
622 </div>
623 <?php
624 break;
625 case 'VARIANTS':
626 ?>
627 <div id="p-variants" class="vectorMenu<?php if ( count( $this->data['variant_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
628 <?php if ( $wgVectorShowVariantName ): ?>
629 <h4>
630 <?php foreach ( $this->data['variant_urls'] as $link ): ?>
631 <?php if ( stripos( $link['attributes'], 'selected' ) !== false ): ?>
632 <?php echo htmlspecialchars( $link['text'] ) ?>
633 <?php endif; ?>
634 <?php endforeach; ?>
635 </h4>
636 <?php endif; ?>
637 <h5><span><?php $this->msg('variants') ?></span><a href="#"></a></h5>
638 <div class="menu">
639 <ul<?php $this->html('userlangattributes') ?>>
640 <?php foreach ( $this->data['variant_urls'] as $link ): ?>
641 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
642 <?php endforeach; ?>
643 </ul>
644 </div>
645 </div>
646 <?php
647 break;
648 case 'VIEWS':
649 ?>
650 <div id="p-views" class="vectorTabs<?php if ( count( $this->data['view_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
651 <h5><?php $this->msg('views') ?></h5>
652 <ul<?php $this->html('userlangattributes') ?>>
653 <?php foreach ( $this->data['view_urls'] as $link ): ?>
654 <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>
655 <?php endforeach; ?>
656 </ul>
657 </div>
658 <?php
659 break;
660 case 'ACTIONS':
661 ?>
662 <div id="p-cactions" class="vectorMenu<?php if ( count( $this->data['action_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
663 <h5><span><?php $this->msg('actions') ?></span><a href="#"></a></h5>
664 <div class="menu">
665 <ul<?php $this->html('userlangattributes') ?>>
666 <?php foreach ($this->data['action_urls'] as $link ): ?>
667 <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
668 <?php endforeach; ?>
669 </ul>
670 </div>
671 </div>
672 <?php
673 break;
674 case 'PERSONAL':
675 ?>
676 <div id="p-personal" class="<?php if ( count( $this->data['personal_urls'] ) == 0 ) echo ' emptyPortlet'; ?>">
677 <h5><?php $this->msg('personaltools') ?></h5>
678 <ul<?php $this->html('userlangattributes') ?>>
679 <?php foreach($this->getPersonalTools() as $key => $item) { ?>
680 <?php echo $this->makeListItem($key, $item); ?>
681
682 <?php } ?>
683 </ul>
684 </div>
685 <?php
686 break;
687 case 'SEARCH':
688 ?>
689 <div id="p-search">
690 <h5<?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
691 <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
692 <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
693 <?php if ( $wgVectorUseSimpleSearch && $wgUser->getOption( 'vector-simplesearch' ) ): ?>
694 <div id="simpleSearch">
695 <?php if ( $this->data['rtl'] ): ?>
696 <?php echo $this->makeSearchButton("image", array( "id" => "searchButton", "src" => $this->skin->getSkinStylePath('images/search-rtl.png') )); ?>
697 <?php endif; ?>
698 <?php echo $this->makeSearchInput(array( "id" => "searchInput", "type" => "text" )); ?>
699 <?php if ( !$this->data['rtl'] ): ?>
700 <?php echo $this->makeSearchButton("image", array( "id" => "searchButton", "src" => $this->skin->getSkinStylePath('images/search-ltr.png') )); ?>
701 <?php endif; ?>
702 </div>
703 <?php else: ?>
704 <?php echo $this->makeSearchInput(array( "id" => "searchInput" )); ?>
705 <?php echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" )); ?>
706 <?php echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" )); ?>
707 <?php endif; ?>
708 </form>
709 </div>
710 <?php
711
712 break;
713 }
714 echo "\n<!-- /{$name} -->\n";
715 }
716 }
717 }