#!/usr/local/bin/perl
# Show a form for restoring a single virtual server, or a bunch
require './virtual-server-lib.pl';
&can_backup_domains() || &error($text{'restore_ecannot'});
&ui_print_header(undef, $text{'restore_title'}, "");
&ReadParse();
@tds = ( "width=30%" );
print &ui_form_start("restore.cgi", "post");
print &ui_hidden_table_start($text{'restore_sourceheader'}, "width=100%", 2,
"source", 1, \@tds);
# Get source
$dest = $config{'backup_dest'};
if (defined($in{'dom'})) {
$d = &get_domain($in{'dom'});
if ($d->{'backup_dest'}) {
$dest = $d->{'backup_dest'};
}
elsif ($config{'backup_fmt'} == 0 && $dest) {
$dest .= "/$d->{'dom'}.tar.gz";
}
print &ui_hidden("onedom", $d->{'id'}),"\n";
}
# Show source file field
if ($dest eq "download:") {
# Not possible for restores
$dest = "/";
}
print &ui_table_row($text{'restore_src'},
&show_backup_destination("src", $dest, 0, undef, 1));
print &ui_hidden_table_end("source");
# Show feature selection boxes
print &ui_hidden_table_start($text{'restore_headerfeatures'}, "width=100%", 2,
"features", 0, \@tds);
$ftable = "";
$ftable .= &ui_radio("feature_all", int($config{'backup_feature_all'}),
[ [ 1, $text{'restore_allfeatures'} ],
[ 0, $text{'backup_selfeatures'} ] ])."
\n";
@links = ( &select_all_link("feature"), &select_invert_link("feature") );
$ftable .= &ui_links_row(\@links);
foreach $f (&get_available_backup_features()) {
$ftable .= &ui_checkbox("feature", $f,
$text{'backup_feature_'.$f} || $text{'feature_'.$f},
$config{'backup_feature_'.$f});
local $ofunc = "show_restore_$f";
local %opts = map { split(/=/, $_) }
split(/,/, $config{'backup_opts_'.$f});
local $ohtml;
if (defined(&$ofunc) && ($ohtml = &$ofunc(\%opts, $d))) {
$ftable .= "
| \n"; $ftable .= (" " x 5); $ftable .= " | \n"; $ftable .= $ohtml; $ftable .= " |