r53210 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53209‎ | r53210 | r53211 >
Date:04:55, 14 July 2009
Author:tparscal
Status:ok (Comments)
Tags:
Comment:
Refactor of Vector skin output and RTL strategy. Needs more testing, but it seems to be working very well so far.
Modified paths:
  • /trunk/phase3/skins/Vector.php (modified) (history)
  • /trunk/phase3/skins/vector/main-ltr.css (modified) (history)
  • /trunk/phase3/skins/vector/main-rtl.css (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/Vector.php
@@ -341,29 +341,29 @@
342342 * @ingroup Skins
343343 */
344344 class VectorTemplate extends QuickTemplate {
345 -
 345+
346346 /* Members */
347 -
 347+
348348 /**
349349 * @var Cached skin object
350350 */
351351 var $skin;
352 -
 352+
353353 /* Functions */
354 -
 354+
355355 /**
356356 * Outputs the entire contents of the XHTML page
357357 */
358358 public function execute() {
359 - global $wgRequest, $wgUseTwoButtonsSearchForm, $wgOut;
360 -
 359+ global $wgRequest, $wgOut, $wgContLang;
 360+
361361 $this->skin = $this->data['skin'];
362362 $action = $wgRequest->getText( 'action' );
363 -
 363+
364364 // Suppress warnings to prevent notices about missing indexes in
365365 // $this->data (is this really the best way to handle this?)
366366 wfSuppressWarnings();
367 -
 367+
368368 // Build additional attributes for navigation urls
369369 $nav = $this->skin->buildNavigationUrls();
370370 foreach ( $nav as $section => $links ) {
@@ -383,12 +383,11 @@
384384 ' class="' . htmlspecialchars( $link['class'] ) . '"';
385385 unset( $nav[$section][$key]['class'] );
386386 }
387 -
388 - // We don't want to give the watch tab an accesskey if the page is
389 - // being edited, because that conflicts with the accesskey on the
390 - // watch checkbox. We also don't want to give the edit tab an
391 - // accesskey, because that's fairly superfluous and conflicts with
392 - // an accesskey (Ctrl-E) often used for editing in Safari.
 387+ // We don't want to give the watch tab an accesskey if the page
 388+ // is being edited, because that conflicts with the accesskey on
 389+ // the watch checkbox. We also don't want to give the edit tab
 390+ // an accesskey, because that's fairly superfluous and conflicts
 391+ // with an accesskey (Ctrl-E) often used for editing in Safari.
393392 if (
394393 in_array( $action, array( 'edit', 'submit' ) ) &&
395394 in_array( $key, array( 'edit', 'watch', 'unwatch' ) )
@@ -405,7 +404,6 @@
406405 $this->data['view_urls'] = $nav['views'];
407406 $this->data['action_urls'] = $nav['actions'];
408407 $this->data['variant_urls'] = $nav['variants'];
409 -
410408 // Build additional attributes for personal_urls
411409 foreach ( $this->data['personal_urls'] as $key => $item) {
412410 $this->data['personal_urls'][$key]['attributes'] =
@@ -417,7 +415,7 @@
418416 $this->data['personal_urls'][$key]['key'] =
419417 $this->skin->tooltipAndAccesskey('pt-'.$key);
420418 }
421 -
 419+
422420 // Generate additional footer links
423421 $footerlinks = array(
424422 'info' => array(
@@ -434,8 +432,7 @@
435433 'disclaimer',
436434 ),
437435 );
438 -
439 - // Build list of valid footer links
 436+ // Reduce footer links down to only those which are being used
440437 $validFooterLinks = array();
441438 foreach( $footerlinks as $category => $links ) {
442439 $validFooterLinks[$category] = array();
@@ -445,58 +442,72 @@
446443 }
447444 }
448445 }
449 -
450 - // Begin content output
451 -
 446+ // Reverse horizontally rendered navigation elements
 447+ if ( $wgContLang->isRTL() ) {
 448+ $this->data['view_urls'] =
 449+ array_reverse( $this->data['view_urls'] );
 450+ $this->data['namespace_urls'] =
 451+ array_reverse( $this->data['namespace_urls'] );
 452+ $this->data['personal_urls'] =
 453+ array_reverse( $this->data['personal_urls'] );
 454+ }
 455+ // Output HTML Page
452456 echo $wgOut->headElement( $this->skin );
453 -?> <body<?php if($this->data['body_ondblclick']): ?> ondblclick="<?php $this->text('body_ondblclick') ?>"<?php endif; ?> <?php if($this->data['body_onload']): ?> onload="<?php $this->text('body_onload') ?>"<?php endif; ?> class="mediawiki <?php $this->text('dir') ?> <?php $this->text('pageclass') ?> <?php $this->text('skinnameclass') ?>">
 457+?>
 458+ <body<?php if ( $this->data['body_ondblclick'] ): ?> ondblclick="<?php $this->text( 'body_ondblclick' ) ?>"<?php endif; ?> <?php if ( $this->data['body_onload'] ): ?> onload="<?php $this->text( 'body_onload' ) ?>"<?php endif; ?> class="mediawiki <?php $this->text( 'dir' ) ?> <?php $this->text( 'pageclass' ) ?> <?php $this->text( 'skinnameclass' ) ?>" dir="<?php $this->text( 'dir' ) ?>">
454459 <div id="page-base" class="noprint"></div>
455460 <div id="head-base" class="noprint"></div>
456461 <!-- content -->
457462 <div id="content">
458463 <a id="top"></a>
459464 <div id="mw-js-message" style="display:none;"></div>
 465+ <?php if ( $this->data['sitenotice'] ): ?>
460466 <!-- sitenotice -->
461 - <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
 467+ <div id="siteNotice"><?php $this->html( 'sitenotice' ) ?></div>
462468 <!-- /sitenotice -->
 469+ <?php endif; ?>
463470 <!-- firstHeading -->
464 - <h1 id="firstHeading" class="firstHeading"><?php $this->html('title') ?></h1>
 471+ <h1 id="firstHeading" class="firstHeading"><?php $this->html( 'title' ) ?></h1>
465472 <!-- /firstHeading -->
466473 <!-- bodyContent -->
467474 <div id="bodyContent">
468475 <!-- tagline -->
469 - <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
 476+ <h3 id="siteSub"><?php $this->msg( 'tagline' ) ?></h3>
470477 <!-- /tagline -->
471478 <!-- subtitle -->
472 - <div id="contentSub"><?php $this->html('subtitle') ?></div>
 479+ <div id="contentSub"><?php $this->html( 'subtitle' ) ?></div>
473480 <!-- /subtitle -->
474 - <?php if($this->data['undelete']): ?>
 481+ <?php if ( $this->data['undelete'] ): ?>
475482 <!-- undelete -->
476 - <div id="contentSub2"><?php $this->html('undelete') ?></div>
 483+ <div id="contentSub2"><?php $this->html( 'undelete' ) ?></div>
477484 <!-- /undelete -->
478485 <?php endif; ?>
479486 <?php if($this->data['newtalk'] ): ?>
480487 <!-- newtalk -->
481 - <div class="usermessage"><?php $this->html('newtalk') ?></div>
 488+ <div class="usermessage"><?php $this->html( 'newtalk' ) ?></div>
482489 <!-- /newtalk -->
483490 <?php endif; ?>
484 - <?php if($this->data['showjumplinks']): ?>
 491+ <?php if ( $this->data['showjumplinks'] ): ?>
485492 <!-- jumpto -->
486493 <div id="jump-to-nav">
487 - <?php $this->msg('jumpto') ?> <a href="#head"><?php $this->msg('jumptonavigation') ?></a>,
488 - <a href="#search"><?php $this->msg('jumptosearch') ?></a>
 494+ <?php $this->msg( 'jumpto' ) ?><a href="#head"><?php $this->msg( 'jumptonavigation' ) ?></a>,
 495+ <a href="#search"><?php $this->msg( 'jumptosearch' ) ?></a>
489496 </div>
490497 <!-- /jumpto -->
491498 <?php endif; ?>
492499 <!-- bodytext -->
493 - <?php $this->html('bodytext') ?>
 500+ <?php $this->html( 'bodytext' ) ?>
494501 <!-- /bodytext -->
 502+ <?php if ( $this->data['catlinks'] ): ?>
495503 <!-- catlinks -->
496 - <?php if($this->data['catlinks']) { $this->html('catlinks'); } ?>
 504+ <?php $this->html( 'catlinks' ); ?>
497505 <!-- /catlinks -->
 506+ <?php endif; ?>
 507+ <?php if ( $this->data['dataAfterContent'] ): ?>
498508 <!-- dataAfterContent -->
499 - <?php if($this->data['dataAfterContent']) { $this->html('dataAfterContent'); } ?>
 509+ <?php $this->html( 'dataAfterContent' ); ?>
500510 <!-- /dataAfterContent -->
 511+ <?php endif; ?>
501512 <div class="visualClear"></div>
502513 </div>
503514 <!-- /bodyContent -->
@@ -504,118 +515,20 @@
505516 <!-- /content -->
506517 <!-- header -->
507518 <div id="head" class="noprint">
508 - <!-- personal -->
509 - <?php if ( count( $this->data['personal_urls'] ) > 0 ): ?>
510 - <div id="p-personal">
511 - <h5><?php $this->msg('personaltools') ?></h5>
512 - <ul <?php $this->html('userlangattributes') ?>>
513 - <?php foreach($this->data['personal_urls'] as $key => $item): ?>
514 - <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>
515 - <?php endforeach; ?>
516 - </ul>
517 - </div>
518 - <?php endif; ?>
519 - <!-- /personal -->
 519+ <?php $this->renderNavigation( 'PERSONAL' ); ?>
520520 <div id="left-navigation">
521 - <!-- namespaces -->
522 - <?php if ( count( $this->data['namespace_urls'] ) > 0 ): ?>
523 - <div id="namespaces" class="vectorTabs">
524 - <h5><?php $this->msg('namespaces') ?></h5>
525 - <ul <?php $this->html('userlangattributes') ?>>
526 - <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
527 - <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>
528 - <?php endforeach; ?>
529 - </ul>
530 - </div>
531 - <?php endif; ?>
532 - <!-- /namespaces -->
533 - <!-- variants -->
534 - <?php if ( count( $this->data['variant_urls'] ) > 0 ): ?>
535 - <div id="variants" class="vectorMenu">
536 - <h5><span><?php $this->msg('variants') ?></span><a href="#">&nbsp;</a></h5>
537 - <div class="menu">
538 - <ul <?php $this->html('userlangattributes') ?>>
539 - <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
540 - <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
541 - <?php endforeach; ?>
542 - </ul>
543 - </div>
544 - </div>
545 - <?php endif; ?>
546 - <!-- /variants -->
 521+ <?php $this->renderNavigation( array( 'NAMESPACES', 'VARIANTS' ) ); ?>
547522 </div>
548523 <div id="right-navigation">
549 - <!-- views -->
550 - <?php if ( count( $this->data['view_urls'] ) > 0 ): ?>
551 - <div id="views" class="vectorTabs">
552 - <h5><?php $this->msg('views') ?></h5>
553 - <ul <?php $this->html('userlangattributes') ?>>
554 - <?php foreach ($this->data['view_urls'] as $key => $link ): ?>
555 - <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>
556 - <?php endforeach; ?>
557 - </ul>
558 - </div>
559 - <?php endif; ?>
560 - <!-- /views -->
561 - <!-- actions -->
562 - <?php if ( count( $this->data['action_urls'] ) > 0 ): ?>
563 - <div id="p-cactions" class="vectorMenu">
564 - <h5><span><?php $this->msg('actions') ?></span><a href="#">&nbsp;</a></h5>
565 - <div class="menu">
566 - <ul <?php $this->html('userlangattributes') ?>>
567 - <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
568 - <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
569 - <?php endforeach; ?>
570 - </ul>
571 - </div>
572 - </div>
573 - <?php endif; ?>
574 - <!-- /actions -->
575 - <!-- search -->
576 - <div id="p-search">
577 - <h5 <?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
578 - <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
579 - <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
580 - <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; ?> />
581 - <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
582 - <?php if ( $wgUseTwoButtonsSearchForm ): ?>
583 - <input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
584 - <?php else: ?>
585 - <div><a href="<?php $this->text( 'searchaction' ) ?>" rel="search"><?php $this->msg( 'powersearch-legend' ) ?></a></div>
586 - <?php endif; ?>
587 - </form>
588 - </div>
589 - <!-- /search -->
 524+ <?php $this->renderNavigation( array( 'VIEWS', 'ACTIONS', 'SEARCH' ) ); ?>
590525 </div>
591526 </div>
592527 <!-- /header -->
593528 <!-- panel -->
594 - <div id="panel" class="noprint">
595 - <!-- sidebar -->
596 - <?php
597 - $sidebar = $this->data['sidebar'];
598 - $sidebar['TOOLBOX'] = ( !isset( $sidebar['TOOLBOX'] ) );
599 - $sidebar['LANGUAGES'] = ( !isset( $sidebar['LANGUAGES'] ) );
600 - foreach ( $sidebar as $name => $content ) {
601 - switch( $name ) {
602 - case 'SEARCH':
603 - break;
604 - case 'TOOLBOX':
605 - $this->toolBox();
606 - break;
607 - case 'LANGUAGES':
608 - $this->languageBox();
609 - break;
610 - default:
611 - $this->customBox( $name, $content );
612 - break;
613 - }
614 - }
615 - ?>
616 - <!-- /sidebar -->
617 - </div>
 529+ <div id="panel" class="noprint">
 530+ <?php $this->renderPortals( $this->data['sidebar'] ); ?>
 531+ </div>
618532 <!-- /panel -->
619 - <div class="break"></div>
620533 <!-- foot -->
621534 <div id="foot">
622535 <?php foreach( $validFooterLinks as $category => $links ): ?>
@@ -630,10 +543,10 @@
631544 <?php endif; ?>
632545 <?php endforeach; ?>
633546 <ul id="foot-icons" class="noprint">
634 - <?php if( $this->data['poweredbyico'] ): ?>
 547+ <?php if ( $this->data['poweredbyico'] ): ?>
635548 <li id="foot-icon-poweredby"><?php $this->html( 'poweredbyico' ) ?></li>
636549 <?php endif; ?>
637 - <?php if( $this->data['copyrightico'] ): ?>
 550+ <?php if ( $this->data['copyrightico'] ): ?>
638551 <li id="foot-icon-copyright"><?php $this->html( 'copyrightico' ) ?></li>
639552 <?php endif; ?>
640553 </ul>
@@ -641,19 +554,15 @@
642555 </div>
643556 <!-- /foot -->
644557 <!-- logo -->
645 - <div id="p-logo">
646 - <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>
647 - </div>
 558+ <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>
648559 <!-- /logo -->
649560 <!-- fixalpha -->
650 - <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha( 'p-logo' ); </script>
 561+ <script type="<?php $this->text('jsmimetype') ?>"> if ( window.isMSIE55 ) fixalpha(); </script>
651562 <!-- /fixalpha -->
652563 <?php $this->html( 'bottomscripts' ); /* JS call to runBodyOnloadHook */ ?>
653564 <?php $this->html( 'reporttime' ) ?>
654565 <?php if ( $this->data['debug'] ): ?>
655 - <!-- Debug output:
656 - <?php $this->text( 'debug' ); ?>
657 - -->
 566+ <!-- Debug output: <?php $this->text( 'debug' ); ?> -->
658567 <?php endif; ?>
659568 </body>
660569 </html>
@@ -661,58 +570,65 @@
662571 // We're done with abusing arrays now...
663572 wfRestoreWarnings();
664573 }
665 -
 574+
666575 /**
667 - * Outputs a box with a list of tools
 576+ * Render a series of portals
668577 */
669 - private function toolBox() {
 578+ private function renderPortals( $portals ) {
 579+ // Force the rendering of the following portals
 580+ if ( !isset( $portals['SEARCH'] ) ) $portals['SEARCH'] = true;
 581+ if ( !isset( $portals['TOOLBOX'] ) ) $portals['TOOLBOX'] = true;
 582+ if ( !isset( $portals['LANGUAGES'] ) ) $portals['LANGUAGES'] = true;
 583+ // Render portals
 584+ foreach ( $portals as $name => $content ) {
 585+ echo "\n<!-- {$name} -->\n";
 586+ switch( $name ) {
 587+ case 'SEARCH':
 588+ break;
 589+ case 'TOOLBOX':
670590 ?>
671 - <div class="portal" id="p-tb">
672 - <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5>
673 - <div class="body">
674 - <ul>
675 - <?php if( $this->data['notspecialpage'] ): ?>
676 - <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>
677 - <?php if( $this->data['nav_urls']['recentchangeslinked'] ): ?>
678 - <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>
679 - <?php endif; ?>
 591+<div class="portal" id="p-tb">
 592+ <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5>
 593+ <div class="body">
 594+ <ul>
 595+ <?php if( $this->data['notspecialpage'] ): ?>
 596+ <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>
 597+ <?php if( $this->data['nav_urls']['recentchangeslinked'] ): ?>
 598+ <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>
680599 <?php endif; ?>
681 - <?php if( isset( $this->data['nav_urls']['trackbacklink'] ) ): ?>
682 - <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>
683 - <?php endif; ?>
684 - <?php if( $this->data['feeds']): ?>
685 - <li id="feedlinks">
686 - <?php foreach( $this->data['feeds'] as $key => $feed ): ?>
687 - <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>
688 - <?php endforeach; ?>
689 - </li>
690 - <?php endif; ?>
691 - <?php foreach( array( 'contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages' ) as $special ): ?>
692 - <?php if( $this->data['nav_urls'][$special]): ?>
693 - <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>
694 - <?php endif; ?>
 600+ <?php endif; ?>
 601+ <?php if( isset( $this->data['nav_urls']['trackbacklink'] ) ): ?>
 602+ <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>
 603+ <?php endif; ?>
 604+ <?php if( $this->data['feeds']): ?>
 605+ <li id="feedlinks">
 606+ <?php foreach( $this->data['feeds'] as $key => $feed ): ?>
 607+ <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>
695608 <?php endforeach; ?>
696 - <?php if( !empty( $this->data['nav_urls']['print']['href'] ) ): ?>
697 - <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>
 609+ </li>
 610+ <?php endif; ?>
 611+ <?php foreach( array( 'contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages' ) as $special ): ?>
 612+ <?php if( $this->data['nav_urls'][$special]): ?>
 613+ <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>
698614 <?php endif; ?>
699 - <?php if ( !empty( $this->data['nav_urls']['permalink']['href'] ) ): ?>
700 - <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>
701 - <?php elseif ( $this->data['nav_urls']['permalink']['href'] === '' ): ?>
702 - <li id="t-ispermalink"<?php echo $this->skin->tooltip( 't-ispermalink' ) ?>><?php $this->msg( 'permalink' ) ?></li>
703 - <?php endif; ?>
704 - <?php wfRunHooks( 'VectorTemplateToolboxEnd', array( &$this ) ); ?>
705 - <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?>
706 - </ul>
707 - </div>
 615+ <?php endforeach; ?>
 616+ <?php if( !empty( $this->data['nav_urls']['print']['href'] ) ): ?>
 617+ <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>
 618+ <?php endif; ?>
 619+ <?php if ( !empty( $this->data['nav_urls']['permalink']['href'] ) ): ?>
 620+ <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>
 621+ <?php elseif ( $this->data['nav_urls']['permalink']['href'] === '' ): ?>
 622+ <li id="t-ispermalink"<?php echo $this->skin->tooltip( 't-ispermalink' ) ?>><?php $this->msg( 'permalink' ) ?></li>
 623+ <?php endif; ?>
 624+ <?php wfRunHooks( 'VectorTemplateToolboxEnd', array( &$this ) ); ?>
 625+ <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?>
 626+ </ul>
708627 </div>
 628+</div>
709629 <?php
710 - }
711 -
712 - /**
713 - * Outputs a box with a list of alternative languages for this page
714 - */
715 - private function languageBox() {
716 - if( $this->data['language_urls'] ) {
 630+ break;
 631+ case 'LANGUAGES':
 632+ if ( $this->data['language_urls'] ) {
717633 ?>
718634 <div class="portal" id="p-lang">
719635 <h5 <?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5>
@@ -725,18 +641,12 @@
726642 </div>
727643 </div>
728644 <?php
729 - }
730 - }
731 -
732 - /**
733 - * Outputs a box with a custom list of items or HTML content
734 - * @param string $bar Message name for title of box
735 - * @param mixed $content HTML or array of items to build a list from
736 - */
737 - private function customBox( $bar, $content ) {
 645+ }
 646+ break;
 647+ default:
738648 ?>
739 -<div class="portal" id='<?php echo Sanitizer::escapeId( "p-$bar" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $bar ) ?>>
740 - <h5 <?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $bar ); if ( wfEmptyMsg( $bar, $out ) ) echo htmlspecialchars( $bar ); else echo htmlspecialchars( $out ); ?></h5>
 649+<div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $name ) ?>>
 650+ <h5 <?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $name ); if ( wfEmptyMsg( $name, $out ) ) echo htmlspecialchars( $name ); else echo htmlspecialchars( $out ); ?></h5>
741651 <div class="body">
742652 <?php if ( is_array( $content ) ): ?>
743653 <ul>
@@ -750,5 +660,124 @@
751661 </div>
752662 </div>
753663 <?php
 664+ break;
 665+ }
 666+ echo "\n<!-- /{$name} -->\n";
 667+ }
