Index: branches/REL1_17/phase3/skins/Vector.php |
— | — | @@ -73,8 +73,6 @@ |
74 | 74 | $action = $wgRequest->getVal( 'action', 'view' ); |
75 | 75 | $section = $wgRequest->getVal( 'section' ); |
76 | 76 | |
77 | | - $userCanRead = $this->mTitle->userCanRead(); |
78 | | - |
79 | 77 | // Checks if page is some kind of content |
80 | 78 | if( $this->iscontent ) { |
81 | 79 | // Gets page objects for the related namespaces |
— | — | @@ -95,16 +93,16 @@ |
96 | 94 | |
97 | 95 | // Adds namespace links |
98 | 96 | $links['namespaces'][$subjectId] = $this->tabAction( |
99 | | - $subjectPage, 'nstab-' . $subjectId, !$isTalk, '', $userCanRead |
| 97 | + $subjectPage, 'nstab-' . $subjectId, !$isTalk, '', true |
100 | 98 | ); |
101 | 99 | $links['namespaces'][$subjectId]['context'] = 'subject'; |
102 | 100 | $links['namespaces'][$talkId] = $this->tabAction( |
103 | | - $talkPage, 'talk', $isTalk, '', $userCanRead |
| 101 | + $talkPage, 'talk', $isTalk, '', true |
104 | 102 | ); |
105 | 103 | $links['namespaces'][$talkId]['context'] = 'talk'; |
106 | 104 | |
107 | 105 | // Adds view view link |
108 | | - if ( $this->mTitle->exists() && $userCanRead ) { |
| 106 | + if ( $this->mTitle->exists() ) { |
109 | 107 | $links['views']['view'] = $this->tabAction( |
110 | 108 | $isTalk ? $talkPage : $subjectPage, |
111 | 109 | 'vector-view-view', ( $action == 'view' ), '', true |
— | — | @@ -115,8 +113,8 @@ |
116 | 114 | |
117 | 115 | // Checks if user can... |
118 | 116 | if ( |
119 | | - // read and edit the current page |
120 | | - $userCanRead && $this->mTitle->quickUserCan( 'edit' ) && |
| 117 | + // edit the current page |
| 118 | + $this->mTitle->quickUserCan( 'edit' ) && |
121 | 119 | ( |
122 | 120 | // if it exists |
123 | 121 | $this->mTitle->exists() || |
— | — | @@ -157,7 +155,7 @@ |
158 | 156 | } |
159 | 157 | } |
160 | 158 | // Checks if the page has some kind of viewable content |
161 | | - } elseif ( $this->mTitle->hasSourceText() && $userCanRead ) { |
| 159 | + } elseif ( $this->mTitle->hasSourceText() ) { |
162 | 160 | // Adds view source view link |
163 | 161 | $links['views']['viewsource'] = array( |
164 | 162 | 'class' => ( $action == 'edit' ) ? 'selected' : false, |
— | — | @@ -171,7 +169,7 @@ |
172 | 170 | wfProfileIn( __METHOD__ . '-live' ); |
173 | 171 | |
174 | 172 | // Checks if the page exists |
175 | | - if ( $this->mTitle->exists() && $userCanRead ) { |
| 173 | + if ( $this->mTitle->exists() ) { |
176 | 174 | // Adds history view link |
177 | 175 | $links['views']['history'] = array( |
178 | 176 | 'class' => 'collapsible ' . ( ( $action == 'history' ) ? 'selected' : false ), |
— | — | @@ -341,7 +339,7 @@ |
342 | 340 | * QuickTemplate class for Vector skin |
343 | 341 | * @ingroup Skins |
344 | 342 | */ |
345 | | -class VectorTemplate extends BaseTemplate { |
| 343 | +class VectorTemplate extends QuickTemplate { |
346 | 344 | |
347 | 345 | /* Members */ |
348 | 346 | |
— | — | @@ -413,6 +411,37 @@ |
414 | 412 | $this->skin->tooltipAndAccesskey('pt-'.$key); |
415 | 413 | } |
416 | 414 | |
| 415 | + // Generate additional footer links |
| 416 | + $footerlinks = $this->data["footerlinks"]; |
| 417 | + |
| 418 | + // Reduce footer links down to only those which are being used |
| 419 | + $validFooterLinks = array(); |
| 420 | + foreach( $footerlinks as $category => $links ) { |
| 421 | + $validFooterLinks[$category] = array(); |
| 422 | + foreach( $links as $link ) { |
| 423 | + if( isset( $this->data[$link] ) && $this->data[$link] ) { |
| 424 | + $validFooterLinks[$category][] = $link; |
| 425 | + } |
| 426 | + } |
| 427 | + } |
| 428 | + |
| 429 | + // Generate additional footer icons |
| 430 | + $footericons = $this->data["footericons"]; |
| 431 | + // Unset any icons which don't have an image |
| 432 | + foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) { |
| 433 | + foreach ( $footerIconsBlock as $footerIconKey => $footerIcon ) { |
| 434 | + if ( !is_string($footerIcon) && !isset($footerIcon["src"]) ) { |
| 435 | + unset($footerIconsBlock[$footerIconKey]); |
| 436 | + } |
| 437 | + } |
| 438 | + } |
| 439 | + // Redo removal of any empty blocks |
| 440 | + foreach ( $footericons as $footerIconsKey => &$footerIconsBlock ) { |
| 441 | + if ( count($footerIconsBlock) <= 0 ) { |
| 442 | + unset($footericons[$footerIconsKey]); |
| 443 | + } |
| 444 | + } |
| 445 | + |
417 | 446 | // Reverse horizontally rendered navigation elements |
418 | 447 | if ( $wgLang->isRTL() ) { |
419 | 448 | $this->data['view_urls'] = |
— | — | @@ -504,15 +533,18 @@ |
505 | 534 | <!-- /panel --> |
506 | 535 | <!-- footer --> |
507 | 536 | <div id="footer"<?php $this->html('userlangattributes') ?>> |
508 | | - <?php foreach( $this->getFooterLinks() as $category => $links ): ?> |
| 537 | + <?php foreach( $validFooterLinks as $category => $links ): ?> |
| 538 | + <?php if ( count( $links ) > 0 ): ?> |
509 | 539 | <ul id="footer-<?php echo $category ?>"> |
510 | 540 | <?php foreach( $links as $link ): ?> |
| 541 | + <?php if( isset( $this->data[$link] ) && $this->data[$link] ): ?> |
511 | 542 | <li id="footer-<?php echo $category ?>-<?php echo $link ?>"><?php $this->html( $link ) ?></li> |
| 543 | + <?php endif; ?> |
512 | 544 | <?php endforeach; ?> |
513 | 545 | </ul> |
| 546 | + <?php endif; ?> |
514 | 547 | <?php endforeach; ?> |
515 | | - <?php $footericons = $this->getFooterIcons("icononly"); |
516 | | - if ( count( $footericons ) > 0 ): ?> |
| 548 | +<?php if ( count( $footericons ) > 0 ): ?> |
517 | 549 | <ul id="footer-icons" class="noprint"> |
518 | 550 | <?php foreach ( $footericons as $blockName => $footerIcons ): ?> |
519 | 551 | <li id="footer-<?php echo htmlspecialchars($blockName); ?>ico"> |
— | — | @@ -555,51 +587,83 @@ |
556 | 588 | case 'SEARCH': |
557 | 589 | break; |
558 | 590 | case 'TOOLBOX': |
559 | | - $this->renderPortal( "tb", $this->getToolbox(), "toolbox", "SkinTemplateToolboxEnd" ); |
| 591 | +?> |
| 592 | +<div class="portal" id="p-tb"> |
| 593 | + <h5<?php $this->html('userlangattributes') ?>><?php $this->msg( 'toolbox' ) ?></h5> |
| 594 | + <div class="body"> |
| 595 | + <ul> |
| 596 | + <?php if( $this->data['notspecialpage'] ): ?> |
| 597 | + <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> |
| 598 | + <?php if( $this->data['nav_urls']['recentchangeslinked'] ): ?> |
| 599 | + <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> |
| 600 | + <?php endif; ?> |
| 601 | + <?php endif; ?> |
| 602 | + <?php if( isset( $this->data['nav_urls']['trackbacklink'] ) ): ?> |
| 603 | + <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> |
| 604 | + <?php endif; ?> |
| 605 | + <?php if( $this->data['feeds']): ?> |
| 606 | + <li id="feedlinks"> |
| 607 | + <?php foreach( $this->data['feeds'] as $key => $feed ): ?> |
| 608 | + <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> |
| 609 | + <?php endforeach; ?> |
| 610 | + </li> |
| 611 | + <?php endif; ?> |
| 612 | + <?php foreach( array( 'contributions', 'log', 'blockip', 'emailuser', 'upload', 'specialpages' ) as $special ): ?> |
| 613 | + <?php if( $this->data['nav_urls'][$special]): ?> |
| 614 | + <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> |
| 615 | + <?php endif; ?> |
| 616 | + <?php endforeach; ?> |
| 617 | + <?php if( !empty( $this->data['nav_urls']['print']['href'] ) ): ?> |
| 618 | + <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> |
| 619 | + <?php endif; ?> |
| 620 | + <?php if ( !empty( $this->data['nav_urls']['permalink']['href'] ) ): ?> |
| 621 | + <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> |
| 622 | + <?php elseif ( $this->data['nav_urls']['permalink']['href'] === '' ): ?> |
| 623 | + <li id="t-ispermalink"<?php echo $this->skin->tooltip( 't-ispermalink' ) ?>><?php $this->msg( 'permalink' ) ?></li> |
| 624 | + <?php endif; ?> |
| 625 | + <?php wfRunHooks( 'SkinTemplateToolboxEnd', array( &$this ) ); ?> |
| 626 | + </ul> |
| 627 | + </div> |
| 628 | +</div> |
| 629 | +<?php |
560 | 630 | break; |
561 | 631 | case 'LANGUAGES': |
562 | 632 | if ( $this->data['language_urls'] ) { |
563 | | - $this->renderPortal("lang", $this->data['language_urls'], "otherlanguages"); |
| 633 | +?> |
| 634 | +<div class="portal" id="p-lang"> |
| 635 | + <h5<?php $this->html('userlangattributes') ?>><?php $this->msg( 'otherlanguages' ) ?></h5> |
| 636 | + <div class="body"> |
| 637 | + <ul> |
| 638 | + <?php foreach ( $this->data['language_urls'] as $langlink ): ?> |
| 639 | + <li class="<?php echo htmlspecialchars( $langlink['class'] ) ?>"><a href="<?php echo htmlspecialchars( $langlink['href'] ) ?>" title="<?php echo htmlspecialchars( $langlink['title'] ) ?>"><?php echo $langlink['text'] ?></a></li> |
| 640 | + <?php endforeach; ?> |
| 641 | + </ul> |
| 642 | + </div> |
| 643 | +</div> |
| 644 | +<?php |
564 | 645 | } |
565 | 646 | break; |
566 | 647 | default: |
567 | | - $this->renderPortal($name, $content); |
568 | | - break; |
569 | | - } |
570 | | - echo "\n<!-- /{$name} -->\n"; |
571 | | - } |
572 | | - } |
573 | | - |
574 | | - private function renderPortal($name, $content, $msg=null, $hook=null) { |
575 | | - if ( !isset($msg) ) { |
576 | | - $msg = $name; |
577 | | - } |
578 | | - ?> |
| 648 | +?> |
579 | 649 | <div class="portal" id='<?php echo Sanitizer::escapeId( "p-$name" ) ?>'<?php echo $this->skin->tooltip( 'p-' . $name ) ?>> |
580 | | - <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $msg ); if ( wfEmptyMsg( $msg, $out ) ) echo htmlspecialchars( $msg ); else echo htmlspecialchars( $out ); ?></h5> |
| 650 | + <h5<?php $this->html('userlangattributes') ?>><?php $out = wfMsg( $name ); if ( wfEmptyMsg( $name, $out ) ) echo htmlspecialchars( $name ); else echo htmlspecialchars( $out ); ?></h5> |
581 | 651 | <div class="body"> |
582 | | -<?php |
583 | | - if ( is_array( $content ) ): ?> |
| 652 | + <?php if ( is_array( $content ) ): ?> |
584 | 653 | <ul> |
585 | | -<?php |
586 | | - foreach( $content as $key => $val ): ?> |
587 | | - <?php echo $this->makeListItem($key, $val); ?> |
588 | | - |
589 | | -<?php |
590 | | - endforeach; |
591 | | - if ( isset($hook) ) { |
592 | | - wfRunHooks( $hook, array( &$this ) ); |
593 | | - } |
594 | | - ?> |
| 654 | + <?php foreach( $content as $val ): ?> |
| 655 | + <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> |
| 656 | + <?php endforeach; ?> |
595 | 657 | </ul> |
596 | | -<?php |
597 | | - else: ?> |
| 658 | + <?php else: ?> |
598 | 659 | <?php echo $content; /* Allow raw HTML block to be defined by extensions */ ?> |
599 | | -<?php |
600 | | - endif; ?> |
| 660 | + <?php endif; ?> |
601 | 661 | </div> |
602 | 662 | </div> |
603 | 663 | <?php |
| 664 | + break; |
| 665 | + } |
| 666 | + echo "\n<!-- /{$name} -->\n"; |
| 667 | + } |
604 | 668 | } |
605 | 669 | |
606 | 670 | /** |
— | — | @@ -702,18 +766,13 @@ |
703 | 767 | <input type='hidden' name="title" value="<?php $this->text( 'searchtitle' ) ?>"/> |
704 | 768 | <?php if ( $wgVectorUseSimpleSearch && $wgUser->getOption( 'vector-simplesearch' ) ): ?> |
705 | 769 | <div id="simpleSearch"> |
706 | | - <?php if ( $this->data['rtl'] ): ?> |
707 | | - <?php echo $this->makeSearchButton("image", array( "id" => "searchButton", "src" => $this->skin->getSkinStylePath('images/search-rtl.png') )); ?> |
708 | | - <?php endif; ?> |
709 | | - <?php echo $this->makeSearchInput(array( "id" => "searchInput", "type" => "text" )); ?> |
710 | | - <?php if ( !$this->data['rtl'] ): ?> |
711 | | - <?php echo $this->makeSearchButton("image", array( "id" => "searchButton", "src" => $this->skin->getSkinStylePath('images/search-ltr.png') )); ?> |
712 | | - <?php endif; ?> |
| 770 | + <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; ?> /> |
| 771 | + <button id="searchButton" type='submit' name='button' <?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?>><img src="<?php echo $this->skin->getSkinStylePath('images/search-' . ( $this->data['rtl'] ? 'rtl' : 'ltr' ) . '.png'); ?>" alt="<?php $this->msg( 'searchbutton' ) ?>" /></button> |
713 | 772 | </div> |
714 | 773 | <?php else: ?> |
715 | | - <?php echo $this->makeSearchInput(array( "id" => "searchInput" )); ?> |
716 | | - <?php echo $this->makeSearchButton("go", array( "id" => "searchGoButton", "class" => "searchButton" )); ?> |
717 | | - <?php echo $this->makeSearchButton("fulltext", array( "id" => "mw-searchButton", "class" => "searchButton" )); ?> |
| 774 | + <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; ?> /> |
| 775 | + <input type='submit' name="go" class="searchButton" id="searchGoButton" value="<?php $this->msg( 'searcharticle' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-go' ); ?> /> |
| 776 | + <input type="submit" name="fulltext" class="searchButton" id="mw-searchButton" value="<?php $this->msg( 'searchbutton' ) ?>"<?php echo $this->skin->tooltipAndAccesskey( 'search-fulltext' ); ?> /> |
718 | 777 | <?php endif; ?> |
719 | 778 | </form> |
720 | 779 | </div> |