diff --git a/mysql/CHANGELOG b/mysql/CHANGELOG index b45397fca..6e019df47 100644 --- a/mysql/CHANGELOG +++ b/mysql/CHANGELOG @@ -65,3 +65,4 @@ When testing if a user can login, no specific database is used in case the user When there are too many databases, huge lists of all databases and tables are not shown on the Table Permissions and Field Permissions pages. Instead, text boxes for entering names are shown. System variables can now be searched using a new field, making it easier to find the one you want from the large list on some systems. Re-designed the Execute SQL page to use tabs. +Converted all user interface code to use the new Webmin UI library, for a more consistent look. diff --git a/mysql/edit_field.cgi b/mysql/edit_field.cgi index e1daf0d5e..c2b87ef75 100755 --- a/mysql/edit_field.cgi +++ b/mysql/edit_field.cgi @@ -20,53 +20,47 @@ else { $type = $f->{'type'}; } -print "
\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "
$text{'field_header'}
\n"; +# Start of form +print &ui_form_start("save_field.cgi"); +print &ui_hidden("db", $in{'db'}); +print &ui_hidden("table", $in{'table'}); +print &ui_hidden("new", $in{'type'}); +print &ui_table_start($text{'field_header'}, undef, 2); -print "\n"; -print "\n"; -print "\n" if (!$in{'type'}); +# Field name +print &ui_table_row($text{'field_name'}, + &ui_textbox("field", $f->{'field'}, 20)); +print &ui_hidden("old", $f->{'field'}) if (!$in{'type'}); +# Type if ($type =~ /^(\S+)\((.*)\)(.*)/) { $type = $1; $size = $2; $extra = $3; } -print "\n"; -print "\n"; +print &ui_hidden("type", $type); if ($in{'type'}) { # New field .. just show chosen type - print "\n"; + $tsel = $type; } else { # Existing field .. allow type change - print "\n"; + $tsel = &ui_select("newtype", $type, \@type_list)." ". + $text{'field_typewarn'}; } +print &ui_table_row($text{'field_type'}, $tsel); if ($type eq 'enum' || $type eq 'set') { # List of values local @ev = &split_enum($size); - print "\n"; - print "\n"; + print &ui_table_row($text{'field_enum'}, + &ui_textarea("size", join("\n", @ev), 4, 20)); } elsif ($type eq 'float' || $type eq 'double' || $type eq 'decimal') { - # Two values - print "\n"; - printf "\n", - $size =~ /(\d+)$/ ? $1 : ''; + # Two values, for total and decimal + print &ui_table_row($text{'field_dual'}, + &ui_textbox("size1", $size =~ /^(\d+)/ ? $1 : '', 5)."\n". + &ui_textbox("size2", $size =~ /(\d+)$/ ? $1 : '', 5)); } elsif ($type eq 'date' || $type eq 'datetime' || $type eq 'time' || $type eq 'timestamp' || $type =~ /(blob|text)$/) { @@ -74,90 +68,69 @@ elsif ($type eq 'date' || $type eq 'datetime' || $type eq 'time' || } elsif ($type ne 'varchar' && $type ne 'char' && $in{'type'}) { # Size is optional for new fields of most types - print "\n"; - print "\n"; + print &ui_table_row($text{'field_size'}, + &ui_opt_textbox("size", undef, $text{'default'}, 10)); } else { - # One single value - print "\n"; - print "\n"; + # Size is one value + print &ui_table_row($text{'field_size'}, + &ui_textbox("size", $size, 10)); } if ($type =~ /int$/) { # Display unsigned/zerofill option - print "\n"; - printf "\n", - $extra =~ /zerofill/ ? 'checked' : '', - $text{'field_zerofill'}; + print &ui_table_row($text{'field_opts'}, + &ui_radio("opts", $extra =~ /unsigned/ ? 'unsigned' : + $extra =~ /zerofill/ ? 'zerofill' : '', + [ [ '', $text{'field_none'} ], + [ 'unsigned', $text{'field_unsigned'} ], + [ 'zerofill', $text{'field_zerofill'} ] ])); # Display auto-increment option - print "\n"; - printf "\n", - $f->{'extra'} =~ /auto_increment/ ? '' : 'checked', - $text{'no'}; + print &ui_table_row($text{'field_auto'}, + &ui_radio("ext", $f->{'extra'} =~ /auto_increment/ ? + 'auto_increment' : '', + [ [ 'auto_increment', $text{'yes'} ], + [ '', $text{'no'} ] ])); } elsif ($type eq 'float' || $type eq 'double' || $type eq 'decimal') { # Display zerofill option - print "\n"; - printf "\n", - $extra =~ /zerofill/ ? 'checked' : '', - $text{'field_zerofill'}; + print &ui_table_row($text{'field_opts'}, + &ui_radio("opts", $extra =~ /zerofill/ ? 'zerofill' : '', + [ [ '', $text{'field_none'} ], + [ 'zerofill', $text{'field_zerofill'} ] ])); } elsif ($type eq 'char' || $type eq 'varchar') { # Display binary option - print "\n"; - printf "\n", - $extra =~ /binary/ ? 'checked' : '', - $text{'field_binary'}; + print &ui_table_row($text{'field_opts'}, + &ui_radio("opts", $extra =~ /binary/ ? 'binary' : '', + [ [ '', $text{'field_ascii'} ], + [ 'binary', $text{'field_binary'} ] ])); } -print "\n"; -printf "\n", - $in{'type'} || $f->{'null'} eq 'YES' ? '' : 'checked'; +# Allow nulls? +print &ui_table_row($text{'field_null'}, + &ui_radio("null", $in{'type'} || $f->{'null'} eq 'YES' ? 1 : 0, + [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ])); -print "\n"; -printf "\n", - $f->{'default'} eq 'NULL' ? '' : $f->{'default'}; +# Default value +print &ui_table_row($text{'field_default'}, + &ui_textbox("default", $f->{'default'} eq 'NULL' ? '' : + $f->{'default'}, 40)); -print "\n"; -printf "\n", - $f->{'key'} eq 'PRI' ? '' : 'checked', $text{'no'}; -printf "\n", - $f->{'key'} eq 'PRI' ? 1 : 0; +# Part of primary key +print &ui_table_row($text{'field_key'}, + &ui_yesno_radio("key", $f->{'key'} eq 'PRI' ? 1 : 0)); +print &ui_hidden("oldkey", $f->{'key'} eq 'PRI' ? 1 : 0); -print "
$text{'field_name'}
$text{'field_type'}$type
$text{'field_typewarn'}
$text{'field_enum'}
$text{'field_dual'}\n", - $size =~ /^(\d+)/ ? $1 : ''; - printf "
$text{'field_size'} ", - "$text{'default'}\n"; - print "\n"; - print "
$text{'field_size'}
$text{'field_opts'} %s\n", - $extra =~ /unsigned/ ? '' : 'checked', - $text{'field_none'}; - printf " %s\n", - $extra =~ /unsigned/ && $extra !~ /zerofill/ ? 'checked' : '', - $text{'field_unsigned'}; - printf " %s
$text{'field_auto'} %s\n", - 'auto_increment', - $f->{'extra'} =~ /auto_increment/ ? 'checked' : '', - $text{'yes'}; - printf " %s
$text{'field_opts'} %s\n", - $extra =~ /unsigned/ ? '' : 'checked', - $text{'field_none'}; - printf " %s
$text{'field_opts'} %s\n", - $extra =~ /binary/ ? '' : 'checked', - $text{'field_ascii'}; - printf " %s
$text{'field_null'} $text{'yes'}\n", - $in{'type'} || $f->{'null'} eq 'YES' ? 'checked' : ''; -printf " $text{'no'}
$text{'field_default'}
$text{'field_key'} %s\n", - $f->{'key'} eq 'PRI' ? 'checked' : '', $text{'yes'}; -printf " %s
\n"; +print &ui_table_end(); if ($in{'type'}) { - print "\n"; + print &ui_form_end([ [ undef, $text{'create'} ] ]); } else { - print " \n"; - print "\n" - if (@desc > 1); + print &ui_form_end([ [ undef, $text{'save'} ], + @desc > 1 ? ( [ 'delete', $text{'delete'} ] ): ( ) ]); } -print "
\n"; &ui_print_footer("edit_table.cgi?db=$in{'db'}&table=".&urlize($in{'table'}), $text{'table_return'}, diff --git a/mysql/edit_table.cgi b/mysql/edit_table.cgi index e5f056dba..7836dbe40 100755 --- a/mysql/edit_table.cgi +++ b/mysql/edit_table.cgi @@ -48,52 +48,41 @@ print &ui_columns_end(); print &ui_links_row(\@rowlinks); print &ui_form_end([ [ "delete", $text{'table_delete'} ] ]); -print "
\n"; -print &ui_hidden("db", $in{'db'}),"\n"; -print &ui_hidden("table", $in{'table'}),"\n"; -print "\n"; +$hiddens = &ui_hidden("db", $in{'db'}).&ui_hidden("table", $in{'table'}); +print "
\n"; # Add field button -print "\n"; +print &ui_form_start("edit_field.cgi"); +print $hiddens; +print "",&ui_form_end(); # View and edit data button -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; +print &ui_form_start("view_table.cgi", "form-data"); +print $hiddens; +print "",&ui_form_end(); # CSV export button -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; +print &ui_form_start("csv_form.cgi"); +print $hiddens; +print "",&ui_form_end(); if ($access{'indexes'}) { # Create index button - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; + print &ui_form_start("edit_index.cgi"); + print $hiddens; + print "",&ui_form_end(); } # Drop table button -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n"; +print &ui_form_start("drop_table.cgi"); +print $hiddens; +print "",&ui_form_end(); print "
\n"; -print "",&ui_submit($text{'table_add'}); +print &ui_select("type", undef, \@type_list); +print "
\n"; -print "",&ui_submit($text{'table_data'}); +print "
\n"; -print "",&ui_submit($text{'table_csv'}); +print "
\n"; - print "",&ui_submit($text{'table_index'}); + print "
\n"; -print "",&ui_submit($text{'table_drop'}); +print "
\n";