mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Fixed default inputs
This commit is contained in:
@@ -80,3 +80,4 @@ The correct character set is ready from my.cnf when connecting using DBI mode, t
|
||||
The password is passed to all MySQL commands using the MYSQL_PWD environment variables on systems running MySQL 4.1 and later, version 5.1 in older Webmin releases.
|
||||
---- Changes since 1.450 ----
|
||||
Use DBI for listing databases and tables, to reduce dependency on the un-reliable MYSQL_PWD environment variable.
|
||||
Fixed the input for setting the default value for fields.
|
||||
|
||||
@@ -114,12 +114,18 @@ print &ui_table_row($text{'field_null'},
|
||||
[ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]));
|
||||
|
||||
# Default value
|
||||
$defmode = $f->{'default'} eq 'NULL' ? 0 :
|
||||
$defmode = $f->{'default'} eq 'NULL' || !defined($f->{'default'}) ? 0 :
|
||||
$f->{'default'} eq 'CURRENT_TIMESTAMP' ? 2 :
|
||||
$f->{'default'} eq '' ? 3 : 1;
|
||||
@defs = ( [ 3, $in{'type'} ? $text{'field_defnone'}
|
||||
: $text{'field_defleave'} ],
|
||||
[ 0, 'NULL' ] );
|
||||
@defs = ( [ 0, 'NULL' ] );
|
||||
if ($in{'type'}) {
|
||||
# Let MySQL decide
|
||||
push(@defs, [ 3, $text{'field_defdef'} ]);
|
||||
}
|
||||
elsif ($type eq 'char' || $type eq 'varchar') {
|
||||
# Empty string
|
||||
push(@defs, [ 3, $text{'field_defempty'} ]);
|
||||
}
|
||||
if ($type eq "timestamp") {
|
||||
push(@defs, [ 2, $text{'field_current'} ]);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,8 @@ foreach $r (@desc) {
|
||||
$r->{'key'} eq 'PRI' ? $text{'table_pri'} :
|
||||
$r->{'key'} eq 'MUL' ? $text{'table_mul'} :
|
||||
$text{'table_none'});
|
||||
push(@cols, &html_escape($r->{'default'}));
|
||||
push(@cols, &html_escape(defined($r->{'default'}) ? $r->{'default'}
|
||||
: 'NULL'));
|
||||
push(@cols, &html_escape($r->{'extra'}));
|
||||
print &ui_checked_columns_row(\@cols, \@tds, "d", $r->{'field'});
|
||||
$i++;
|
||||
|
||||
@@ -167,7 +167,9 @@ field_null=Allow nulls?
|
||||
field_default=Default value
|
||||
field_current=Current time
|
||||
field_defval=Value
|
||||
field_defdef=MySQL default
|
||||
field_defnone=No default
|
||||
field_defempty=Empty string
|
||||
field_defleave=Don't change
|
||||
field_dmode0=None
|
||||
field_dmode1=Null
|
||||
|
||||
@@ -212,6 +212,7 @@ return @rv;
|
||||
# Returns a list of hashes detailing the structure of a table
|
||||
sub table_structure
|
||||
{
|
||||
#local $config{'nodbi'} = 1;
|
||||
local $s = &execute_sql_safe($_[0], "desc "."estr($_[1]));
|
||||
local (@rv, $r);
|
||||
local (%tp, $i);
|
||||
|
||||
@@ -16,7 +16,7 @@ elsif ($in{'default_def'} == 2) {
|
||||
$default = "default CURRENT_TIMESTAMP";
|
||||
}
|
||||
elsif ($in{'default_def'} == 3) {
|
||||
$default = $in{'new'} ? "" : "default none";
|
||||
$default = $in{'new'} ? "" : "default ''";
|
||||
}
|
||||
else {
|
||||
$default = "default '$in{'default'}'";
|
||||
|
||||
Reference in New Issue
Block a user