Separate type_change()
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@199 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
67096cd08f
commit
93c27c9515
|
@ -96,7 +96,10 @@ $collations = collations();
|
||||||
<select name="Collation"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $row["Collation"]); ?></select>
|
<select name="Collation"><option value="">(<?php echo lang('collation'); ?>)</option><?php echo optionlist($collations, $row["Collation"]); ?></select>
|
||||||
<input type="submit" value="<?php echo lang('Save'); ?>" />
|
<input type="submit" value="<?php echo lang('Save'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
|
<table border="0" cellspacing="0" cellpadding="2">
|
||||||
<?php $column_comments = edit_fields($row["fields"], $collations); ?>
|
<?php $column_comments = edit_fields($row["fields"], $collations); ?>
|
||||||
|
</table>
|
||||||
|
<?php echo type_change(count($row["fields"])); ?>
|
||||||
<p><?php echo lang('Comment'); ?>: <input name="Comment" value="<?php echo htmlspecialchars($row["Comment"]); ?>" maxlength="60" />
|
<p><?php echo lang('Comment'); ?>: <input name="Comment" value="<?php echo htmlspecialchars($row["Comment"]); ?>" maxlength="60" />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
document.write('<label for="column_comments"><input type="checkbox" id="column_comments"<?php if ($column_comments) { ?> checked="checked"<?php } ?> onclick="column_comments_click(this.checked);" /><?php echo lang('Show column comments'); ?></label>');
|
document.write('<label for="column_comments"><input type="checkbox" id="column_comments"<?php if ($column_comments) { ?> checked="checked"<?php } ?> onclick="column_comments_click(this.checked);" /><?php echo lang('Show column comments'); ?></label>');
|
||||||
|
|
|
@ -80,7 +80,6 @@ function process_type($field) {
|
||||||
function edit_fields($fields, $collations, $type = "TABLE") {
|
function edit_fields($fields, $collations, $type = "TABLE") {
|
||||||
global $inout;
|
global $inout;
|
||||||
?>
|
?>
|
||||||
<table border="0" cellspacing="0" cellpadding="2">
|
|
||||||
<thead><tr>
|
<thead><tr>
|
||||||
<?php if ($type == "PROCEDURE") { ?><td><?php echo lang('In-Out'); ?></td><?php } ?>
|
<?php if ($type == "PROCEDURE") { ?><td><?php echo lang('In-Out'); ?></td><?php } ?>
|
||||||
<th><?php echo lang('Column name'); ?></th>
|
<th><?php echo lang('Column name'); ?></th>
|
||||||
|
@ -95,10 +94,10 @@ function edit_fields($fields, $collations, $type = "TABLE") {
|
||||||
<td><input type="submit" name="add[0]" value="<?php echo lang('Add next'); ?>" /></td>
|
<td><input type="submit" name="add[0]" value="<?php echo lang('Add next'); ?>" /></td>
|
||||||
</tr></thead>
|
</tr></thead>
|
||||||
<?php
|
<?php
|
||||||
$column_comments = false;
|
$column_comments = false;
|
||||||
foreach ($fields as $i => $field) {
|
foreach ($fields as $i => $field) {
|
||||||
$i++;
|
$i++;
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<?php if ($type == "PROCEDURE") { ?><td><select name="inout"><?php echo optionlist($inout, $field["inout"]); ?></select></td><?php } ?>
|
<?php if ($type == "PROCEDURE") { ?><td><select name="inout"><?php echo optionlist($inout, $field["inout"]); ?></select></td><?php } ?>
|
||||||
<th><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo htmlspecialchars($field[($_POST ? "orig" : "field")]); ?>" /><input name="fields[<?php echo $i; ?>][field]" value="<?php echo htmlspecialchars($field["field"]); ?>" maxlength="64" /></th>
|
<th><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo htmlspecialchars($field[($_POST ? "orig" : "field")]); ?>" /><input name="fields[<?php echo $i; ?>][field]" value="<?php echo htmlspecialchars($field["field"]); ?>" maxlength="64" /></th>
|
||||||
|
@ -111,25 +110,27 @@ foreach ($fields as $i => $field) {
|
||||||
<td><input type="submit" name="add[<?php echo $i; ?>]" value="<?php echo lang('Add next'); ?>" /></td>
|
<td><input type="submit" name="add[<?php echo $i; ?>]" value="<?php echo lang('Add next'); ?>" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
if (strlen($field["comment"])) {
|
if (strlen($field["comment"])) {
|
||||||
$column_comments = true;
|
$column_comments = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//! JavaScript for next rows
|
||||||
|
return $column_comments;
|
||||||
}
|
}
|
||||||
//! JavaScript for next rows
|
|
||||||
|
function type_change($count) {
|
||||||
?>
|
?>
|
||||||
</table>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function type_change(type) {
|
function type_change(type) {
|
||||||
var name = type.name.substr(0, type.name.length - 6);
|
var name = type.name.substr(0, type.name.length - 6);
|
||||||
type.form[name + '[collation]'].style.display = (/char|text|enum|set/.test(type.form[name + '[type]'].value) ? '' : 'none');
|
type.form[name + '[collation]'].style.display = (/char|text|enum|set/.test(type.form[name + '[type]'].value) ? '' : 'none');
|
||||||
type.form[name + '[unsigned]'].style.display = (/int|float|double|decimal/.test(type.form[name + '[type]'].value) ? '' : 'none');
|
type.form[name + '[unsigned]'].style.display = (/int|float|double|decimal/.test(type.form[name + '[type]'].value) ? '' : 'none');
|
||||||
}
|
}
|
||||||
for (var i=1; <?php echo count($fields); ?> >= i; i++) {
|
for (var i=1; <?php echo $count; ?> >= i; i++) {
|
||||||
document.getElementById('form')['fields[' + i + '][type]'].onchange();
|
document.getElementById('form')['fields[' + i + '][type]'].onchange();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
return $column_comments;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function routine($name, $type) {
|
function routine($name, $type) {
|
||||||
|
|
Loading…
Reference in a new issue