TIMESTAMP options for table creation and add field

This commit is contained in:
Marc Delisle
2005-03-31 20:36:49 +00:00
parent d567c19f1e
commit b83095b399
2 changed files with 28 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ $Source$
* Documentation.html: added FAQ 5.17 about problem with
Firefox when the Tabbrowser Extensions plugin is installed
* tbl_properties.inc.php: TIMESTAMP options improved looks, thanks to Garvin
* tbl_properties.inc.php: TIMESTAMP default CURRENT_TIMESTAMP checkbox
made dynamic, depending on the field's type.
2005-03-30 Alexander M. Turek <me@derrabus.de>
* server_databases.php: Bug #1172782 (Don't allow to drop

View File

@@ -2,6 +2,7 @@
/* $Id$ */
// vim: expandtab sw=4 ts=4 sts=4:
// Check parameters
require_once('./libraries/common.lib.php');
PMA_checkParameters(array('db','table','action','num_fields'));
@@ -20,6 +21,23 @@ var switch_movement = <?php echo $cfg['DefaultPropDisplay'] == 'horizontal' ? '0
document.onkeydown = onKeyDownArrowsHandler;
// -->
</script>
<?php }
// here, the div_x_7 represents a div id which contains
// the default current timestamp checkbox and label
if (PMA_MYSQL_INT_VERSION >= 40102) { ?>
<script type="text/javascript" language="javascript">
<!--
function display_field_options(field_type, i) {
if (field_type == 'TIMESTAMP') {
getElement('div_' + i + '_7').style.display = 'block';
} else {
getElement('div_' + i + '_7').style.display = 'none';
}
return true;
}
// -->
</script>
<?php } ?>
<form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" >
@@ -215,7 +233,7 @@ for ($i = 0 ; $i < $num_fields; $i++) {
$content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_name[]" size="10" maxlength="64" value="' . (isset($row) && isset($row['Field']) ? str_replace('"', '&quot;', $row['Field']) : '') . '" class="textfield" title="' . $strField . '" />';
$ci++;
$content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n";
$content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '" onchange="display_field_options(this.value,' . $i .')" >' . "\n";
if (empty($row['Type'])) {
$row['Type'] = '';
@@ -389,8 +407,13 @@ for ($i = 0 ; $i < $num_fields; $i++) {
}
$content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_default[]" size="12" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '&quot;', $row['Default']) : '') . '" class="textfield" />';
if (PMA_MYSQL_INT_VERSION >= 40102 && $type_upper == 'TIMESTAMP') {
$content_cells[$i][$ci] .= '<br /><div style="white-space: nowrap;"><input id="field_' . $i . '_' . ($ci - $ci_offset) . 'a" type="checkbox" name="field_default_current_timestamp[' . $i . ']"';
if (PMA_MYSQL_INT_VERSION >= 40102) {
if ($type_upper == 'TIMESTAMP') {
$tmp_display_type = 'block';
} else {
$tmp_display_type = 'none';
}
$content_cells[$i][$ci] .= '<br /><div id="div_' . $i . '_' . ($ci - $ci_offset) . '" style="white-space: nowrap; display: ' . $tmp_display_type . '"><input id="field_' . $i . '_' . ($ci - $ci_offset) . 'a" type="checkbox" name="field_default_current_timestamp[' . $i . ']"';
if ($default_current_timestamp) {
$content_cells[$i][$ci] .= ' checked="checked" ';
}