#!/usr/bin/perl

# First of all, let's load HELM configuration
use Env;
my $HELM_LIB_DIR = $ENV{"HELM_LIB_DIR"};
# this should be the only fixed constant
my $DEFAULT_HELM_LIB_DIR = "/projects/helm/on-line/local/lib/helm";
if (defined ($HELM_LIB_DIR)) {
   $HELM_LIB_PATH = $HELM_LIB_DIR."/configuration.pl";
} else {
   $HELM_LIB_PATH = $DEFAULT_HELM_LIB_DIR."/configuration.pl";
}

# next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm
require $HELM_LIB_PATH;

#use URI::Escape;
use CGI;

$cgi = new CGI($ENV{"REQUEST_URL"});

$mode      = $cgi->param('mode');
$cicuri    = $cgi->param('cicuri');
$theoryuri = $cgi->param('theoryuri');
$topurl    = $cgi->url();

print <<EOT;
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
 <title>Index of $cicuri and $theoryuri</title>
</head>
<frameset rows="18%,*" border="0" scrolling="no">
  <frame src="mkcontrol.pl?topurl=$topurl&mode=$mode&cicuri=$cicuri&theoryuri=$theoryuri" name="control"/>
  <frameset cols="50%,50%" border="0" scrolling="no">
     <frameset rows="11%,*" border="0" scrolling="no">
        <frame src="mkheader.pl?uri=$theoryuri" name="theoryheader"/>
        <frame src="mkindextheory.pl?theoryuri=$theoryuri" name="theoryresult"/>
     </frameset>
     <frameset rows="11%,*" border="0" scrolling="no">
        <frame src="mkheader.pl?uri=$cicuri" name="cicheader"/>
        <frame src="mkindexcic.pl?cicuri=$cicuri" name="cicresult"/>
     </frameset>
  </frameset>
</frameset>
</html>
EOT
