Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -142,8 +142,9 @@ |
143 | 143 | 'articlefeedbackv5-timestamp-months' => '{{PLURAL:$1|$1 month|$1 months}}', |
144 | 144 | 'articlefeedbackv5-timestamp-weeks' => '{{PLURAL:$1|$1 week|$1 weeks}}', |
145 | 145 | 'articlefeedbackv5-timestamp-seconds' => 'less than 1 minute', |
146 | | - |
147 | | - |
| 146 | + 'articlefeedbackv5-mask-text' => 'Feedback hidden by administrative action. Click to view contents.', |
| 147 | + 'articlefeedbackv5-mask-postnumber' => 'Post #$1', |
| 148 | + |
148 | 149 | /* Special page flyover panels */ |
149 | 150 | /* Hide this post panel */ |
150 | 151 | 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
— | — | @@ -598,6 +599,9 @@ |
599 | 600 | * <code>$1</code> – URL of the confirmation link |
600 | 601 | * <code>$2</code> – URL to type in the confirmation code manually. |
601 | 602 | * <code>$3</code> – Confirmation code for the user to type in', |
| 603 | + 'articlefeedbackv5-mask-text' => 'Text to be displayed on the hidden post mask', |
| 604 | + 'articlefeedbackv5-mask-postnumber' => 'Template for post number, to be displayed on the hidden post mask', |
| 605 | + |
602 | 606 | ); |
603 | 607 | |
604 | 608 | /** Afrikaans (Afrikaans) |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css |
— | — | @@ -567,4 +567,21 @@ |
568 | 568 | width: 100%; |
569 | 569 | height: 100%; |
570 | 570 | background-color: #dae2eb; |
| 571 | + padding: 10px; |
571 | 572 | } |
| 573 | +.articleFeedbackv5-post-screen .articleFeedbackv5-mask-text-wrapper { |
| 574 | + position: absolute; |
| 575 | + width: 100%; |
| 576 | + color: #777; |
| 577 | + font-size: 1.4em; |
| 578 | + vertical-align: middle; |
| 579 | +} |
| 580 | +.articleFeedbackv5-post-screen .articleFeedbackv5-mask-text { |
| 581 | + display: inline-block; |
| 582 | + float: left; |
| 583 | +} |
| 584 | +.articleFeedbackv5-post-screen .articleFeedbackv5-mask-postid { |
| 585 | + display: inline-block; |
| 586 | + float: right; |
| 587 | + margin-right: 50px; |
| 588 | +} |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -98,6 +98,17 @@ |
99 | 99 | </div>\ |
100 | 100 | </form>'; |
101 | 101 | |
| 102 | + /** |
| 103 | + * Mask HMTL template |
| 104 | + */ |
| 105 | + $.articleFeedbackv5special.maskHtmlTemplate = '\ |
| 106 | + <div class="articleFeedbackv5-post-screen">\ |
| 107 | + <div class="articleFeedbackv5-mask-text-wrapper">\ |
| 108 | + <span class="articleFeedbackv5-mask-text"></span>\ |
| 109 | + <span class="articleFeedbackv5-mask-postid"></span>\ |
| 110 | + </div>\ |
| 111 | + </div>'; |
| 112 | + |
102 | 113 | // }}} |
103 | 114 | // {{{ Init methods |
104 | 115 | |
— | — | @@ -231,7 +242,8 @@ |
232 | 243 | $.articleFeedbackv5special.flagFeedback( |
233 | 244 | $( '#' + $.articleFeedbackv5special.currentPanelHostId ).closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), |
234 | 245 | $( e.target ).attr( 'action' ), |
235 | | - $( '#articlefeedbackv5-noteflyover-note' ).attr( 'value' ) ); |
| 246 | + $( '#articlefeedbackv5-noteflyover-note' ).attr( 'value' ), |
| 247 | + { } ); |
236 | 248 | |
237 | 249 | // hide tipsy |
238 | 250 | $( '#' + $.articleFeedbackv5special.currentPanelHostId ).tipsy( 'hide' ); |
— | — | @@ -488,12 +500,18 @@ |
489 | 501 | // }}} |
490 | 502 | // {{{ maskPost |
491 | 503 | $.articleFeedbackv5special.maskPost = function( $row ) { |
492 | | - var $screen = $( '<div></div>' ) |
| 504 | + var $screen = $( $.articleFeedbackv5special.maskHtmlTemplate ) |
493 | 505 | .addClass( 'articleFeedbackv5-post-screen' ) |
494 | 506 | .height( $row.innerHeight() ) |
495 | 507 | .click( function( e ) { |
496 | | - $( e.target ).remove(); |
497 | | - }); |
| 508 | + $( e.target ).closest( '.articleFeedbackv5-post-screen' ).remove(); |
| 509 | + } ); |
| 510 | + $screen.find( '.articleFeedbackv5-mask-text-wrapper') |
| 511 | + .css( 'top', $screen.innerHeight() / 2 - 12 ); |
| 512 | + $screen.find( '.articleFeedbackv5-mask-text' ) |
| 513 | + .text( mw.msg( 'articlefeedbackv5-mask-text' ) ); |
| 514 | + $screen.find( '.articleFeedbackv5-mask-postid' ) |
| 515 | + .text( mw.msg( 'articlefeedbackv5-mask-postnumber', $row.attr( 'rel' ) ) ); |
498 | 516 | $row.prepend( $screen ); |
499 | 517 | } |
500 | 518 | // }}} |
— | — | @@ -551,8 +569,9 @@ |
552 | 570 | * @param id int the feedback id |
553 | 571 | * @param action string action to execute |
554 | 572 | * @param note string note for action (default empty) |
| 573 | + * @param options object key => value pairs of additonal API action-specific parameters |
555 | 574 | */ |
556 | | - $.articleFeedbackv5special.flagFeedback = function ( id, action, note ) { |
| 575 | + $.articleFeedbackv5special.flagFeedback = function ( id, action, note, options ) { |
557 | 576 | // default parameters |
558 | 577 | note = typeof note !== undefined ? note : ''; |
559 | 578 | |
— | — | @@ -571,20 +590,24 @@ |
572 | 591 | // messing up the counts, and generally seems like a good idea. |
573 | 592 | $.articleFeedbackv5special.listControls.disabled = true; |
574 | 593 | } |
| 594 | + |
| 595 | + // Merge request data and options objects (flat) |
| 596 | + var requestData = { |
| 597 | + 'pageid' : $.articleFeedbackv5special.page, |
| 598 | + 'feedbackid': id, |
| 599 | + 'flagtype' : $.articleFeedbackv5special.actions[action].apiFlagType, |
| 600 | + 'direction' : $.articleFeedbackv5special.actions[action].apiFlagDir > 0 ? 'increase' : 'decrease', |
| 601 | + 'note' : note, |
| 602 | + 'format' : 'json', |
| 603 | + 'action' : 'articlefeedbackv5-flag-feedback' |
| 604 | + }; |
| 605 | + $.extend( requestData, options ); |
575 | 606 | |
576 | 607 | $.ajax( { |
577 | 608 | 'url' : $.articleFeedbackv5special.apiUrl, |
578 | 609 | 'type' : 'POST', |
579 | 610 | 'dataType': 'json', |
580 | | - 'data' : { |
581 | | - 'pageid' : $.articleFeedbackv5special.page, |
582 | | - 'feedbackid': id, |
583 | | - 'flagtype' : $.articleFeedbackv5special.actions[action].apiFlagType, |
584 | | - 'direction' : $.articleFeedbackv5special.actions[action].apiFlagDir > 0 ? 'increase' : 'decrease', |
585 | | - 'note' : note, |
586 | | - 'format' : 'json', |
587 | | - 'action' : 'articlefeedbackv5-flag-feedback' |
588 | | - }, |
| 611 | + 'data' : requestData, |
589 | 612 | 'success': function ( data ) { |
590 | 613 | var msg = 'articlefeedbackv5-error-flagging'; |
591 | 614 | if ( 'articlefeedbackv5-flag-feedback' in data ) { |
— | — | @@ -802,12 +825,7 @@ |
803 | 826 | if( $.articleFeedbackv5special.canBeFlagged( $link.closest( '.articleFeedbackv5-feedback' ) ) ) { |
804 | 827 | var id = $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
805 | 828 | var activity = $.articleFeedbackv5special.getActivity( id ); |
806 | | - $.articleFeedbackv5special.listControls.allowMultiple = true; |
807 | | - if( activity['unhelpful'] ) { |
808 | | - $.articleFeedbackv5special.flagFeedback( id, 'reverseunhelpful', '' ); |
809 | | - } |
810 | | - $.articleFeedbackv5special.flagFeedback( id, 'helpful', '' ); |
811 | | - $.articleFeedbackv5special.listControls.allowMultiple = false; |
| 829 | + $.articleFeedbackv5special.flagFeedback( id, 'helpful', '', activity['unhelpful'] ? { toggle: true } : { } ); |
812 | 830 | } |
813 | 831 | }, |
814 | 832 | 'apiFlagType': 'helpful', |
— | — | @@ -819,6 +837,10 @@ |
820 | 838 | .removeClass( 'articleFeedbackv5-helpful-link' ) |
821 | 839 | .addClass( 'articleFeedbackv5-reversehelpful-link' ) |
822 | 840 | .attr( 'id', 'articleFeedbackv5-reversehelpful-link-' + id ); |
| 841 | + if( data['toggle'] ) { |
| 842 | + $( '#articleFeedbackv5-unhelpful-link-' + id ).removeClass( 'helpful-active' ); |
| 843 | + setActivityFlag( id, 'unhelpful', false ) |
| 844 | + } |
823 | 845 | $.articleFeedbackv5special.setActivityFlag( id, 'helpful', true ); |
824 | 846 | } |
825 | 847 | }, |
— | — | @@ -831,7 +853,7 @@ |
832 | 854 | var $link = $( e.target ); |
833 | 855 | if( $.articleFeedbackv5special.canBeFlagged( $link.closest( '.articleFeedbackv5-feedback' ) ) ) { |
834 | 856 | $.articleFeedbackv5special.flagFeedback( |
835 | | - $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), 'reversehelpful', '' ); |
| 857 | + $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), 'reversehelpful', '', { } ); |
836 | 858 | } |
837 | 859 | }, |
838 | 860 | 'apiFlagType': 'helpful', |
— | — | @@ -856,12 +878,7 @@ |
857 | 879 | if( $.articleFeedbackv5special.canBeFlagged( $link.closest( '.articleFeedbackv5-feedback' ) ) ) { |
858 | 880 | var id = $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
859 | 881 | var activity = $.articleFeedbackv5special.getActivity( id ); |
860 | | - $.articleFeedbackv5special.listControls.allowMultiple = true; |
861 | | - if( activity['helpful'] ) { |
862 | | - $.articleFeedbackv5special.flagFeedback( id, 'reversehelpful', '' ); |
863 | | - } |
864 | | - $.articleFeedbackv5special.flagFeedback( id, 'unhelpful', '' ); |
865 | | - $.articleFeedbackv5special.listControls.allowMultiple = false; |
| 882 | + $.articleFeedbackv5special.flagFeedback( id, 'unhelpful', '', activity['helpful'] ? { toggle: true } : { } ); |
866 | 883 | } |
867 | 884 | }, |
868 | 885 | 'apiFlagType': 'unhelpful', |
— | — | @@ -873,6 +890,10 @@ |
874 | 891 | .removeClass( 'articleFeedbackv5-unhelpful-link') |
875 | 892 | .addClass( 'articleFeedbackv5-reverseunhelpful-link' ) |
876 | 893 | .attr( 'id', 'articleFeedbackv5-reverseunhelpful-link-' + id ); |
| 894 | + if( data['toggle'] ) { |
| 895 | + $( '#articleFeedbackv5-helpful-link-' + id ).removeClass( 'helpful-active' ); |
| 896 | + setActivityFlag( id, 'helpful', false ) |
| 897 | + } |
877 | 898 | $.articleFeedbackv5special.setActivityFlag( id, 'unhelpful', true ); |
878 | 899 | } |
879 | 900 | }, |
— | — | @@ -885,7 +906,7 @@ |
886 | 907 | var $link = $( e.target ); |
887 | 908 | if( $.articleFeedbackv5special.canBeFlagged( $link.closest( '.articleFeedbackv5-feedback' ) ) ) { |
888 | 909 | $.articleFeedbackv5special.flagFeedback( |
889 | | - $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), 'reverseunhelpful', '' ); |
| 910 | + $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), 'reverseunhelpful', '', { } ); |
890 | 911 | } |
891 | 912 | }, |
892 | 913 | 'apiFlagType': 'unhelpful', |
— | — | @@ -909,7 +930,7 @@ |
910 | 931 | var $link = $( e.target ); |
911 | 932 | if( $.articleFeedbackv5special.canBeFlagged( $link.closest( '.articleFeedbackv5-feedback' ) ) ) { |
912 | 933 | var id = $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
913 | | - $.articleFeedbackv5special.flagFeedback( $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), 'abuse', '' ); |
| 934 | + $.articleFeedbackv5special.flagFeedback( $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), 'abuse', '', { } ); |
914 | 935 | } |
915 | 936 | }, |
916 | 937 | 'apiFlagType': 'abuse', |
— | — | @@ -945,7 +966,7 @@ |
946 | 967 | var $link = $( e.target ); |
947 | 968 | if( $.articleFeedbackv5special.canBeFlagged( $link.closest( '.articleFeedbackv5-feedback' ) ) ) { |
948 | 969 | var id = $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
949 | | - $.articleFeedbackv5special.flagFeedback( $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), 'unabuse', '' ); |
| 970 | + $.articleFeedbackv5special.flagFeedback( $link.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ), 'unabuse', '', { } ); |
950 | 971 | } |
951 | 972 | }, |
952 | 973 | 'apiFlagType': 'abuse', |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -229,7 +229,10 @@ |
230 | 230 | 'articlefeedbackv5-noteflyover-declineoversight-placeholder', |
231 | 231 | 'articlefeedbackv5-noteflyover-declineoversight-submit', |
232 | 232 | 'articlefeedbackv5-noteflyover-declineoversight-help', |
233 | | - 'articlefeedbackv5-noteflyover-declineoversight-help-link' |
| 233 | + 'articlefeedbackv5-noteflyover-declineoversight-help-link', |
| 234 | + |
| 235 | + 'articlefeedbackv5-mask-text', |
| 236 | + 'articlefeedbackv5-mask-postnumber' |
234 | 237 | ), |
235 | 238 | 'dependencies' => array( |
236 | 239 | 'mediawiki.util', |