Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -862,35 +862,32 @@ |
863 | 863 | if ( $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) ) ) { |
864 | 864 | // Builds CSS class for talk page links |
865 | 865 | $isTalkClass = $isTalk ? ' istalk' : ''; |
| 866 | + // Whether the user is editing the page |
| 867 | + $isEditing = $onPage && ( $action == 'edit' || $action == 'submit' ); |
| 868 | + // Whether to show the "Add a new section" tab |
| 869 | + // Checks if this is a current rev of talk page and is not forced to be hidden |
| 870 | + $showNewSection = !$out->forceHideNewSectionLink() |
| 871 | + && ( ( $isTalk && $this->isRevisionCurrent() ) || $out->showNewSectionLink() ); |
866 | 872 | $section = $request->getVal( 'section' ); |
867 | 873 | |
868 | | - // Determines if we're in edit mode |
869 | | - $selected = ( |
870 | | - $onPage && |
871 | | - ( $action == 'edit' || $action == 'submit' ) && |
872 | | - ( $section != 'new' ) |
873 | | - ); |
874 | 874 | $msgKey = $title->exists() || ( $title->getNamespace() == NS_MEDIAWIKI && $title->getDefaultMessageText() !== false ) ? |
875 | 875 | "edit" : "create"; |
876 | 876 | $content_navigation['views']['edit'] = array( |
877 | | - 'class' => ( $selected ? 'selected' : '' ) . $isTalkClass, |
| 877 | + 'class' => ( $isEditing && ( $section !== 'new' || !$showNewSection ) ? 'selected' : '' ) . $isTalkClass, |
878 | 878 | 'text' => wfMessageFallback( "$skname-view-$msgKey", $msgKey )->setContext( $this->getContext() )->text(), |
879 | 879 | 'href' => $title->getLocalURL( $this->editUrlOptions() ), |
880 | 880 | 'primary' => true, // don't collapse this in vector |
881 | 881 | ); |
882 | | - // Checks if this is a current rev of talk page and we should show a new |
| 882 | + |
883 | 883 | // section link |
884 | | - if ( ( $isTalk && $this->isRevisionCurrent() ) || ( $out->showNewSectionLink() ) ) { |
885 | | - // Checks if we should ever show a new section link |
886 | | - if ( !$out->forceHideNewSectionLink() ) { |
887 | | - // Adds new section link |
888 | | - //$content_navigation['actions']['addsection'] |
889 | | - $content_navigation['views']['addsection'] = array( |
890 | | - 'class' => $section == 'new' ? 'selected' : false, |
891 | | - 'text' => wfMessageFallback( "$skname-action-addsection", 'addsection' )->setContext( $this->getContext() )->text(), |
892 | | - 'href' => $title->getLocalURL( 'action=edit§ion=new' ) |
893 | | - ); |
894 | | - } |
| 884 | + if ( $showNewSection ) { |
| 885 | + // Adds new section link |
| 886 | + //$content_navigation['actions']['addsection'] |
| 887 | + $content_navigation['views']['addsection'] = array( |
| 888 | + 'class' => ( $isEditing && $section == 'new' ) ? 'selected' : false, |
| 889 | + 'text' => wfMessageFallback( "$skname-action-addsection", 'addsection' )->setContext( $this->getContext() )->text(), |
| 890 | + 'href' => $title->getLocalURL( 'action=edit§ion=new' ) |
| 891 | + ); |
895 | 892 | } |
896 | 893 | // Checks if the page has some kind of viewable content |
897 | 894 | } elseif ( $title->hasSourceText() ) { |
— | — | @@ -922,6 +919,7 @@ |
923 | 920 | 'href' => $title->getLocalURL( 'action=delete' ) |
924 | 921 | ); |
925 | 922 | } |
| 923 | + |
926 | 924 | if ( $title->quickUserCan( 'move', $user ) ) { |
927 | 925 | $moveTitle = SpecialPage::getTitleFor( 'Movepage', $title->getPrefixedDBkey() ); |
928 | 926 | $content_navigation['actions']['move'] = array( |
— | — | @@ -930,8 +928,6 @@ |
931 | 929 | 'href' => $moveTitle->getLocalURL() |
932 | 930 | ); |
933 | 931 | } |
934 | | - |
935 | | - $isProtected = $title->isProtected(); |
936 | 932 | } else { |
937 | 933 | // article doesn't exist or is deleted |
938 | 934 | if ( $user->isAllowed( 'deletedhistory' ) ) { |
— | — | @@ -948,12 +944,10 @@ |
949 | 945 | ); |
950 | 946 | } |
951 | 947 | } |
952 | | - |
953 | | - $isProtected = $title->getRestrictions( 'create' ); |
954 | 948 | } |
955 | 949 | |
956 | 950 | if ( $title->getNamespace() !== NS_MEDIAWIKI && $title->quickUserCan( 'protect', $user ) ) { |
957 | | - $mode = $isProtected ? 'unprotect' : 'protect'; |
| 951 | + $mode = $title->isProtected() ? 'unprotect' : 'protect'; |
958 | 952 | $content_navigation['actions'][$mode] = array( |
959 | 953 | 'class' => ( $onPage && $action == $mode ) ? 'selected' : false, |
960 | 954 | 'text' => wfMessageFallback( "$skname-action-$mode", $mode )->setContext( $this->getContext() )->text(), |