UI for adding and removing change tags on revisions and log entries
[lhc/web/wiklou.git] / includes / actions / HistoryAction.php
index 85ff994..6693178 100644 (file)
@@ -484,6 +484,7 @@ class HistoryPager extends ReverseChronologicalPager {
                        'id' => 'mw-history-compare' ) ) . "\n";
                $s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n";
                $s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
+               $s .= Html::hidden( 'type', 'revision' ) . "\n";
 
                // Button container stored in $this->buttons for re-use in getEndBody()
                $this->buttons = '<div>';
@@ -494,8 +495,17 @@ class HistoryPager extends ReverseChronologicalPager {
                        $attrs
                ) . "\n";
 
-               if ( $this->getUser()->isAllowed( 'deleterevision' ) ) {
-                       $this->buttons .= $this->getRevisionButton( 'revisiondelete', 'showhideselectedversions' );
+               $user = $this->getUser();
+               $actionButtons = '';
+               if ( $user->isAllowed( 'deleterevision' ) ) {
+                       $actionButtons .= $this->getRevisionButton( 'revisiondelete', 'showhideselectedversions' );
+               }
+               if ( $user->isAllowed( 'changetags' ) ) {
+                       $actionButtons .= $this->getRevisionButton( 'editchangetags', 'history-edit-tags' );
+               }
+               if ( $actionButtons ) {
+                       $this->buttons .= Xml::tags( 'div', array( 'class' =>
+                               'mw-history-revisionactions' ), $actionButtons );
                }
                $this->buttons .= '</div>';
 
@@ -616,11 +626,15 @@ class HistoryPager extends ReverseChronologicalPager {
 
                $del = '';
                $user = $this->getUser();
-               // Show checkboxes for each revision
-               if ( $user->isAllowed( 'deleterevision' ) ) {
+               $canRevDelete = $user->isAllowed( 'deleterevision' );
+               $canModifyTags = $user->isAllowed( 'changetags' );
+               // Show checkboxes for each revision, to allow for revision deletion and
+               // change tags
+               if ( $canRevDelete || $canModifyTags ) {
                        $this->preventClickjacking();
-                       // If revision was hidden from sysops, disable the checkbox
-                       if ( !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
+                       // If revision was hidden from sysops and we don't need the checkbox
+                       // for anything else, disable it
+                       if ( !$canModifyTags && !$rev->userCan( Revision::DELETED_RESTRICTED, $user ) ) {
                                $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
                        // Otherwise, enable the checkbox...
                        } else {