754668 }
 669+
 670+ /**
 671+ * Render one or more navigations elements by name, automatically reveresed
 672+ * when UI is in RTL mode
 673+ */
 674+ private function renderNavigation( $elements ) {
 675+ global $wgContLang, $wgUseTwoButtonsSearchForm;
 676+
 677+ // If only one element was given, wrap it in an array, allowing more
 678+ // flexible arguments
 679+ if ( !is_array( $elements ) ) {
 680+ $elements = array( $elements );
 681+ // If there's a series of elements, reverse them when in RTL mode
 682+ } else if ( $wgContLang->isRTL() ) {
 683+ $elements = array_reverse( $elements );
 684+ }
 685+ // Render elements
 686+ foreach ( $elements as $name => $element ) {
 687+ echo "\n<!-- {$name} -->\n";
 688+ switch ( $element ) {
 689+ case 'NAMESPACES':
 690+ if ( count( $this->data[ 'namespace_urls' ] ) > 0 ) {
 691+?>
 692+<div id="namespaces" class="vectorTabs">
 693+ <h5><?php $this->msg('namespaces') ?></h5>
 694+ <ul <?php $this->html('userlangattributes') ?>>
 695+ <?php foreach ($this->data['namespace_urls'] as $key => $link ): ?>
 696+ <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>
 697+ <?php endforeach; ?>
 698+ </ul>
 699+</div>
 700+<?php
 701+ }
 702+ break;
 703+ case 'VARIANTS':
 704+ if ( count( $this->data[ 'variant_urls' ] ) > 0 ) {
 705+?>
 706+<div id="variants" class="vectorMenu">
 707+ <h5><span><?php $this->msg('variants') ?></span><a href="#">&nbsp;</a></h5>
 708+ <div class="menu">
 709+ <ul <?php $this->html('userlangattributes') ?>>
 710+ <?php foreach ($this->data['variant_urls'] as $key => $link ): ?>
 711+ <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
 712+ <?php endforeach; ?>
 713+ </ul>
 714+ </div>
 715+</div>
 716+<?php
 717+ }
 718+ break;
 719+ case 'VIEWS':
 720+ if ( count( $this->data[ 'view_urls' ] ) > 0 ) {
 721+?>
 722+<div id="views" class="vectorTabs">
 723+ <h5><?php $this->msg('views') ?></h5>
 724+ <ul <?php $this->html('userlangattributes') ?>>
 725+ <?php foreach ($this->data['view_urls'] as $key => $link ): ?>
 726+ <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>
 727+ <?php endforeach; ?>
 728+ </ul>
 729+</div>
 730+<?php
 731+ }
 732+ break;
 733+ case 'ACTIONS':
 734+ if ( count( $this->data[ 'action_urls' ] ) > 0 ) {
 735+?>
 736+<div id="p-cactions" class="vectorMenu">
 737+ <h5><span><?php $this->msg('actions') ?></span><a href="#">&nbsp;</a></h5>
 738+ <div class="menu">
 739+ <ul <?php $this->html('userlangattributes') ?>>
 740+ <?php foreach ($this->data['action_urls'] as $key => $link ): ?>
 741+ <li<?php echo $link['attributes'] ?>><a href="<?php echo htmlspecialchars( $link['href'] ) ?>" <?php echo $link['key'] ?>><?php echo htmlspecialchars( $link['text'] ) ?></a></li>
 742+ <?php endforeach; ?>
 743+ </ul>
 744+ </div>
 745+</div>
 746+<?php
 747+ }
 748+ break;
 749+ case 'PERSONAL':
 750+ if ( count( $this->data['personal_urls'] ) > 0 ) {
 751+?>
 752+<div id="p-personal">
 753+ <h5><?php $this->msg('personaltools') ?></h5>
 754+ <ul <?php $this->html('userlangattributes') ?>>
 755+ <?php foreach($this->data['personal_urls'] as $key => $item): ?>
 756+ <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>
 757+ <?php endforeach; ?>
 758+ </ul>
 759+</div>
 760+<?php
 761+ }
 762+ break;
 763+ case 'SEARCH':
 764+?>
 765+<div id="p-search">
 766+ <h5 <?php $this->html('userlangattributes') ?>><label for="searchInput"><?php $this->msg( 'search' ) ?></label></h5>
 767+ <form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
 768+ <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
 769+ <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; ?> />
 770+ <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> />
 771+ <?php if ( $wgUseTwoButtonsSearchForm ): ?>
 772+ <input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> />
 773+ <?php else: ?>
 774+ <div><a href="<?php $this->text( 'searchaction' ) ?>" rel="search"><?php $this->msg( 'powersearch-legend' ) ?></a></div>
 775+ <?php endif; ?>
 776+ </form>
 777+</div>
 778+<?php
 779+ break;
 780+ }
 781+ echo "\n<!-- /{$name} -->\n";
 782+ }
 783+ }
