r89673 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89672‎ | r89673 | r89674 >
Date:18:47, 7 June 2011
Author:krinkle
Status:ok
Tags:
Comment:
Adding 'articlefeedback-disable-preference' to preferences panel under 'Appearance / options'
* (bug 29173) Create a preference to turn the Article feedback widget off
Modified paths:
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.startup.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php
@@ -287,4 +287,18 @@
288288 $vars['wgArticleFeedbackNamespaces'] = $wgArticleFeedbackNamespaces;
289289 return true;
290290 }
 291+
 292+ /**
 293+ * Add the preference in the user preferences with the GetPreferences hook.
 294+ * @param $user User
 295+ * @param $preferences
 296+ */
 297+ public static function getPreferences( $user, &$preferences ) {
 298+ $preferences['articlefeedback-disable'] = array(
 299+ 'type' => 'check',
 300+ 'section' => 'rendering/advancedrendering',
 301+ 'label-message' => 'articlefeedback-disable-preference',
 302+ );
 303+ return true;
 304+ }
291305 }
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.startup.js
@@ -13,6 +13,8 @@
1414 // Current revision
1515 && mw.util.getParamValue( 'diff' ) == null
1616 && mw.util.getParamValue( 'oldid' ) == null
 17+ // Not disabled via preferences
 18+ && !mw.user.options.get( 'articlefeedback-disable' )
1719 // Not viewing a redirect
1820 && mw.util.getParamValue( 'redirect' ) != 'no'
1921 // Not viewing the printable version
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php
@@ -87,6 +87,8 @@
8888 'articleFeedback-table-heading-average' => 'Average',
8989 'articleFeedback-copy-above-highlow-tables' => 'This is an experimental feature. Please provide feedback on the [$1 discussion page].',
9090 'articleFeedback-copy-below-highlow-tables' => 'These tables contain pages that have received at least 10 ratings within the last 24 hours. Averages are calculated by taking the mean of all ratings submitted within the last 24 hours.',
 91+ /* Special:Preferences */
 92+ 'articlefeedback-disable-preference' => "Don't show the Article feedback widget on pages",
9193 /* EmailCapture */
9294 'articlefeedback-emailcapture-response-body' => 'Hello!
9395
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php
@@ -144,6 +144,7 @@
145145 'descriptionmsg' => 'articlefeedback-desc',
146146 'url' => 'http://www.mediawiki.org/wiki/Extension:ArticleFeedback'
147147 );
 148+
148149 // Autoloading
149150 $dir = dirname( __FILE__ ) . '/';
150151 $wgAutoloadClasses['ApiQueryArticleFeedback'] = $dir . 'api/ApiQueryArticleFeedback.php';
@@ -152,12 +153,15 @@
153154 $wgAutoloadClasses['SpecialArticleFeedback'] = $dir . 'SpecialArticleFeedback.php';
154155 $wgExtensionMessagesFiles['ArticleFeedback'] = $dir . 'ArticleFeedback.i18n.php';
155156 $wgExtensionAliasesFiles['ArticleFeedback'] = $dir . 'ArticleFeedback.alias.php';
 157+
156158 // Hooks
157159 $wgHooks['LoadExtensionSchemaUpdates'][] = 'ArticleFeedbackHooks::loadExtensionSchemaUpdates';
158160 $wgHooks['ParserTestTables'][] = 'ArticleFeedbackHooks::parserTestTables';
159161 $wgHooks['BeforePageDisplay'][] = 'ArticleFeedbackHooks::beforePageDisplay';
160162 $wgHooks['ResourceLoaderRegisterModules'][] = 'ArticleFeedbackHooks::resourceLoaderRegisterModules';
161163 $wgHooks['ResourceLoaderGetConfigVars'][] = 'ArticleFeedbackHooks::resourceLoaderGetConfigVars';
 164+$wgHooks['GetPreferences'][] = 'ArticleFeedbackHooks::getPreferences';
 165+
162166 // API Registration
163167 $wgAPIListModules['articlefeedback'] = 'ApiQueryArticleFeedback';
164168 $wgAPIModules['articlefeedback'] = 'ApiArticleFeedback';

Status & tagging log