r40300 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40299‎ | r40300 | r40301 >
Date:13:07, 1 September 2008
Author:aaron
Status:old
Tags:
Comment:
Move rating link to toolbox
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/RatingHistory.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -368,6 +368,9 @@
369369 $wgHooks['InitPreferencesForm'][] = 'FlaggedRevsHooks::injectFormPreferences';
370370 $wgHooks['ResetPreferences'][] = 'FlaggedRevsHooks::resetPreferences';
371371 $wgHooks['SavePreferences'][] = 'FlaggedRevsHooks::savePreferences';
 372+# Rating link
 373+$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'FlaggedRevsHooks::addRatingLink';
 374+$wgHooks['MonoBookTemplateToolboxEnd'][] = 'FlaggedRevsHooks::ratingToolboxLink';
372375 # Show unreviewed pages links
373376 $wgHooks['CategoryPageView'][] = 'FlaggedRevsHooks::onCategoryPageView';
374377 # Backlog notice
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -761,17 +761,6 @@
762762 if( !isset($skin->mTitle) )
763763 return true;
764764 $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 - }
776765 # Non-content pages cannot be validated
777766 if( !FlaggedRevs::isPageReviewable( $title ) || !$title->exists() )
778767 return true;
Index: trunk/extensions/FlaggedRevs/language/RatingHistory.i18n.php
@@ -12,6 +12,7 @@
1313 'ratinghistory-text' => '\'\'\'This page displays article rating data for [[:$1|$1]].\'\'\'',
1414 'ratinghistory-leg' => 'Rating history data',
1515 'ratinghistory-tab' => 'rating',
 16+ 'ratinghistory-link' => 'Article rating',
1617 'ratinghistory-thanks' => '\'\'\'\'\'<font color="darkred">Thank you for taking a moment to review this page!</font>\'\'\'\'\'',
1718 'ratinghistory-period' => 'Time period:',
1819 'ratinghistory-month' => 'last month',
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1088,6 +1088,32 @@
10891089 return true;
10901090 }
10911091
 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+
10921118 public static function overrideRedirect( &$title, $request, &$ignoreRedirect, &$target ) {
10931119 if( !FlaggedRevs::isPageReviewable( $title ) ) {
10941120 return true;