Display table links above table structure
Move body_load back to <body onload> git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1119 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
d3227c963f
commit
f2ed2379bd
|
@ -66,12 +66,24 @@ class Adminer {
|
|||
return '<span title="' . h($field["full_type"]) . '">' . h($field["field"]) . '</span>';
|
||||
}
|
||||
|
||||
/** Links after select heading
|
||||
/** Print links after select heading
|
||||
* @param array result of SHOW TABLE STATUS
|
||||
* @return string
|
||||
* @param strin new item options, NULL for no new item
|
||||
* @return null
|
||||
*/
|
||||
function selectLinks($tableStatus) {
|
||||
return '<a href="' . h(ME) . 'table=' . urlencode($_GET['select']) . '">' . lang('Table structure') . '</a>';
|
||||
function selectLinks($tableStatus, $set = "") {
|
||||
$TABLE = $tableStatus["Name"];
|
||||
echo '<p><a href="' . h(ME) . 'select=' . urlencode($TABLE) . '">' . lang('Select table') . '</a>';
|
||||
echo ' <a href="' . h(ME) . 'table=' . urlencode($TABLE) . '">' . lang('Table structure') . '</a>';
|
||||
if (isset($tableStatus["Rows"])) {
|
||||
echo ' <a href="' . h(ME) . 'create=' . urlencode($TABLE) . '">' . lang('Alter table') . '</a>';
|
||||
} else {
|
||||
echo ' <a href="' . h(ME) . 'view=' . urlencode($TABLE) . '">' . lang('Alter view') . '</a>';
|
||||
}
|
||||
if (isset($set)) {
|
||||
echo ' <a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . '</a>';
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
/** Find backward keys for table
|
||||
|
@ -421,10 +433,6 @@ class Adminer {
|
|||
<span class="version"><?php echo $VERSION; ?></span>
|
||||
<a href="http://www.adminer.org/#download" id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
|
||||
</h1>
|
||||
<script type="text/javascript">
|
||||
body_load();
|
||||
<?php echo (isset($_COOKIE["adminer_version"]) ? "" : "verify_version();"); ?>
|
||||
</script>
|
||||
<?php
|
||||
if ($missing != "auth") {
|
||||
$databases = get_databases();
|
||||
|
|
|
@ -15,7 +15,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
|||
<link rel="stylesheet" type="text/css" href="adminer.css">
|
||||
<?php } ?>
|
||||
|
||||
<body>
|
||||
<body onload="body_load();<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verify_version();"); ?>">
|
||||
<script type="text/javascript" src="../adminer/functions.js"></script>
|
||||
<script type="text/javascript" src="editing.js"></script>
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ if ($_POST && !$error) {
|
|||
$table_name = $adminer->tableName($table_status);
|
||||
page_header(lang('Select') . ": $table_name", $error);
|
||||
|
||||
echo "<p>";
|
||||
$set = null;
|
||||
if (isset($rights["insert"])) {
|
||||
$set = "";
|
||||
foreach ((array) $_GET["where"] as $val) {
|
||||
|
@ -132,9 +132,8 @@ if (isset($rights["insert"])) {
|
|||
$set .= "&set" . urlencode("[" . bracket_escape($val["col"]) . "]") . "=" . urlencode($val["val"]);
|
||||
}
|
||||
}
|
||||
echo '<a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . '</a> ';
|
||||
}
|
||||
echo $adminer->selectLinks($table_status);
|
||||
$adminer->selectLinks($table_status, $set);
|
||||
|
||||
if (!$columns) {
|
||||
echo "<p class='error'>" . lang('Unable to select the table') . ($fields ? "" : ": " . h($dbh->error)) . ".\n";
|
||||
|
|
|
@ -5,9 +5,9 @@ if (!$result) {
|
|||
$error = h($dbh->error);
|
||||
}
|
||||
$table_status = ($result ? table_status($TABLE) : array());
|
||||
$is_view = !isset($table_status["Rows"]);
|
||||
|
||||
page_header(($result && $is_view ? lang('View') : lang('Table')) . ": " . h($TABLE), $error);
|
||||
$adminer->selectLinks($table_status);
|
||||
|
||||
if ($result) {
|
||||
echo "<table cellspacing='0'>\n";
|
||||
|
@ -20,16 +20,7 @@ if ($result) {
|
|||
}
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<p>";
|
||||
if ($is_view) {
|
||||
echo '<a href="' . h(ME) . 'view=' . urlencode($TABLE) . '">' . lang('Alter view') . '</a>';
|
||||
} else {
|
||||
echo '<a href="' . h(ME) . 'create=' . urlencode($TABLE) . '">' . lang('Alter table') . '</a>';
|
||||
}
|
||||
echo ' <a href="' . h(ME) . 'select=' . urlencode($TABLE) . '">' . lang('Select table') . '</a>';
|
||||
echo ' <a href="' . h(ME) . 'edit=' . urlencode($TABLE) . '">' . lang('New item') . '</a>';
|
||||
|
||||
if (!$is_view) {
|
||||
if (isset($table_status["Rows"])) {
|
||||
echo "<h3>" . lang('Indexes') . "</h3>\n";
|
||||
$indexes = indexes($TABLE);
|
||||
if ($indexes) {
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
// Editor specific functions
|
||||
|
||||
function body_load() {
|
||||
}
|
||||
|
|
|
@ -39,8 +39,11 @@ class Adminer {
|
|||
return h(strlen($field["comment"]) ? $field["comment"] : $field["field"]);
|
||||
}
|
||||
|
||||
function selectLinks($tableStatus) {
|
||||
return "";
|
||||
function selectLinks($tableStatus, $set = "") {
|
||||
$TABLE = $tableStatus["Name"];
|
||||
if (isset($set)) {
|
||||
echo '<p><a href="' . h(ME . 'edit=' . urlencode($TABLE) . $set) . '">' . lang('New item') . "</a>\n";
|
||||
}
|
||||
}
|
||||
|
||||
function backwardKeys($table) {
|
||||
|
@ -356,7 +359,6 @@ ORDER BY ORDINAL_POSITION"); //! requires MySQL 5
|
|||
<a href="http://www.adminer.org/editor/#download" id="version"><?php echo (version_compare($VERSION, $_COOKIE["adminer_version"]) < 0 ? h($_COOKIE["adminer_version"]) : ""); ?></a>
|
||||
</h1>
|
||||
<?php
|
||||
echo (isset($_COOKIE["adminer_version"]) ? "" : "<script type='text/javascript'>verify_version();</script>\n");
|
||||
if ($missing != "auth") {
|
||||
?>
|
||||
<form action="" method="post">
|
||||
|
|
Loading…
Reference in a new issue