Skip to content

Commit

Permalink
Allow dropping remote foreign key
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1246 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Nov 19, 2009
1 parent 445c997 commit 36c2ae7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions adminer/foreign.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

<form action="" method="post">
<p>
<?php if (!strlen($row["db"])) { ?>
<?php echo lang('Target table'); ?>:
<?php echo html_select("table", array_keys(table_status_referencable()), $row["table"], "this.form['change-js'].value = '1'; this.form.submit();"); ?>
<input type="hidden" name="change-js" value="">
Expand All @@ -64,8 +65,9 @@
<?php echo lang('ON DELETE'); ?>: <?php echo html_select("on_delete", array(-1 => "") + $on_actions, $row["on_delete"]); ?>
<?php echo lang('ON UPDATE'); ?>: <?php echo html_select("on_update", array(-1 => "") + $on_actions, $row["on_update"]); ?>
<p>
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="submit" value="<?php echo lang('Save'); ?>">
<?php if (strlen($_GET["name"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?>
<noscript><p><input type="submit" name="add" value="<?php echo lang('Add column'); ?>"></noscript>
<?php } ?>
<?php if (strlen($_GET["name"])) { ?><input type="submit" name="drop" value="<?php echo lang('Drop'); ?>"<?php echo $confirm; ?>><?php } ?>
<input type="hidden" name="token" value="<?php echo $token; ?>">
</form>
2 changes: 1 addition & 1 deletion adminer/table.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
echo "<th><i>" . implode("</i>, <i>", array_map('h', $foreign_key["source"])) . "</i>";
echo "<td><a href='" . h(strlen($foreign_key["db"]) ? preg_replace('~db=[^&]*~', "db=" . urlencode($foreign_key["db"]), ME) : ME) . "table=" . urlencode($foreign_key["table"]) . "'>$link</a>";
echo "(<em>" . implode("</em>, <em>", array_map('h', $foreign_key["target"])) . "</em>)";
echo "<td>" . (!strlen($foreign_key["db"]) ? '<a href="' . h(ME . 'foreign=' . urlencode($TABLE) . '&name=' . urlencode($name)) . '">' . lang('Alter') . '</a>' : '&nbsp;');
echo '<td><a href="' . h(ME . 'foreign=' . urlencode($TABLE) . '&name=' . urlencode($name)) . '">' . lang('Alter') . '</a>';
}
echo "</table>\n";
}
Expand Down

0 comments on commit 36c2ae7

Please sign in to comment.