r22428 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22427‎ | r22428 | r22429 >
Date:16:11, 25 May 2007
Author:aaron
Status:old
Tags:
Comment:
*modify tab scheme a tad
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -650,9 +650,9 @@
651651 * Do the current URL params allow for overriding by stable revisions?
652652 */
653653 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 );
657657 }
658658
659659 /**
@@ -840,18 +840,17 @@
841841 }
842842
843843 function setCurrentTab( &$sktmp, &$content_actions ) {
844 - global $wgRequest, $wgArticle, $action;
 844+ global $wgRequest, $wgArticle, $wgFlaggedRevsAnonOnly, $wgUser, $action;
845845 // Only trigger on article view, not for protect/delete/hist
846846 // 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() )
848848 return;
849849 // If we are viewing a page normally, and it was overrode
850850 // change the edit tab to a "current revision" tab
851 - if( !$wgRequest->getVal('oldid') ) {
 851+ if( !( $wgFlaggedRevsAnonOnly && !$wgUser->isAnon() ) ) {
852852 $tfrev = $this->getOverridingRev( $wgArticle );
853853 // No quality revs? Find the last reviewed one
854 - if( !is_object($tfrev) )
855 - return;
 854+ if( !is_object($tfrev) ) return;
856855 // Note that revisions may not be set to override for users
857856 if( $this->pageOverride() ) {
858857 # Remove edit option altogether
@@ -865,7 +864,7 @@
866865 $new_actions['current'] = array(
867866 'class' => '',
868867 'text' => wfMsg('currentrev'),
869 - 'href' => $sktmp->mTitle->getLocalUrl( 'stable=false' )
 868+ 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' )
870869 );
871870 }
872871 $new_actions[$action] = $data;
@@ -873,6 +872,40 @@
874873 }
875874 # Reset static array
876875 $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;
877910 }
878911 }
879912 }