Don't use capture function when we can return the table directly https://sourceforge.net/p/webadmin/bugs/4360/

This commit is contained in:
Jamie Cameron
2014-01-29 20:38:04 -08:00
parent d95aadb2ac
commit 1a92a32534
3 changed files with 9 additions and 10 deletions

View File

@@ -873,13 +873,13 @@ return 1;
# show_table_form(count)
sub show_table_form
{
print &ui_columns_start([ $text{'field_name'}, $text{'field_type'},
my $rv;
$rv = &ui_columns_start([ $text{'field_name'}, $text{'field_type'},
$text{'field_size'}, $text{'table_nkey'},
$text{'field_auto'}, $text{'field_null'},
$text{'field_unsigned'}, $text{'field_default'} ]);
local $i;
for($i=0; $i<$_[0]; $i++) {
local @cols;
for(my $i=0; $i<$_[0]; $i++) {
my @cols;
push(@cols, &ui_textbox("field_$i", undef, 20));
push(@cols, &ui_select("type_$i", "", [ "", @type_list ]));
push(@cols, &ui_textbox("size_$i", undef, 10));
@@ -888,9 +888,10 @@ for($i=0; $i<$_[0]; $i++) {
push(@cols, &ui_checkbox("null_$i", 1, $text{'yes'}, 1));
push(@cols, &ui_checkbox("unsigned_$i", 1, $text{'yes'}, 0));
push(@cols, &ui_textbox("default_$i", undef, 20));
print &ui_columns_row(\@cols);
$rv .= &ui_columns_row(\@cols);
}
print &ui_columns_end();
$rv .= &ui_columns_end();
return $rv;
}
# parse_table_form(&extrafields, tablename)

View File

@@ -39,8 +39,7 @@ print &ui_table_row($text{'newdb_table'},
&ui_radio("table_def", 1, [ [ 1, $text{'newdb_none'} ],
[ 0, $text{'newdb_tname'} ] ])." ".
&ui_textbox("table", undef, 20)." ".$text{'newdb_str'}."...");
$out = &capture_function_output(\&show_table_form, 4);
print &ui_table_row(undef, $out, 2);
print &ui_table_row(undef, &show_table_form(4), 2);
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'create'} ] ]);

View File

@@ -62,8 +62,7 @@ print &ui_table_row($text{'table_type'},
[ "heap" ], [ "merge" ], [ "innodb" ], [ "ndbcluster" ]
]));
$out = &capture_function_output(\&show_table_form, $in{"fields"} || 4);
print &ui_table_row(undef, $out, 2);
print &ui_table_row(undef, &show_table_form($in{"fields"} || 4), 2);
print &ui_table_end();
print &ui_form_end([ [ "create", $text{'create'} ] ]);