Consistent message strings and types for error submission

We can share more strings on the failed error reporting and also the
messages should have same type regardless it was manual or automatic
submission.

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2014-05-28 09:26:35 +02:00
parent 42a694db77
commit d3fcfec4bb

View File

@ -19,74 +19,50 @@ if (isset($_REQUEST['send_error_report'])
$success = false;
} else {
$decoded_response = json_decode($server_response, true);
$success = !empty($decoded_response) ? $decoded_response["success"] : false;
}
$success = !empty($decoded_response) ? $decoded_response["success"] : false; }
if (isset($_REQUEST['automatic'])
&& $_REQUEST['automatic'] === "true"
) {
if ($success) {
$response->addJSON(
'message',
PMA_Message::error(
__(
'An error has been detected and an error report has been '
. 'automatically submitted based on your settings.'
)
. '<br />'
. __('You may want to refresh the page.')
)
/* Message to show to the user */
if ($success) {
if (isset($_REQUEST['automatic'])
&& $_REQUEST['automatic'] === "true"
) {
$message = __(
'An error has been detected and an error report has been '
. 'automatically submitted based on your settings.'
);
} else {
$response->addJSON(
'message',
PMA_Message::error(
__(
'An error has been detected and an error report has been '
. 'generated but failed to be sent.'
)
. ' '
. __(
'If you experience any '
. 'problems please submit a bug report manually.'
)
. '<br />'
. __('You may want to refresh the page.')
)
);
$message = __('Thank you for submitting this report.');
}
} else {
if ($success) {
$response->addJSON(
'message',
PMA_Message::success(
__('Thank you for submitting this report.')
. '<br />'
. __('You may want to refresh the page.')
)
);
} else {
$response->addJSON(
'message',
PMA_Message::error(
__('Thank you for submitting this report.')
. ' '
. __('Unfortunately the submission failed.')
. ' '
. __(
'If you experience any '
. 'problems please submit a bug report manually.'
)
. '<br />'
. __('You may want to refresh the page.')
)
);
}
if (isset($_REQUEST['always_send'])
&& $_REQUEST['always_send'] === "true"
) {
PMA_persistOption("SendErrorReports", "always", "ask");
}
$message = __(
'An error has been detected and an error report has been '
. 'generated but failed to be sent.'
)
. ' '
. __(
'If you experience any '
. 'problems please submit a bug report manually.'
);
}
$message .= ' ' . __('You may want to refresh the page.');
/* Create message object */
if ($success) {
$message = PMA_Message::notice($message);
} else {
$message = PMA_Message::error($message);
}
/* Add message to JSON response */
$response->addJSON('message', $message);
/* Persist always send settings */
if (! isset($_REQUEST['automatic'])
&& $_REQUEST['automatic'] !== "true"
&& isset($_REQUEST['always_send'])
&& $_REQUEST['always_send'] === "true"
) {
PMA_persistOption("SendErrorReports", "always", "ask");
}
} elseif (! empty($_REQUEST['get_settings'])) {
$response->addJSON('report_setting', $GLOBALS['cfg']['SendErrorReports']);