3 # Display a form for creating a table
5 require './mysql-lib.pl';
7 &can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
9 # Redirect to other pages depending on button
11 &redirect("edit_view.cgi?new=1&db=".&urlize($in{'db'}));
14 elsif ($in{'dropdb'}) {
15 &redirect("drop_dbase.cgi?db=".&urlize($in{'db'}));
18 elsif ($in{'backupdb'}) {
19 &redirect("backup_form.cgi?db=".&urlize($in{'db'}));
23 &redirect("exec_form.cgi?db=".&urlize($in{'db'}));
27 $access{'edonly'} && &error($text{'dbase_ecannot'});
28 $desc = "<tt>$in{'db'}</tt>";
29 &ui_print_header($desc, $text{'table_title2'}, "", "table_form");
31 print &ui_form_start("create_table.cgi", "post");
32 print &ui_hidden("db", $in{'db'}),"\n";
33 print &ui_table_start($text{'table_header2'}, undef, 2);
35 print &ui_table_row($text{'table_name'},
36 &ui_textbox("name", undef, 30));
38 @dbs = grep { &can_edit_db($_) } &list_databases();
39 if (@dbs > $max_dbs) {
40 # Enter source table name manually
41 print &ui_table_row($text{'table_copy2'},
42 &ui_select("copydb", $in{'db'}, \@dbs).
43 " $text{'table_copy2t'} ".
44 &ui_textbox("copytable", undef, 20));
47 # Show all tables in all DBs
49 foreach $t (&list_tables($d, 1)) {
50 push(@tables, [ "$d.$t" ]);
53 print &ui_table_row($text{'table_copy'},
54 &ui_select("copy", undef,
55 [ [ "", $text{'table_copynone'} ],
59 print &ui_table_row($text{'table_type'},
60 &ui_select("type", "",
61 [ [ "", $text{'default'} ], [ "isam" ], [ "myisam" ],
62 [ "heap" ], [ "merge" ], [ "innodb" ], [ "ndbcluster" ]
65 $out = &capture_function_output(\&show_table_form, $in{"fields"} || 4);
66 print &ui_table_row(undef, $out, 2);
68 print &ui_table_end();
69 print &ui_form_end([ [ "create", $text{'create'} ] ]);
71 &ui_print_footer("edit_dbase.cgi?db=$in{'db'}", $text{'dbase_return'},
72 "", $text{'index_return'});