r22431 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22430‎ | r22431 | r22432 >
Date:17:08, 25 May 2007
Author:aaron
Status:old
Tags:
Comment:
*More tab tinkering
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -55,7 +55,7 @@
5656 # perhaps treat flagged pages as "done",
5757 # or just be too damn lazy to always click "current".
5858 # We may just want non-user visitors to see reviewed pages by default.
59 -$wgFlaggedRevsAnonOnly = true;
 59+$wgFlaggedRevsAnonOnly = false;
6060 # Can users make comments that will show up below flagged revisions?
6161 $wgFlaggedRevComments = true;
6262 # How long to cache stable versions? (seconds)
@@ -652,7 +652,7 @@
653653 function pageOverride() {
654654 global $wgFlaggedRevsAnonOnly, $wgUser, $wgRequest, $action;
655655 return !( ( $wgFlaggedRevsAnonOnly && !$wgUser->isAnon() ) || $action !='view' ||
656 - $wgRequest->getVal('oldid') || $wgRequest->getVal('diff') || $wgRequest->getInt('stable')===0 );
 656+ $wgRequest->getVal('oldid') || $wgRequest->getVal('diff') || $wgRequest->getIntOrNull('stable')===0 );
657657 }
658658
659659 /**
@@ -840,15 +840,16 @@
841841 }
842842
843843 function setCurrentTab( &$sktmp, &$content_actions ) {
844 - global $wgRequest, $wgArticle, $wgFlaggedRevsAnonOnly, $wgUser, $action;
845 - // Only trigger on article view, not for protect/delete/hist
 844+ global $wgRequest, $wgFlaggedRevsAnonOnly, $wgUser, $action;
 845+ // Get the subject page
 846+ $title = $sktmp->mTitle->getSubjectPage();
846847 // Non-content pages cannot be validated
847 - if( !$wgArticle || !$sktmp->mTitle->exists() || !$sktmp->mTitle->isContentPage() )
848 - return;
 848+ if( !$title->isContentPage() || !$title->exists() ) return;
 849+ $article = new Article( $title );
849850 // If we are viewing a page normally, and it was overrode
850851 // change the edit tab to a "current revision" tab
851852 if( !( $wgFlaggedRevsAnonOnly && !$wgUser->isAnon() ) ) {
852 - $tfrev = $this->getOverridingRev( $wgArticle );
 853+ $tfrev = $this->getOverridingRev( $article );
853854 // No quality revs? Find the last reviewed one
854855 if( !is_object($tfrev) ) return;
855856 // Note that revisions may not be set to override for users
@@ -864,7 +865,7 @@
865866 $new_actions['current'] = array(
866867 'class' => '',
867868 'text' => wfMsg('currentrev'),
868 - 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' )
 869+ 'href' => $title->getLocalUrl( 'stable=0' )
869870 );
870871 }
871872 $new_actions[$action] = $data;
@@ -872,7 +873,7 @@
873874 }
874875 # Reset static array
875876 $content_actions = $new_actions;
876 - } else if( $action != 'view' || $wgRequest->getVal('oldid') ) {
 877+ } else if( $action != 'view' || $wgRequest->getVal('oldid') || $sktmp->mTitle->isTalkPage() ) {
877878 # Straighten out order
878879 $new_actions = array(); $counter = 0;
879880 foreach( $content_actions as $action => $data ) {
@@ -881,7 +882,7 @@
882883 $new_actions['current'] = array(
883884 'class' => '',
884885 'text' => wfMsg('currentrev'),
885 - 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' )
 886+ 'href' => $title->getLocalUrl( 'stable=0' )
886887 );
887888 }
888889 $new_actions[$action] = $data;
@@ -898,7 +899,7 @@
899900 $new_actions['current'] = array(
900901 'class' => 'selected',
901902 'text' => wfMsg('currentrev'),
902 - 'href' => $sktmp->mTitle->getLocalUrl( 'stable=0' )
 903+ 'href' => $title->getLocalUrl( 'stable=0' )
903904 );
904905 }
905906 $new_actions[$action] = $data;