755784 }
Index: trunk/phase3/skins/vector/main-ltr.css
@@ -76,8 +76,11 @@
7777 margin: 0;
7878 padding: 0;
7979 }
 80+ /* @noflip */
8081 div#p-personal li {
8182 float: left;
 83+ }
 84+ div#p-personal li {
8285 margin-left: 0.75em;
8386 margin-top: 0.5em;
8487 font-size: 0.9em;
@@ -98,24 +101,33 @@
99102 display: none;
100103 }
101104 /* Namespaces and Views */
 105+ /* @noflip */
102106 div.vectorTabs {
103107 float: left;
 108+ }
 109+ div.vectorTabs {
104110 background-image: url(images/tab-break.png);
105111 background-position: bottom left;
106112 background-repeat: no-repeat;
107113 padding-left: 1px;
108114 }
 115+ /* @noflip */
109116 div.vectorTabs ul {
110117 float: left;
 118+ }
 119+ div.vectorTabs ul {
111120 height: 100%;
112121 list-style: none;
113122 margin: 0;
114123 padding: 0;
115124 }
 125+ /* @noflip */
 126+ div.vectorTabs ul li {
 127+ float: left;
 128+ }
116129 /* OVERRIDDEN BY COMPLIANT BROWSERS */
117130 div.vectorTabs ul li {
118131 display: inline-block;
119 - float: left;
120132 height: 100%;
121133 margin: 0;
122134 padding: 0;
@@ -175,8 +187,11 @@
176188 color: #a55858;
177189 }
178190 /* Variants and Actions */
 191+ /* @noflip */
