diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index ce8ec73a..97b5e1d1 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -139,7 +139,7 @@ document.getElementById('username').focus(); */ function selectQuery($query) { global $jush; - return "

>> " . h(str_replace("\n", " ", $query)) . " " . lang('Edit') . "\n"; + return "

>> " . h(str_replace("\n", " ", $query)) . " " . lang('Edit') . "\n"; } /** Description of a row in a table diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php index 7b9bcd93..8f948064 100644 --- a/adminer/include/design.inc.php +++ b/adminer/include/design.inc.php @@ -26,7 +26,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") { -', '');"> +);" onload="bodyLoad('server_info, 0, 3) : ""); ?>', '');"> diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index fff0a69f..58ef4fd1 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -462,7 +462,7 @@ function remove_from_uri($param = "") { * @return string */ function pagination($page, $current) { - return " " . ($page == $current ? $page + 1 : '' . ($page + 1) . ""); + return " " . ($page == $current ? $page + 1 : '' . ($page + 1) . ""); } /** Get file contents from $_FILES diff --git a/adminer/select.inc.php b/adminer/select.inc.php index a3e15538..053c1d85 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -263,7 +263,7 @@ if (!$columns) { $rank++; $names[$key] = $name; $column = idf_escape($key); - echo '' . apply_sql_function($val["fun"], $name) . ""; // $order[0] == $key - COUNT(*) //! columns looking like functions + echo '' . apply_sql_function($val["fun"], $name) . ""; // $order[0] == $key - COUNT(*) //! columns looking like functions } $functions[$key] = $val["fun"]; next($select); @@ -386,7 +386,7 @@ if (!$columns) { for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) { echo pagination($i, $page); } - echo ($page + 5 < $max_page ? " ..." : "") . ($exact_count ? pagination($max_page, $page) : ' ' . lang('last') . ""); + echo ($page + 5 < $max_page ? " ..." : "") . ($exact_count ? pagination($max_page, $page) : ' ' . lang('last') . ""); } echo " (" . ($exact_count ? "" : "~ ") . lang('%d row(s)', $found_rows) . ") " . checkbox("all", 1, 0, lang('whole result')) . "\n"; diff --git a/adminer/static/functions.js b/adminer/static/functions.js index 9c19046f..436d827e 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -115,7 +115,7 @@ function setHtml(id, html) { function pageClick(href, page, event) { if (!isNaN(page) && page) { href += (page != 1 ? '&page=' + (page - 1) : ''); - if (!ajaxMain(href, undefined, event)) { + if (!ajaxMain(href, '', event)) { location.href = href; } } @@ -250,7 +250,7 @@ function ajaxSend(url, data) { * @return XMLHttpRequest or false in case of an error */ function ajaxMain(url, data, event) { - if (!history.pushState || (event && event.ctrlKey)) { + if (!history.pushState || (event && (event.ctrlKey || event.shiftKey || event.metaKey))) { return false; } history.pushState(data, '', url); @@ -286,9 +286,8 @@ function ajaxForm(form, data) { } if (form.method == 'post') { return ajaxMain((/\?/.test(form.action) ? form.action : location.href), params.join('&')); // ? - always part of Adminer URL - } else { - return ajaxMain((form.action || location.pathname) + '?' + params.join('&')); } + return ajaxMain((form.action || location.pathname) + '?' + params.join('&')); } @@ -341,3 +340,32 @@ function selectDblClick(td, event, text) { range.select(); } } + + + +/** Load link by AJAX +* @param MouseEvent +* @param [string] +* @return bool +*/ +function bodyClick(event, db) { + var el = event.target || event.srcElement; + if (/^a$/i.test(el.parentNode.tagName)) { + el = el.parentNode; + } + if (/^a$/i.test(el.tagName) && !/^https?:/i.test(el.getAttribute('href')) && !el.onclick && /[&?]username=/.exec(el.href)) { + var match = /&db=([^&]*)/.exec(el.href); + if (db === (match ? match[1] : '') && ajaxMain(el.href, '', event)) { + var as = document.getElementById('menu').getElementsByTagName('a'); + for (var i=0; i < as.length; i++) { + if (as[i].className == 'active') { + as[i].className = ''; + } else if (el.href == as[i].href) { + as[i].className = 'active'; + } + } + //! modify Export link + return false; + } + } +}