diff --git a/adminer/select.inc.php b/adminer/select.inc.php index 8ccaeeda..6a8e95b9 100644 --- a/adminer/select.inc.php +++ b/adminer/select.inc.php @@ -297,8 +297,9 @@ if (!$columns && support("table")) { } else { $backward_keys = $adminer->backwardKeys($TABLE, $table_name); - echo "\n"; - echo "" . (!$group && $select ? "" : "
" . lang('Modify') . ""); + echo ""; + echo "\n"; + echo "" . (!$group && $select ? "" : ""; + echo ""; } } } @@ -461,7 +464,8 @@ if (!$columns && support("table")) { : floor(($found_rows - 1) / $limit) ); if ($jush != "simpledb") { - echo '" . lang('Page') . ":"; + echo '' . lang('Page') . ":"; + echo "\n"; echo pagination(0, $page) . ($page > 5 ? " ..." : ""); for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) { echo pagination($i, $page); @@ -474,7 +478,8 @@ if (!$columns && support("table")) { ); } echo (($found_rows === false ? count($rows) + 1 : $found_rows - $page * $limit) > $limit - ? ' ' . lang('Load more data') . '' + ? ' ' . lang('Load more data') . '' + . "" : '' ); } else { diff --git a/adminer/static/default.css b/adminer/static/default.css index b1fae3b7..63666550 100644 --- a/adminer/static/default.css +++ b/adminer/static/default.css @@ -11,7 +11,7 @@ h3 { font-weight: normal; font-size: 130%; margin: 1em 0 0; } form { margin: 0; } td table { width: 100%; margin: 0; } table { margin: 1em 20px 0 0; border: 0; border-top: 1px solid #999; border-left: 1px solid #999; font-size: 90%; } -td, th { border: 0; border-right: 1px solid #999; border-bottom: 1px solid #999; padding: .2em .3em; } +td, th {border: 0;border-right: 1px solid #999;border-bottom: 1px solid #999;padding: .2em .3em;} th { background: #eee; text-align: left; } thead th { text-align: center; padding: .2em .5em; } thead td, thead th { background: #ddf; } diff --git a/adminer/static/functions.js b/adminer/static/functions.js index f43e3a91..c1d9401b 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -7,6 +7,15 @@ function qs(selector) { return document.querySelector(selector); } +/** Get last element by selector +* @param string +* @return HTMLElement +*/ +function qsl(selector) { + var els = qsa(selector, document); + return els[els.length - 1]; +} + /** Get all elements by selector * @param string * @param HTMLElement @@ -16,6 +25,41 @@ function qsa(selector, context) { return context.querySelectorAll(selector); } +/** Return a function calling fn with the next arguments +* @param function +* @param ... +* @return function with preserved this +*/ +function partial(fn) { + var args = Array.apply(null, arguments).slice(1); + return function () { + return fn.apply(this, args); + }; +} + +/** Return a function calling fn with the first parameter and then the next arguments +* @param function +* @param ... +* @return function with preserved this +*/ +function partialArg(fn) { + var args = Array.apply(null, arguments); + return function (arg) { + args[0] = arg; + return fn.apply(this, args); + }; +} + +/** Assign values from source to target +* @param Object +* @param Object +*/ +function mixin(target, source) { + for (var key in source) { + target[key] = source[key]; + } +} + /** Add or remove CSS class * @param HTMLElement * @param string @@ -279,12 +323,10 @@ function nodePosition(el) { /** Go to the specified page * @param string * @param string -* @param [MouseEvent] */ -function pageClick(href, page, event) { +function pageClick(href, page) { if (!isNaN(page) && page) { - href += (page != 1 ? '&page=' + (page - 1) : ''); - location.href = href; + location.href = href + (page != 1 ? '&page=' + (page - 1) : ''); } } @@ -377,6 +419,7 @@ function columnMouse(className) { /** Fill column in search field * @param string +* @return boolean false */ function selectSearch(name) { var el = qs('#fieldset-search'); @@ -393,6 +436,7 @@ function selectSearch(name) { div.firstChild.onchange(); } div.lastChild.focus(); + return false; } @@ -685,7 +729,7 @@ function selectClick(event, text, warning) { /** Load and display next page in select * @param number * @param string -* @return boolean +* @return boolean false for success * @this HTMLLinkElement */ function selectLoadMore(limit, loading) { @@ -695,7 +739,7 @@ function selectLoadMore(limit, loading) { a.innerHTML = loading; if (href) { a.removeAttribute('href'); - return ajax(href, function (request) { + return !ajax(href, function (request) { var tbody = document.createElement('tbody'); tbody.innerHTML = request.responseText; qs('#table').appendChild(tbody);
" . lang('Modify') . ""); $names = array(); $functions = array(); reset($select); @@ -314,13 +315,14 @@ if (!$columns && support("table")) { $column = idf_escape($key); $href = remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key); $desc = "&desc%5B0%5D=1"; - echo ''; + echo ""; echo ''; // $order[0] == $key - COUNT(*) echo apply_sql_function($val["fun"], $name) . ""; //! columns looking like functions echo ""; } @@ -419,7 +421,8 @@ if (!$columns && support("table")) { echo "" . ($text ? "" : ""); } else { $long = strpos($val, "..."); - echo "$val"; + echo "$val