#!/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;
+# 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;
+
+$getter_url_get_uri = $getter_url."get?uri=";
+$html_keys = "key=C1&key=HC2";
+
+# LUCA
+# the following lines precompute some escaped string so that they can
+# be used safely in a URI as value for parameters.
+
+use URI::Escape;
+
+#$escape_these = "\;\/\?\:\@\&\=\+\,\$";
+$escape_these = "&=;:?";
+$esc_getter_url = uri_escape($getter_url, $escape_these);
+$esc_processor_url = uri_escape($processor_url, $escape_these);
+$esc_getter_url_get_uri = uri_escape($getter_url_get_uri, $escape_these);
+$esc_html_keys = uri_escape($html_keys, $escape_these);
$baseuri0 = $dirname = $uri = $ENV{"REQUEST_URI"};
$dirname =~ s/$helm_url_path//;
-$dirname = $helm_dir.$dirname;
+$dirname = $library_dir_on_line.$dirname;
$baseuri0 =~ s/$helm_url_path//;
foreach $i (@filenames) {
if ($i eq "..") {
$output .= <<EOT;
-<img border="0" src="/icons/back.gif" alt="[BACK]"> <a href="$uri$i">Parent Directory</a>
+<tr>
+<td><img border="0" src="/icons/back.gif" alt="[BACK]"></td>
+<td><a href="$uri$i">Parent Directory</a></td>
+</tr>
EOT
} elsif ($i !~ /^\./) {
# hidden files excluded
if ($mode &= 16384) {
# directory
$output .= <<EOT;
-<img border="0" src="/icons/folder.gif" alt="[DIR]"> <a href="$uri$i">$i</a>
+<tr>
+<td><img border="0" src="/icons/folder.gif" alt="[DIR]"></td>
+<td><a href="$uri$i">$i</a></td>
+</tr>
EOT
} else {
# file
- if ($i =~ /\.(con|var|ind)\.xml$/) {
+ if ($i =~ /\.(con|var|ind)(\.types)?\.xml(\.gz)?$/) {
my $i_without_xml = $i;
- $i_without_xml =~ s/(.*)\.xml/$1/;
+ $i_without_xml =~ s/(.*)\.xml(\.gz)/$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>
+<tr>
+<td><img border="0" src="/icons/generic.red.gif" alt="[DIR]"></td>
+<td><a href="$uri$i">$i</a></td>
+<td><a href="$processor_url/apply?key=C1&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML Content</a></td>
+<td><a href="$processor_url/apply?key=C1&key=C2&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML Presentation</a></td>
+<!--
+<td><a href="$processor_url/apply?key=C1&key=C2&key=R2A&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML P Abs</a></td>
+-->
+<td><a href="$processor_url/apply?$html_keys¶m.getterURL=$esc_getter_url¶m.processorURL=$esc_processor_url¶m.keys=$esc_html_keys&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">HTML</a></td>
+</tr>
EOT
- } elsif ($i =~ /\.(con|var|ind)\.ann\.xml$/) {
+ } elsif ($i =~ /\.(con|var|ind)\.ann\.xml(\.gz)?$/) {
my $i_without_xml = $i;
my $i_without_ann_and_xml = $i;
- $i_without_xml =~ s/(.*)\.xml/$1/;
+ $i_without_xml =~ s/(.*)\.xml(\.gz)/$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>
+<tr>
+<td><img border="0" src="/icons/text.gif" alt="[DIR]"></td>
+<td><a href="$uri$i">$i</a></td>
+<td><a href="$processor_url/apply?key=C1&xmluri=$esc_getter_url_get_uri$baseuri$i_without_ann_and_xml&annuri=$baseuri$i_without_xml">MathML Content</a></td>
+<td><a href="$processor_url/apply?key=C1&key=C2&xmluri=$esc_getter_url_get_uri$baseuri$i_without_ann_and_xml&annuri=$baseuri$i_without_xml">MathML Presentation</a></td>
+<!--
+<td><a href="$processor_url/apply?key=C1&key=C2&key=R2A&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML P Abs</a></td>
+-->
+<td><a href="$processor_url/apply$html_keys¶m.getterURL=$esc_getter_url¶m.processorURL=$esc_processor_url¶m.keys=$esc_html_keys&xmluri=$esc_getter_url_get_uri$baseuri$i_without_ann_and_xml&annuri=$baseuri$i_without_xml">HTML</a></td>
+</tr>
EOT
- } elsif ($i =~ /\.theory\.xml$/) {
+ } elsif ($i =~ /\.theory\.xml(\.gz)?$/) {
my $i_without_xml = $i;
- $i_without_xml =~ s/(.*)\.xml/$1/;
+ $i_without_xml =~ s/(.*)\.xml(\.gz)/$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>
+ my $baseuri = "theory:".$baseuri0; $output .= <<EOT;
+<tr>
+<td><img border="0" src="/icons/layout.gif" alt="[DIR]"></td>
+<td><a href="$uri$i">$i</a></td>
+<td><a href="$processor_url/apply?key=T1&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML Content</a></td>
+<td><a href="$processor_url/apply?key=T1&key=T2&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML Presentation</a></td>
+<td><a href="$processor_url/apply?key=T1&key=T2&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">HTML</a></td>
+</tr>
EOT
} else {
# other file
$output .= <<EOT;
-<img border="0" src="/icons/unknown.gif" alt="[DIR]"> <a href="$uri$i">$i</a>
+<tr>
+<td><img border="0" src="/icons/unknown.gif" alt="[DIR]"></td>
+<td><a href="$uri$i">$i</a></td>
+</tr>
EOT
}
}
<font size="+3" face="Helvetica,Arial,sans-serif"><b>Index of $uri</b></font>
</td></tr></table>
<hr noshade align="left" width="80%">
-<pre>
+<table>
$output
-</pre>
+</table>
<hr noshade align="left" width="80%">
</body>
</html>
+++ /dev/null
-#!/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;
-
-require HTTP::Request;
-require LWP::UserAgent;
-use CGI;
-
-$url = $ENV{"REQUEST_URI"};
-$url =~ s/.*mmlurl=(.*)/$1/;
-
-$content = "";
-
-$ua = LWP::UserAgent->new;
-$request = HTTP::Request->new(GET => "$url");
-$response = $ua->request($request, \&callback);
-
-$content =~ s/\r//sg;
-$content =~ s/\n/ /sg;
-$content =~ s/<!DOCTYPE[^>]*(.*)>/$1/sg;
-$content =~ s/<m:/</g;
-$content =~ s/<\/m:/<\//g;
-$content =~ s/<math[^>]*>/<math>/sg;
-$content =~ s/"/'/g;
-$content =~ s/&/&/g;
-
-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>Generato in automatico a partire da $url</title>
-</head>
-<body bgcolor="#ffffff" text="#000000">
-<applet codebase="http://www.webeq.com/WebEQ/2.2/classes" code="webeq.Main"
-+width=600 height=2000 align=middle>
-<param name=eq value="$content">
-<param name=color value="#cccccc">
-<param name=parser value="mathml">
-<param name=size value="14">
-</applet>
-</body>
-</html>
-EOT
-
-#=========================
-
-sub callback
-{
- my ($data) = @_;
- $content .= $data;
-}
+++ /dev/null
-#!/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;
-
-require HTTP::Request;
-require LWP::UserAgent;
-use CGI;
-
-$url = $ENV{"REQUEST_URI"};
-$url =~ s/.*mmlurl=(.*)/$1/;
-
-$content = "";
-
-$ua = LWP::UserAgent->new;
-$request = HTTP::Request->new(GET => "$url");
-$response = $ua->request($request, \&callback);
-
-$content =~ s/\r//sg;
-$content =~ s/\n/ /sg;
-$content =~ s/<!DOCTYPE[^>]*>//sg;
-$content =~ s/<\?xml[^?]*\?>//sg;
-$content =~ s/"/'/g;
-$content =~ s/&/&/g;
-$content =~ s/<m:/</g;
-$content =~ s/<\/m:/<\//g;
-$content =~ s/<math[^>]*>/<math>/sg;
-$content =~ s/(<\/?semantics[^>]*>)/<!-- $1 -->/sg;
-$content =~ s/(<annotation-xml)/<!-- $1/sg;
-$content =~ s/(<\/annotation-xml>)/$1 -->/sg;
-$content =~ s/<mo helm:xref='[^']*' xlink:href='([^']*)'>([^<]*)<\/mo>/<maction actiontype='href' other='$use_webeqp_url?uri=$1'><mo>$2<\/mo><\/maction>/sg;
-$content =~ s/<mi helm:xref='[^']*' xlink:href='([^']*)'>([^<]*)<\/mi>/<maction actiontype='href' other='$use_webeqp_url?uri=$1'><mi>$2<\/mi><\/maction>/sg;
-$content =~ s/helm:xref='[^']*'//sg;
-$content =~ s/xmlns:helm='[^']*'//sg;
-$content =~ s/xlink:href='[^']*'//sg;
-$content =~ s/xmlns:xlink='[^']*'//sg;
-$content =~ s/<mchar name='([^']*)' \/>/&$1;/sg;
-
-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>Generato in automatico a partire da $url</title>
-</head>
-<body bgcolor="#ffffff" text="#000000">
-<applet codebase="http://www.webeq.com/WebEQ/2.2/classes" code="webeq.Main"
-+width=600 height=2000 align=middle>
-<param name=eq value="$content">
-<param name=color value="#cccccc">
-<param name=parser value="mathml">
-<param name=size value="14">
-</applet>
-</body>
-</html>
-EOT
-
-#=========================
-
-sub callback
-{
- my ($data) = @_;
- $content .= $data;
-}