179192 div.vectorMenu {
180193 float: left;
 194+ }
 195+ div.vectorMenu {
181196 background-image: url(images/arrow-down-icon.png);
182197 background-position: center center;
183198 background-repeat: no-repeat;
@@ -232,8 +247,11 @@
233248 div#p-search h5 {
234249 display: none;
235250 }
 251+ /* @noflip */
236252 div#p-search {
237253 float: left;
 254+ }
 255+ div#p-search {
238256 margin-right: 0.75em;
239257 }
240258 div#p-search form,
Index: trunk/phase3/skins/vector/main-rtl.css
@@ -76,8 +76,11 @@
7777 margin: 0;
7878 padding: 0;
7979 }
 80+ /* @noflip */
8081 div#p-personal li {
81 - float: right;
 82+ float: left;
 83+ }
 84+ div#p-personal li {
8285 margin-right: 0.75em;
8386 margin-top: 0.5em;
8487 font-size: 0.9em;
@@ -98,24 +101,33 @@
99102 display: none;
100103 }
101104 /* Namespaces and Views */
 105+ /* @noflip */
102106 div.vectorTabs {
103 - float: right;
 107+ float: left;
 108+ }
 109+ div.vectorTabs {
104110 background-image: url(images/tab-break.png);
105111 background-position: bottom right;
106112 background-repeat: no-repeat;
107113 padding-right: 1px;
108114 }
 115+ /* @noflip */
