\n";
print " $text{'field_name'} \n";
print " \n";
print " \n" if (!$in{'type'});
if ($type =~ /^(\S+)\((.*)\)(.*)/) {
$type = $1;
$size = $2;
$extra = $3;
}
print " \n";
print " $text{'field_type'} \n";
if ($in{'type'}) {
# New field .. just show chosen type
print "$type \n";
}
else {
# Existing field .. allow type change
print "\n";
foreach $t (@type_list) {
printf "%s\n",
$t eq $type ? "selected" : "", $t;
}
print " $text{'field_typewarn'} \n";
}
if ($type eq 'enum' || $type eq 'set') {
# List of values
local @ev = &split_enum($size);
print " $text{'field_enum'} \n";
print " \n";
}
elsif ($type eq 'float' || $type eq 'double' || $type eq 'decimal') {
# Two values
print " $text{'field_dual'} \n";
printf " \n",
$size =~ /^(\d+)/ ? $1 : '';
printf " \n",
$size =~ /(\d+)$/ ? $1 : '';
}
elsif ($type eq 'date' || $type eq 'datetime' || $type eq 'time' ||
$type eq 'timestamp' || $type =~ /(blob|text)$/) {
# No width!
}
elsif ($type ne 'varchar' && $type ne 'char' && $in{'type'}) {
# Size is optional for new fields of most types
print " $text{'field_size'} \n";
print " ",
"$text{'default'}\n";
print " \n";
print " \n";
}
else {
# One single value
print " $text{'field_size'} \n";
print " \n";
}
if ($type =~ /int$/) {
# Display unsigned/zerofill option
print " $text{'field_opts'} \n";
printf " %s\n",
$extra =~ /unsigned/ ? '' : 'checked',
$text{'field_none'};
printf " %s\n",
$extra =~ /unsigned/ && $extra !~ /zerofill/ ? 'checked' : '',
$text{'field_unsigned'};
printf " %s \n",
$extra =~ /zerofill/ ? 'checked' : '',
$text{'field_zerofill'};
# Display auto-increment option
print " $text{'field_auto'} \n";
printf " %s\n",
'auto_increment',
$f->{'extra'} =~ /auto_increment/ ? 'checked' : '',
$text{'yes'};
printf " %s \n",
$f->{'extra'} =~ /auto_increment/ ? '' : 'checked',
$text{'no'};
}
elsif ($type eq 'float' || $type eq 'double' || $type eq 'decimal') {
# Display zerofill option
print " $text{'field_opts'} \n";
printf " %s\n",
$extra =~ /unsigned/ ? '' : 'checked',
$text{'field_none'};
printf " %s \n",
$extra =~ /zerofill/ ? 'checked' : '',
$text{'field_zerofill'};
}
elsif ($type eq 'char' || $type eq 'varchar') {
# Display binary option
print " $text{'field_opts'} \n";
printf " %s\n",
$extra =~ /binary/ ? '' : 'checked',
$text{'field_ascii'};
printf " %s \n",
$extra =~ /binary/ ? 'checked' : '',
$text{'field_binary'};
}
print " $text{'field_null'} \n";
printf " $text{'yes'}\n",
$in{'type'} || $f->{'null'} eq 'YES' ? 'checked' : '';
printf " $text{'no'} \n",
$in{'type'} || $f->{'null'} eq 'YES' ? '' : 'checked';
print " $text{'field_default'} \n";
printf " \n",
$f->{'default'} eq 'NULL' ? '' : $f->{'default'};
print " $text{'field_key'} \n";
printf " %s\n",
$f->{'key'} eq 'PRI' ? 'checked' : '', $text{'yes'};
printf " %s \n",
$f->{'key'} eq 'PRI' ? '' : 'checked', $text{'no'};
printf " \n",
$f->{'key'} eq 'PRI' ? 1 : 0;
print "