From c9e999ff51f52a56b43c0aec526495e9fd2d5435 Mon Sep 17 00:00:00 2001 From: jakubvrana Date: Wed, 3 Jun 2009 18:32:23 +0000 Subject: [PATCH] Simplify order in select git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@646 7c3ca157-0c34-0410-bff1-cbf682f78f5c --- changes.txt | 1 + default.css | 1 + functions.js | 8 ++++++++ lang/cs.inc.php | 1 + lang/fr.inc.php | 1 - lang/it.inc.php | 1 - select.inc.php | 34 +++++++++++++++------------------- 7 files changed, 26 insertions(+), 21 deletions(-) diff --git a/changes.txt b/changes.txt index 956719f6..3156526b 100644 --- a/changes.txt +++ b/changes.txt @@ -7,6 +7,7 @@ Version checker Separate JavaScript functions Always use the default style before the external one Always try to use the syntax highlighter +Simplify order in select phpMinAdmin 1.10.1: Highlight odd and hover rows diff --git a/default.css b/default.css index 6884be66..4f33cbfa 100644 --- a/default.css +++ b/default.css @@ -14,6 +14,7 @@ p { margin: 0 20px 1em 0; } img { vertical-align: middle; border: 0; } code { background: #eee; } .js .hidden { display: none; } +.popup { position: absolute; } .nowrap { white-space: nowrap; } .error { color: red; background: #fee; padding: .5em .8em; } .message { color: green; background: #efe; padding: .5em .8em; } diff --git a/functions.js b/functions.js index 0fb94e6d..0c94a340 100644 --- a/functions.js +++ b/functions.js @@ -6,6 +6,14 @@ function toggle(id) { return true; } +function popup(el) { + el.getElementsByTagName('span')[0].className = 'popup'; +} + +function popdown(el) { + el.getElementsByTagName('span')[0].className = 'hidden'; +} + function verify_version(version) { document.cookie = 'phpMinAdmin_version=0'; var script = document.createElement('script'); diff --git a/lang/cs.inc.php b/lang/cs.inc.php index 30bdfd76..08c8fc3a 100644 --- a/lang/cs.inc.php +++ b/lang/cs.inc.php @@ -58,6 +58,7 @@ $translations = array( 'New item' => 'Nová položka', 'Search' => 'Vyhledat', 'Sort' => 'Setřídit', + 'ASC' => 'vzestupně', 'DESC' => 'sestupně', 'Limit' => 'Limit', 'No rows.' => 'Žádné řádky.', diff --git a/lang/fr.inc.php b/lang/fr.inc.php index 1c4f643f..8a637f33 100644 --- a/lang/fr.inc.php +++ b/lang/fr.inc.php @@ -58,7 +58,6 @@ $translations = array( 'New item' => 'Nouvel élément', 'Search' => 'Rechercher', 'Sort' => 'Ordonner', - 'DESC' => 'DESC', 'Limit' => 'Limit', 'No rows.' => 'Aucun résultat', 'Action' => 'Action', diff --git a/lang/it.inc.php b/lang/it.inc.php index 0d6c9013..1070caa3 100644 --- a/lang/it.inc.php +++ b/lang/it.inc.php @@ -58,7 +58,6 @@ $translations = array( 'New item' => 'Nuovo elemento', 'Search' => 'Cerca', 'Sort' => 'Ordina', - 'DESC' => 'DESC', 'Limit' => 'Limite', 'No rows.' => 'Nessuna riga.', 'Action' => 'Azione', diff --git a/select.inc.php b/select.inc.php index 7ae7cc36..017c7aa3 100644 --- a/select.inc.php +++ b/select.inc.php @@ -194,20 +194,9 @@ if (!$columns) { echo "\n"; echo "\n"; - echo "
" . lang('Sort') . "\n"; - $i = 0; - foreach ((array) $_GET["order"] as $key => $val) { - if (in_array($val, $columns, true)) { - echo "
"; - echo "
\n"; - $i++; - } - } - echo "
"; - echo "
\n"; - echo "
\n"; - - echo "
" . lang('Limit') . "
\n"; + echo "
" . lang('Limit') . "
"; + echo hidden_fields(array("order" => (array) $_GET["order"], "desc" => (array) $_GET["desc"])); + echo "
\n"; if (isset($text_length)) { echo "
" . lang('Text length') . "
\n"; @@ -239,7 +228,16 @@ if (!$columns) { if (!$j) { echo ''; foreach ($row as $key => $val) { - echo '' . htmlspecialchars($key) . ""; + $pos = array_search($key, (array) $_GET["order"]); + $uri = remove_from_uri($pos !== false ? "(order|desc)%5B$pos%5D" : ""); + $pos2 = 0; + if ($_GET["order"]) { + $pos2 = max(array_keys($_GET["order"])); + $pos2 += ($pos2 !== $pos ? 1 : 0); + } + echo '' . htmlspecialchars($key) . ''; + echo ''; } echo "\n"; } @@ -251,10 +249,8 @@ if (!$columns) { } elseif (preg_match('~blob|binary~', $fields[$key]["type"]) && preg_match('~[\\0-\\x8\\xb\\xc\\xe-\\x1F\\x80-\\xFF]~', $val)) { $val = '' . lang('%d byte(s)', strlen($val)) . ''; } else { - if (!strlen(trim($val))) { - $val = " "; - } elseif (intval($text_length) > 0 && preg_match('~blob|text~', $fields[$key]["type"]) && strlen($val) > intval($text_length)) { - $val = (preg_match('~blob~', $fields[$key]["type"]) ? nl2br(htmlspecialchars(substr($val, 0, intval($text_length)))) . "..." : shorten_utf8($val, intval($text_length))); + if (intval($text_length) > 0 && preg_match('~blob|text~', $fields[$key]["type"])) { + $val = shorten_utf8($val, intval($text_length)); } else { $val = nl2br(htmlspecialchars($val)); if ($fields[$key]["type"] == "char") {