Simplify order in select

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@646 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-06-03 18:32:23 +00:00
parent 4b5280320d
commit c9e999ff51
7 changed files with 26 additions and 21 deletions

View file

@ -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

View file

@ -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; }

View file

@ -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');

View file

@ -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.',

View file

@ -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',

View file

@ -58,7 +58,6 @@ $translations = array(
'New item' => 'Nuovo elemento',
'Search' => 'Cerca',
'Sort' => 'Ordina',
'DESC' => 'DESC',
'Limit' => 'Limite',
'No rows.' => 'Nessuna riga.',
'Action' => 'Azione',

View file

@ -194,20 +194,9 @@ if (!$columns) {
echo "<input name='where[$i][val]' /></div>\n";
echo "</fieldset>\n";
echo "<fieldset><legend>" . lang('Sort') . "</legend>\n";
$i = 0;
foreach ((array) $_GET["order"] as $key => $val) {
if (in_array($val, $columns, true)) {
echo "<div><select name='order[$i]'><option></option>" . optionlist($columns, $val) . "</select>";
echo "<label><input type='checkbox' name='desc[$i]' value='1'" . (isset($_GET["desc"][$key]) ? " checked='checked'" : "") . " />" . lang('DESC') . "</label></div>\n";
$i++;
}
}
echo "<div><select name='order[$i]' onchange='select_add_row(this);'><option></option>" . optionlist($columns) . "</select>";
echo "<label><input type='checkbox' name='desc[$i]' value='1' />" . lang('DESC') . "</label></div>\n";
echo "</fieldset>\n";
echo "<fieldset><legend>" . lang('Limit') . "</legend><div><input name='limit' size='3' value=\"" . htmlspecialchars($limit) . "\" /></div></fieldset>\n";
echo "<fieldset><legend>" . lang('Limit') . "</legend><div>";
echo hidden_fields(array("order" => (array) $_GET["order"], "desc" => (array) $_GET["desc"]));
echo "<input name='limit' size='3' value=\"" . htmlspecialchars($limit) . "\" /></div></fieldset>\n";
if (isset($text_length)) {
echo "<fieldset><legend>" . lang('Text length') . "</legend><div><input name='text_length' size='3' value=\"" . htmlspecialchars($text_length) . "\" /></div></fieldset>\n";
@ -239,7 +228,16 @@ if (!$columns) {
if (!$j) {
echo '<thead><tr><td><label><input type="checkbox" name="all" value="1" />' . lang('whole result') . '</label></td>';
foreach ($row as $key => $val) {
echo '<th><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*')) . '&amp;order%5B0%5D=' . htmlspecialchars($key) . ($_GET["order"][0] === $key && !$_GET["desc"][0] ? '&amp;desc%5B0%5D=1' : '') . '">' . htmlspecialchars($key) . "</a></th>";
$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 '<th onmouseover="popup(this);" onmouseout="popdown(this);"><a href="' . htmlspecialchars(remove_from_uri('(order|desc)[^=]*') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"][0] === $key && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '">' . htmlspecialchars($key) . '</a>';
echo '<span class="hidden"><a href="' . htmlspecialchars("$uri&order%5B$pos2%5D=" . urlencode($key)) . '"><img src="up.gif" alt="^" title="' . lang('ASC') . '" /></a>';
echo '<a href="' . htmlspecialchars("$uri&order%5B$pos2%5D=" . urlencode($key) . "&desc%5B$pos2") . '%5D=1"><img src="down.gif" alt="v" title="' . lang('DESC') . '" /></a></span></th>';
}
echo "</tr></thead>\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 = '<a href="' . htmlspecialchars($SELF) . 'download=' . urlencode($_GET["select"]) . '&amp;field=' . urlencode($key) . '&amp;' . $unique_idf . '">' . lang('%d byte(s)', strlen($val)) . '</a>';
} else {
if (!strlen(trim($val))) {
$val = "&nbsp;";
} 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)))) . "<em>...</em>" : 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") {