1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-08 07:36:44 +02:00

Separate type_class

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@824 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-07-14 08:45:24 +00:00
parent acaa05d887
commit 3015aed76b
2 changed files with 13 additions and 13 deletions

View File

@@ -38,6 +38,18 @@ function process_type($field, $collate = "COLLATE") {
; ;
} }
function type_class($type) {
if (ereg('char|text', $type)) {
return " class='char'";
} elseif (ereg('date|time|year', $type)) {
return " class='date'";
} elseif (ereg('binary|blob', $type)) {
return " class='binary'";
} elseif (ereg('enum|set', $type)) {
return " class='enum'";
}
}
function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $foreign_keys = array()) { function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $foreign_keys = array()) {
global $inout; global $inout;
$column_comments = false; $column_comments = false;

View File

@@ -62,19 +62,7 @@ foreach ($schema as $name => $table) {
echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schema_mousedown(this, event);'>"; echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schema_mousedown(this, event);'>";
echo '<a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($name) . '"><strong>' . htmlspecialchars($name) . "</strong></a><br>\n"; echo '<a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($name) . '"><strong>' . htmlspecialchars($name) . "</strong></a><br>\n";
foreach ($table["fields"] as $field) { foreach ($table["fields"] as $field) {
$val = htmlspecialchars($field["field"]); $val = '<span' . type_class($field["type"]) . ' title="' . htmlspecialchars($field["full_type"] . ($field["null"] ? " " . lang('NULL') : '')) . '">' . htmlspecialchars($field["field"]) . '</span>';
$title = ' title="' . htmlspecialchars($field["full_type"] . ($field["null"] ? " " . lang('NULL') : '')) . '"';
if (ereg('char|text', $field["type"])) {
$val = "<span class='char'$title>$val</span>";
} elseif (ereg('date|time|year', $field["type"])) {
$val = "<span class='date'$title>$val</span>";
} elseif (ereg('binary|blob', $field["type"])) {
$val = "<span class='binary'$title>$val</span>";
} elseif (ereg('enum|set', $field["type"])) {
$val = "<span class='enum'$title>$val</span>";
} else {
$val = "<span$title>$val</span>";
}
echo ($field["primary"] ? "<em>$val</em>" : $val) . "<br>\n"; echo ($field["primary"] ? "<em>$val</em>" : $val) . "<br>\n";
} }
foreach ((array) $table["references"] as $target_name => $refs) { foreach ((array) $table["references"] as $target_name => $refs) {