Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -368,6 +368,9 @@ |
369 | 369 | $wgHooks['InitPreferencesForm'][] = 'FlaggedRevsHooks::injectFormPreferences'; |
370 | 370 | $wgHooks['ResetPreferences'][] = 'FlaggedRevsHooks::resetPreferences'; |
371 | 371 | $wgHooks['SavePreferences'][] = 'FlaggedRevsHooks::savePreferences'; |
| 372 | +# Rating link |
| 373 | +$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'FlaggedRevsHooks::addRatingLink'; |
| 374 | +$wgHooks['MonoBookTemplateToolboxEnd'][] = 'FlaggedRevsHooks::ratingToolboxLink'; |
372 | 375 | # Show unreviewed pages links |
373 | 376 | $wgHooks['CategoryPageView'][] = 'FlaggedRevsHooks::onCategoryPageView'; |
374 | 377 | # Backlog notice |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -761,17 +761,6 @@ |
762 | 762 | if( !isset($skin->mTitle) ) |
763 | 763 | return true; |
764 | 764 | $title = $skin->mTitle->getSubjectPage(); |
765 | | - # Add rating tab |
766 | | - if( $wgUser->isAllowed( 'feedback' ) && $this->isRateable() ) { |
767 | | - wfLoadExtensionMessages( 'FlaggedRevs' ); |
768 | | - wfLoadExtensionMessages( 'RatingHistory' ); |
769 | | - $ratingTitle = SpecialPage::getTitleFor( 'RatingHistory' ); |
770 | | - $contentActions['ratinghist'] = array( |
771 | | - 'class' => false, |
772 | | - 'text' => wfMsg('ratinghistory-tab'), |
773 | | - 'href' => $ratingTitle->getLocalUrl('target='.$title->getPrefixedUrl()) |
774 | | - ); |
775 | | - } |
776 | 765 | # Non-content pages cannot be validated |
777 | 766 | if( !FlaggedRevs::isPageReviewable( $title ) || !$title->exists() ) |
778 | 767 | return true; |
Index: trunk/extensions/FlaggedRevs/language/RatingHistory.i18n.php |
— | — | @@ -12,6 +12,7 @@ |
13 | 13 | 'ratinghistory-text' => '\'\'\'This page displays article rating data for [[:$1|$1]].\'\'\'', |
14 | 14 | 'ratinghistory-leg' => 'Rating history data', |
15 | 15 | 'ratinghistory-tab' => 'rating', |
| 16 | + 'ratinghistory-link' => 'Article rating', |
16 | 17 | 'ratinghistory-thanks' => '\'\'\'\'\'<font color="darkred">Thank you for taking a moment to review this page!</font>\'\'\'\'\'', |
17 | 18 | 'ratinghistory-period' => 'Time period:', |
18 | 19 | 'ratinghistory-month' => 'last month', |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1088,6 +1088,32 @@ |
1089 | 1089 | return true; |
1090 | 1090 | } |
1091 | 1091 | |
| 1092 | + public static function addRatingLink( &$skintemplate, &$nav_urls, &$oldid, &$revid ) { |
| 1093 | + $fa = FlaggedArticle::getTitleInstance( $skintemplate->mTitle ); |
| 1094 | + # Add rating tab |
| 1095 | + if( $fa->isRateable() ) { |
| 1096 | + wfLoadExtensionMessages( 'FlaggedRevs' ); |
| 1097 | + wfLoadExtensionMessages( 'RatingHistory' ); |
| 1098 | + $nav_urls['ratinghist'] = array( |
| 1099 | + 'text' => wfMsg( 'ratinghistory-link' ), |
| 1100 | + 'href' => $skintemplate->makeSpecialUrl( 'RatingHistory', |
| 1101 | + "target=" . wfUrlencode( "{$skintemplate->thispage}" ) ) |
| 1102 | + ); |
| 1103 | + } |
| 1104 | + return true; |
| 1105 | + } |
| 1106 | + |
| 1107 | + public static function ratingToolboxLink( &$monobook ) { |
| 1108 | + if( isset( $monobook->data['nav_urls']['ratinghist'] ) ) { |
| 1109 | + ?><li id="t-cite"><?php |
| 1110 | + ?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['ratinghist']['href'] ) ?>"><?php |
| 1111 | + echo $monobook->msg( 'ratinghistory-link' ); |
| 1112 | + ?></a><?php |
| 1113 | + ?></li><?php |
| 1114 | + } |
| 1115 | + return true; |
| 1116 | + } |
| 1117 | + |
1092 | 1118 | public static function overrideRedirect( &$title, $request, &$ignoreRedirect, &$target ) { |
1093 | 1119 | if( !FlaggedRevs::isPageReviewable( $title ) ) { |
1094 | 1120 | return true; |