r87336 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87335‎ | r87336 | r87337 >
Date:17:11, 3 May 2011
Author:krinkle
Status:ok
Tags:
Comment:
(bug 28080) Add configuration option to ArticleFeedback to define namespaces where it is enabled
Modified paths:
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.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
@@ -218,11 +218,13 @@
219219 global $wgArticleFeedbackCategories,
220220 $wgArticleFeedbackLotteryOdds,
221221 $wgArticleFeedbackTracking,
222 - $wgArticleFeedbackOptions;
 222+ $wgArticleFeedbackOptions,
 223+ $wgArticleFeedbackNamespaces;
223224 $vars['wgArticleFeedbackCategories'] = $wgArticleFeedbackCategories;
224225 $vars['wgArticleFeedbackLotteryOdds'] = $wgArticleFeedbackLotteryOdds;
225226 $vars['wgArticleFeedbackTracking'] = $wgArticleFeedbackTracking;
226227 $vars['wgArticleFeedbackOptions'] = $wgArticleFeedbackOptions;
 228+ $vars['wgArticleFeedbackNamespaces'] = $wgArticleFeedbackNamespaces;
227229 return true;
228230 }
229231 }
Index: trunk/extensions/ArticleFeedback/modules/ext.articleFeedback/ext.articleFeedback.startup.js
@@ -5,7 +5,7 @@
66 jQuery( function( $ ) {
77 if (
88 // Main namespace articles
9 - mw.config.get( 'wgNamespaceNumber' ) === 0
 9+ $.inArray( mw.config.get( 'wgNamespaceNumber' ), mw.config.get( 'wgArticleFeedbackNamespaces', [] ) ) > -1
1010 // Existing pages
1111 && mw.config.get( 'wgArticleId' ) > 0
1212 // View pages
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php
@@ -28,6 +28,10 @@
2929 // Extension is "disabled" if this field is an empty array (as per default configuration)
3030 $wgArticleFeedbackCategories = array();
3131
 32+// Only load the module / enable the tool in these namespaces
 33+// Default to $wgContentNamespaces (defaults to array( NS_MAIN ) ).
 34+$wgArticleFeedbackNamespaces = $wgContentNamespaces;
 35+
3236 // Articles not categorized as on of the values in $wgArticleFeedbackCategories can still have the
3337 // tool psudo-randomly activated by applying the following odds to a lottery based on $wgArticleId.
3438 // The value can be a floating point number (percentage) in range of 0 - 100. Tenths of a percent

Status & tagging log