r57118 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57117‎ | r57118 | r57119 >
Date:17:30, 30 September 2009
Author:aaron
Status:ok
Tags:
Comment:
Maintain original tab name, rather than generic "stable page"
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -964,23 +964,23 @@
965965 * SkinTemplateTabs, to inlude flagged revs UI elements
966966 */
967967 public function setViewTabs( $skin, &$views ) {
968 - global $wgRequest, $wgUser;
969 -
970 - $title = $this->parent->getTitle()->getSubjectPage();
 968+ global $wgRequest, $wgUser, $wgFlaggedRevTabs;
 969+
 970+ $title = $this->parent->getTitle()->getSubjectPage(); // Get the actual content page
971971 $article = new Article( $title );
972972 $action = $wgRequest->getVal( 'action', 'view' );
973973 $fa = FlaggedArticle::getTitleInstance( $title );
974974 if ( !$fa->isReviewable() || $this->limitedUI() ) {
975 - // Exit, since this isn't a reviewable page or the UI is hidden
 975+ // This isn't a reviewable page or the UI is hidden
976976 return true;
977977 }
978978 $srev = $this->getStableRev( $action == 'rollback' ? FR_MASTER : 0 );
979979 if( is_null( $srev ) ) {
980 - // Exit, since no stable revision exists
981 - return true;
 980+ return true; // No stable revision exists
982981 }
983982 wfLoadExtensionMessages( 'FlaggedRevs' );
984983 $synced = FlaggedRevs::stableVersionIsSynced( $srev, $article );
 984+ // Set draft tab as needed...
985985 if ( !$skin->mTitle->isTalkPage() && !$synced ) {
986986 if ( isset( $views['edit'] ) ) {
987987 if ( $this->showStableByDefault() ) {
@@ -999,14 +999,14 @@
10001000 }
10011001 }
10021002 }
1003 - if ( !FlaggedRevs::showVersionTabs() || $synced ) {
1004 - // Exit, since either the flagged revisions tabs should not be shown
 1003+ if ( !$wgFlaggedRevTabs || $synced ) {
 1004+ // Exit, since either the stable/draft tabs should not be shown
10051005 // or the page is already the most current revision
10061006 return true;
10071007 }
10081008 $tabs = array(
10091009 'stable' => array(
1010 - 'text' => wfMsg( 'revreview-stable' ),
 1010+ 'text' => wfMsg( 'revreview-stable' ), // unused
10111011 'href' => $title->getLocalUrl( 'stable=1' ),
10121012 'class' => ''
10131013 ),
@@ -1029,13 +1029,16 @@
10301030 $first = true;
10311031 $newViews = array();
10321032 foreach ( $views as $tabAction => $data ) {
1033 - if ( $first ) {
 1033+ // Very first tab (page link)
 1034+ if( $first ) {
10341035 if( $synced ) {
10351036 // Use existing first tabs when synced
10361037 $newViews[$tabAction] = $data;
10371038 } else {
10381039 // Use split current and stable tabs when not synced
1039 - $newViews['stable'] = $tabs['stable'];
 1040+ $newViews[$tabAction]['text'] = $data['text']; // keep tab name
 1041+ $newViews[$tabAction]['href'] = $tabs['stable']['href'];
 1042+ $newViews[$tabAction]['class'] = $tabs['stable']['class'];
10401043 $newViews['current'] = $tabs['current'];
10411044 }
10421045 $first = false;

Status & tagging log