3 # First of all, let's load HELM configuration
5 my $HELM_LIB_DIR = $ENV{"HELM_LIB_DIR"};
6 # this should be the only fixed constant
7 my $DEFAULT_HELM_LIB_DIR = "/projects/helm/on-line/local/lib/helm";
8 if (defined ($HELM_LIB_DIR)) {
9 $HELM_LIB_PATH = $HELM_LIB_DIR."/configuration.pl";
11 $HELM_LIB_PATH = $DEFAULT_HELM_LIB_DIR."/configuration.pl";
14 # next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm
15 require $HELM_LIB_PATH;
17 $getter_url_get_uri = $getter_url."get?uri=";
18 $html_keys = "key=C1&key=HC2";
21 # the following lines precompute some escaped string so that they can
22 # be used safely in a URI as value for parameters.
26 #$escape_these = "\;\/\?\:\@\&\=\+\,\$";
27 $escape_these = "&=;:?";
28 $esc_getter_url = uri_escape($getter_url, $escape_these);
29 $esc_processor_url = uri_escape($processor_url, $escape_these);
30 $esc_getter_url_get_uri = uri_escape($getter_url_get_uri, $escape_these);
31 $esc_html_keys = uri_escape($html_keys, $escape_these);
33 $baseuri0 = $dirname = $uri = $ENV{"REQUEST_URI"};
35 $dirname =~ s/$helm_url_path//;
36 $dirname = $library_dir_on_line.$dirname;
38 $baseuri0 =~ s/$helm_url_path//;
40 opendir(DIR, $dirname);
41 @filenames = readdir(DIR);
45 foreach $i (@filenames) {
49 <td><img border="0" src="/icons/back.gif" alt="[BACK]"></td>
50 <td><a href="$uri$i">Parent Directory</a></td>
53 } elsif ($i !~ /^\./) {
54 # hidden files excluded
55 (undef,undef,$mode) = stat("$dirname$i");
60 <td><img border="0" src="/icons/folder.gif" alt="[DIR]"></td>
61 <td><a href="$uri$i">$i</a></td>
66 if ($i =~ /\.(con|var|ind)(\.types)?\.xml(\.gz)?$/) {
67 my $i_without_xml = $i;
68 $i_without_xml =~ s/(.*)\.xml(\.gz)/$1/;
70 my $baseuri = "cic:".$baseuri0;
73 <td><img border="0" src="/icons/generic.red.gif" alt="[DIR]"></td>
74 <td><a href="$uri$i">$i</a></td>
75 <td><a href="$processor_url/apply?key=C1&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML Content</a></td>
76 <td><a href="$processor_url/apply?key=C1&key=C2&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML Presentation</a></td>
78 <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>
80 <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>
83 } elsif ($i =~ /\.(con|var|ind)\.ann\.xml(\.gz)?$/) {
84 my $i_without_xml = $i;
85 my $i_without_ann_and_xml = $i;
86 $i_without_xml =~ s/(.*)\.xml(\.gz)/$1/;
87 $i_without_ann_and_xml =~ s/(.*)\.ann\.xml/$1/;
89 my $baseuri = "cic:".$baseuri0;
92 <td><img border="0" src="/icons/text.gif" alt="[DIR]"></td>
93 <td><a href="$uri$i">$i</a></td>
94 <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>
95 <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>
97 <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>
99 <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>
102 } elsif ($i =~ /\.theory\.xml(\.gz)?$/) {
103 my $i_without_xml = $i;
104 $i_without_xml =~ s/(.*)\.xml(\.gz)/$1/;
106 my $baseuri = "theory:".$baseuri0; $output .= <<EOT;
108 <td><img border="0" src="/icons/layout.gif" alt="[DIR]"></td>
109 <td><a href="$uri$i">$i</a></td>
110 <td><a href="$processor_url/apply?key=T1&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML Content</a></td>
111 <td><a href="$processor_url/apply?key=T1&key=T2&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">MathML Presentation</a></td>
112 <td><a href="$processor_url/apply?key=T1&key=T2&xmluri=$esc_getter_url_get_uri$baseuri$i_without_xml">HTML</a></td>
119 <td><img border="0" src="/icons/unknown.gif" alt="[DIR]"></td>
120 <td><a href="$uri$i">$i</a></td>
129 Content-type: text/html
131 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
132 "http://www.w3.org/TR/REC-html40/loose.dtd">
135 <title>Index of $uri</title>
137 <body bgcolor="#ffffff" text="#000000">
138 <table><tr><td bgcolor="#ffffff" class="title">
139 <font size="+3" face="Helvetica,Arial,sans-serif"><b>Index of $uri</b></font>
141 <hr noshade align="left" width="80%">
145 <hr noshade align="left" width="80%">