#!/usr/bin/perl -w
{
  require "cgi-lib.pl";
  require "wjs_web_perl_utilities.pl";

  $build_opt_env = "./build-opt-env.pl";
  $! = 0;
  if ( ! -r $build_opt_env) {
    $msg = ($! == 0) ? "Permission denied" : $!;
    &quit ("Cannot read $build_opt_env: $msg");
  }
  require "$build_opt_env";

  $jg_cgi = &rel_filespec($ENV{"JGSCRIPTDIR"});
  $jg_url = "http://$ENV{'MYADDR'}/$jg_cgi";

  if ($ENV{'OBJECT'}) {
    $ENV{'QUERY_STRING'} = "object=$ENV{'OBJECT'}";
    system ("./download_inquiry.pl");
  } else {
    $download_inquiry_url = "$jg_url/download_inquiry.pl";
    $back_to_otheropt = "";
    &print_form();
  }
  				
  exit;
}

sub print_form
{
  print &printheader;
  print <<END;
<html>
<head>
<title>Download inquiry/pickup</title>
</head>
<body>
<form method="post" action="$download_inquiry_url">
<H1>Download inquiry/pickup</H1>

<pre>
If you know the process ID of the download in which you're interested,
please enter it here <input type="text" name="process_id" size="6">

<input type="submit" value="Submit"> 



<font size=+1><b>OR</b></font>



<input type="checkbox" name="this_computer" value="TRUE"> Check here if download was initiated from computer now being used (and address of
this computer has not changed since download, as it might if you're logging on from
home)

<input type="radio" name="sort" value="by_date" selected> sort by download date <input type="radio" name="sort" value="by_name"> sort by downloaded object name

<input type="submit" value="Submit">




<font size=+1><b>OR</b></font>




If you know the name of the computer from which the download was initiated,
please enter it here <input type="text" name="computer">

<input type="radio" name="sort" value="by_date" selected> sort by download date <input type="radio" name="sort" value="by_name"> sort by downloaded object name

<input type="submit" value="Submit">




<font size=+1><b>OR</b></font>




<input type="checkbox" name="computer_list" value="TRUE"> Check here to get a list of computers that initiated downloads

<input type="radio" name="sort" value="by_date" selected> sort by most recent download date <input type="radio" name="sort" value="by_name"> sort by computer name

<input type="submit" value="Submit">

</pre>

<input type="hidden" name="back_to_otheropt" value="$back_to_otheropt">

</form>
</body>
</html>

END
}
