Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -650,9 +650,9 @@ |
651 | 651 | * Do the current URL params allow for overriding by stable revisions? |
652 | 652 | */ |
653 | 653 | function pageOverride() { |
654 | | - global $wgFlaggedRevsAnonOnly, $wgUser, $wgRequest; |
655 | | - return !( ( $wgFlaggedRevsAnonOnly && !$wgUser->isAnon() ) || |
656 | | - $wgRequest->getVal('oldid') || $wgRequest->getVal('diff') || $wgRequest->getText('stable')=='false' ); |
| 654 | + global $wgFlaggedRevsAnonOnly, $wgUser, $wgRequest, $action; |
| 655 | + return !( ( $wgFlaggedRevsAnonOnly && !$wgUser->isAnon() ) || $action !='view' || |
| 656 | + $wgRequest->getVal('oldid') || $wgRequest->getVal('diff') || $wgRequest->getInt('stable')===0 ); |
657 | 657 | } |
658 | 658 | |
659 | 659 | /** |
— | — | @@ -840,18 +840,17 @@ |
841 | 841 | } |
842 | 842 | |
843 | 843 | function setCurrentTab( &$sktmp, &$content_actions ) { |
844 | | - global $wgRequest, $wgArticle, $action; |
| 844 | + global $wgRequest, $wgArticle, $wgFlaggedRevsAnonOnly, $wgUser, $action; |
845 | 845 | // Only trigger on article view, not for protect/delete/hist |
846 | 846 | // Non-content pages cannot be validated |
847 | | - if( !$wgArticle || !$sktmp->mTitle->exists() || !$sktmp->mTitle->isContentPage() || $action !='view' ) |
| 847 | + if( !$wgArticle || !$sktmp->mTitle->exists() || !$sktmp->mTitle->isContentPage() ) |
848 | 848 | return; |
849 | 849 | // If we are viewing a page normally, and it was overrode |
850 | 850 | // change the edit tab to a "current revision" tab |
851 | | - if( !$wgRequest->getVal('oldid') ) { |
| 851 | + if( !( $wgFlaggedRevsAnonOnly && !$wgUser->isAnon() ) ) { |
852 | 852 | $tfrev = $this->getOverridingRev( $wgArticle ); |
853 | 853 | // No quality revs? Find the last reviewed one |
854 | | - if( !is_object($tfrev) ) |
855 | | - return; |
| 854 | + if( !is_object($tfrev) ) return; |
856 | 855 | // Note that revisions may not be set to override for users |
857 | 856 | if( $this->pageOverride() ) { |
858 | 857 | # Remove edit option altogether |
— | — | @@ -865,7 +864,7 @@ |
866 | 865 | $new_actions['current'] = array( |
867 | 866 | 'class' => '', |
868 | 867 | 'text' => wfMsg('currentrev'), |
869 | | - 'href' => $sktmp->mTitle->getLocalUrl( 'stable=false' ) |
| 868 | + 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' ) |
870 | 869 | ); |
871 | 870 | } |
872 | 871 | $new_actions[$action] = $data; |
— | — | @@ -873,6 +872,40 @@ |
874 | 873 | } |
875 | 874 | # Reset static array |
876 | 875 | $content_actions = $new_actions; |
| 876 | + } else if( $action != 'view' || $wgRequest->getVal('oldid') ) { |
| 877 | + # Straighten out order |
| 878 | + $new_actions = array(); $counter = 0; |
| 879 | + foreach( $content_actions as $action => $data ) { |
| 880 | + if( $counter==1 ) { |
| 881 | + # Set current rev tab AFTER the main tab is set |
| 882 | + $new_actions['current'] = array( |
| 883 | + 'class' => '', |
| 884 | + 'text' => wfMsg('currentrev'), |
| 885 | + 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' ) |
| 886 | + ); |
| 887 | + } |
| 888 | + $new_actions[$action] = $data; |
| 889 | + $counter++; |
| 890 | + } |
| 891 | + # Reset static array |
| 892 | + $content_actions = $new_actions; |
| 893 | + } else { |
| 894 | + # Straighten out order |
| 895 | + $new_actions = array(); $counter = 0; |
| 896 | + foreach( $content_actions as $action => $data ) { |
| 897 | + if( $counter==1 ) { |
| 898 | + # Set current rev tab AFTER the main tab is set |
| 899 | + $new_actions['current'] = array( |
| 900 | + 'class' => 'selected', |
| 901 | + 'text' => wfMsg('currentrev'), |
| 902 | + 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' ) |
| 903 | + ); |
| 904 | + } |
| 905 | + $new_actions[$action] = $data; |
| 906 | + $counter++; |
| 907 | + } |
| 908 | + # Reset static array |
| 909 | + $content_actions = $new_actions; |
877 | 910 | } |
878 | 911 | } |
879 | 912 | } |