]> matita.cs.unibo.it Git - helm.git/blob - helm/cgi/mkcontrol.pl
ocaml 3.09 transition
[helm.git] / helm / cgi / mkcontrol.pl
1 #!/usr/bin/perl
2
3 # First of all, let's load HELM configuration
4 use Env;
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";
10 } else {
11    $HELM_LIB_PATH = $DEFAULT_HELM_LIB_DIR."/configuration.pl";
12 }
13
14 # next require defines: $helm_dir, $html_link, $dtd_dir, $uris_dbm
15 require $HELM_LIB_PATH;
16
17 use CGI;
18
19 $cgi = new CGI($ENV{"REQUEST_URL"});
20 $mode = $cgi->param('mode');
21 $cicuri = $cgi->param('cicuri');
22 $theoryuri = $cgi->param('theoryuri');
23 $topurl = $cgi->param('topurl');
24 $processorURL = $cgi->param('processorURL');
25 $getterURL = $cgi->param('getterURL');
26 ($mode1,$mode2,$mode3,$mode4,$mode5) = split(/,/, $mode);
27 $natural = "checked" if ($mode4 eq "yes");
28 $annotations = "checked" if ($mode5 eq "yes");
29 if ($mode1 eq "raw") {
30    $format_raw = "selected";
31 } else {
32    $format_processed = "selected";
33 }
34
35 print <<EOT;
36 Content-type: text/html
37
38 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
39 "http://www.w3.org/TR/REC-html40/loose.dtd">
40 <html>
41 <head>
42 <title>Control panel</title>
43 <script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/utils.js">
44 <script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/utils.js">
45 <script language="JavaScript" src="http://phd.cs.unibo.it/helm/javascript/control.js">
46 </script>
47 </head>
48 <body bgcolor="#ffffff" text="#000000">
49 <form>
50 <table>
51   <tr>
52     <td>
53       <b>Format</b>:
54     </td>
55     <td>
56       <select name="output" onChange="updateOutput(this,document.forms[0].format)">
57         <option value="processed" $format_processed>Processed</option>
58         <option value="raw" $format_raw>Raw</option>
59       </select>
60     </td>
61     <td>
62       <select name="format" onChange="updateFormat(this)">
63 EOT
64     if ($mode1 eq "raw") {
65        $tmp = "output_".$mode2;
66        $$tmp="selected";
67        print <<EOT;
68         <option value="cic" $output_cic>CIC</option>
69         <option value="zcic" $output_zcic>CIC GZipped</option>
70 EOT
71     } else {
72        $tmp = "output_".$mode3;
73        $$tmp="selected";
74        print <<EOT;
75         <option value="html" $output_html>HTML</option>
76         <option value="mml_cont" $output_mml_cont>MathML Content</option>
77         <option value="mml_pres" $output_mml_pres>MathML Presentation</option>
78 EOT
79     }
80 print <<EOT;
81       </select>
82     </td>
83     <td>
84      <a target="_top" href="$topurl?mode=$mode&cicuri=$cicuri&theoryuri=$theoryuri&processorURL=$processorURL&getterURL=$getterURL">Reload</a><br>
85      (do it also before attempting to take a link to the current page)
86      <script>
87        top.processorURL = getParam('processorURL');
88        top.getterURL = getParam('getterURL');
89        top.topurl = getParam('topurl');
90        top.mode = getParam('mode');
91        top.cicuri = getParam('cicuri');
92        top.theoryuri = getParam('theoryuri');
93      </script>
94     </td>
95   </tr>
96   <tr>
97     <td colspan="3">
98       <input type="checkbox" $natural onClick="updateNatural(this)">&nbsp;Natural Language</input>
99       <input type="checkbox" $annotations onClick="updateAnnotations(this)">&nbsp;Annotations</input>
100     </td>
101     <td>
102      <a target="_top" href="../html/index.html?mode=$mode&cicuri=$cicuri&theoryuri=$theoryuri&processorURL=$processorURL&getterURL=$getterURL">Configuration panel</a>
103     </td>
104   </tr>
105 </table>
106 </form>
107 </body>
108 </html>
109 EOT