1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-15 11:04:02 +02:00
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@620 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2009-05-29 16:51:21 +00:00
parent a4ece841c5
commit 56e884fd2d
3 changed files with 25 additions and 16 deletions

View File

@@ -124,12 +124,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0) {
<td><input type="radio" name="auto_increment_col" value="" /><?php echo lang('Auto Increment'); ?></td>
<td<?php echo ($column_comments ? "" : " class='hidden'"); ?>><?php echo lang('Comment'); ?></td>
<?php } ?>
<td><input type="image" name="add[0]" src="plus.gif" title="<?php echo lang('Add next'); ?>" />
<script type="text/javascript">
var added = '.';
var row_count = <?php echo count($fields); ?>;
</script>
</td>
<td><input type="image" name="add[0]" src="plus.gif" title="<?php echo lang('Add next'); ?>" /><script type="text/javascript">row_count = <?php echo count($fields); ?>;</script></td>
</tr></thead>
<?php
foreach ($fields as $i => $field) {

View File

@@ -1,3 +1,5 @@
document.body.className = 'js';
function toggle(id) {
var el = document.getElementById(id);
el.className = (el.className == 'hidden' ? '' : 'hidden');
@@ -20,6 +22,8 @@ function tables_check(el) {
}
}
function where_change(op) {
for (var i=0; i < op.form.elements.length; i++) {
var el = op.form.elements[i];
@@ -46,11 +50,15 @@ function select_add_row(field) {
field.onchange = function () { };
}
var added = '.', row_count;
function editing_add_row(button, allowed) {
if (allowed && row_count >= allowed) {
return false;
}
var match = /([0-9]+)(\.[0-9]+)?/.exec(button.name)
var match = /([0-9]+)(\.[0-9]+)?/.exec(button.name);
var x = match[0] + (match[2] ? added.substr(match[2].length) : added) + '1';
var row = button.parentNode.parentNode;
var row2 = row.cloneNode(true);
@@ -119,6 +127,8 @@ function partition_name_change(el) {
el.onchange = function () {};
}
function foreign_add_row(field) {
var row = field.parentNode.parentNode.cloneNode(true);
var selects = row.getElementsByTagName('select');
@@ -130,6 +140,8 @@ function foreign_add_row(field) {
field.onchange = function () { };
}
function indexes_add_row(field) {
var row = field.parentNode.parentNode.cloneNode(true);
var spans = row.getElementsByTagName('span');
@@ -158,9 +170,12 @@ function indexes_add_column(field) {
field.onchange = function () { };
}
function schema_mousedown(el, event, top) {
var that, x, y, em, table_pos;
function schema_mousedown(el, event) {
that = el;
em = document.getElementById('schema').offsetHeight / top;
x = event.clientX - el.offsetLeft;
y = event.clientY - el.offsetTop;
}
@@ -223,6 +238,8 @@ function schema_mouseup(ev) {
}
}
function dump_check(a, name, value) {
var inputs = a.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('input');
for (var i=0; i < inputs.length; i++) {
@@ -232,5 +249,3 @@ function dump_check(a, name, value) {
}
return true;
}
document.body.className = 'js';

View File

@@ -50,17 +50,16 @@ while ($row = $result->fetch_assoc()) {
$result->free();
?>
<div id="schema" style="height: <?php echo $top; ?>em;">
<script type="text/javascript">
var that, x, y, em;
var table_pos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
table_pos = {<?php echo implode(",", $table_pos_js) . "\n"; ?>};
em = document.getElementById('schema').offsetHeight / <?php echo $top; ?>;
document.onmousemove = schema_mousemove;
document.onmouseup = schema_mouseup;
</script>
<div id="schema" style="height: <?php echo $top; ?>em;">
<?php
foreach ($schema as $name => $table) {
echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schema_mousedown(this, event, $top);'>";
echo "<div class='table' style='top: " . $table["pos"][0] . "em; left: " . $table["pos"][1] . "em;' onmousedown='schema_mousedown(this, event);'>";
echo '<a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($name) . '"><strong>' . htmlspecialchars($name) . "</strong></a><br />\n";
foreach ($table["fields"] as $field) {
$val = htmlspecialchars($field["field"]);