1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-30 09:39:51 +02:00

Show second link for editing a table under the table view, add table head to indexes

This commit is contained in:
Peter Knut
2024-09-23 10:01:55 +02:00
parent 0f2e04730f
commit 1de9275f11
2 changed files with 15 additions and 1 deletions

View File

@@ -366,9 +366,12 @@ class Adminer {
*/ */
function tableIndexesPrint($indexes) { function tableIndexesPrint($indexes) {
echo "<table cellspacing='0'>\n"; echo "<table cellspacing='0'>\n";
echo "<thead><tr><th>" . lang('Type') . "</th><td>" . lang('Column (length)') . "</td></tr></thead>\n";
foreach ($indexes as $name => $index) { foreach ($indexes as $name => $index) {
ksort($index["columns"]); // enforce correct columns order ksort($index["columns"]); // enforce correct columns order
$print = array(); $print = [];
foreach ($index["columns"] as $key => $val) { foreach ($index["columns"] as $key => $val) {
$print[] = "<i>" . h($val) . "</i>" $print[] = "<i>" . h($val) . "</i>"
. ($index["lengths"][$key] ? "(" . $index["lengths"][$key] . ")" : "") . ($index["lengths"][$key] ? "(" . $index["lengths"][$key] . ")" : "")
@@ -377,6 +380,7 @@ class Adminer {
} }
echo "<tr title='" . h($name) . "'><th>$index[type]<td>" . implode(", ", $print) . "\n"; echo "<tr title='" . h($name) . "'><th>$index[type]<td>" . implode(", ", $print) . "\n";
} }
echo "</table>\n"; echo "</table>\n";
} }

View File

@@ -28,10 +28,20 @@ if ($comment != "") {
if ($fields) { if ($fields) {
$adminer->tableStructurePrint($fields); $adminer->tableStructurePrint($fields);
if (is_view($table_status)) {
$editLink = '<p class="links"><a href="' . h(ME) . 'view=' . urlencode($TABLE) . '">' . lang('Alter view') . "</a>\n";
} else {
$editLink = '<p class="links"><a href="' . h(ME) . 'create=' . urlencode($TABLE) . '">' . lang('Alter table') . "</a>\n";
}
echo $editLink;
if (support("partitioning") && preg_match("~partitioned~", $table_status["Create_options"])) { if (support("partitioning") && preg_match("~partitioned~", $table_status["Create_options"])) {
echo "<h3 id='partition-by'>" . lang('Partition by') . "</h3>\n"; echo "<h3 id='partition-by'>" . lang('Partition by') . "</h3>\n";
$partitions_info = get_partitions_info($TABLE); $partitions_info = get_partitions_info($TABLE);
$adminer->tablePartitionsPrint($partitions_info); $adminer->tablePartitionsPrint($partitions_info);
echo $editLink;
} }
} }