Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php |
— | — | @@ -214,10 +214,12 @@ |
215 | 215 | public static function resourceLoaderGetConfigVars( &$vars ) { |
216 | 216 | global $wgArticleFeedbackCategories, |
217 | 217 | $wgArticleFeedbackLotteryOdds, |
218 | | - $wgArticleFeedbackTracking; |
| 218 | + $wgArticleFeedbackTracking, |
| 219 | + $wgArticleFeedbackOptions; |
219 | 220 | $vars['wgArticleFeedbackCategories'] = $wgArticleFeedbackCategories; |
220 | 221 | $vars['wgArticleFeedbackLotteryOdds'] = $wgArticleFeedbackLotteryOdds; |
221 | 222 | $vars['wgArticleFeedbackTracking'] = $wgArticleFeedbackTracking; |
| 223 | + $vars['wgArticleFeedbackOptions'] = $wgArticleFeedbackOptions; |
222 | 224 | return true; |
223 | 225 | } |
224 | 226 | } |
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js |
— | — | @@ -9,6 +9,11 @@ |
10 | 10 | 'ext.articleFeedback-tracking', mw.config.get( 'wgArticleFeedbackTracking' ) |
11 | 11 | ); |
12 | 12 | |
| 13 | +// Only show extra options to users in the options group |
| 14 | +var showOptions = 'show' === mw.user.bucket( |
| 15 | + 'ext.articleFeedback-options', mw.config.get( 'wgArticleFeedbackOptions' ) |
| 16 | +); |
| 17 | + |
13 | 18 | /** |
14 | 19 | * Prefixes a key for cookies or events, with extension and version information |
15 | 20 | * |
— | — | @@ -58,24 +63,26 @@ |
59 | 64 | <div style="clear:both;"></div>\ |
60 | 65 | <div class="articleFeedback-ratings"></div>\ |
61 | 66 | <div style="clear:both;"></div>\ |
62 | | - <div class="articleFeedback-expertise articleFeedback-visibleWith-form" >\ |
63 | | - <input type="checkbox" value="general" disabled="disabled" /><label class="articleFeedback-expertise-disabled"><html:msg key="form-panel-expertise" /></label>\ |
64 | | - <div class="articleFeedback-expertise-options">\ |
65 | | - <div><input type="checkbox" value="studies" /><label><html:msg key="form-panel-expertise-studies" /></label></div>\ |
66 | | - <div><input type="checkbox" value="profession" /><label><html:msg key="form-panel-expertise-profession" /></label></div>\ |
67 | | - <div><input type="checkbox" value="hobby" /><label><html:msg key="form-panel-expertise-hobby" /></label></div>\ |
68 | | - <div><input type="checkbox" value="other" /><label><html:msg key="form-panel-expertise-other" /></label></div>\ |
| 67 | + <div class="articleFeedback-options">\ |
| 68 | + <div class="articleFeedback-expertise articleFeedback-visibleWith-form" >\ |
| 69 | + <input type="checkbox" value="general" disabled="disabled" /><label class="articleFeedback-expertise-disabled"><html:msg key="form-panel-expertise" /></label>\ |
| 70 | + <div class="articleFeedback-expertise-options">\ |
| 71 | + <div><input type="checkbox" value="studies" /><label><html:msg key="form-panel-expertise-studies" /></label></div>\ |
| 72 | + <div><input type="checkbox" value="profession" /><label><html:msg key="form-panel-expertise-profession" /></label></div>\ |
| 73 | + <div><input type="checkbox" value="hobby" /><label><html:msg key="form-panel-expertise-hobby" /></label></div>\ |
| 74 | + <div><input type="checkbox" value="other" /><label><html:msg key="form-panel-expertise-other" /></label></div>\ |
| 75 | + </div>\ |
69 | 76 | </div>\ |
70 | | - </div>\ |
71 | | - <div style="clear:both;"></div>\ |
72 | | - <div class="articleFeedback-helpimprove articleFeedback-visibleWith-form" >\ |
73 | | - <input type="checkbox" value="on" disabled="disabled" /><label class="articleFeedback-helpimprove-disabled"><html:msg key="form-panel-helpimprove" /></label>\ |
74 | | - <div class="articleFeedback-helpimprove-options">\ |
75 | | - <div><input type="text" placeholder="" class="articleFeedback-helpimprove-email" /></div>\ |
76 | | - <div class="articleFeedback-helpimprove-note"></div>\ |
| 77 | + <div style="clear:both;"></div>\ |
| 78 | + <div class="articleFeedback-helpimprove articleFeedback-visibleWith-form" >\ |
| 79 | + <input type="checkbox" value="on" disabled="disabled" /><label class="articleFeedback-helpimprove-disabled"><html:msg key="form-panel-helpimprove" /></label>\ |
| 80 | + <div class="articleFeedback-helpimprove-options">\ |
| 81 | + <div><input type="text" placeholder="" class="articleFeedback-helpimprove-email" /></div>\ |
| 82 | + <div class="articleFeedback-helpimprove-note"></div>\ |
| 83 | + </div>\ |
77 | 84 | </div>\ |
| 85 | + <div style="clear:both;"></div>\ |
78 | 86 | </div>\ |
79 | | - <div style="clear:both;"></div>\ |
80 | 87 | <button class="articleFeedback-submit articleFeedback-visibleWith-form" type="submit" disabled="disabled"><html:msg key="form-panel-submit" /></button>\ |
81 | 88 | <div class="articleFeedback-success articleFeedback-visibleWith-form"><span><html:msg key="form-panel-success" /></span></div>\ |
82 | 89 | <div style="clear:both;"></div>\ |
— | — | @@ -764,6 +771,10 @@ |
765 | 772 | $rating.find( 'input:hidden' ).val( 0 ); |
766 | 773 | $.articleFeedback.fn.updateRating.call( $rating ); |
767 | 774 | } ); |
| 775 | + // Hide/show additional options according to group |
| 776 | + if ( !showOptions ) { |
| 777 | + context.$ui.find( '.articleFeedback-options' ).hide(); |
| 778 | + } |
768 | 779 | // Show initial form and report values |
769 | 780 | $.articleFeedback.fn.load.call( context ); |
770 | 781 | } |
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php |
— | — | @@ -52,6 +52,17 @@ |
53 | 53 | 'tracked' => true |
54 | 54 | ); |
55 | 55 | |
| 56 | +// Bucket settings for extra options in the UI |
| 57 | +$wgArticleFeedbackOptions = array( |
| 58 | + 'buckets' => array( |
| 59 | + 'show' => 100, |
| 60 | + 'hide' => 0, |
| 61 | + ), |
| 62 | + 'version' => 0, |
| 63 | + 'expires' => 30, |
| 64 | + 'tracked' => true |
| 65 | +); |
| 66 | + |
56 | 67 | // Would ordinarily call this articlefeedback but survey names are 16 chars max |
57 | 68 | $wgPrefSwitchSurveys['articlerating'] = array( |
58 | 69 | 'updatable' => false, |