Clean up some error-handling messages a bit, particularly as relate to TitleBlacklist.
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 2 Jan 2008 02:01:09 +0000 (02:01 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 2 Jan 2008 02:01:09 +0000 (02:01 +0000)
* Hook-generated error messages should be strong class="error" on moving a page, just like system-generated errors.
* For consistency, "You do not have permission to do that, for the following reason:" should be displayed even if there's only one error message.
* Add a <div class="permissions-errors"> for a single error displayed on editing a page, akin to the <ul class="permissions-errors"> already present.
* In TitleBlacklist, errors should be inline and unstyled; otherwise they'll display inconsistently when added to lists, styled externally, etc.  Using <code> for the matching regex is better than using bold/italics.  I *did not* change all the different languages, only English.

includes/OutputPage.php
includes/SpecialMovepage.php

index 0c691ab..3ce9451 100644 (file)
@@ -827,7 +827,7 @@ class OutputPage {
                global $wgTitle;
 
                $this->mDebugtext .= 'Original title: ' .
-                 $wgTitle->getPrefixedText() . "\n";
+               $wgTitle->getPrefixedText() . "\n";
                $this->setPageTitle( wfMsg( $title ) );
                $this->setHTMLTitle( wfMsg( 'errorpagetitle' ) );
                $this->setRobotpolicy( 'noindex,nofollow' );
@@ -853,7 +853,7 @@ class OutputPage {
                global $wgTitle;
 
                $this->mDebugtext .= 'Original title: ' .
-                        $wgTitle->getPrefixedText() . "\n";
+               $wgTitle->getPrefixedText() . "\n";
                $this->setPageTitle( wfMsg( 'permissionserrors' ) );
                $this->setHTMLTitle( wfMsg( 'permissionserrors' ) );
                $this->setRobotpolicy( 'noindex,nofollow' );
@@ -981,14 +981,12 @@ class OutputPage {
 
        /**
         * @param array $errors An array of arrays returned by Title::getUserPermissionsErrors
-        * @return string The error-messages, formatted into a list.
+        * @return string The wikitext error-messages, formatted into a list.
         */
        public function formatPermissionsErrorMessage( $errors ) {
-               $text = '';
+               $text = wfMsgExt( 'permissionserrorstext', array( 'parsemag' ), count( $errors ) ) . "\n\n";
 
-               if (sizeof( $errors ) > 1) {
-
-                       $text .= wfMsgExt( 'permissionserrorstext', array( 'parse' ), count( $errors ) ) . "\n";
+               if (count( $errors ) > 1) {
                        $text .= '<ul class="permissions-errors">' . "\n";
 
                        foreach( $errors as $error )
@@ -999,7 +997,7 @@ class OutputPage {
                        }
                        $text .= '</ul>';
                } else {
-                       $text .= call_user_func_array( 'wfMsg', $errors[0]);
+                       $text .= '<div class="permissions-errors">' . call_user_func_array( 'wfMsg', $errors[0]) . '</div>';
                }
 
                return $text;
index 54730e6..7a003bb 100644 (file)
@@ -139,7 +139,7 @@ class MovePageForm {
                        $wgOut->setSubtitle( wfMsg( 'formerror' ) );
                        $errMsg = "";
                        if( $err == 'hookaborted' ) {
-                               $errMsg = $hookErr;
+                               $errMsg = "<p><strong class=\"error\">$hookErr</strong></p>\n";
                        } else {
                                $errMsg = '<p><strong class="error">' . wfMsgWikiHtml( $err ) . "</strong></p>\n";
                        }
@@ -194,7 +194,7 @@ class MovePageForm {
        <input type='hidden' name='wpEditToken' value=\"{$token}\" />
 </form>\n" );
 
-       $this->showLogFragment( $ot, $wgOut );
+               $this->showLogFragment( $ot, $wgOut );
 
        }