#  This software was derived from SATAN 1.1.1 by Dan Farmer and Wietse Venema
#  (http://www.porcupine.org/satan).
#
#
# Select SARA data base
#
$_sara_dir = "";
@_results = `ls results`;
for (@_results) { chop; }

print CLIENT <<EOF;
<HTML>
<HEAD>
<META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">
<title> SARA Data Management </title>

<SCRIPT language="JavaScript">
  function movepic(img_name,img_src) {
  document[img_name].src=img_src;
}
</SCRIPT>

</HEAD>
<BODY>
EOF
if ($pi_menu) {
  $screen = &$pi_menu;
} else {
  $screen = print_menu();
}
$screen =~ s/\\n/\n/g;
print CLIENT $screen;
print CLIENT <<EOF;
</TD><TD valign=top>
<TABLE BORDER="0" WIDTH="650"
<TR><TD BGCOLOR="#000000">
<Font Color="#FFFFFF">
<Center> <H2>SARA Data Management</H2></Center>
</FONT>
</TD></TR></TABLE>
<UL>
<FORM METHOD=GET ACTION="sara_open_action.pl">
<input Type=hidden Name=sequence Value="$seq">

<a name="open-or-create"><h3>Open existing or create new SARA data base</h3>

<h3>
<INPUT TYPE="reset" VALUE=" Reset ">
<INPUT SIZE="28" NAME="_sara_dir" Value="$sara_data">
<INPUT TYPE="submit" VALUE=" Open or create ">
</h3>
</FORM>

EOF

if (@_results) {
	print CLIENT <<EOF;
	<h3>Existing data bases...</h3>
EOF
}

print CLIENT <<EOF;
<ul>
EOF
for (@_results) {
	if (-d "results/$_") {
		print CLIENT <<EOF;
		<li> <a href="sara_open_action.pl,$_,">$_</a>
EOF
	}
}

print CLIENT <<EOF;
</ul>

<hr>

<FORM METHOD=GET ACTION="sara_merge_action.pl">

<a name="merge"><h3>Merge with existing SARA data base</h3>

<h3>
<INPUT TYPE="reset" VALUE=" Reset ">
<INPUT SIZE="28" NAME="_sara_dir" Value="">
<INPUT TYPE="submit" VALUE=" Merge ">
</h3>

</FORM>

EOF

if (@_results) {
	print CLIENT <<EOF;
	<h3>Existing data bases...</h3>
EOF
}

print CLIENT <<EOF;
<ul>
EOF

for (@_results) {
	if (-d "results/$_") {
		print CLIENT <<EOF;
		<li> <a href="sara_merge_action.pl,$_,">$_</a>
EOF
	}
}
print CLIENT <<EOF;
</ul>


<hr>

<FORM METHOD=GET ACTION="sara_delete_action.pl">

<a name="delete"><h3>Delete existing SARA data base</h3>

<h3>
<INPUT TYPE="reset" VALUE=" Reset ">
<INPUT SIZE="28" NAME="_sara_dir" Value="">
<INPUT TYPE="submit" VALUE=" Delete ">
</h3>

</FORM>

EOF

if (@_results) {
	print CLIENT <<EOF;
	<h3>Existing data bases...</h3>
EOF
}

print CLIENT <<EOF;
<ul>
EOF

for (@_results) {
	if (-d "results/$_") {
		print CLIENT <<EOF;
		<li> <a href="sara_delete_action.pl,$_,">$_</a>
EOF
	}
}

print CLIENT <<EOF;
</ul>
<hr>
</UL></UL>
</TD></TR></TABLE>
</BODY>
</HTML>
EOF
