]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/cgi/mkcontrol.pl
New on-line interface
[helm.git] / helm / cgi / mkcontrol.pl
diff --git a/helm/cgi/mkcontrol.pl b/helm/cgi/mkcontrol.pl
new file mode 100755 (executable)
index 0000000..6e593d7
--- /dev/null
@@ -0,0 +1,98 @@
+#!/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 CGI;
+
+$cgi = new CGI($ENV{"REQUEST_URL"});
+$mode = $cgi->param('mode');
+$cicuri = $cgi->param('cicuri');
+$theoryuri = $cgi->param('theoryuri');
+$topurl = $cgi->param('topurl');
+($mode1,$mode2,$mode3,$mode4,$mode5) = split(/,/, $mode);
+$natural = "checked" if ($mode4 eq "yes");
+$annotations = "checked" if ($mode5 eq "yes");
+if ($mode1 eq "raw") {
+   $format_raw = "selected";
+} else {
+   $format_processed = "selected";
+}
+
+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>Control panel</title>
+<script language="JavaScript" src="http://phd.cs.unibo.it/helm/library3/control.js">
+</script>
+</head>
+<body bgcolor="#ffffff" text="#000000">
+<form>
+<table>
+  <tr>
+    <td>
+      <b>Format</b>:
+    </td>
+    <td>
+      <select name="output" onChange="updateOutput(this,document.forms[0].format)">
+        <option value="processed" $format_processed>Processed</option>
+        <option value="raw" $format_raw>Raw</option>
+      </select>
+    </td>
+    <td>
+      <select name="format" onChange="updateFormat(this)">
+EOT
+    if ($mode1 eq "raw") {
+       $tmp = "output_".$mode2;
+       $$tmp="selected";
+       print <<EOT;
+        <option value="cic" $output_cic>CIC</option>
+        <option value="zcic" $output_zcic>CIC GZipped</option>
+EOT
+    } else {
+       $tmp = "output_".$mode3;
+       $$tmp="selected";
+       print <<EOT;
+        <option value="html" $output_html>HTML</option>
+        <option value="mml_cont" $output_mml_cont>MathML Content</option>
+        <option value="mml_pres" $output_mml_pres>MathML Presentation</option>
+EOT
+    }
+print <<EOT;
+      </select>
+    </td>
+    <td>
+     <a target="_top" href="$topurl?mode=$mode&cicuri=$cicuri&theoryuri=$theoryuri">Reload</a><br>
+     (do it also before attempting to take a link to the current page)
+     <input type="hidden" name="hiddentopurl" value="$topurl">
+     <input type="hidden" name="hiddenmode" value="$mode">
+     <input type="hidden" name="hiddencicuri" value="$cicuri">
+     <input type="hidden" name="hiddentheoryuri" value="$theoryuri">
+    </td>
+  </tr>
+  <tr>
+    <td colspan="3">
+      <input type="checkbox" $natural onClick="updateNatural(this)">&nbsp;Natural Language</input>
+      <input type="checkbox" $annotations onClick="updateAnnotations(this)">&nbsp;Annotations</input>
+    </td>
+  </tr>
+</table>
+</form>
+</body>
+</html>
+EOT