From 685352116602e42b23484119f1fde5c6b7fef594 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 18 Feb 2011 12:28:03 +0300 Subject: [PATCH] fix fatalError() not working properly --- errors.php | 15 +++++++++++++++ functions.js | 46 ++++++++++++++++++++++++++-------------------- login_form.php | 13 ++++++++++++- tt-rss.js | 4 ++-- tt-rss.php | 1 + 5 files changed, 56 insertions(+), 23 deletions(-) diff --git a/errors.php b/errors.php index b2e0841a..cd76d10a 100644 --- a/errors.php +++ b/errors.php @@ -1,4 +1,5 @@ $error) { + + $error = preg_replace("/\n/", "", $error); + $error = preg_replace("/\"/", "\\\"", $error); + + print "ERRORS[$id] = \"$error\";\n"; + } + } ?> diff --git a/functions.js b/functions.js index 67d7b4f2..88365d70 100644 --- a/functions.js +++ b/functions.js @@ -503,8 +503,6 @@ function setInitParam(key, value) { function fatalError(code, msg, ext_info) { try { - if (!ext_info) ext_info = "N/A"; - if (code == 6) { window.location.href = "tt-rss.php"; } else if (code == 5) { @@ -513,28 +511,36 @@ function fatalError(code, msg, ext_info) { if (msg == "") msg = "Unknown error"; - var ebc = $("xebContent"); - - if (ebc) { - - Element.show("dialog_overlay"); - Element.show("errorBoxShadow"); - Element.hide("xebBtn"); - - if (ext_info) { - if (ext_info.responseText) { - ext_info = ext_info.responseText; - } + if (ext_info) { + if (ext_info.responseText) { + ext_info = ext_info.responseText; } - - ebc.innerHTML = - "
Error message:
" + - "
" + msg + "
" + - "
Additional information:
" + - ""; } + + if (ERRORS && ERRORS[code] && !msg) { + msg = ERRORS[code]; + } + + var content = "
Error code: " + code + "
" + + "

" + msg + "

"; + + if (ext_info) { + content = content + "
Additional information:
" + + ""; + } + + var dialog = new dijit.Dialog({ + title: "Fatal error", + style: "width: 600px", + content: content}); + + dialog.show(); + } + return false; + } catch (e) { exception_error("fatalError", e); } diff --git a/login_form.php b/login_form.php index 14882b34..141f3f0b 100644 --- a/login_form.php +++ b/login_form.php @@ -1,19 +1,30 @@ Tiny Tiny RSS : Login + + + - + +