Browse files

Align numbers to right in select

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1149 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 83e8bac commit a1609c79acf988a3ce708123b56f7f26424d1194 jakubvrana committed Sep 25, 2009
Showing with 15 additions and 6 deletions.
  1. +6 −5 adminer/select.inc.php
  2. +1 −0 adminer/static/default.css
  3. +1 −0 changes.txt
  4. +7 −1 editor/include/adminer.inc.php
View
11 adminer/select.inc.php
@@ -127,7 +127,7 @@
$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 @@
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 (!$link && is_email($val)) {
$link = "mailto:$val";
}
- $val = $adminer->selectVal($val, $link, $fields[$key]);
+ $val = $adminer->selectVal($val, $link, $field);
echo "<td>$val";
}
}
View
1 adminer/static/default.css
@@ -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
1 changes.txt
@@ -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
8 editor/include/adminer.inc.php
@@ -147,7 +147,13 @@ function selectVal($val, $link, $field) {
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) {

0 comments on commit a1609c7

Please sign in to comment.