print "<p>\n";
%c = $module_info{'usermin'} ? %userconfig : %config;
-print "<form action=backup.cgi method=post>\n" ;
-print "<input type=hidden name=db value=\"$in{'db'}\">\n" ;
-print "<input type=hidden name=all value=\"$in{'all'}\">\n" ;
-print "<table border>\n" ;
-print "<tr $tb> <td><b>$text{'backup_header'}</b></td> </tr>\n" ;
-print "<tr $cb> <td><table>\n" ;
+print &ui_form_start("backup.cgi", "post");
+print &ui_hidden("db", $in{'db'});
+print &ui_hidden("all", $in{'all'});
+print &ui_hidden_table_start($text{'backup_header1'}, undef, 2, "main", 1,
+ [ "width=30%" ]);
+# Destination file or directory
$p = $c{'backup_'.$in{'db'}} || "$config{'repository'}/";
+print &ui_table_row($in{'all'} ? $text{'backup_path2'}
+ : $text{'backup_path'},
+ &ui_textbox("path", $p, 60)." ".
+ &file_chooser_button("path"));
+
+# Create destination dir
if ($in{'all'}) {
- print "<tr> <td><b>$text{'backup_path2'}</b></td>\n" ;
- }
-else {
- print "<tr> <td><b>$text{'backup_path'}</b></td>\n" ;
+ print &ui_table_row($text{'backup_mkdir'},
+ &ui_yesno_radio("mkdir", int($c{'backup_mkdir_'.$in{'db'}})));
}
-print "<td><input type=text name=path value='$p' size=64>",
- &file_chooser_button("path"),"</td></tr>\n" ;
# Show backup format input
$f = $c{'backup_format_'.$in{'db'}};
-print "<tr> <td><b>$text{'backup_format'}</b></td>\n";
-print "<td><select name=format>\n";
-foreach $t ('p', 't', 'c') {
- printf "<option value=%s %s>%s\n",
- $t, $f eq $t ? "selected" : "", $text{'backup_format_'.$t};
- }
-print "</select></td> </tr>\n";
+print &ui_table_row($text{'backup_format'},
+ &ui_select("format", $f,
+ [ [ 'p', $text{'backup_format_p'} ],
+ [ 't', $text{'backup_format_t'} ],
+ [ 'c', $text{'backup_format_c'} ] ]));
if (!$in{'all'}) {
# Show input to select tables
$t = $c{'backup_tables_'.$in{'db'}};
- print "<tr> <td valign=top><b>$text{'backup_tables'}</b></td> <td>\n";
- printf "<input type=radio name=tables_def value=1 %s> %s\n",
- $t ? "" : "checked", $text{'backup_alltables'};
- printf "<input type=radio name=tables_def value=0 %s> %s\n",
- $t ? "checked" : "", $text{'backup_seltables'};
@tables = &list_tables($in{'db'});
- %got = map { $_, 1 } split(/\s+/, $t);
- print "<select name=tables>\n";
- foreach $t (sort @tables) {
- printf "<option %s>%s\n",
- $got{$t} ? "selected" : "", $t;
- }
- print "</select></td> </tr>\n";
+ print &ui_table_row($text{'backup_tables'},
+ &ui_radio("tables_def", $t ? 0 : 1,
+ [ [ 1, $text{'backup_alltables'} ],
+ [ 0, $text{'backup_seltables'} ] ])."<br>".
+ &ui_select("tables", [ split(/\s+/, $t) ],
+ [ sort @tables ], 5, 1));
}
+print &ui_hidden_table_end("main");
+
if ($cron) {
if ($access{'cmds'}) {
+ print &ui_hidden_table_start($text{'backup_header2'}, undef, 2,
+ "opts", 0, [ "width=30%" ]);
+
$b = $c{'backup_before_'.$in{'db'}};
- print "<tr> <td><b>$text{'backup_before'}</b></td>\n";
- print "<td>",&ui_textbox("before", $b, 50),"</td> </tr>\n";
+ print &ui_table_row($text{'backup_before'},
+ &ui_textbox("before", $b, 50));
$a = $c{'backup_after_'.$in{'db'}};
- print "<tr> <td><b>$text{'backup_after'}</b></td>\n";
- print "<td>",&ui_textbox("after", $a, 50),"</td> </tr>\n";
+ print &ui_table_row($text{'backup_after'},
+ &ui_textbox("after", $a, 50));
if ($in{'all'}) {
# Command mode option
$cmode = $c{'backup_cmode_'.$in{'db'}};
- print "<tr> <td><b>$text{'backup_cmode'}</b></td>\n";
- print "<td>",&ui_radio("cmode", int($cmode),
- [ [ 0, $text{'backup_cmode0'} ],
- [ 1, $text{'backup_cmode1'} ] ]),
- "</td> </tr>\n";
+ print &ui_table_row($text{'backup_cmode'},
+ &ui_radio("cmode", int($cmode),
+ [ [ 0, $text{'backup_cmode0'} ],
+ [ 1, $text{'backup_cmode1'} ] ]));
}
+
+ print &ui_hidden_table_end("opts");
}
+ print &ui_hidden_table_start($text{'backup_header3'}, undef, 2, "sched",
+ 1, [ "width=30%" ]);
+
&foreign_require("cron", "cron-lib.pl");
@jobs = &cron::list_cron_jobs();
$cmd = $in{'all'} ? "$cron_cmd --all" : "$cron_cmd $in{'db'}";
($job) = grep { $_->{'command'} eq $cmd } @jobs;
- print "<tr> <td><b>$text{'backup_sched'}</b></td>\n";
- printf "<td><input type=radio name=sched value=0 %s> %s\n",
- $job ? "" : "checked", $text{'no'};
- printf "<input type=radio name=sched value=1 %s> %s</td> </tr>\n",
- $job ? "checked" : "", $text{'backup_sched1'};
+ print &ui_table_row($text{'backup_sched'},
+ &ui_radio("sched", $job ? 1 : 0,
+ [ [ 0, $text{'no'} ], [ 1, $text{'backup_sched1'} ] ]));
if (!$config{'simple_sched'} || ($dump && !$dump->{'special'})) {
# Complex Cron time input
- print "<tr> <td colspan=2><table border width=100%>\n";
$job ||= { 'mins' => 0,
'hours' => 0,
'days' => '*',
'months' => '*',
'weekdays' => '*' };
- &cron::show_times_input($job);
- print "</table></td> </tr>\n";
+ print &ui_table_row(undef,
+ "<table border=2 width=100%>".
+ &capture_function_output(\&cron::show_times_input,$job).
+ "</table>", 2);
}
else {
# Simple Cron time input
$job ||= { 'special' => 'daily' };
print &ui_hidden("special_def", 1),"\n";
- print "<tr> <td><b>$text{'backup_special'}</b></td>\n";
- print "<td>",&ui_select("special", $job->{'special'},
+ print &ui_table_row($text{'backup_special'},
+ &ui_select("special", $job->{'special'},
[ map { [ $_, $cron::text{'edit_special_'.$_} ] }
- ('hourly', 'daily', 'weekly', 'monthly', 'yearly') ]),
- "</td> </tr>\n";
+ ('hourly', 'daily', 'weekly', 'monthly', 'yearly')]));
}
+ print &ui_hidden_table_end("sched");
}
-print "</table></td></tr></table>\n" ;
if ($cron) {
- print "<input type=submit name=backup value='$text{'backup_ok1'}'>\n";
- print "<input type=submit name=save value='$text{'backup_ok2'}'>\n";
+ print &ui_form_end([ [ "backup", $text{'backup_ok'} ],
+ [ "save", $text{'backup_ok2'} ] ]);
}
else {
- print "<input type=submit name=backup value='$text{'backup_ok'}'>\n";
+ print &ui_form_end([ [ "backup", $text{'backup_ok'} ] ]);
}
-print "<br>\n";
-print "</form>\n";
if ($in{'all'}) {
&ui_print_footer("", $text{'index_return'});