Merge "Add a 'revdelete-selected-file' message on Special:RevisionDelete"
[lhc/web/wiklou.git] / includes / specials / SpecialRevisiondelete.php
index 3599dc6..ff287a1 100644 (file)
@@ -63,29 +63,39 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         */
        static $UILabels = array(
                'revision' => array(
-                       'check-label'   => 'revdelete-hide-text',
-                       'success'               => 'revdelete-success',
-                       'failure'               => 'revdelete-failure',
+                       'check-label' => 'revdelete-hide-text',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-text',
+                       'selected'=> 'revdelete-selected-text',
                ),
                'archive' => array(
-                       'check-label'   => 'revdelete-hide-text',
-                       'success'               => 'revdelete-success',
-                       'failure'               => 'revdelete-failure',
+                       'check-label' => 'revdelete-hide-text',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-text',
+                       'selected'=> 'revdelete-selected-text',
                ),
                'oldimage' => array(
-                       'check-label'   => 'revdelete-hide-image',
-                       'success'               => 'revdelete-success',
-                       'failure'               => 'revdelete-failure',
+                       'check-label' => 'revdelete-hide-image',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-file',
+                       'selected'=> 'revdelete-selected-file',
                ),
                'filearchive' => array(
-                       'check-label'   => 'revdelete-hide-image',
-                       'success'               => 'revdelete-success',
-                       'failure'               => 'revdelete-failure',
+                       'check-label' => 'revdelete-hide-image',
+                       'success' => 'revdelete-success',
+                       'failure' => 'revdelete-failure',
+                       'text' => 'revdelete-text-file',
+                       'selected'=> 'revdelete-selected-file',
                ),
                'logging' => array(
-                       'check-label'   => 'revdelete-hide-name',
-                       'success'               => 'logdelete-success',
-                       'failure'               => 'logdelete-failure',
+                       'check-label' => 'revdelete-hide-name',
+                       'success' => 'logdelete-success',
+                       'failure' => 'logdelete-failure',
+                       'text' => 'logdelete-text',
+                       'selected' => 'logdelete-selected',
                ),
        );
 
@@ -132,6 +142,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $this->token = $request->getVal( 'token' );
                if ( $this->archiveName && $this->targetObj ) {
                        $this->tryShowFile( $this->archiveName );
+
                        return;
                }
 
@@ -151,6 +162,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                # We need a target page!
                if ( is_null( $this->targetObj ) ) {
                        $output->addWikiMsg( 'undelete-header' );
+
                        return;
                }
                # Give a link to the logs/hist for this page
@@ -252,6 +264,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $conds['log_action'] = $this->getList()->getLogAction();
                $conds['ls_field'] = RevisionDeleter::getRelationType( $this->typeName );
                $conds['ls_value'] = $this->ids;
+
                return $conds;
        }
 
@@ -266,6 +279,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                // Check if user is allowed to see this file
                if ( !$oimage->exists() ) {
                        $this->getOutput()->addWikiMsg( 'revdelete-no-file' );
+
                        return;
                }
                $user = $this->getUser();
@@ -295,6 +309,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                Xml::submitButton( $this->msg( 'revdelete-show-file-submit' )->text() ) .
                                '</form>'
                        );
+
                        return;
                }
                $this->getOutput()->disable();
@@ -320,6 +335,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                $this->typeName, $this->getContext(), $this->targetObj, $this->ids
                        );
                }
+
                return $this->list;
        }
 
@@ -328,14 +344,10 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         * which will allow the user to choose new visibility settings.
         */
        protected function showForm() {
-               $UserAllowed = true;
+               $userAllowed = true;
 
-               if ( $this->typeName == 'logging' ) {
-                       $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLanguage()->formatNum( count( $this->ids ) ) );
-               } else {
-                       $this->getOutput()->addWikiMsg( 'revdelete-selected',
-                               $this->targetObj->getPrefixedText(), count( $this->ids ) );
-               }
+               $this->getOutput()->wrapWikiMsg( "<strong>$1</strong>", array( $this->typeLabels['selected'],
+                       $this->getLanguage()->formatNum( count( $this->ids ) ), $this->targetObj->getPrefixedText() ) );
 
                $this->getOutput()->addHTML( "<ul>" );
 
@@ -348,7 +360,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                if ( !$this->submitClicked ) {
                                        throw new PermissionsError( 'suppressrevision' );
                                }
-                               $UserAllowed = false;
+                               $userAllowed = false;
                        }
                        $numRevisions++;
                        $this->getOutput()->addHTML( $item->getHTML() );
@@ -363,7 +375,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $this->addUsageText();
 
                // Normal sysops can always see what they did, but can't always change it
-               if ( !$UserAllowed ) {
+               if ( !$userAllowed ) {
                        return;
                }
 
@@ -431,7 +443,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
         * @todo FIXME: Wikimedia-specific policy text
         */
        protected function addUsageText() {
-               $this->getOutput()->addWikiMsg( 'revdelete-text' );
+               $this->getOutput()->wrapWikiMsg( "<strong>$1</strong>\n$2", $this->typeLabels['text'], 'revdelete-text-others' );
                if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
                        $this->getOutput()->addWikiMsg( 'revdelete-suppress-text' );
                }
@@ -462,8 +474,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                                $line = Xml::tags( 'td', array( 'class' => 'mw-input' ), $innerHTML );
                                $html .= "<tr>$line</tr>\n";
                        }
-               // Otherwise, use tri-state radios
                } else {
+                       // Otherwise, use tri-state radios
                        $html .= '<tr>';
                        $html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-same' )->escaped() . '</th>';
                        $html .= '<th class="mw-revdel-checkbox">' . $this->msg( 'revdelete-radio-unset' )->escaped() . '</th>';
@@ -490,6 +502,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                }
 
                $html .= '</table>';
+
                return $html;
        }
 
@@ -503,6 +516,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $token = $this->getRequest()->getVal( 'wpEditToken' );
                if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
                        $this->getOutput()->addWikiMsg( 'sessionfailure' );
+
                        return false;
                }
                $bitParams = $this->extractBitParams();
@@ -522,11 +536,13 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                $status = $this->save( $bitParams, $comment, $this->targetObj );
                if ( $status->isGood() ) {
                        $this->success();
+
                        return true;
-               # ...otherwise, bounce back to form...
                } else {
+                       # ...otherwise, bounce back to form...
                        $this->failure( $status );
                }
+
                return false;
        }
 
@@ -568,6 +584,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                if ( !isset( $bitfield[Revision::DELETED_RESTRICTED] ) ) {
                        $bitfield[Revision::DELETED_RESTRICTED] = 0;
                }
+
                return $bitfield;
        }