r104602 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104601‎ | r104602 | r104603 >
Date:21:59, 29 November 2011
Author:rsterbin
Status:deferred (Comments)
Tags:
Comment:
First pass with bucket 2:
- ArticleFeedbackv5.i18n.php:
- Renamed articlefeedbackv5-bucket1-tooltip-* to articlefeedbackv5-help-tooltip-*
- Added bucket2 messages
- modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css:
- Renamed "tags" to "articleFeedbackv5-tags"
- modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js:
- Renamed tooltip messages
- $.articleFeedbackv5.buckets[2]:
- Added properties tagInfo and commentDefault
- Added method selectTag()
- Updated buildForm() to dynamically build the tags
- Updated bindEvents() to set the click events for tags and the
blur/focus events for the comment area
- ArticleFeedbackv5.php:
- New config variables $wgArticleFeedbackv5Bucket2TagNames and $wgArticleFeedbackv5LearnToEdit
- ArticleFeedbackv5.hooks.php:
- Updated message tags passed to modules
- Updated config vars passed to modules
- Added dynamic message names for tags

Replaced bucket 3 markup with new from Sean (still needs to be templatized)

Got bucket 4 working with temporary markup
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -31,9 +31,6 @@
3232 /* ext.articleFeedbackv5 and jquery.articleFeedbackv5 */
3333 /* START Messages needing translation */
3434 'articlefeedbackv5-bucket1-title' => 'Help improve this article',
35 - 'articlefeedbackv5-bucket1-tooltip-title' => 'What is This?',
36 - 'articlefeedbackv5-bucket1-tooltip-info' => 'Wikipedia\'s new Article Feedback system is designed to help you help us. We need your input to make Wikipedia the best encyclopedia in the world.',
37 - 'articlefeedbackv5-bucket1-tooltip-linktext' => 'Learn more about Article Feedback',
3835 'articlefeedbackv5-bucket1-question-toggle' => 'Did you find what you were looking for?',
3936 'articlefeedbackv5-bucket1-toggle-found-yes' => 'Yes',
4037 'articlefeedbackv5-bucket1-toggle-found-no' => 'No',
@@ -45,10 +42,24 @@
4643 'articlefeedbackv5-bucket1-disclosure-shared-linktext' => 'feedback page',
4744 'articlefeedbackv5-bucket1-disclosure-privacy-policy-linktext' => 'terms',
4845 'articlefeedbackv5-bucket1-form-pending' => 'Your feedback has not been submitted yet',
 46+ 'articlefeedbackv5-bucket1-form-submit' => 'Post Your Feedback',
 47+ 'articlefeedbackv5-bucket2-title' => 'Help improve this article',
 48+ 'articlefeedbackv5-bucket2-suggestion-label' => 'Suggestion',
 49+ 'articlefeedbackv5-bucket2-question-label' => 'Question',
 50+ 'articlefeedbackv5-bucket2-problem-label' => 'Problem',
 51+ 'articlefeedbackv5-bucket2-praise-label' => 'Praise',
 52+ 'articlefeedbackv5-bucket2-form-submit' => 'Post Your Feedback',
 53+ 'articlefeedbackv5-bucket2-suggestion-comment-default' => 'Make a suggestion. How can this article be improved?',
 54+ 'articlefeedbackv5-bucket2-question-comment-default' => 'Ask a question about this article.',
 55+ 'articlefeedbackv5-bucket2-problem-comment-default' => 'Report a problem. How can this article be improved?',
 56+ 'articlefeedbackv5-bucket2-praise-comment-default' => 'What do you like most? Share your praise with the editors',
 57+ 'articlefeedbackv5-bucket2-form-submit' => 'Post Your Feedback',
4958 'articlefeedbackv5-bucket5-form-success' => 'Saved successfully',
50 - 'articlefeedbackv5-bucket1-form-submit' => 'Post Your Feedback',
5159 'articlefeedbackv5-shared-on-feedback' => 'Your comment will be shared on this $1.',
5260 'articlefeedbackv5-shared-on-feedback-linktext' => 'feedback page',
 61+ 'articlefeedbackv5-help-tooltip-title' => 'What is This?',
 62+ 'articlefeedbackv5-help-tooltip-info' => 'Wikipedia\'s new Article Feedback system is designed to help you help us. We need your input to make Wikipedia the best encyclopedia in the world.',
 63+ 'articlefeedbackv5-help-tooltip-linktext' => 'Learn more about Article Feedback',
