Align numbers to right in select

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1149 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-09-25 14:52:30 +00:00
parent 83e8bac503
commit a1609c79ac
4 changed files with 15 additions and 6 deletions

View file

@ -127,7 +127,7 @@ if (isset($rights["insert"])) {
$set = "";
foreach ((array) $_GET["where"] as $val) {
if (count($foreign_keys[$val["col"]]) == 1 && ($val["op"] == "="
|| ($val["op"] == "" && !ereg('[_%]', $val["val"])) // LIKE in Editor
|| (!$val["op"] && !ereg('[_%]', $val["val"])) // LIKE in Editor
)) {
$set .= "&set" . urlencode("[" . bracket_escape($val["col"]) . "]") . "=" . urlencode($val["val"]);
}
@ -198,20 +198,21 @@ if (!$columns) {
echo "<tr" . odd() . "><td>" . checkbox("check[]", $unique_idf, in_array($unique_idf, (array) $_POST["check"]), "", "this.form['all'].checked = false; form_uncheck('all-page');") . (count($select) != count($group) || information_schema(DB) ? '' : " <a href='" . h(ME . "edit=" . urlencode($TABLE) . "&$unique_idf") . "'>" . lang('edit') . "</a>");
foreach ($row as $key => $val) {
if (isset($names[$key])) {
$field = $fields[$key];
if (strlen($val) && (!isset($email_fields[$key]) || strlen($email_fields[$key]))) {
$email_fields[$key] = (is_email($val) ? $names[$key] : ""); //! filled e-mails may be contained on other pages
}
$link = "";
$val = $adminer->editVal($val, $fields[$key]);
$val = $adminer->editVal($val, $field);
if (!isset($val)) {
$val = "<i>NULL</i>";
} else {
if (ereg('blob|binary', $fields[$key]["type"]) && strlen($val)) {
if (ereg('blob|binary', $field["type"]) && strlen($val)) {
$link = h(ME . 'download=' . urlencode($TABLE) . '&field=' . urlencode($key) . "&$unique_idf");
}
if (!strlen($val)) {
$val = "&nbsp;";
} elseif (strlen($text_length) && ereg('blob|text', $fields[$key]["type"]) && is_utf8($val)) {
} elseif (strlen($text_length) && ereg('text|blob', $field["type"]) && is_utf8($val)) {
$val = whitespace(shorten_utf8($val, max(0, intval($text_length)))); // usage of LEFT() would reduce traffic but complicate query
} else {
$val = whitespace(h($val));
@ -232,7 +233,7 @@ if (!$columns) {
if (!$link && is_email($val)) {
$link = "mailto:$val";
}
$val = $adminer->selectVal($val, $link, $fields[$key]);
$val = $adminer->selectVal($val, $link, $field);
echo "<td>$val";
}
}

View file

@ -30,6 +30,7 @@ tr:hover td, tr:hover th { background: #ddf; }
.odd td { background: #F5F5F5; }
.time { color: silver; font-size: 70%; float: right; margin-top: -3em; }
.function { text-align: right; }
.number { text-align: right; }
.type { width: 15ex; width: auto\9; }
#menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; overflow: auto; overflow-y: hidden; white-space: nowrap; }
#menu p { padding: .8em 1em; margin: 0; border-bottom: 1px solid #ccc; }

View file

@ -6,6 +6,7 @@ Display number of manipulated rows in JS confirm
E-mail attachments (Editor)
Optional year in date (Editor)
Search operators (Editor)
Align numbers to right in select (Editor)
Move <h1> to $adminer->navigation (customization)
Rename get_dbh to connection (customization)

View file

@ -147,7 +147,13 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
if ($field["full_type"] == "tinyint(1)" && $return != "&nbsp;") { // bool
$return = '<img src="' . ($val ? "../adminer/static/plus.gif" : "../adminer/static/cross.gif") . '" alt="' . h($val) . '">';
}
return ($link ? "<a href='$link'>$return</a>" : $return);
if ($link) {
$return = "<a href='$link'>$return</a>";
}
if (!$link && $field["full_type"] != "tinyint(1)" && ereg('int|float|double|decimal', $field["type"])) {
$return = "<div class='number'>$return</div>"; // Firefox doesn't support <colgroup>
}
return $return;
}
function editVal($val, $field) {