Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php |
— | — | @@ -287,4 +287,18 @@ |
288 | 288 | $vars['wgArticleFeedbackNamespaces'] = $wgArticleFeedbackNamespaces; |
289 | 289 | return true; |
290 | 290 | } |
| 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 | + } |
291 | 305 | } |
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.startup.js |
— | — | @@ -13,6 +13,8 @@ |
14 | 14 | // Current revision |
15 | 15 | && mw.util.getParamValue( 'diff' ) == null |
16 | 16 | && mw.util.getParamValue( 'oldid' ) == null |
| 17 | + // Not disabled via preferences |
| 18 | + && !mw.user.options.get( 'articlefeedback-disable' ) |
17 | 19 | // Not viewing a redirect |
18 | 20 | && mw.util.getParamValue( 'redirect' ) != 'no' |
19 | 21 | // Not viewing the printable version |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.i18n.php |
— | — | @@ -87,6 +87,8 @@ |
88 | 88 | 'articleFeedback-table-heading-average' => 'Average', |
89 | 89 | 'articleFeedback-copy-above-highlow-tables' => 'This is an experimental feature. Please provide feedback on the [$1 discussion page].', |
90 | 90 | '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", |
91 | 93 | /* EmailCapture */ |
92 | 94 | 'articlefeedback-emailcapture-response-body' => 'Hello! |
93 | 95 | |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php |
— | — | @@ -144,6 +144,7 @@ |
145 | 145 | 'descriptionmsg' => 'articlefeedback-desc', |
146 | 146 | 'url' => 'http://www.mediawiki.org/wiki/Extension:ArticleFeedback' |
147 | 147 | ); |
| 148 | + |
148 | 149 | // Autoloading |
149 | 150 | $dir = dirname( __FILE__ ) . '/'; |
150 | 151 | $wgAutoloadClasses['ApiQueryArticleFeedback'] = $dir . 'api/ApiQueryArticleFeedback.php'; |
— | — | @@ -152,12 +153,15 @@ |
153 | 154 | $wgAutoloadClasses['SpecialArticleFeedback'] = $dir . 'SpecialArticleFeedback.php'; |
154 | 155 | $wgExtensionMessagesFiles['ArticleFeedback'] = $dir . 'ArticleFeedback.i18n.php'; |
155 | 156 | $wgExtensionAliasesFiles['ArticleFeedback'] = $dir . 'ArticleFeedback.alias.php'; |
| 157 | + |
156 | 158 | // Hooks |
157 | 159 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'ArticleFeedbackHooks::loadExtensionSchemaUpdates'; |
158 | 160 | $wgHooks['ParserTestTables'][] = 'ArticleFeedbackHooks::parserTestTables'; |
159 | 161 | $wgHooks['BeforePageDisplay'][] = 'ArticleFeedbackHooks::beforePageDisplay'; |
160 | 162 | $wgHooks['ResourceLoaderRegisterModules'][] = 'ArticleFeedbackHooks::resourceLoaderRegisterModules'; |
161 | 163 | $wgHooks['ResourceLoaderGetConfigVars'][] = 'ArticleFeedbackHooks::resourceLoaderGetConfigVars'; |
| 164 | +$wgHooks['GetPreferences'][] = 'ArticleFeedbackHooks::getPreferences'; |
| 165 | + |
162 | 166 | // API Registration |
163 | 167 | $wgAPIListModules['articlefeedback'] = 'ApiQueryArticleFeedback'; |
164 | 168 | $wgAPIModules['articlefeedback'] = 'ApiArticleFeedback'; |