Merge pull request #308 from kijin/pr/no-alert-on-success

댓글 작성시 "등록되었습니다." alert이 뜨는 문제 수정
This commit is contained in:
Kijin Sung 2016-02-25 16:04:38 +09:00
commit 9502aef063
2 changed files with 27 additions and 20 deletions

View file

@ -24,11 +24,6 @@ class VirtualXMLDisplayHandler
if($error === 0)
{
if($message != 'success')
{
$output->message = $message;
}
if($redirect_url)
{
$output->url = $redirect_url;
@ -40,29 +35,32 @@ class VirtualXMLDisplayHandler
}
else
{
if($message != 'fail')
{
$output->message = $message;
}
$output->message = $message;
}
$html = array();
$html[] = '<script type="text/javascript">';
$html[] = '//<![CDATA[';
$html[] = '<html>';
$html[] = '<head>';
$html[] = '<script>';
if($output->message)
{
$html[] = 'alert("' . $output->message . '");';
$html[] = 'alert(' . json_encode($output->message) . ');';
}
if($output->url)
{
$url = preg_replace('/#(.+)$/i', '', $output->url);
$html[] = 'self.location.href = "' . $request_url . 'common/tpl/redirect.html?redirect_url=' . urlencode($url) . '";';
$output->url = preg_replace('/#(.+)$/', '', $output->url);
$html[] = 'if (opener) {';
$html[] = ' opener.location.href = ' . json_encode($output->url) . ';';
$html[] = '} else {';
$html[] = ' parent.location.href = ' . json_encode($output->url) . ';';
$html[] = '}';
}
$html[] = '//]]>';
$html[] = '</script>';
$html[] = '</head><body></body></html>';
return join(PHP_EOL, $html);
}

View file

@ -134,11 +134,13 @@
// Hide the waiting message and display an error notice.
clearTimeout(wfsr_timeout);
waiting_obj.hide().trigger("cancel_confirm");
var error_info;
if ($(".x_modal-body").size()) {
var error_info = xhr.status + " " + xhr.statusText + " (" + textStatus + ")" + "<br><br><pre>" + xhr.responseText + "</pre>";
error_info = xhr.status + " " + xhr.statusText + " (" + textStatus + ")" + "<br><br><pre>" + xhr.responseText + "</pre>";
alert("AJAX communication error while requesting " + params.module + "." + params.act + "<br><br>" + error_info);
} else {
var error_info = xhr.status + " " + xhr.statusText + " (" + textStatus + ")" + "\n\n" + xhr.responseText;
error_info = xhr.status + " " + xhr.statusText + " (" + textStatus + ")" + "\n\n" + xhr.responseText;
alert("AJAX communication error while requesting " + params.module + "." + params.act + "\n\n" + error_info);
}
};
@ -232,8 +234,15 @@
var errorHandler = function(xhr, textStatus) {
clearTimeout(wfsr_timeout);
waiting_obj.hide().trigger("cancel_confirm");
var error_info = xhr.status + " " + xhr.statusText + " (" + textStatus + ")";
alert("AJAX communication error while requesting " + params.module + "." + params.act + "\n\n" + error_info);
var error_info;
if ($(".x_modal-body").size()) {
error_info = xhr.status + " " + xhr.statusText + " (" + textStatus + ")" + "<br><br><pre>" + xhr.responseText + "</pre>";
alert("AJAX communication error while requesting " + params.module + "." + params.act + "<br><br>" + error_info);
} else {
error_info = xhr.status + " " + xhr.statusText + " (" + textStatus + ")" + "\n\n" + xhr.responseText;
alert("AJAX communication error while requesting " + params.module + "." + params.act + "\n\n" + error_info);
}
};
// Send the AJAX request.