]> git.joonet.de Git - adminer.git/commitdiff
Align numbers right (bug #912)
authorJakub Vrana <jakub@vrana.cz>
Sat, 15 Mar 2025 14:13:41 +0000 (15:13 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sat, 15 Mar 2025 14:13:41 +0000 (15:13 +0100)
adminer/include/editing.inc.php
adminer/select.inc.php
changes.txt
editor/include/adminer.inc.php

index 297e1da577e11d5ccc5c7aab998cc88682acbca6..eb1c05543185c4575fca7a504831bee6b4e06ae2 100644 (file)
@@ -90,7 +90,8 @@ function select($result, $connection2 = null, $orgtables = array(), $limit = 0)
                        if ($link) {
                                $val = "<a href='" . h($link) . "'" . (is_url($link) ? target_blank() : '') . ">$val</a>";
                        }
-                       echo "<td>$val";
+                       // https://dev.mysql.com/doc/dev/mysql-server/latest/field__types_8h.html
+                       echo "<td" . ($types[$key] <= 9 || $types[$key] == 246 ? " class='number'" : "") . ">$val";
                }
        }
        echo ($i ? "</table>\n</div>" : "<p class='message'>" . lang('No rows.')) . "\n";
index 32688b24a0b33a8e00000b81eaeb86984ed8daf6..83122c6eb5ac7a0be3097a1982c28367c9ea090a 100644 (file)
@@ -453,7 +453,7 @@ if (!$columns && support("table")) {
                                                $value = $_POST["val"][$unique_idf][bracket_escape($key)];
                                                $editable = !is_array($row[$key]) && is_utf8($val) && $rows[$n][$key] == $row[$key] && !$functions[$key] && !$field["generated"];
                                                $text = preg_match('~text|json|lob~', $field["type"]);
-                                               echo "<td id='$id'";
+                                               echo "<td id='$id'" . (preg_match(number_type(), $field["type"]) ? " class='number'" : "");
                                                if (($_GET["modify"] && $editable) || $value !== null) {
                                                        $h_value = h($value !== null ? $value : $row[$key]);
                                                        echo ">" . ($text ? "<textarea name='$id' cols='30' rows='" . (substr_count($row[$key], "\n") + 1) . "'>$h_value</textarea>" : "<input name='$id' value='$h_value' size='$lengths[$key]'>");
index 58f8d0c827617269d090c8904dcd9c476ad6d4f1..a53e2dfda7172db28436b44917e3be41e921ad1c 100644 (file)
@@ -1,4 +1,5 @@
 Adminer dev:
+Align numbers right (bug #912)
 CSS: Dark mode syntax highlighting
 SQL textarea: Open help on Ctrl+click
 Designs named adminer-dark.css use dark basic style
index 0516eacc38bdc67f30c1309c211d66d545a90eb9..6ab6da82238c1b21ed70e090470a650bc1e78cc8 100644 (file)
@@ -213,9 +213,8 @@ ORDER BY ORDINAL_POSITION", null, "") as $row //! requires MySQL 5
                if ($link) {
                        $return = "<a href='$link'" . (is_url($link) ? target_blank() : "") . ">$return</a>";
                }
-               if (!$link && !like_bool($field) && preg_match(number_type(), $field["type"])) {
-                       $return = "<div class='number'>$return</div>"; // Firefox doesn't support <colgroup>
-               } elseif (preg_match('~date~', $field["type"])) {
+               // Firefox doesn't support <colgroup>
+               if (preg_match('~date~', $field["type"])) {
                        $return = "<div class='datetime'>$return</div>";
                }
                return $return;