#!/usr/local/bin/perl
# backup_form.cgi
# Display a form for backing up this database

require './mysql-lib.pl';
&ReadParse();
&can_edit_db($in{'db'}) || &error($text{'dbase_ecannot'});
$access{'edonly'} && &error($text{'dbase_ecannot'});
&header($text{'backup_title'}, "", "backup_form");
print "<hr>\n";

if (!-x $config{'mysqldump'}) {
	print "<p>",&text('backup_edump', "<tt>$config{'mysqldump'}</tt>",
			  "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
	print "<hr>\n";
	&footer("edit_dbase.cgi?db=$in{'db'}", $text{'dbase_return'});
	exit;
	}

print &text('backup_desc', "<tt>$in{'db'}</tt>"),"<p>\n";

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

print "<tr> <td><b>$text{'backup_file'}</td>\n";
printf "<td><input name=file size=40 value='%s'> %s</td> </tr>\n",
	$config{'backup_'.$in{'db'}}, &file_chooser_button("file");

print "<tr> <td><b>$text{'backup_where'}</b></td>\n";
print "<td><input type=radio name=where_def value=1 checked> ",
      "$text{'backup_none'}\n";
print "<input type=radio name=where_def value=0>\n";
print "<input name=where size=30></td> </tr>\n";

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

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

print "<hr>\n";
&footer("edit_dbase.cgi?db=$in{'db'}", $text{'dbase_return'},
	"", $text{'index_return'});

