]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/cgi/mkindex.pl
ocaml 3.09 transition
[helm.git] / helm / cgi / mkindex.pl
index 61c39d0e46d0b8c89a52dbc45314a30e215381f0..955d6d8b0e6dd597fc832d190da129d574bab783 100755 (executable)
@@ -1,76 +1,30 @@
 #!/usr/bin/perl
 
-my $HELM_CONFIGURATION_PREFIX = $ENV{"HELM_CONFIGURATION_PREFIX"};
-my $HELM_CONFIGURATION_PATH =
- $HELM_CONFIGURATION_PREFIX."/local/lib/helm/configuration.pl";
- # next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm
- require $HELM_CONFIGURATION_PATH;
-
-$baseuri0 = $dirname = $uri = $ENV{"REQUEST_URI"};
+# 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";
+}
 
-$dirname =~ s/$helm_url_path//;
-$dirname = $helm_dir.$dirname;
+# next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm
+require $HELM_LIB_PATH;
 
-$baseuri0 =~ s/$helm_url_path//;
+#use URI::Escape;
+use CGI;
 
-opendir(DIR, $dirname);
-@filenames = readdir(DIR);
-closedir(DIR);
+$cgi = new CGI($ENV{"REQUEST_URL"});
 
-$output = "";
-foreach $i (@filenames) {
-   if ($i eq "..") {
-      $output .= <<EOT;
-<img border="0" src="/icons/back.gif" alt="[BACK]"> <a href="$uri$i">Parent Directory</a>
-EOT
-   } elsif ($i !~ /^\./) {
-      # hidden files excluded
-      (undef,undef,$mode) = stat("$dirname$i");
-      if ($mode &= 16384) {
-         # directory
-         $output .= <<EOT;
-<img border="0" src="/icons/folder.gif" alt="[DIR]"> <a href="$uri$i">$i</a>
-EOT
-      } else {
-        # file
-        if ($i =~ /\.(con|var|ind)\.xml$/) {
-            my $i_without_xml = $i;
-            $i_without_xml =~ s/(.*)\.xml/$1/;
-           # cic file
-            my $baseuri = "cic:".$baseuri0;
-            $output .= <<EOT;
-<img border="0" src="/icons/generic.red.gif" alt="[DIR]"> <a
-href="$uri$i">$i</a> <a
-href="$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=annotatedpres.xsl&xmluri=$baseuri$i_without_xml">MathML</a> <a href="$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=content_to_html.xsl&xmluri=$baseuri$i_without_xml">HTML</a> <a href="$webeq_url?mmlurl=$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=annotatedpres.xsl&xmluri=$baseuri$i_without_xml">WEBEQ</a> <a href="$webeqp_url?mmlurl=$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=annotatedpres.xsl&xmluri=$baseuri$i_without_xml">WEBEQ PRESENTATION ONLY</a>
-EOT
-        } elsif ($i =~ /\.(con|var|ind)\.ann\.xml$/) {
-            my $i_without_xml = $i;
-            my $i_without_ann_and_xml = $i;
-            $i_without_xml =~ s/(.*)\.xml/$1/;
-            $i_without_ann_and_xml =~ s/(.*)\.ann\.xml/$1/;
-           # cic file
-            my $baseuri = "cic:".$baseuri0;
-            $output .= <<EOT;
-<img border="0" src="/icons/text.gif" alt="[DIR]"> <a href="$uri$i">$i</a> <a href="$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=annotatedpres.xsl&xmluri=$baseuri$i_without_ann_and_xml&annuri=$baseuri$i_without_xml">MathML</a> <a href="$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=content_to_html.xsl&xmluri=$baseuri$i_without_ann_and_xml&annuri=$baseuri$i_without_xml">HTML</a> <a href="$webeq_url?mmlurl=$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=annotatedpres.xsl&xmluri=$baseuri$i_without_ann_and_xml&annuri=$baseuri$i_without_xml">WEBEQ</a> <a href="$webeqp_url?mmlurl=$getheader_url?baseurl=$style_url&stylesheet1=rootcontent.xsl&stylesheet2=annotatedpres.xsl&xmluri=$baseuri$i_without_ann_and_xml&annuri=$baseuri$i_without_xml">WEBEQ PRESENTATION ONLY</a>
-EOT
-        } elsif ($i =~ /\.theory\.xml$/) {
-            my $i_without_xml = $i;
-            $i_without_xml =~ s/(.*)\.xml/$1/;
-           # theory file
-            my $baseuri = "theory:".$baseuri0;
-            $output .= <<EOT;
-<img border="0" src="/icons/layout.gif" alt="[DIR]"> <a
-href="$uri$i">$i</a> <a href="$getheader_url?baseurl=$style_url&stylesheet1=theory_content.xsl&stylesheet2=theory_pres.xsl&xmluri=$baseuri$i_without_xml">MathML</a> <a href="$getheader_url?baseurl=$style_url&stylesheet1=roottheory.xsl&stylesheet2=content_to_html.xsl&xmluri=$baseuri$i_without_xml">HTML</a>
-EOT
-         } else {
-           # other file
-            $output .= <<EOT;
-<img border="0" src="/icons/unknown.gif" alt="[DIR]"> <a href="$uri$i">$i</a>
-EOT
-        }
-      }
-   }
-}
+$mode      = $cgi->param('mode');
+$cicuri    = $cgi->param('cicuri');
+$theoryuri = $cgi->param('theoryuri');
+$processorURL = $cgi->param('processorURL');
+$getterURL = $cgi->param('getterURL');
+$topurl    = $cgi->url();
 
 print <<EOT;
 Content-type: text/html
@@ -79,17 +33,20 @@ Content-type: text/html
 "http://www.w3.org/TR/REC-html40/loose.dtd">
 <html>
 <head>
-<title>Index of $uri</title>
+ <title>Index of $cicuri and $theoryuri</title>
 </head>
-<body bgcolor="#ffffff" text="#000000">
-<table><tr><td bgcolor="#ffffff" class="title">
-<font size="+3" face="Helvetica,Arial,sans-serif"><b>Index of $uri</b></font>
-</td></tr></table>
-<hr noshade align="left" width="80%">
-<pre>
-$output
-</pre>
-<hr noshade align="left" width="80%">
-</body>
+<frameset rows="18%,*" border="0" scrolling="no">
+  <frame src="mkcontrol.pl?topurl=$topurl&mode=$mode&cicuri=$cicuri&theoryuri=$theoryuri&processorURL=$processorURL&getterURL=$getterURL" 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&getterURL=$getterURL" name="theoryresult"/>
+     </frameset>
+     <frameset rows="11%,*" border="0" scrolling="no">
+        <frame src="mkheader.pl?uri=$cicuri" name="cicheader"/>
+        <frame src="mkindexcic.pl?cicuri=$cicuri&getterURL=$getterURL" name="cicresult"/>
+     </frameset>
+  </frameset>
+</frameset>
 </html>
 EOT