Show table links if driver supports indexes
This commit is contained in:
parent
1c0c335d38
commit
4b6d02cdf8
|
@ -80,7 +80,7 @@ if ($adminer->homepage()) {
|
||||||
foreach ($tables_list as $name => $type) {
|
foreach ($tables_list as $name => $type) {
|
||||||
$view = ($type !== null && !preg_match('~table~i', $type));
|
$view = ($type !== null && !preg_match('~table~i', $type));
|
||||||
echo '<tr' . odd() . '><td>' . checkbox(($view ? "views[]" : "tables[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');");
|
echo '<tr' . odd() . '><td>' . checkbox(($view ? "views[]" : "tables[]"), $name, in_array($name, $tables_views, true), "", "formUncheck('check-all');");
|
||||||
echo '<th>' . (support("table") ? '<a href="' . h(ME) . 'table=' . urlencode($name) . '" title="' . lang('Show structure') . '">' . h($name) . '</a>' : h($name));
|
echo '<th>' . (support("table") || support("indexes") ? '<a href="' . h(ME) . 'table=' . urlencode($name) . '" title="' . lang('Show structure') . '">' . h($name) . '</a>' : h($name));
|
||||||
if ($view) {
|
if ($view) {
|
||||||
echo '<td colspan="6"><a href="' . h(ME) . "view=" . urlencode($name) . '" title="' . lang('Alter view') . '">' . lang('View') . '</a>';
|
echo '<td colspan="6"><a href="' . h(ME) . "view=" . urlencode($name) . '" title="' . lang('Alter view') . '">' . lang('View') . '</a>';
|
||||||
echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '" title="' . lang('Select data') . '">?</a>';
|
echo '<td align="right"><a href="' . h(ME) . "select=" . urlencode($name) . '" title="' . lang('Select data') . '">?</a>';
|
||||||
|
@ -95,7 +95,7 @@ if ($adminer->homepage()) {
|
||||||
"Rows" => array("select", lang('Select data')),
|
"Rows" => array("select", lang('Select data')),
|
||||||
) as $key => $link) {
|
) as $key => $link) {
|
||||||
$id = " id='$key-" . h($name) . "'";
|
$id = " id='$key-" . h($name) . "'";
|
||||||
echo ($link ? "<td align='right'>" . (support("table") || $key == "Rows"
|
echo ($link ? "<td align='right'>" . (support("table") || $key == "Rows" || (support("indexes") && $key != "Data_length")
|
||||||
? "<a href='" . h(ME . "$link[0]=") . urlencode($name) . "'$id title='$link[1]'>?</a>"
|
? "<a href='" . h(ME . "$link[0]=") . urlencode($name) . "'$id title='$link[1]'>?</a>"
|
||||||
: "<span$id>?</span>"
|
: "<span$id>?</span>"
|
||||||
) : "<td id='$key-" . h($name) . "'> ");
|
) : "<td id='$key-" . h($name) . "'> ");
|
||||||
|
|
|
@ -128,8 +128,10 @@ username.form['auth[driver]'].onchange();
|
||||||
function selectLinks($tableStatus, $set = "") {
|
function selectLinks($tableStatus, $set = "") {
|
||||||
echo '<p class="links">';
|
echo '<p class="links">';
|
||||||
$links = array("select" => lang('Select data'));
|
$links = array("select" => lang('Select data'));
|
||||||
if (support("table")) {
|
if (support("table") || support("indexes")) {
|
||||||
$links["table"] = lang('Show structure');
|
$links["table"] = lang('Show structure');
|
||||||
|
}
|
||||||
|
if (support("table")) {
|
||||||
if (is_view($tableStatus)) {
|
if (is_view($tableStatus)) {
|
||||||
$links["view"] = lang('Alter view');
|
$links["view"] = lang('Alter view');
|
||||||
} else {
|
} else {
|
||||||
|
@ -854,7 +856,7 @@ username.form['auth[driver]'].onchange();
|
||||||
foreach ($tables as $table => $status) {
|
foreach ($tables as $table => $status) {
|
||||||
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table) . ">" . lang('select') . "</a> ";
|
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table) . ">" . lang('select') . "</a> ";
|
||||||
$name = $this->tableName($status);
|
$name = $this->tableName($status);
|
||||||
echo (support("table")
|
echo (support("table") || support("indexes")
|
||||||
? '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold(in_array($table, array($_GET["table"], $_GET["create"], $_GET["indexes"], $_GET["foreign"], $_GET["trigger"])), (is_view($status) ? "view" : "")) . " title='" . lang('Show structure') . "'>$name</a>"
|
? '<a href="' . h(ME) . 'table=' . urlencode($table) . '"' . bold(in_array($table, array($_GET["table"], $_GET["create"], $_GET["indexes"], $_GET["foreign"], $_GET["trigger"])), (is_view($status) ? "view" : "")) . " title='" . lang('Show structure') . "'>$name</a>"
|
||||||
: "<span>$name</span>"
|
: "<span>$name</span>"
|
||||||
) . "<br>\n";
|
) . "<br>\n";
|
||||||
|
|
|
@ -448,7 +448,7 @@ if (!$columns && support("table")) {
|
||||||
? $page + (count($rows) >= $limit ? 2 : 1)
|
? $page + (count($rows) >= $limit ? 2 : 1)
|
||||||
: floor(($found_rows - 1) / $limit)
|
: floor(($found_rows - 1) / $limit)
|
||||||
);
|
);
|
||||||
if (support("table")) {
|
if ($jush != "simpledb") {
|
||||||
echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "'), event); return false;\">" . lang('Page') . "</a>:";
|
echo '<a href="' . h(remove_from_uri("page")) . "\" onclick=\"pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "'), event); return false;\">" . lang('Page') . "</a>:";
|
||||||
echo pagination(0, $page) . ($page > 5 ? " ..." : "");
|
echo pagination(0, $page) . ($page > 5 ? " ..." : "");
|
||||||
for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
|
for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
|
||||||
|
|
|
@ -25,8 +25,9 @@ if ($fields) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_view($table_status)) {
|
if (!is_view($table_status)) {
|
||||||
if (support("indexes")) {
|
if (support("indexes")) {
|
||||||
echo "<h3 id='indexes'>" . lang('Indexes') . "</h3>\n";
|
echo "<h3 id='indexes'>" . lang('Indexes') . "</h3>\n";
|
||||||
$indexes = indexes($TABLE);
|
$indexes = indexes($TABLE);
|
||||||
|
@ -70,10 +71,9 @@ if ($fields) {
|
||||||
}
|
}
|
||||||
echo '<p class="links"><a href="' . h(ME) . 'foreign=' . urlencode($TABLE) . '">' . lang('Add foreign key') . "</a>\n";
|
echo '<p class="links"><a href="' . h(ME) . 'foreign=' . urlencode($TABLE) . '">' . lang('Add foreign key') . "</a>\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
if (support(is_view($table_status) ? "view_trigger" : "trigger")) {
|
||||||
|
|
||||||
if (support(is_view($table_status) ? "view_trigger" : "trigger")) {
|
|
||||||
echo "<h3 id='triggers'>" . lang('Triggers') . "</h3>\n";
|
echo "<h3 id='triggers'>" . lang('Triggers') . "</h3>\n";
|
||||||
$triggers = triggers($TABLE);
|
$triggers = triggers($TABLE);
|
||||||
if ($triggers) {
|
if ($triggers) {
|
||||||
|
@ -84,5 +84,4 @@ if ($fields) {
|
||||||
echo "</table>\n";
|
echo "</table>\n";
|
||||||
}
|
}
|
||||||
echo '<p class="links"><a href="' . h(ME) . 'trigger=' . urlencode($TABLE) . '">' . lang('Add trigger') . "</a>\n";
|
echo '<p class="links"><a href="' . h(ME) . 'trigger=' . urlencode($TABLE) . '">' . lang('Add trigger') . "</a>\n";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue