(bug 9033) Use a more specific error message when users are not able/allowed to edit...
authorRob Church <robchurch@users.mediawiki.org>
Mon, 2 Apr 2007 07:39:32 +0000 (07:39 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Mon, 2 Apr 2007 07:39:32 +0000 (07:39 +0000)
RELEASE-NOTES
includes/ProtectionForm.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index c2c72a6..73f6f7c 100644 (file)
@@ -298,7 +298,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 9472) Invalid XHTML on cached special pages
 * (bug 9472) Invalid XHTML on Special:Newpages
 * (bug 4764) "My contributions" not bold when viewing own contributions
-* (bug 9194) Add {{PLURAL:...}} to navigation bar of special:whatlinkshere
+* (bug 9194) Add {{PLURAL:...}} to navigation bar of Special:Whatlinkshere
+* (bug 9033) Use a more specific error message when users are not able/allowed
+  to edit page protection levels due to a block, database lock or permissions
 
 == Maintenance ==
 * New script maintenance/language/checkExtensioni18n.php used to check i18n
index 659ba1f..f799624 100644 (file)
@@ -86,7 +86,7 @@ class ProtectionForm {
        }
 
        function show( $err = null ) {
-               global $wgOut;
+               global $wgOut, $wgUser;
 
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
 
@@ -119,9 +119,25 @@ class ProtectionForm {
                $wgOut->setPageTitle( wfMsg( 'confirmprotect' ) );
                $wgOut->setSubtitle( wfMsg( 'protectsub', $this->mTitle->getPrefixedText() ) );
 
-               $wgOut->addWikiText(
-                       wfMsg( $this->disabled ? "protect-viewtext" : "protect-text",
-                               wfEscapeWikiText( $this->mTitle->getPrefixedText() ) ) );
+               # Show an appropriate message if the user isn't allowed or able to change
+               # the protection settings at this time
+               if( $this->disabled ) {
+                       if( $wgUser->isAllowed( 'protect' ) ) {
+                               if( $wgUser->isBlocked() ) {
+                                       # Blocked
+                                       $message = 'protect-locked-blocked';
+                               } else {
+                                       # Database lock
+                                       $message = 'protect-locked-dblock';
+                               }
+                       } else {
+                               # Permission error
+                               $message = 'protect-locked-access';
+                       }
+               } else {
+                       $message = 'protect-text';
+               }
+               $wgOut->addWikiText( wfMsg( $message, wfEscapeWikiText( $this->mTitle->getPrefixedText() ) ) );
 
                $wgOut->addHTML( $this->buildForm() );
 
index bdadbe2..2232aea 100644 (file)
@@ -1809,8 +1809,12 @@ Please hit "back" and reload the page you came from, then try again.',
 'unprotectcomment' => 'Reason for unprotecting',
 'protect-unchain' => 'Unlock move permissions',
 'protect-text' => 'You may view and change the protection level here for the page <strong>$1</strong>.',
-'protect-viewtext' => 'Your account does not have permission to change
-page protection levels. Here are the current settings for the page <strong>$1</strong>:',
+'protect-locked-blocked' => 'You cannot change protection levels while blocked. Here are the
+current settings for the page <strong>$1</strong>:',
+'protect-locked-dblock' => 'Protection levels cannot be changed due to an active database lock.
+Here are the current settings for the page <strong>$1</strong>:',
+'protect-locked-access' => 'Your account does not have permission to change page protection levels.
+Here are the current settings for the page <strong>$1</strong>:',
 'protect-cascadeon' => "This page is currently protected because it is included in the following pages, which have cascading protection turned on. You can change this page's protection level, but it will not affect the cascading protection.",
 'protect-default' => '(default)',
 'protect-level-autoconfirmed' => 'Block unregistered users',
index eeca58f..62bcda7 100644 (file)
@@ -1155,7 +1155,9 @@ $wgMessageStructure = array(
                'unprotectcomment',
                'protect-unchain',
                'protect-text',
-               'protect-viewtext',
+               'protect-locked-blocked',
+               'protect-locked-dblock',
+               'protect-locked-access',
                'protect-cascadeon',
                'protect-default',
                'protect-level-autoconfirmed',