109116 div.vectorTabs ul {
110 - float: right;
 117+ float: left;
 118+ }
 119+ div.vectorTabs ul {
111120 height: 100%;
112121 list-style: none;
113122 margin: 0;
114123 padding: 0;
115124 }
 125+ /* @noflip */
 126+ div.vectorTabs ul li {
 127+ float: left;
 128+ }
116129 /* OVERRIDDEN BY COMPLIANT BROWSERS */
117130 div.vectorTabs ul li {
118131 display: inline-block;
119 - float: right;
120132 height: 100%;
121133 margin: 0;
122134 padding: 0;
@@ -175,8 +187,11 @@
176188 color: #a55858;
177189 }
178190 /* Variants and Actions */
 191+ /* @noflip */
179192 div.vectorMenu {
180 - float: right;
 193+ float: left;
 194+ }
 195+ div.vectorMenu {
181196 background-image: url(images/arrow-down-icon.png);
182197 background-position: center center;
183198 background-repeat: no-repeat;
@@ -232,8 +247,11 @@
233248 div#p-search h5 {
234249 display: none;
235250 }
 251+ /* @noflip */
236252 div#p-search {
237 - float: right;
 253+ float: left;
 254+ }
 255+ div#p-search {
238256 margin-left: 0.75em;
239257 }
240258 div#p-search form,

Follow-up revisions

RevisionCommit summaryAuthorDate
r53410Merging UI fixes from trunk; second batch from http://www.mediawiki.org/wiki/......brion18:05, 17 July 2009

Comments

#Comment by MarkAHershberger (talk | contribs)   01:14, 29 January 2011

+ private function renderPortals( $portals ) { In a code review from TimS early in 2010, he told me that "private" functions should tend to be "protected" instead so that they could be overridden. See also https://bugzilla.wikimedia.org/show_bug.cgi?id=26459

Status & tagging log