5364 'articlefeedbackv5-transparency-terms' => 'By posting, you agree to transparency under these $1.',
5465 'articlefeedbackv5-transparency-terms-linktext' => 'terms',
5566 'articlefeedbackv5-transparency-terms-url' => 'Project:Privacy_policy', // TODO: Confirm correct link
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.css
@@ -552,7 +552,7 @@
553553 text-shadow: 1px 1px 1px #000;
554554 }
555555 /*** Option 2 ***/
556 -.tags ul li {
 556+.articleFeedbackv5-tags ul li {
557557 color: #666;
558558 list-style: none;
559559 float: left;
@@ -568,15 +568,15 @@
569569 -khtml-border-radius: 8px; /* for old Konqueror browsers */
570570 position: relative;
571571 }
572 -.tags ul li:first-child {
 572+.articleFeedbackv5-tags ul li:first-child {
573573 margin: 0;
574574 }
575 -.tags ul li:hover, .tags ul li.active {
 575+.articleFeedbackv5-tags ul li:hover, .articleFeedbackv5-tags ul li.active {
576576 background: #fff;
577577 border-color: #ccc;
578578 color: #000;
579579 }
580 -.tags ul li.active .tag-selector {
 580+.articleFeedbackv5-tags ul li.active .tag-selector {
581581 position: absolute;
582582 background: url(images/bg-tag-active.png) no-repeat center bottom;
583583 display: block;
@@ -586,44 +586,42 @@
587587 left: 50%;
588588 margin: 0 0 0 -5px;
589589 }
590 -.tags ul li input {
 590+.articleFeedbackv5-tags ul li input {
591591 display: none;
592592 }
593 -.tags ul li label {
 593+.articleFeedbackv5-tags ul li label {
594594 padding: 0 0 0 22px;
595595 cursor: pointer;
596596 }
597 -.tags ul li .articleFeedbackv5-bucket2-suggestion-label {
 597+.articleFeedbackv5-tags ul li .articleFeedbackv5-bucket2-suggestion-label {
598598 background: url(images/bg-tag-suggestion-off.png) no-repeat 0 center;
599 - padding: 0 0 0 15px;
600599 }
601 -.tags ul li .articleFeedbackv5-bucket2-question-label {
 600+.articleFeedbackv5-tags ul li .articleFeedbackv5-bucket2-question-label {
602601 background: url(images/bg-tag-question-off.png) no-repeat 0 center;
603 -
604602 }
605 -.tags ul li .articleFeedbackv5-bucket2-problem-label {
 603+.articleFeedbackv5-tags ul li .articleFeedbackv5-bucket2-problem-label {
606604 background: url(images/bg-tag-problem-off.png) no-repeat 0 center;
607605 }
608 -.tags ul li .articleFeedbackv5-bucket2-praise-label {
 606+.articleFeedbackv5-tags ul li .articleFeedbackv5-bucket2-praise-label {
609607 background: url(images/bg-tag-praise-off.png) no-repeat 0 center;
610608 }
611 -.tags ul li:hover .articleFeedbackv5-bucket2-suggestion-label,
612 -.tags ul li.active .articleFeedbackv5-bucket2-suggestion-label {
 609+.articleFeedbackv5-tags ul li:hover .articleFeedbackv5-bucket2-suggestion-label,
 610+.articleFeedbackv5-tags ul li.active .articleFeedbackv5-bucket2-suggestion-label {
613611 background: url(images/bg-tag-suggestion-on.png) no-repeat 0 center;
614612 }
615 -.tags ul li:hover .articleFeedbackv5-bucket2-question-label,
616 -.tags ul li.active .articleFeedbackv5-bucket2-question-label {
 613+.articleFeedbackv5-tags ul li:hover .articleFeedbackv5-bucket2-question-label,
 614+.articleFeedbackv5-tags ul li.active .articleFeedbackv5-bucket2-question-label {
617615 background: url(images/bg-tag-question-on.png) no-repeat 0 center;
618616 }
619 -.tags ul li:hover .articleFeedbackv5-bucket2-problem-label,
620 -.tags ul li.active .articleFeedbackv5-bucket2-problem-label {
 617+.articleFeedbackv5-tags ul li:hover .articleFeedbackv5-bucket2-problem-label,
 618+.articleFeedbackv5-tags ul li.active .articleFeedbackv5-bucket2-problem-label {
621619 background: url(images/bg-tag-problem-on.png) no-repeat 0 center;
622620 }
623 -.tags ul li:hover .articleFeedbackv5-bucket2-praise-label,
624 -.tags ul li.active .articleFeedbackv5-bucket2-praise-label {
 621+.articleFeedbackv5-tags ul li:hover .articleFeedbackv5-bucket2-praise-label,
 622+.articleFeedbackv5-tags ul li.active .articleFeedbackv5-bucket2-praise-label {
625623 background: url(images/bg-tag-praise-on.png) no-repeat 0 center;
626624 }
627 -/*** Option 2 ***/
 625+/*** Option 3 ***/
628626 .articleFeedbackv5-rating-new .articleFeedbackv5-rating-label {
629627 background: url(images/bg-rating-off.png) no-repeat;
630628 }
@@ -632,4 +630,4 @@
633631 }
634632 .articleFeedbackv5-rating .articleFeedbackv5-rating-prompt {
635633
636 -}
\ No newline at end of file
 634+}
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -150,9 +150,9 @@
151151 <div class="articleFeedbackv5-tooltip">\
152152 <div class="tooltip-top"></div>\
153153 <div class="tooltip-repeat">\
154 - <h3><html:msg key="bucket1-tooltip-title" /></h3>\
155 - <p><html:msg key="bucket1-tooltip-info" /></p>\
156 - <p><a target="_blank" href="http://www.mediawiki.org/wiki/Article_feedback/Version_5"><html:msg key="bucket1-tooltip-linktext" /></a></p>\
 154+ <h3><html:msg key="help-tooltip-title" /></h3>\
 155+ <p><html:msg key="help-tooltip-info" /></p>\
 156+ <p><a target="_blank" href="http://www.mediawiki.org/wiki/Article_feedback/Version_5"><html:msg key="help-tooltip-linktext" /></a></p>\
157157 </div>\
158158 <div class="tooltip-bottom"></div>\
159159 </div>\
@@ -188,7 +188,7 @@
189189 ';
190190 // Start up the block to return
191191 var $block = $( block_tpl );
192 -
 192+
193193 // Start out the tooltip hidden
194194 $block.find( '.articleFeedbackv5-tooltip' ).hide();
195195
@@ -265,7 +265,7 @@
266266
267267 // Clear out the question on focus
268268 $block.find( '.articleFeedbackv5-comment textarea' )
269 - .focus( function () {
 269+ .focus( function () {
270270 var def_msg = '';
271271 var val = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-bucket1-toggle input[checked]' ).val();
272272 if ( val == 'yes' ) {
@@ -277,7 +277,7 @@
278278 $( this ).val( '' );
279279 $(this).addClass( 'active' );
280280 }
281 -
 281+
282282 })
283283 .blur( function () {
284284 var def_msg = '';
@@ -290,10 +290,12 @@
291291 if ( $( this ).val() == '' ) {
292292 $( this ).val( def_msg );
293293 $(this).removeClass( 'active' );
 294+ } else {
 295+ $.articleFeedbackv5.currentBucket().enableSubmission( true );
294296 }
295297 } );
296 -
297298
 299+
298300 // Attach the submit
299301 $block.find( '.articleFeedbackv5-submit' )
300302 .click( function ( e ) {
@@ -410,6 +412,19 @@
411413 */
412414 '2': {
413415
 416+ // {{{ properties
 417+
 418+ /**
 419+ * The tags available for this bucket
 420+ */
 421+ tagInfo: mw.config.get( 'wgArticleFeedbackv5Bucket2TagNames' ),
 422+
 423+ /**
 424+ * The comment default text, by tag (filled by buildForm)
 425+ */
 426+ commentDefault: {},
 427+
 428+ // }}}
414429 // {{{ buildForm
415430
416431 /**
@@ -431,13 +446,13 @@
432447 <div class="tooltip-top"></div>\
433448 <div class="tooltip-repeat">\
434449 <h3>\
435 - <html:msg key="bucket2-tooltip-title" />\
 450+ <html:msg key="help-tooltip-title" />\
436451 </h3>\
437452 <p>\
438 - <html:msg key="bucket2-tooltip-info" />\
 453+ <html:msg key="help-tooltip-info" />\
439454 </p>\
440455 <p><a target="_blank" href="http://www.mediawiki.org/wiki/Article_feedback/Version_5">\
441 - <html:msg key="bucket2-tooltip-linktext" />\
 456+ <html:msg key="help-tooltip-linktext" />\
442457 </a></p>\
443458 </div>\
444459 <div class="tooltip-bottom"></div>\
@@ -445,17 +460,8 @@
446461 <div class="clear"></div>\
447462 </div>\
448463 <div>\
449 - <p class="instructions-left">\
450 - <html:msg key="bucket2-question-toggle" />\
451 - </p>\
452 - <div class="tags">\
453 - <ul>\
454 - <li class="active"><span class="tag-selector"></span><label class="articleFeedbackv5-bucket2-suggestion-label" for="articleFeedbackv5-bucket2-suggestion">Suggestion</label><input name="articleFeedbackv5-bucket2-tag" type="radio" id="articleFeedbackv5-bucket2-suggestion"><span class="clear"></span></li>\
455 - <li><span class="tag-selector"></span><label class="articleFeedbackv5-bucket2-question-label" for="articleFeedbackv5-bucket2-question">Question</label><input name="articleFeedbackv5-bucket2-tag" type="radio" id="articleFeedbackv5-bucket2-question"><span class="clear"></span></li>\
456 - <li><span class="tag-selector"></span><label class="articleFeedbackv5-bucket2-problem-label" for="articleFeedbackv5-bucket2-problem">Problem</label><input name="articleFeedbackv5-bucket2-tag" type="radio" id="articleFeedbackv5-bucket2-problem"><span class="clear"></span></li>\
457 - <li><span class="tag-selector"></span><label class="articleFeedbackv5-bucket2-praise-label" for="articleFeedbackv5-bucket2-praise">Praise</label><input name="articleFeedbackv5-bucket2-tag" type="radio" id="articleFeedbackv5-bucket2-praise"><span class="clear"></span></li>\
458 - <li class="clear"></li>\
459 - </ul>\
 464+ <div class="articleFeedbackv5-tags">\
 465+ <ul></ul>\
460466 <div class="clear"></div>\
461467 </div>\
462468 <div class="clear"></div>\
@@ -473,9 +479,42 @@
474480 <div class="clear"></div>\
475481 </form>\
476482 ';
 483+
 484+ var tag_tpl = '\
 485+ <li>\
 486+ <span class="tag-selector"></span>\
 487+ <label class="articleFeedbackv5-tag-label"></label>\
 488+ <input name="articleFeedbackv5-bucket2-tag" type="radio" class="articleFeedbackv5-tag-input" />\
 489+ <span class="clear"></span>\
 490+ </li>\
 491+ ';
 492+
477493 // Start up the block to return
478494 var $block = $( block_tpl );
479 -
 495+
 496+ // Add the tags from the options
 497+ $block.find( '.articleFeedbackv5-tags ul' ).each( function () {
 498+ var info = $.articleFeedbackv5.currentBucket().tagInfo;
 499+ for ( var i in info ) {
 500+ var key = info[i];
 501+ var comm_def_msg = 'articlefeedbackv5-bucket2-' + key + '-comment-default';
 502+ $.articleFeedbackv5.currentBucket().commentDefault[key] = mw.msg( comm_def_msg );
 503+ var label_msg = 'articlefeedbackv5-bucket2-' + key + '-label';
 504+ var tag_id = 'articleFeedbackv5-bucket2-' + key;
 505+ var $tag = $( tag_tpl );
 506+ $tag.attr( 'rel', key );
 507+ $tag.find( '.articleFeedbackv5-tag-input' )
 508+ .attr( 'id', tag_id )
 509+ .val( key );
 510+ $tag.find( '.articleFeedbackv5-tag-label' )
 511+ .addClass( 'articleFeedbackv5-bucket2-' + key + '-label' )
 512+ .attr( 'for', tag_id )
 513+ .text( mw.msg( label_msg ) );
 514+ $tag.appendTo( $( this ) );
 515+ }
 516+ $( '<li class="clear"></li>' ).appendTo( $( this ) );
 517+ } );
 518+
480519 // Start out the tooltip hidden
481520 $block.find( '.articleFeedbackv5-tooltip' ).hide();
482521
@@ -521,6 +560,38 @@
522561 */
523562 bindEvents: function ( $block ) {
524563
 564+ // Enable submission and switch out the comment default on toggle selection
 565+ $block.find( '.articleFeedbackv5-tags li' )
 566+ .click( function ( e ) {
 567+ var new_val = $( this ).attr( 'rel' );
 568+ $.articleFeedbackv5.currentBucket().selectTag( new_val );
 569+ $.articleFeedbackv5.currentBucket().enableSubmission( true );
 570+ } );
 571+
 572+ // Clear out the question on focus
 573+ $block.find( '.articleFeedbackv5-comment textarea' )
 574+ .focus( function () {
 575+ var key = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-tags input[checked]' ).val();
 576+ var def_msg = $.articleFeedbackv5.currentBucket().commentDefault[key];
 577+ console.log( key );
 578+ console.log( def_msg );
 579+ if ( $( this ).val() == def_msg ) {
 580+ $( this ).val( '' );
 581+ $(this).addClass( 'active' );
 582+ }
 583+
 584+ })
 585+ .blur( function () {
 586+ var key = $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-tags input[checked]' ).val();
 587+ var def_msg = $.articleFeedbackv5.currentBucket().commentDefault[key];
 588+ if ( $( this ).val() == '' ) {
 589+ $( this ).val( def_msg );
 590+ $(this).removeClass( 'active' );
 591+ } else {
 592+ $.articleFeedbackv5.currentBucket().enableSubmission( true );
 593+ }
 594+ } );
 595+
525596 // Attach the submit
526597 $block.find( '.articleFeedbackv5-submit' )
527598 .click( function ( e ) {
@@ -531,6 +602,48 @@
532603 },
533604
534605 // }}}
 606+ // {{{ selectTag
 607+
 608+ /**
 609+ * Selects a particular tag
 610+ *
 611+ * @param tag string the tag
 612+ */
 613+ selectTag: function ( tag ) {
 614+ var $h = $.articleFeedbackv5.$holder;
 615+ var $c = $h.find( '.articleFeedbackv5-comment textarea' );
 616+ $h.find( '.articleFeedbackv5-tags li' ).each( function () {
 617+ var key = $( this ).attr( 'rel' );
 618+ if ( key == tag ) {
 619+ // Set checked
 620+ $( this ).find( 'input' ).attr( 'checked', 'checked' );
 621+ // Set active
 622+ $( this ).addClass( 'active' );
 623+ // Change out comment text
 624+ var empty = false;
 625+ if ( $c.val() == '') {
 626+ empty = true;
 627+ } else {
 628+ for ( t in $.articleFeedbackv5.currentBucket().commentDefault ) {
 629+ if ( $c.val() == $.articleFeedbackv5.currentBucket().commentDefault[t] ) {
 630+ empty = true;
 631+ break;
 632+ }
 633+ }
 634+ }
 635+ if ( empty ) {
 636+ $c.val( $.articleFeedbackv5.currentBucket().commentDefault[key] );
 637+ }
 638+ } else {
 639+ // Clear checked
 640+ $( this ).find( 'input' ).removeAttr( 'checked' );
 641+ // Remove active
 642+ $( this ).removeClass( 'active' );
 643+ }
 644+ } );
 645+ },
 646+
 647+ // }}}
535648 // {{{ enableSubmission
536649
537650 /**
@@ -642,51 +755,63 @@
643756 // The overall template
644757 var block_tpl = '\
645758 <form>\
646 - <div class="title-wrap">\
647 - <h2 class="articleFeedbackv5-title"><html:msg key="bucket3-title" /></h2>\
648 - <a class="articleFeedbackv5-tooltip-trigger"></a>\
649 - <div class="articleFeedbackv5-tooltip">\
650 - <div class="tooltip-top"></div>\
651 - <div class="tooltip-repeat">\
652 - <h3><html:msg key="bucket3-tooltip-title" /></h3>\
653 - <p><html:msg key="bucket3-tooltip-info" /></p>\
654 - <p><a target="_blank" href="http://www.mediawiki.org/wiki/Article_feedback/Version_5"><html:msg key="bucket3-tooltip-linktext" /></a></p>\
 759+ <div class="title-wrap">\
 760+ <h2 class="articleFeedbackv5-title">\
 761+ <html:msg key="bucket3-title" />\
 762+ </h2>\
 763+ <a class="articleFeedbackv5-tooltip-trigger"></a>\
 764+ <div class="articleFeedbackv5-tooltip">\
 765+ <div class="tooltip-top"></div>\
 766+ <div class="tooltip-repeat">\
 767+ <h3>\
 768+ <html:msg key="help-tooltip-title" />\
 769+ </h3>\
 770+ <p>\
 771+ <html:msg key="help-tooltip-info" />\
 772+ </p>\
 773+ <p><a target="_blank" href="http://www.mediawiki.org/wiki/Article_feedback/Version_5">\
 774+ <html:msg key="help-tooltip-linktext" />\
 775+ </a></p>\
 776+ </div>\
 777+ <div class="tooltip-bottom"></div>\
655778 </div>\
656 - <div class="tooltip-bottom"></div>\
 779+ <div class="clear"></div>\
657780 </div>\
658 - <div class="clear"></div>\
659 - </div>\
660 - <div class="form-row articleFeedbackv5-bucket3-toggle">\
661 - <p class="instructions-left"><html:msg key="bucket3-question-toggle" /></p>\
662 - <div class="buttons">\
663 - <div class="form-item" rel="yes" id="articleFeedbackv5-bucket3-toggle-wrapper-yes">\
664 - <label for="articleFeedbackv5-bucket3-toggle-yes"><html:msg key="bucket3-toggle-found-yes-full" /></label>\
665 - <span class="articleFeedbackv5-button-placeholder"><html:msg key="bucket3-toggle-found-yes" value="yes" /></span>\
666 - <input type="radio" name="toggle" id="articleFeedbackv5-bucket3-toggle-yes" class="query-button" value="yes" />\
 781+ <div>\
 782+ <p class="instructions-left">\
 783+ <html:msg key="bucket3-question-toggle" />\
 784+ </p>\
 785+ <div class="articleFeedbackv5-rating articleFeedbackv5-rating-new" rel="trustworthy">\
 786+ <span class="articleFeedbackv5-rating-prompt">How would you rate this article?</span>\
 787+ <input type="hidden" name="r1" value="2">\
 788+ <div class="articleFeedback-rating-labels articleFeedback-visibleWith-form">\
 789+ <div class="articleFeedbackv5-rating-label articleFeedback-rating-label-full" rel="1"></div>\
 790+ <div class="articleFeedbackv5-rating-label articleFeedback-rating-label-full" rel="2"></div>\
 791+ <div class="articleFeedbackv5-rating-label" rel="3"></div>\
 792+ <div class="articleFeedbackv5-rating-label" rel="4"></div>\
 793+ <div class="articleFeedbackv5-rating-label" rel="5"></div>\
 794+ <div class="articleFeedback-rating-clear" original-title="Remove this rating" style="display: block; "></div>\
 795+ </div>\
 796+ <div style="clear:both;"></div>\
667797 </div>\
668 - <div class="form-item" rel="no" id="articleFeedbackv5-bucket3-toggle-wrapper-no">\
669 - <label for="articleFeedbackv5-bucket3-toggle-no"><html:msg key="bucket3-toggle-found-no-full" /></label>\
670 - <span class="articleFeedbackv5-button-placeholder"><html:msg key="bucket3-toggle-found-no" /></span>\
671 - <input type="radio" name="toggle" id="articleFeedbackv5-bucket3-toggle-no" class="query-button last" value="no" />\
672 - </div>\
673798 <div class="clear"></div>\
674799 </div>\
 800+ <div class="articleFeedbackv5-comment">\
 801+ <textarea id="find-feedback" class="feedback-text" name="comment"></textarea>\
 802+ </div>\
 803+ <div class="articleFeedbackv5-disclosure">\
 804+ <p class="articlefeedbackv5-shared-on-feedback"></p>\
 805+ <p class="articlefeedbackv5-transparency-terms"></p>\
 806+ </div>\
 807+ <button class="articleFeedbackv5-submit" type="submit" disabled="disabled">\
 808+ <html:msg key="bucket3-form-submit" />\
 809+ </button>\
675810 <div class="clear"></div>\
676 - </div>\
677 - <div class="articleFeedbackv5-comment">\
678 - <textarea id="find-feedback" class="feedback-text" name="comment"></textarea>\
679 - </div>\
680 - <div class="articleFeedbackv5-disclosure">\
681 - <p class="articlefeedbackv5-shared-on-feedback"></p>\
682 - <p class="articlefeedbackv5-transparency-terms"></p>\
683 - </div>\
684 - <button class="articleFeedbackv5-submit" type="submit" disabled="disabled"><html:msg key="bucket3-form-submit" /></button>\
685 - <div class="clear"></div>\
686811 </form>\
687812 ';
688813 // Start up the block to return
689814 var $block = $( block_tpl );
690 -
 815+
691816 // Start out the tooltip hidden
692817 $block.find( '.articleFeedbackv5-tooltip' ).hide();
693818
@@ -859,69 +984,48 @@
860985 <div class="articleFeedbackv5-tooltip">\
861986 <div class="tooltip-top"></div>\
862987 <div class="tooltip-repeat">\
863 - <h4><html:msg key="bucket4-tooltip-title" /></h4>\
864 - <p><html:msg key="bucket4-tooltip-info" /></p>\
865 - <p><a target="_blank" href="http://www.mediawiki.org/wiki/Article_feedback/Version_5"><html:msg key="bucket4-tooltip-linktext" /></a></p>\
 988+ <h4><html:msg key="help-tooltip-title" /></h4>\
 989+ <p><html:msg key="help-tooltip-info" /></p>\
 990+ <p><a target="_blank" href="http://www.mediawiki.org/wiki/Article_feedback/Version_5"><html:msg key="help-tooltip-linktext" /></a></p>\
866991 </div>\
867992 <div class="tooltip-bottom"></div>\
868993 </div>\
869994 <div class="clear"></div>\
870995 </div>\
871996 <div class="form-row articleFeedbackv5-bucket4-toggle">\
872 - <p class="instructions-left"><html:msg key="bucket4-question-toggle" /></p>\
873 - <div class="buttons">\
874 - <div class="form-item" rel="yes" id="articleFeedbackv5-bucket4-toggle-wrapper-yes">\
875 - <label for="articleFeedbackv5-bucket4-toggle-yes"><html:msg key="bucket4-toggle-found-yes-full" /></label>\
876 - <span class="articleFeedbackv5-button-placeholder"><html:msg key="bucket4-toggle-found-yes" value="yes" /></span>\
877 - <input type="radio" name="toggle" id="articleFeedbackv5-bucket4-toggle-yes" class="query-button" value="yes" />\
878 - </div>\
879 - <div class="form-item" rel="no" id="articleFeedbackv5-bucket4-toggle-wrapper-no">\
880 - <label for="articleFeedbackv5-bucket4-toggle-no"><html:msg key="bucket4-toggle-found-no-full" /></label>\
881 - <span class="articleFeedbackv5-button-placeholder"><html:msg key="bucket4-toggle-found-no" /></span>\
882 - <input type="radio" name="toggle" id="articleFeedbackv5-bucket4-toggle-no" class="query-button last" value="no" />\
883 - </div>\
884 - <div class="clear"></div>\
885 - </div>\
886 - <div class="clear"></div>\
 997+ <h3><html:msg key="bucket4-subhead"></h3>\
 998+ <p class="instructions-left"><html:msg key="bucket4-teaser-line1" /><br />\
 999+ <html:msg key="bucket4-teaser-line1" /></p>\
8871000 </div>\
888 - <div class="articleFeedbackv5-comment">\
889 - <textarea id="find-feedback" class="feedback-text" name="comment"></textarea>\
890 - </div>\
8911001 <div class="articleFeedbackv5-disclosure">\
892 - <p class="articlefeedbackv5-shared-on-feedback"></p>\
893 - <p class="articlefeedbackv5-transparency-terms"></p>\
 1002+ <p><a class="articleFeedbackv5-learn-to-edit" target="_blank"><html:msg key="bucket4-learn-to-edit"></a></p>\
8941003 </div>\
895 - <button class="articleFeedbackv5-submit" type="submit" disabled="disabled"><html:msg key="bucket4-form-submit" /></button>\
 1004+ <a class="articleFeedbackv5-submit"><html:msg key="bucket4-form-submit" /></a>\
8961005 <div class="clear"></div>\
8971006 </form>\
8981007 ';
8991008 // Start up the block to return
9001009 var $block = $( block_tpl );
901 -
 1010+
9021011 // Start out the tooltip hidden
9031012 $block.find( '.articleFeedbackv5-tooltip' ).hide();
9041013
905 - // Fill in the disclosure text
906 - $block.find( '.articlefeedbackv5-shared-on-feedback' )
907 - .html( $.articleFeedbackv5.buildLink(
908 - 'articlefeedbackv5-shared-on-feedback',
909 - {
910 - href: mw.config.get( 'wgScript' ) + '?' + $.param( {
911 - title: mw.config.get( 'wgPageName' ),
912 - action: 'feedback'
913 - } ),
914 - text: 'articlefeedbackv5-shared-on-feedback-linktext',
915 - target: '_blank'
916 - } ) );
917 - $block.find( '.articlefeedbackv5-transparency-terms' )
918 - .html( $.articleFeedbackv5.buildLink(
919 - 'articlefeedbackv5-transparency-terms',
920 - {
921 - href: mw.util.wikiGetlink( mw.config.get( 'wgArticleFeedbackv5TermsPage' ) ),
922 - text: 'articlefeedbackv5-transparency-terms-linktext',
923 - target: '_blank'
924 - } ) );
 1014+ // Fill in the learn to edit link
 1015+ $block.find( '.articleFeedbackv5-learn-to-edit' )
 1016+ .attr( 'href', mw.config.get( 'wgArticleFeedbackv5LearnToEdit' ) );
9251017
 1018+ // Fill in the edit link
 1019+ $block.find( '.articleFeedbackv5-submit' )
 1020+ .attr( 'href',
 1021+ mw.config.get( 'wgScript' ) + '?' + $.param( {
 1022+ 'title': mw.config.get( 'wgPageName' ),
 1023+ 'action': 'edit',
 1024+ 'articleFeedbackv5_feedback_id': $.articleFeedbackv5.feedbackId,
 1025+ 'articleFeedbackv5_cta_id': $.articleFeedbackv5.ctaId,
 1026+ 'articleFeedbackv5_bucket_id': $.articleFeedbackv5.bucketId
 1027+ } )
 1028+ );
 1029+
9261030 // Localize the block
9271031 $block.localize( { 'prefix': 'articlefeedbackv5-' } );
9281032
@@ -931,117 +1035,10 @@
9321036 .addClass( 'ui-button-blue' )
9331037
9341038 return $block;
935 - },
 1039+ }
9361040
9371041 // }}}
938 - // {{{ bindEvents
9391042
940 - /**
941 - * Binds any events
942 - *
943 - * @param $block element the form block
944 - */
945 - bindEvents: function ( $block ) {
946 -
947 - // Attach the submit
948 - $block.find( '.articleFeedbackv5-submit' )
949 - .click( function ( e ) {
950 - e.preventDefault();
951 - $.articleFeedbackv5.submitForm();
952 - } );
953 -
954 - },
955 -
956 - // }}}
957 - // {{{ enableSubmission
958 -
959 - /**
960 - * Enables or disables submission of the form
961 - *
962 - * @param state bool true to enable; false to disable
963 - */
964 - enableSubmission: function ( state ) {
965 - var $h = $.articleFeedbackv5.$holder;
966 - if ( state ) {
967 - if ($.articleFeedbackv5.successTimeout) {
968 - clearTimeout( $.articleFeedbackv5.successTimeout );
969 - }
970 - $h.find( '.articleFeedbackv5-submit' ).button( { 'disabled': false } );
971 - $h.find( '.articleFeedbackv5-success span' ).hide();
972 - $h.find( '.articleFeedbackv5-pending span' ).fadeIn( 'fast' );
973 - } else {
974 - $h.find( '.articleFeedbackv5-submit' ).button( { 'disabled': true } );
975 - $h.find( '.articleFeedbackv5-pending span' ).hide();
976 - }
977 - },
978 -
979 - // }}}
980 - // {{{ getFormData
981 -
982 - /**
983 - * Pulls down form data
984 - *
985 - * @return object the form data
986 - */
987 - getFormData: function () {
988 - var data = {};
989 - return data;
990 - },
991 -
992 - // }}}
993 - // {{{ localValidation
994 -
995 - /**
996 - * Performs any local validation
997 - *
998 - * @param object formdata the form data
999 - * @return mixed if ok, false; otherwise, an object as { 'field name' : 'message' }
1000 - */
1001 - localValidation: function ( formdata ) {
1002 - var error = {};
1003 - var ok = true;
1004 - if ( $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-bucket4-toggle input[checked]' ).length < 1 ) {
1005 - error.toggle = 'Please select an option';
1006 - ok = false;
1007 - }
1008 - return ok ? false : error;
1009 - },
1010 -
1011 - // }}}
1012 - // {{{ markFormError
1013 -
1014 - /**
1015 - * Marks any errors on the form
1016 - *
1017 - * @param object error errors, indexed by field name
1018 - */
1019 - markFormError: function ( error ) {
1020 - if ( '_api' in error ) {
1021 - $.articleFeedbackv5.markShowstopperError( error._api.info );
1022 - } else {
1023 - alert( 'Validation error' );
1024 - mw.log( 'Validation error' );
1025 - }
1026 - console.log( error );
1027 - },
1028 -
1029 - // }}}
1030 - // {{{ setSuccessState
1031 -
1032 - /**
1033 - * Sets the success state
1034 - */
1035 - setSuccessState: function () {
1036 - var $h = $.articleFeedbackv5.$holder;
1037 - $h.find( '.articleFeedbackv5-success span' ).fadeIn( 'fast' );
1038 - $.articleFeedbackv5.successTimeout = setTimeout( function () {
1039 - $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-success span' )
1040 - .fadeOut( 'slow' );
1041 - }, 5000 );
1042 - },
1043 -
1044 - // }}}
1045 -
10461043 },
10471044
10481045 // }}}
@@ -1902,7 +1899,7 @@
19031900 // 1. Requested in query string (debug only)
19041901 // 2. From cookie (see below)
19051902 // 3. Core bucketing
1906 - var knownBuckets = { 0: true, 1: true, 2: true, 3: true, 5: true };
 1903+ var knownBuckets = { '0': true, '1': true, '2': true, '3': true, '4': true, '5': true };
19071904 var requested = mw.util.getParamValue( 'bucket' );
19081905 var cookieval = $.cookie( $.articleFeedbackv5.prefix( 'display-bucket' ) );
19091906 if ( $.articleFeedbackv5.debug && requested in knownBuckets ) {
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php
@@ -50,6 +50,9 @@
5151 // The rating categories for bucket 5 -- these MUST match the field names in the database.
5252 $wgArticleFeedbackv5Bucket5RatingCategories = array( 'trustworthy', 'objective', 'complete', 'wellwritten' );
5353
 54+// The tag names for bucket 5.
 55+$wgArticleFeedbackv5Bucket2TagNames = array( 'suggestion', 'question', 'problem', 'praise' );
 56+
5457 // Bucket settings for display options
5558 $wgArticleFeedbackv5DisplayBuckets = array(
5659 // Users can fall into one of several display buckets (these are defined in
@@ -124,6 +127,13 @@
125128 */
126129 $wgArticleFeedbackv5DashboardTalkPage = "http://www.mediawiki.org/wiki/Talk:Article_feedback";
127130
 131+/**
 132+ * The full URL for the "Learn to Edit" link
 133+ *
 134+ * @var string
 135+ */
 136+$wgArticleFeedbackv5LearnToEdit = "http://en.wikipedia.org/wiki/Wikipedia:Tutorial";
 137+
128138 # TODO: What's up with the surveys, then?
129139 // Would ordinarily call this articlefeedback but survey names are 16 chars max
130140 $wgPrefSwitchSurveys['articlerating'] = array(
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php
@@ -61,9 +61,6 @@
6262 'styles' => 'jquery.articleFeedbackv5/jquery.articleFeedbackv5.css',
6363 'messages' => array(
6464 'articlefeedbackv5-bucket1-title',
65 - 'articlefeedbackv5-bucket1-tooltip-title',
66 - 'articlefeedbackv5-bucket1-tooltip-info',
67 - 'articlefeedbackv5-bucket1-tooltip-linktext',
6865 'articlefeedbackv5-bucket1-question-toggle',
6966 'articlefeedbackv5-bucket1-toggle-found-yes',
7067 'articlefeedbackv5-bucket1-toggle-found-yes-full',
@@ -74,6 +71,9 @@
7572 'articlefeedbackv5-bucket1-form-pending',
7673 'articlefeedbackv5-bucket1-form-success',
7774 'articlefeedbackv5-bucket1-form-submit',
 75+ 'articlefeedbackv5-bucket2-title',
 76+ 'articlefeedbackv5-bucket2-form-submit',
 77+
7878 'articlefeedbackv5-bucket5-form-switch-label',
7979 'articlefeedbackv5-bucket5-form-panel-title',
8080 'articlefeedbackv5-bucket5-form-panel-explanation',
@@ -100,6 +100,9 @@
101101 'articlefeedbackv5-error',
102102 'articlefeedbackv5-shared-on-feedback',
103103 'articlefeedbackv5-shared-on-feedback-linktext',
 104+ 'articlefeedbackv5-help-tooltip-title',
 105+ 'articlefeedbackv5-help-tooltip-info',
 106+ 'articlefeedbackv5-help-tooltip-linktext',
104107 'articlefeedbackv5-transparency-terms',
105108 'articlefeedbackv5-transparency-terms-linktext',
106109 'parentheses',
@@ -179,13 +182,20 @@
180183 */
181184 public static function resourceLoaderRegisterModules( &$resourceLoader ) {
182185 global $wgExtensionAssetsPath,
183 - $wgArticleFeedbackv5Bucket5RatingCategories;
 186+ $wgArticleFeedbackv5Bucket5RatingCategories,
 187+ $wgArticleFeedbackv5Bucket2TagNames;
184188
185189 $localpath = dirname( __FILE__ ) . '/modules';
186190 $remotepath = "$wgExtensionAssetsPath/ArticleFeedbackv5/modules";
187191
188192 foreach ( self::$modules as $name => $resources ) {
189193 if ( $name == 'jquery.articleFeedbackv5' ) {
 194+ // Bucket 2: labels and comment defaults
 195+ $prefix = 'articlefeedbackv5-bucket2-';
 196+ foreach ( $wgArticleFeedbackv5Bucket2TagNames as $tag ) {
 197+ $resources['messages'][] = $prefix . $tag . '-label';
 198+ $resources['messages'][] = $prefix . $tag . '-comment-default';
 199+ }
190200 // Bucket 5: labels and tooltips
191201 $prefix = 'articlefeedbackv5-bucket5-';
192202 foreach ( $wgArticleFeedbackv5Bucket5RatingCategories as $field ) {
@@ -215,21 +225,25 @@
216226 $wgArticleFeedbackv5BlacklistCategories,
217227 $wgArticleFeedbackv5LotteryOdds,
218228 $wgArticleFeedbackv5Debug,
 229+ $wgArticleFeedbackv5Bucket2TagNames,
219230 $wgArticleFeedbackv5Bucket5RatingCategories,
220231 $wgArticleFeedbackv5DisplayBuckets,
221232 $wgArticleFeedbackv5Tracking,
222233 $wgArticleFeedbackv5Options,
223 - $wgArticleFeedbackv5Namespaces;
 234+ $wgArticleFeedbackv5Namespaces,
 235+ $wgArticleFeedbackv5LearnToEdit;
224236 $vars['wgArticleFeedbackv5SMaxage'] = $wgArticleFeedbackv5SMaxage;
225237 $vars['wgArticleFeedbackv5Categories'] = $wgArticleFeedbackv5Categories;
226238 $vars['wgArticleFeedbackv5BlacklistCategories'] = $wgArticleFeedbackv5BlacklistCategories;
227239 $vars['wgArticleFeedbackv5LotteryOdds'] = $wgArticleFeedbackv5LotteryOdds;
228240 $vars['wgArticleFeedbackv5Debug'] = $wgArticleFeedbackv5Debug;
 241+ $vars['wgArticleFeedbackv5Bucket2TagNames'] = $wgArticleFeedbackv5Bucket2TagNames;
229242 $vars['wgArticleFeedbackv5Bucket5RatingCategories'] = $wgArticleFeedbackv5Bucket5RatingCategories;
230243 $vars['wgArticleFeedbackv5DisplayBuckets'] = $wgArticleFeedbackv5DisplayBuckets;
231244 $vars['wgArticleFeedbackv5Tracking'] = $wgArticleFeedbackv5Tracking;
232245 $vars['wgArticleFeedbackv5Options'] = $wgArticleFeedbackv5Options;
233246 $vars['wgArticleFeedbackv5Namespaces'] = $wgArticleFeedbackv5Namespaces;
 247+ $vars['wgArticleFeedbackv5LearnToEdit'] = $wgArticleFeedbackv5LearnToEdit;
234248 $vars['wgArticleFeedbackv5WhatsThisPage'] = wfMsgForContent( 'articlefeedbackv5-bucket5-form-panel-explanation-link' );
235249 $vars['wgArticleFeedbackv5TermsPage'] = wfMsgForContent( 'articlefeedbackv5-transparency-terms-url' );
236250 return true;

Follow-up revisions

RevisionCommit summaryAuthorDate
r104988Updated Option 3 and tooltip text, and added documentation lines for new mess...rsterbin18:50, 2 December 2011

Comments

#Comment by Johnduhart (talk | contribs)   14:04, 2 December 2011

Please add message documentation for the newly added messages. Thanks.

#Comment by Rsterbin (talk | contribs)   18:51, 2 December 2011

Done in r104988

Status & tagging log