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 Separate JavaScript functions
Always use the default style before the external one Always use the default style before the external one
Always try to use the syntax highlighter Always try to use the syntax highlighter
Simplify order in select
phpMinAdmin 1.10.1: phpMinAdmin 1.10.1:
Highlight odd and hover rows Highlight odd and hover rows

View file

@ -14,6 +14,7 @@ p { margin: 0 20px 1em 0; }
img { vertical-align: middle; border: 0; } img { vertical-align: middle; border: 0; }
code { background: #eee; } code { background: #eee; }
.js .hidden { display: none; } .js .hidden { display: none; }
.popup { position: absolute; }
.nowrap { white-space: nowrap; } .nowrap { white-space: nowrap; }
.error { color: red; background: #fee; padding: .5em .8em; } .error { color: red; background: #fee; padding: .5em .8em; }
.message { color: green; background: #efe; padding: .5em .8em; } .message { color: green; background: #efe; padding: .5em .8em; }

View file

@ -6,6 +6,14 @@ function toggle(id) {
return true; return true;
} }
function popup(el) {
el.getElementsByTagName('span')[0].className = 'popup';
}
function popdown(el) {
el.getElementsByTagName('span')[0].className = 'hidden';
}
function verify_version(version) { function verify_version(version) {
document.cookie = 'phpMinAdmin_version=0'; document.cookie = 'phpMinAdmin_version=0';
var script = document.createElement('script'); var script = document.createElement('script');

View file

@ -58,6 +58,7 @@ $translations = array(
'New item' => 'Nová položka', 'New item' => 'Nová položka',
'Search' => 'Vyhledat', 'Search' => 'Vyhledat',
'Sort' => 'Setřídit', 'Sort' => 'Setřídit',
'ASC' => 'vzestupně',
'DESC' => 'sestupně', 'DESC' => 'sestupně',
'Limit' => 'Limit', 'Limit' => 'Limit',
'No rows.' => 'Žádné řádky.', 'No rows.' => 'Žádné řádky.',

View file

@ -58,7 +58,6 @@ $translations = array(
'New item' => 'Nouvel élément', 'New item' => 'Nouvel élément',
'Search' => 'Rechercher', 'Search' => 'Rechercher',
'Sort' => 'Ordonner', 'Sort' => 'Ordonner',
'DESC' => 'DESC',
'Limit' => 'Limit', 'Limit' => 'Limit',
'No rows.' => 'Aucun résultat', 'No rows.' => 'Aucun résultat',
'Action' => 'Action', 'Action' => 'Action',

View file

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

View file

@ -194,20 +194,9 @@ if (!$columns) {
echo "<input name='where[$i][val]' /></div>\n"; echo "<input name='where[$i][val]' /></div>\n";
echo "</fieldset>\n"; echo "</fieldset>\n";
echo "<fieldset><legend>" . lang('Sort') . "</legend>\n"; echo "<fieldset><legend>" . lang('Limit') . "</legend><div>";
$i = 0; echo hidden_fields(array("order" => (array) $_GET["order"], "desc" => (array) $_GET["desc"]));
foreach ((array) $_GET["order"] as $key => $val) { echo "<input name='limit' size='3' value=\"" . htmlspecialchars($limit) . "\" /></div></fieldset>\n";
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";
if (isset($text_length)) { 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"; 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) { if (!$j) {
echo '<thead><tr><td><label><input type="checkbox" name="all" value="1" />' . lang('whole result') . '</label></td>'; echo '<thead><tr><td><label><input type="checkbox" name="all" value="1" />' . lang('whole result') . '</label></td>';
foreach ($row as $key => $val) { 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"; 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)) { } 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>'; $val = '<a href="' . htmlspecialchars($SELF) . 'download=' . urlencode($_GET["select"]) . '&amp;field=' . urlencode($key) . '&amp;' . $unique_idf . '">' . lang('%d byte(s)', strlen($val)) . '</a>';
} else { } else {
if (!strlen(trim($val))) { if (intval($text_length) > 0 && preg_match('~blob|text~', $fields[$key]["type"])) {
$val = "&nbsp;"; $val = shorten_utf8($val, intval($text_length));
} 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)));
} else { } else {
$val = nl2br(htmlspecialchars($val)); $val = nl2br(htmlspecialchars($val));
if ($fields[$key]["type"] == "char") { if ($fields[$key]["type"] == "char") {