From ed25431f3cdd73fddff8048214507997f60f271c Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Sat, 17 Sep 2011 15:24:18 +0200 Subject: [PATCH] Error message with no response from server in AJAX --- adminer/include/design.inc.php | 1 + adminer/lang/cs.inc.php | 1 + adminer/static/functions.js | 66 ++++++++++++++++------------------ changes.txt | 1 + 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php index 383f1e51..f2345b45 100644 --- a/adminer/include/design.inc.php +++ b/adminer/include/design.inc.php @@ -28,6 +28,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { diff --git a/adminer/lang/cs.inc.php b/adminer/lang/cs.inc.php index 86d8b34d..2845fec5 100644 --- a/adminer/lang/cs.inc.php +++ b/adminer/lang/cs.inc.php @@ -279,6 +279,7 @@ $translations = array( // reload confirmation in AJAX 'Resend POST data?' => 'Znovu odeslat POST data?', + 'No response from server.' => 'Server neodpověděl.', 'Editor' => 'Editor', // date format in Editor: $1 yyyy, $2 yy, $3 mm, $4 m, $5 dd, $6 d diff --git a/adminer/static/functions.js b/adminer/static/functions.js index 619026ce..626aaeba 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -335,43 +335,39 @@ function ajaxSend(url, data, popState, noscroll) { if (originalFavicon) { replaceFavicon(originalFavicon); } - if (!xmlhttp.status) { - setHtml('loader', ''); - } else { - if (!popState) { - if (data || url != location.href) { - history.pushState(data, '', url); //! remember window position - } - } - if (!noscroll && !/&order/.test(url)) { - scrollTo(0, 0); - } - setHtml('content', xmlhttp.responseText); - var content = document.getElementById('content'); - var scripts = content.getElementsByTagName('script'); - var length = scripts.length; // required to avoid infinite loop - for (var i=0; i < length; i++) { - var script = document.createElement('script'); - script.text = scripts[i].text; - content.appendChild(script); - } - - var as = document.getElementById('menu').getElementsByTagName('a'); - var href = location.href.replace(/(&(sql=|dump=|(select|table)=[^&]*)).*/, '$1'); - for (var i=0; i < as.length; i++) { - as[i].className = (href == as[i].href ? 'active' : ''); - } - var dump = document.getElementById('dump'); - if (dump) { - var match = /&(select|table)=([^&]+)/.exec(href); - dump.href = dump.href.replace(/[^=]+$/, '') + (match ? match[2] : ''); - } - //! modify Change database hidden fields - - if (window.jush) { - jush.highlight_tag('code', 0); + if (!popState) { + if (data || url != location.href) { + history.pushState(data, '', url); //! remember window position } } + if (!noscroll && !/&order/.test(url)) { + scrollTo(0, 0); + } + setHtml('content', (xmlhttp.status ? xmlhttp.responseText : '

' + noResponse)); + var content = document.getElementById('content'); + var scripts = content.getElementsByTagName('script'); + var length = scripts.length; // required to avoid infinite loop + for (var i=0; i < length; i++) { + var script = document.createElement('script'); + script.text = scripts[i].text; + content.appendChild(script); + } + + var as = document.getElementById('menu').getElementsByTagName('a'); + var href = location.href.replace(/(&(sql=|dump=|(select|table)=[^&]*)).*/, '$1'); + for (var i=0; i < as.length; i++) { + as[i].className = (href == as[i].href ? 'active' : ''); + } + var dump = document.getElementById('dump'); + if (dump) { + var match = /&(select|table)=([^&]+)/.exec(href); + dump.href = dump.href.replace(/[^=]+$/, '') + (match ? match[2] : ''); + } + //! modify Change database hidden fields + + if (window.jush) { + jush.highlight_tag('code', 0); + } } }, data); } diff --git a/changes.txt b/changes.txt index 7e94f49f..efc81a15 100644 --- a/changes.txt +++ b/changes.txt @@ -4,6 +4,7 @@ Fix minor parser bug in SQL command with webserver file Ctrl+click on button opens form to blank window SET DEFAULT foreign key action Trim table and column names (bug #3405309) +Error message with no response from server in AJAX PostgreSQL: fix alter foreign key PostgreSQL over PDO: connect if the eponymous database does not exist (bug #3391619) Boolean search (Editor)