1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 01:24:17 +02:00

Move backward keys to Editor

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1134 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-09-23 14:28:06 +00:00
parent 06ce6828b1
commit 09e93ded96
3 changed files with 46 additions and 32 deletions

View File

@@ -174,16 +174,7 @@ if (!$columns) {
: count($rows)
);
$backward_keys = $adminer->backwardKeys($TABLE);
$table_names = array();
if ($backward_keys) {
foreach ($backward_keys as $key => $val) {
$val = $adminer->tableName(table_status($key));
if (strlen($val)) {
$table_names[$key] = (preg_match('(^' . preg_quote($table_name) . '(:|\\s*-)?\\s+(.+))', $val, $match) ? $match[2] : $val);
}
}
}
$backward_keys = $adminer->backwardKeys($TABLE, $table_name);
echo "<table cellspacing='0' class='nowrap' onclick='table_click(event);'>\n";
echo "<thead><tr><td><input type='checkbox' id='all-page' onclick='form_check(this, /check/);'>";
@@ -201,7 +192,7 @@ if (!$columns) {
}
next($select);
}
echo ($table_names ? "<th>" . lang('Relations') : "") . "</thead>\n";
echo ($backward_keys ? "<th>" . lang('Relations') : "") . "</thead>\n";
foreach ($adminer->rowDescriptions($rows, $foreign_keys) as $n => $row) {
$unique_idf = implode('&amp;', unique_idf($rows[$n], $indexes));
echo "<tr" . odd() . "><td><input type='checkbox' name='check[]' value='$unique_idf'" . (in_array(str_replace("&amp;", "&", $unique_idf), (array) $_POST["check"]) ? " checked" : "") . " onclick=\"this.form['all'].checked = false; form_uncheck('all-page');\">" . (count($select) != count($group) || information_schema(DB) ? '' : " <a href='" . h(ME) . "edit=" . urlencode($TABLE) . "&amp;$unique_idf'>" . lang('edit') . "</a>");
@@ -245,19 +236,7 @@ if (!$columns) {
echo "<td>$val";
}
}
if ($table_names) {
echo "<td>";
foreach ($table_names as $table => $name) {
foreach ($backward_keys[$table] as $cols) {
$link = ME . 'select=' . urlencode($table);
$i = 0;
foreach ($cols as $column => $val) {
$link .= where_link($i++, $column, $rows[$n][$val]);
}
echo " <a href='" . h($link) . "'>$name</a>";
}
}
}
$adminer->backwardKeysPrint($backward_keys, $rows[$n]);
echo "\n";
}
echo "</table>\n";