Show table links if driver supports indexes

This commit is contained in:
Jakub Vrana 2014-01-09 00:06:59 -08:00
parent 1c0c335d38
commit 4b6d02cdf8
4 changed files with 61 additions and 60 deletions

View file

@ -80,7 +80,7 @@ if ($adminer->homepage()) {
foreach ($tables_list as $name => $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 '<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) {
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>';
@ -95,7 +95,7 @@ if ($adminer->homepage()) {
"Rows" => array("select", lang('Select data')),
) as $key => $link) {
$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>"
: "<span$id>?</span>"
) : "<td id='$key-" . h($name) . "'>&nbsp;");

View file

@ -128,8 +128,10 @@ username.form['auth[driver]'].onchange();
function selectLinks($tableStatus, $set = "") {
echo '<p class="links">';
$links = array("select" => lang('Select data'));
if (support("table")) {
if (support("table") || support("indexes")) {
$links["table"] = lang('Show structure');
}
if (support("table")) {
if (is_view($tableStatus)) {
$links["view"] = lang('Alter view');
} else {
@ -854,7 +856,7 @@ username.form['auth[driver]'].onchange();
foreach ($tables as $table => $status) {
echo '<a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table) . ">" . lang('select') . "</a> ";
$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>"
: "<span>$name</span>"
) . "<br>\n";

View file

@ -448,7 +448,7 @@ if (!$columns && support("table")) {
? $page + (count($rows) >= $limit ? 2 : 1)
: 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 pagination(0, $page) . ($page > 5 ? " ..." : "");
for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {

View file

@ -25,8 +25,9 @@ if ($fields) {
echo "\n";
}
echo "</table>\n";
}
if (!is_view($table_status)) {
if (!is_view($table_status)) {
if (support("indexes")) {
echo "<h3 id='indexes'>" . lang('Indexes') . "</h3>\n";
$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";
}
}
}
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";
$triggers = triggers($TABLE);
if ($triggers) {
@ -84,5 +84,4 @@ if ($fields) {
echo "</table>\n";
}
echo '<p class="links"><a href="' . h(ME) . 'trigger=' . urlencode($TABLE) . '">' . lang('Add trigger') . "</a>\n";
}
}