summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6f1df80)
Errors that go through the Status object of the EditFilterMergedContent
hook have less control over how their errors are displayed, compared to
the legacy EditFilterMerged hook. Notably, Scribunto wrapped its errors
in an errorbox for increased visibility. That was a good idea in
general, so let's do that for all errors.
Change-Id: I1f0e463841298b8c59ed8bd898c8a4661c5e3aa4
// being set. This is used by ConfirmEdit to display a captcha
// without any error message cruft.
} else {
// being set. This is used by ConfirmEdit to display a captcha
// without any error message cruft.
} else {
- $this->hookError = $status->getWikiText();
+ $this->hookError = $this->formatStatusErrors( $status );
}
// Use the existing $status->value if the hook set it
if ( !$status->value ) {
}
// Use the existing $status->value if the hook set it
if ( !$status->value ) {
} elseif ( !$status->isOK() ) {
# ...or the hook could be expecting us to produce an error
// FIXME this sucks, we should just use the Status object throughout
} elseif ( !$status->isOK() ) {
# ...or the hook could be expecting us to produce an error
// FIXME this sucks, we should just use the Status object throughout
- $this->hookError = $status->getWikiText();
+ $this->hookError = $this->formatStatusErrors( $status );
$status->fatal( 'hookaborted' );
$status->value = self::AS_HOOK_ERROR_EXPECTED;
return false;
$status->fatal( 'hookaborted' );
$status->value = self::AS_HOOK_ERROR_EXPECTED;
return false;
+ /**
+ * Wrap status errors in an errorbox for increased visiblity
+ *
+ * @param Status $status
+ * @return string
+ */
+ private function formatStatusErrors( Status $status ) {
+ $errmsg = $status->getHTML(
+ 'edit-error-short',
+ 'edit-error-long',
+ $this->context->getLanguage()
+ );
+ return <<<ERROR
+<div class="errorbox">
+{$errmsg}
+</div>
+<br clear="all" />
+ERROR;
+ }
+
/**
* Return the summary to be used for a new section.
*
/**
* Return the summary to be used for a new section.
*
"usercssispublic": "Please note: CSS subpages should not contain confidential data as they are viewable by other users.",
"restrictionsfield-badip": "Invalid IP address or range: $1",
"restrictionsfield-label": "Allowed IP ranges:",
"usercssispublic": "Please note: CSS subpages should not contain confidential data as they are viewable by other users.",
"restrictionsfield-badip": "Invalid IP address or range: $1",
"restrictionsfield-label": "Allowed IP ranges:",
- "restrictionsfield-help": "One IP address or CIDR range per line. To enable everything, use<br><code>0.0.0.0/0</code><br><code>::/0</code>"
+ "restrictionsfield-help": "One IP address or CIDR range per line. To enable everything, use<br><code>0.0.0.0/0</code><br><code>::/0</code>",
+ "edit-error-short": "Error: $1",
+ "edit-error-long": "Errors:\n\n$1"
"usercssispublic": "A reminder to users that CSS subpages are not preferences but normal pages, and thus can be viewed by other users and the general public. This message is shown to a user whenever they are editing a subpage in their own user-space that ends in .css. See also {{msg-mw|userjsispublic}}",
"restrictionsfield-badip": "An error message shown when one entered an invalid IP address or range in a restrictions field (such as Special:BotPassword). $1 is the IP address.",
"restrictionsfield-label": "Field label shown for restriction fields (e.g. on Special:BotPassword).",
"usercssispublic": "A reminder to users that CSS subpages are not preferences but normal pages, and thus can be viewed by other users and the general public. This message is shown to a user whenever they are editing a subpage in their own user-space that ends in .css. See also {{msg-mw|userjsispublic}}",
"restrictionsfield-badip": "An error message shown when one entered an invalid IP address or range in a restrictions field (such as Special:BotPassword). $1 is the IP address.",
"restrictionsfield-label": "Field label shown for restriction fields (e.g. on Special:BotPassword).",
- "restrictionsfield-help": "Placeholder text displayed in restriction fields (e.g. on Special:BotPassword)."
+ "restrictionsfield-help": "Placeholder text displayed in restriction fields (e.g. on Special:BotPassword).",
+ "edit-error-short": "Error message. Parameters:\n* $1 - the error details\nSee also:\n* {{msg-mw|edit-error-long}}",
+ "edit-error-long": "Error message. Parameters:\n* $1 - the error details\nSee also:\n* {{msg-mw|edit-error-short}}"