]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/on-line/javascript/control.js
first moogle template checkin
[helm.git] / helm / on-line / javascript / control.js
index 4136c0edfdfa9e6e41155500ded7020fade6d1ce..79ed47fd7ef1c626592192a7c9852bc3c2175e1c 100644 (file)
@@ -1,4 +1,3 @@
-
 function updateMode(i, s)
 {
   var mode = top.mode;
@@ -23,15 +22,26 @@ function updateOutput(output,format)
   var topurl = top.topurl;
   var processorURL = top.processorURL;
   var getterURL = top.getterURL;
+  var proofcheckerURL = top.proofcheckerURL;
+  var draw_graphURL = top.draw_graphURL;
+  var uri_set_queueURL = top.uri_set_queueURL;
   var mode_list = mode.split(",");
   var new_mode = output.options[output.selectedIndex].value;
-  var dest = "?theoryuri=" + theoryuri + "&cicuri=" + cicuri + "&topurl=" + topurl + "&processorURL=" + processorURL + "&getterURL=" + getterURL + "&mode=";
+  var dest = "?theoryuri=" + theoryuri + "&cicuri=" + cicuri + "&topurl=" + topurl + "&processorURL=" + processorURL + "&getterURL=" + getterURL + "&proofcheckerURL=" + proofcheckerURL + "&draw_graphURL=" + draw_graphURL + "&uri_set_queueURL=" + uri_set_queueURL + "&mode=";
   
   if (new_mode != mode_list[0]) {
     updateMode(0, new_mode);
     if (new_mode == "raw") updateMode(2, format.options[format.selectedIndex].value);
     else updateMode(1, format.options[format.selectedIndex].value);
-    location.search = dest + top.mode;
+
+    var href =
+     top.processorURL + 'apply' +
+     '?keys=RT' +
+     '&param.topurl=' + topurl +
+     '&xmluri=' +
+     escape(top.topurl + '/html/library/control.html' + dest + top.mode);
+    
+    location.href = href;
   }
 }
 
@@ -63,6 +73,20 @@ function updateAnnotations(checkbox)
   refreshReload();
 }
 
+function updateCompressed(checkbox)
+{
+  if (checkbox.checked) updateMode(5, "gz");
+  else updateMode(5, "normal");
+  refreshReload();
+}
+
+function updateDTDPatched(checkbox)
+{
+  if (checkbox.checked) updateMode(6, "yes");
+  else updateMode(6, "no");
+  refreshReload();
+}
+
 function refreshReload()
 {
    var search = 
@@ -70,10 +94,22 @@ function refreshReload()
       "&cicuri=" + top.cicuri +
       "&theoryuri=" + top.theoryuri +
       "&processorURL=" + top.processorURL +
-      "&getterURL=" + top.getterURL;
+      "&getterURL=" + top.getterURL +
+      "&proofcheckerURL=" + top.proofcheckerURL +
+      "&draw_graphURL=" + top.draw_graphURL +
+      "&uri_set_queueURL=" + top.uri_set_queueURL +
+      "&UNICODEvsSYMBOL=" + top.UNICODEvsSYMBOL;
 
-   top.frames[0].document.links[0].search = search;
-   top.frames[0].document.links[1].search = search;
+   var href =
+    top.processorURL + 'apply' +
+    '?keys=RT' +
+    '&param.topurl=' + top.topurl +
+    '&xmluri=' +
+    escape(top.topurl + '/html/library/index.html' + search);
+    
+   top.frames[0].document.links[0].href = href;
+   top.frames[0].document.links[1].href =
+    top.topurl + '/html/index.html' + search;
 
    return true;
 }
@@ -90,54 +126,198 @@ function refreshtheoryHeader(headerURL)
    return true;
 }
 
