Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php |
— | — | @@ -695,6 +695,15 @@ |
696 | 696 | $allowRereview = false; // re-review button |
697 | 697 | } |
698 | 698 | |
| 699 | + # Disable form for unprivileged users |
| 700 | + $disabled = array(); |
| 701 | + if ( !$article->getTitle()->quickUserCan( 'review' ) || |
| 702 | + !$article->getTitle()->quickUserCan( 'edit' ) || |
| 703 | + !FlaggedRevs::userCanSetFlags( $flags ) ) |
| 704 | + { |
| 705 | + $disabled = array( 'disabled' => 'disabled' ); |
| 706 | + } |
| 707 | + |
699 | 708 | # Begin form... |
700 | 709 | $reviewTitle = SpecialPage::getTitleFor( 'RevisionReview' ); |
701 | 710 | $action = $reviewTitle->getLocalUrl( 'action=submit' ); |
— | — | @@ -714,30 +723,25 @@ |
715 | 724 | $form .= wfMsgExt( 'revreview-text', array( 'parse' ) ); |
716 | 725 | } |
717 | 726 | |
718 | | - # Disable form for unprivileged users |
719 | | - $uneditable = !$article->getTitle()->quickUserCan( 'edit' ); |
720 | | - $disabled = !FlaggedRevs::userCanSetFlags( $flags ) || $uneditable; |
721 | 727 | if ( $disabled ) { |
722 | 728 | $form .= Xml::openElement( 'div', array( 'class' => 'fr-rating-controls-disabled', |
723 | 729 | 'id' => 'fr-rating-controls-disabled' ) ); |
724 | | - $toggle = array( 'disabled' => "disabled" ); |
725 | 730 | } else { |
726 | 731 | $form .= Xml::openElement( 'div', array( 'class' => 'fr-rating-controls', |
727 | 732 | 'id' => 'fr-rating-controls' ) ); |
728 | | - $toggle = array(); |
729 | 733 | } |
730 | 734 | |
731 | 735 | # Add main checkboxes/selects |
732 | 736 | $form .= Xml::openElement( 'span', array( 'id' => 'mw-fr-ratingselects' ) ); |
733 | | - $form .= self::ratingInputs( $flags, $disabled, (bool)$frev ); |
| 737 | + $form .= self::ratingInputs( $flags, (bool)$disabled, (bool)$frev ); |
734 | 738 | $form .= Xml::closeElement( 'span' ); |
735 | 739 | # Add review notes input |
736 | 740 | if ( FlaggedRevs::allowComments() && $wgUser->isAllowed( 'validate' ) ) { |
737 | 741 | $form .= "<div id='mw-fr-notebox'>\n"; |
738 | 742 | $form .= "<p>" . wfMsgHtml( 'revreview-notes' ) . "</p>\n"; |
739 | | - $form .= Xml::openElement( 'textarea', |
740 | | - array( 'name' => 'wpNotes', 'id' => 'wpNotes', |
741 | | - 'class' => 'fr-notes-box', 'rows' => '2', 'cols' => '80' ) ) . |
| 743 | + $params = array( 'name' => 'wpNotes', 'id' => 'wpNotes', |
| 744 | + 'class' => 'fr-notes-box', 'rows' => '2', 'cols' => '80' ) + $disabled; |
| 745 | + $form .= Xml::openElement( 'textarea', $params ) . |
742 | 746 | htmlspecialchars( $reviewNotes ) . |
743 | 747 | Xml::closeElement( 'textarea' ) . "\n"; |
744 | 748 | $form .= "</div>\n"; |
— | — | @@ -780,7 +784,7 @@ |
781 | 785 | array( 'class' => 'fr-comment-box' ) ) . "   </span>"; |
782 | 786 | } |
783 | 787 | # Add the submit buttons |
784 | | - $form .= self::submitButtons( $frev, (bool)$toggle, $allowRereview ); |
| 788 | + $form .= self::submitButtons( $frev, (bool)$disabled, $allowRereview ); |
785 | 789 | # Show stability log if there is anything interesting... |
786 | 790 | if ( $article->isPageLocked() ) { |
787 | 791 | $form .= ' ' . FlaggedRevsXML::logToggle( 'revreview-log-toggle-show' ); |