r86591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86590‎ | r86591 | r86592 >
Date:01:06, 21 April 2011
Author:tparscal
Status:ok
Tags:
Comment:
Added $wgArticleFeedbackOptions, which controls the bucketing for showing or hiding expertise and email options in the user interface.
Modified paths:
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/ArticleFeedback.php (modified) (history)
  • /trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/ArticleFeedback.hooks.php
@@ -214,10 +214,12 @@
215215 public static function resourceLoaderGetConfigVars( &$vars ) {
216216 global $wgArticleFeedbackCategories,
217217 $wgArticleFeedbackLotteryOdds,
218 - $wgArticleFeedbackTracking;
 218+ $wgArticleFeedbackTracking,
 219+ $wgArticleFeedbackOptions;
219220 $vars['wgArticleFeedbackCategories'] = $wgArticleFeedbackCategories;
220221 $vars['wgArticleFeedbackLotteryOdds'] = $wgArticleFeedbackLotteryOdds;
221222 $vars['wgArticleFeedbackTracking'] = $wgArticleFeedbackTracking;
 223+ $vars['wgArticleFeedbackOptions'] = $wgArticleFeedbackOptions;
222224 return true;
223225 }
224226 }
Index: trunk/extensions/ArticleFeedback/modules/jquery.articleFeedback/jquery.articleFeedback.js
@@ -9,6 +9,11 @@
1010 'ext.articleFeedback-tracking', mw.config.get( 'wgArticleFeedbackTracking' )
1111 );
1212
 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+
1318 /**
1419 * Prefixes a key for cookies or events, with extension and version information
1520 *
@@ -58,24 +63,26 @@
5964 <div style="clear:both;"></div>\
6065 <div class="articleFeedback-ratings"></div>\
6166 <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>\
6976 </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>\
7784 </div>\
 85+ <div style="clear:both;"></div>\
7886 </div>\
79 - <div style="clear:both;"></div>\
8087 <button class="articleFeedback-submit articleFeedback-visibleWith-form" type="submit" disabled="disabled"><html:msg key="form-panel-submit" /></button>\
8188 <div class="articleFeedback-success articleFeedback-visibleWith-form"><span><html:msg key="form-panel-success" /></span></div>\
8289 <div style="clear:both;"></div>\
@@ -764,6 +771,10 @@
765772 $rating.find( 'input:hidden' ).val( 0 );
766773 $.articleFeedback.fn.updateRating.call( $rating );
767774 } );
 775+ // Hide/show additional options according to group
 776+ if ( !showOptions ) {
 777+ context.$ui.find( '.articleFeedback-options' ).hide();
 778+ }
768779 // Show initial form and report values
769780 $.articleFeedback.fn.load.call( context );
770781 }
Index: trunk/extensions/ArticleFeedback/ArticleFeedback.php
@@ -52,6 +52,17 @@
5353 'tracked' => true
5454 );
5555
 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+
5667 // Would ordinarily call this articlefeedback but survey names are 16 chars max
5768 $wgPrefSwitchSurveys['articlerating'] = array(
5869 'updatable' => false,

Status & tagging log