+function getCICMathMLKeys()
+{
+  return escape("d_c,C1,G,C2,L");
+}
+
+function getTheoryKeys()
+{
+  return escape("T1,T2,L,E");
+}
+
+function getEmbedKeys()
+{
+  return escape("d_c,TC1,HC2,L");
+}
+
+function getCICHTMLKeys()
+{
+  return escape("d_c,C1,HC2,L");
+}
+
+function getCICProofTreeXHTMLMathMLKeys()
+{
+  return escape("HAT,G,HAO,L");
+}
+
 function makeURL(type,uri,cicflags,typesflags)
 {
   var mode = top.mode;
   var processorURL = top.processorURL;
   var getterURL = top.getterURL;
+  var proofcheckerURL = top.proofcheckerURL;
+  var draw_graphURL = top.draw_graphURL;
+  var uri_set_queueURL = top.uri_set_queueURL;
+  var UNICODEvsSYMBOL = top.UNICODEvsSYMBOL;
   var mode_list = mode.split(",");
   
   var keys = "";
   var url = "";
 
+  var interfaceURL = top.topurl + "/html/cic/index.html";
+  var thinterfaceURL = top.topurl + "/html/theory/index.html";
+
   var output = mode_list[0];
   var format;
   if (output == "raw") format = mode_list[1];
   else format = mode_list[2];
   
   if (output == "raw") {
-    url = getterURL + "getciconly?uri=" + uri +
-     "&format=" + (format == "zcic" ? "gz" : "normal");
+    var ext = "";
+    var rdfprefix = "";
+    if (format == "types") ext = ".types"
+    else if (format == "ann") ext = ".ann"
+    else if (format == "fwd") rdfprefix = "helm:rdf:www.cs.unibo.it/helm/rdf/forward//"
+    else if (format == "bwd") rdfprefix = "helm:rdf:www.cs.unibo.it/helm/rdf/backward//";
+    url = getterURL + "getxml?uri=" + rdfprefix + uri + ext + "&format=" +
+          mode_list[5] + "&patch_dtd=" + mode_list[6];
   } else {
-    if (format == "html" && type == "cic") {
-      keys = "C1,HC2&param.processorURL=" + escape(processorURL) +
+    var uri_len = uri.length;
+    if (format == "html" && type == "cic" && uri.substring(uri.length - 10, uri.length) == "proof_tree") {
+      keys = getCICProofTreeXHTMLMathMLKeys() +
+       "&param.processorURL=" + escape(processorURL) +
+       "&param.getterURL=" + escape(getterURL) +
+       "&param.proofcheckerURL=" + escape(proofcheckerURL) +
+       "&param.draw_graphURL=" + escape(draw_graphURL) +
+       "&param.uri_set_queueURL=" + escape(uri_set_queueURL) +
+       "&param.UNICODEvsSYMBOL=" + escape(UNICODEvsSYMBOL) +
+       "&prop.doctype-public="+escape("-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN")+
+       "&prop.doctype-system="+escape("http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd")+
+       "&prop.encoding=iso-8859-1" +
+       "&prop.media-type=text/xml" +
+       "&prop.method=xml" +
+       "&param.doctype-public="+escape("-//W3C//DTD XHTML 1.0 Transitional//EN")+
+       "&param.encoding=iso-8859-1" +
+       "&param.media-type=text/html" +
+       "&param.keys=" + getCICHTMLKeys() +
+       "&param.interfaceURL=" + escape(interfaceURL) +
+       "&param.framewidth=150";
+    } else if (format == "html" && type == "cic") {
+      keys = getCICHTMLKeys() +
+       "&param.processorURL=" + escape(processorURL) +
        "&param.getterURL=" + escape(getterURL) +
-       "&param.keys=" + escape("C1,HC2");
+       "&param.proofcheckerURL=" + escape(proofcheckerURL) +
+       "&param.draw_graphURL=" + escape(draw_graphURL) +
+       "&param.uri_set_queueURL=" + escape(uri_set_queueURL) +
+       "&param.UNICODEvsSYMBOL=" + escape(UNICODEvsSYMBOL) +
+       "&prop.doctype-public="+escape("-//W3C//DTD XHTML 1.0 Transitional//EN")+
+       "&prop.encoding=iso-8859-1" +
+       "&prop.media-type=text/html" +
+       "&prop.method=html" +
+       "&param.doctype-public="+escape("-//W3C//DTD XHTML 1.0 Transitional//EN")+
+       "&param.encoding=iso-8859-1" +
+       "&param.media-type=text/html" +
+       "&param.keys=" + getCICHTMLKeys() +
+       "&param.interfaceURL=" + escape(interfaceURL);
     } else if (format == "html" && type == "theory") {
-      keys = "T1,T2,E&param.processorURL=" + escape(processorURL) +
+      keys = getTheoryKeys()+
+       "&param.processorURL=" + escape(processorURL) +
        "&param.getterURL=" + escape(getterURL) +
-       "&param.keys=" + escape("C1,HC2");
+       "&param.proofcheckerURL=" + escape(proofcheckerURL) +
+       "&param.draw_graphURL=" + escape(draw_graphURL) +
+       "&param.uri_set_queueURL=" + escape(uri_set_queueURL) +
+       "&param.UNICODEvsSYMBOL=" + escape(UNICODEvsSYMBOL) +
+       "&param.keys=" + getCICHTMLKeys() +
+       "&param.thkeys=" + getTheoryKeys() +
+       "&param.embedkeys=" + getEmbedKeys() +
+       "&param.doctype-public="+escape("-//W3C//DTD XHTML 1.0 Transitional//EN")+
+       "&param.encoding=iso-8859-1" +
+       "&param.thencoding=iso-8859-1" +
+       "&param.media-type=text/html" +
+       "&param.thmedia-type=text/html" +
+       "&param.interfaceURL=" + escape(interfaceURL) +
+       "&param.thinterfaceURL=" + escape(thinterfaceURL);
     } else if (format == "mml_cont" && type == "cic") {
-      keys = "C1";
+      keys = escape("d_c,C1")+
+       "&param.processorURL=" + escape(processorURL) +
+       "&param.getterURL=" + escape(getterURL) +
+       "&prop.doctype-public="+
+       //"&prop.encoding=" +
+       "&prop.media-type=text/xml" +
+       "&param.doctype-public=" +
+       "&param.encoding=" +
+       "&param.media-type=text/xml";
     } else if (format == "mml_cont" && type == "theory") {
-      keys = "T1,E&param.keys=C1";
+      keys = escape("T1,L,E")+
+       "&param.processorURL=" + escape(processorURL) +
+       "&param.getterURL=" + escape(getterURL) +
+       "&param.keys=" + escape("d_c,C1") +
+       "&param.thkeys=T1,L,E" +
+       "&param.embedkeys=" + escape("d_c,TC1") +
+
+       "&param.processorURL=" + escape(processorURL) +
+       "&param.getterURL=" + escape(getterURL) +
+       "&param.proofcheckerURL=" + escape(proofcheckerURL) +
+       "&param.draw_graphURL=" + escape(draw_graphURL) +
+       "&param.uri_set_queueURL=" + escape(uri_set_queueURL) +
+       "&param.doctype-public=" +
+       "&param.encoding=" +
+       "&param.thencoding=iso-8859-1" +
+       "&param.media-type=text/xml" +
+       "&param.thmedia-type=text/html" +
+       "&param.interfaceURL=" + escape(interfaceURL) +
+       "&param.thinterfaceURL=" + escape(thinterfaceURL);
     } else if (format == "mml_pres" && type == "cic") {
-      keys = "C1,C2";
+      keys = getCICMathMLKeys()+
+       "&param.processorURL=" + escape(processorURL) +
+       "&param.getterURL=" + escape(getterURL) +
+       "&param.proofcheckerURL=" + escape(proofcheckerURL) +
+       "&param.draw_graphURL=" + escape(draw_graphURL) +
+       "&param.uri_set_queueURL=" + escape(uri_set_queueURL) +
+       "&prop.doctype-public="+
+       //"&prop.encoding=" +
+       "&prop.media-type=text/xml" +
+       "&param.doctype-public=" +
+       "&param.encoding=" +
+       "&param.media-type=text/xml" +
+       "&param.keys=" + getCICMathMLKeys() +
+       "&param.interfaceURL=" + escape(interfaceURL);
     } else if (format == "mml_pres" && type == "theory") {
-      keys = "T1,T2,E&param.keys=C1,C2";
+      keys = getTheoryKeys()+
+       "&param.keys=" + getCICMathMLKeys() +
+       "&param.thkeys=" + getTheoryKeys() +
+       "&param.embedkeys=" + escape("d_c,TC1,G,C2,L") +
+       "&param.processorURL=" + escape(processorURL) +
+       "&param.getterURL=" + escape(getterURL) +
+       "&param.proofcheckerURL=" + escape(proofcheckerURL) +
+       "&param.draw_graphURL=" + escape(draw_graphURL) +
+       "&param.uri_set_queueURL=" + escape(uri_set_queueURL) +
+       "&param.doctype-public=" +
+       "&param.encoding=" +
+       "&param.thencoding=iso-8859-1" +
+       "&param.media-type=text/xml" +
+       "&param.thmedia-type=text/html" +
+       "&param.interfaceURL=" + escape(interfaceURL) +
+       "&param.thinterfaceURL=" + escape(thinterfaceURL);
     }
 
-    var naturalLanguage = typesflags;
+    var naturalLanguage = typesflags.toLowerCase();
     if (typesflags != "NO" || type == "theory") {
        naturalLanguage = mode_list[3];
     }
-    var annotations = cicflags;
+    var annotations = cicflags.toLowerCase();
     if (cicflags != "NO" || type == "theory") {
        annotations = mode_list[4];
     }
-    url = processorURL + "apply?xmluri=" + escape(getterURL + "getciconly?uri=" + uri) + "&keys=" + keys + "&param.CICURI=" + uri + "&param.naturalLanguage=" + naturalLanguage + "&param.annotations=" + annotations;
+    url = processorURL + "apply?xmluri=" + escape(getterURL + "getxml?uri=" + uri) + "&keys=" + keys + "&param.CICURI=" + uri + "&param.naturalLanguage=" + naturalLanguage + "&param.annotations=" + annotations + "&param.topurl=" + top.topurl;
   }
 
-  return url;
+  if (output == "raw")
+   return url;
+  else if (type == "cic")
+   return interfaceURL + "?url=" + escape(url);
+  else if (type == "theory")
+   return thinterfaceURL + "?url=" + escape(url)
 }