#!/usr/local/bin/perl
# restore_form.cgi
# Display a form for restore a database

require './postgresql-lib.pl' ;

&ReadParse ( ) ;

&error_setup ( $text{'restore_err'} ) ;
$access{'restore'} || &error($text{'restore_ecannot'});
&can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
&has_command($config{'rstr_cmd'}) ||
	&error(&text('restore_ecmd', "<tt>$config{'rstr_cmd'}</tt>"));

&header ( $text{'restore_title'}, "", "restore_form" ) ;

print "<hr>\n" ;

print "<form action=restore.cgi method=post>\n" ;
print "<input type=hidden name=db value=\"$in{'db'}\">\n" ;
print "<table border>\n" ;
print "<tr $tb> <td><b>$text{'restore_header'}</b></td> </tr>\n" ;
print "<tr $cb> <td><table>\n" ;

print "<tr> <td><b>$text{'restore_path'}</b></td>\n" ;
print "<td>\n" ;
print "<input type=text name=path value='$config{'repository'}/' size=64></td> </tr>\n" ;

print "<tr> <td><b>$text{'restore_only'}</b></td>\n";
print "<td><input type=radio name=only value=1> $text{'yes'}\n";
print "<input type=radio name=only value=0 checked> $text{'no'}</td> </tr>\n";

print "<tr> <td><b>$text{'restore_clean'}</b></td>\n";
print "<td><input type=radio name=clean value=1> $text{'yes'}\n";
print "<input type=radio name=clean value=0 checked> $text{'no'}</td> </tr>\n";

print "<tr $cb> <td colspan=2 align=right><input type=submit " ,
      "value='$text{'restore_go'}'></td> </tr>\n" ;

print "</table></td></tr></table></form>\n" ;

print "<hr>\n" ;

&ui_print_footer("edit_dbase.cgi?db=$in{'db'}", $text{'dbase_return'},
	"", $text{'index_return'});
