]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/on-line/javascript/prelude.js
ocaml 3.09 transition
[helm.git] / helm / on-line / javascript / prelude.js
index 69479641cd5af9ee32d8ae20aa3d678ee60df6d6..d89ae566d333ae2b54a70c88f8adec07c2697ade 100644 (file)
+function getProfileId()
+{
+  return document.profile.elements[0].value;
+}
 
-function getInitialProcessorURL()
+function getUwoboURL()
 {
-  var search = top.location.search;
-  search = search.slice(1);
-  var args = search.split("&");
-  var processorURL = "-1";
-  for (var i = 0 ; i < args.length ; i++) {
-     var couple = args[i].split("=");
-     if (couple[0] == "processorURL") processorURL = couple[1];
-  }
-  if (processorURL == "-1") processorURL = getDefaultParam("processorURL");
-  return processorURL;
+  return document.uwoboURL.elements[0].value;
 }
 
-function getInitialGetterURL()
+function getGetterURL()
 {
-  var search = top.location.search;
-  search = search.slice(1);
-  var args = search.split("&");
-  var getterURL = "-1";
-  for (var i = 0 ; i < args.length ; i++) {
-     var couple = args[i].split("=");
-     if (couple[0] == "getterURL") getterURL = couple[1];
-  }
-  if (getterURL == "-1") getterURL = getDefaultParam("getterURL");
-  return getterURL;
+  return document.getterURL.elements[0].value;
 }
 
-function getInitialUNICODEvsSYMBOL()
+function getProofCheckerURL()
 {
-  var search = top.location.search;
-  search = search.slice(1);
-  var args = search.split("&");
-  var UNICODEvsSYMBOL = "-1";
-  for (var i = 0 ; i < args.length ; i++) {
-     var couple = args[i].split("=");
-     if (couple[0] == "UNICODEvsSYMBOL") UNICODEvsSYMBOL = couple[1];
-  }
-  if (UNICODEvsSYMBOL == "-1") UNICODEvsSYMBOL = getDefaultParam("UNICODEvsSYMBOL");
-  return UNICODEvsSYMBOL;
+  return document.proofcheckerURL.elements[0].value;
 }
 
-function getInitialUNICODEvsSYMBOLsymbol()
+function getSearchEngineURL()
 {
-  if (getInitialUNICODEvsSYMBOL() == "symbol")
-   return "CHECKED";
-  else
-   return "";
+  return document.searchengineURL.elements[0].value;
 }
 
-function getInitialUNICODEvsSYMBOLunicode()
+function getDrawGraphURL()
 {
-  if (getInitialUNICODEvsSYMBOL() == "unicode")
-   return "CHECKED";
-  else
-   return "";
+  return document.draw_graphURL.elements[0].value;
 }
 
-function getUwoboURL()
+function getURISetQueueURL()
 {
-  return document.uwoboURL.elements[0].value;
+  return document.uri_set_queueURL.elements[0].value;
 }
 
-function getGetterURL()
+function getRdflyURL()
 {
-  return document.getterURL.elements[0].value;
+  return document.rdflyURL.elements[0].value;
+}
+
+function getInterfaceURL()
+{
+  return document.interfaceURL.elements[0].value;
 }
 
 function getUNICODEvsSYMBOL()
 {
   if (document.UNICODEvsSYMBOL.radioUNICODEvsSYMBOL[0].checked)
-   return document.UNICODEvsSYMBOL.radioUNICODEvsSYMBOL[0].value;
+   return 'symbol';
   else
-   return document.UNICODEvsSYMBOL.radioUNICODEvsSYMBOL[1].value;
+   return 'unicode';
 }
 
-function chopSlash(url)
+function getNaturalLanguage()
 {
-  return url.slice(0,url.lastIndexOf('/'));
+  if (document.naturalLanguage.elements[0].checked)
+   return 'yes';
+  else
+   return 'no';
 }
 
-function refreshLinks()
+function getMaxGraphSize()
 {
-  var search = top.location.search;
-  search = search.slice(1);
-  var args = search.split("&");
-  var cicuri = "-1", theoryuri = "-1", mode = "-1";
-  for (var i = 0 ; i < args.length ; i++) {
-     var couple = args[i].split("=");
-     switch (couple[0]) {
-        case "cicuri"       : cicuri     =couple[1]; break;
-        case "theoryuri"    : theoryuri  =couple[1]; break;
-        case "mode"         : mode       =couple[1]; break;
-     }
-  }
-  if (cicuri == "-1") cicuri = getDefaultParam("cicuri");
-  if (theoryuri == "-1") theoryuri = getDefaultParam("theoryuri");
-  if (mode == "-1") mode = getDefaultParam("mode");
-
-  document.links[2].href =
-   document.links[2].protocol + '//' +
-   document.links[2].host +
-   document.links[2].pathname +
-   "?getterURL=" + getGetterURL();
-
-  document.links[3].href = 
-   document.links[3].protocol + '//' +
-   document.links[3].host +
-   document.links[3].pathname +
-   "?processorURL=" + getUwoboURL() +
-   "&getterURL=" + getGetterURL();
-
-  var topurl =
-   chopSlash(chopSlash(
-    document.location.protocol + '//' +
-    document.location.host +
-    document.location.pathname));
-  document.links[4].href =
-     getUwoboURL() + "apply" +
-      "?keys=RT" +
-      "&param.topurl=" + topurl +
-      "&xmluri=" +
-      escape(
-       topurl + "/html/library/index.html" +
-       "?cicuri=" + cicuri +
-       "&theoryuri=" + theoryuri +
-       "&mode=" + mode +
-       "&processorURL=" + getUwoboURL() +
-       "&getterURL=" + getGetterURL() +
-       "&UNICODEvsSYMBOL=" + getUNICODEvsSYMBOL()
-      );
+  return document.maxGraphSize.elements[0].value;
+}
+
+function getUpdateURL()
+{
+  return '&param.processorURL=' + escape(getUwoboURL()) +
+    '&param.getterURL=' + escape(getGetterURL()) +
+    '&param.uri_set_queueURL=' + escape(getURISetQueueURL()) +
+    '&param.draw_graphURL=' + escape(getDrawGraphURL()) +
+    '&param.proofcheckerURL=' + escape(getProofCheckerURL()) +
+    '&param.searchengineURL=' + escape(getSearchEngineURL()) +
+    '&param.rdflyURL=' + escape(getRdflyURL()) +
+    '&param.interfaceURL=' + escape(getInterfaceURL()) +
+    '&param.naturalLanguage=' + escape(getNaturalLanguage()) +
+    '&param.uri_set_size=' + escape(getMaxGraphSize()) +
+    '&param.UNICODEvsSYMBOL=' + escape(getUNICODEvsSYMBOL());
 }
 
 function selectUwoboURL(ss)
@@ -137,19 +84,95 @@ function selectUwoboURL(ss)
   if (ss.selectedIndex == 0) {
     document.uwoboURL.elements[0].value = "";
   } else {
-    document.uwoboURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":8080/helm/servlet/uwobo/";
+    document.uwoboURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":58080/";
   }
-
-  refreshLinks();
 }
-
+                                                                                
 function selectGetterURL(ss)
 {
   if (ss.selectedIndex == 0) {
     document.getterURL.elements[0].value = "";
   } else {
-    document.getterURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":8081/";
+    document.getterURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":58081/";
   }
+}
 
-  refreshLinks();
+function selectProofCheckerURL(ss)
+{
+  if (ss.selectedIndex == 0) {
+    document.proofcheckerURL.elements[0].value = "";
+  } else {
+    document.proofcheckerURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":58084/";
+  }
 }
+
+function selectSearchEngineURL(ss)
+{
+  if (ss.selectedIndex == 0) {
+    document.searchengineURL.elements[0].value = "";
+  } else {
+    document.searchengineURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":58085/";
+  }
+}
+
+function selectDrawGraphURL(ss)
+{
+  if (ss.selectedIndex == 0) {
+    document.draw_graphURL.elements[0].value = "";
+  } else {
+    document.draw_graphURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":58083/";
+  }
+}
+
+function selectURISetQueueURL(ss)
+{
+  if (ss.selectedIndex == 0) {
+    document.uri_set_queueURL.elements[0].value = "";
+  } else {
+    document.uri_set_queueURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":58082/";
+  }
+}
+
+function selectRdflyURL(ss)
+{
+  if (ss.selectedIndex == 0) {
+    document.rdflyURL.elements[0].value = "";
+  } else {
+    document.rdflyURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":58086/";
+  }
+}
+
+function selectInterfaceURL(ss)
+{
+  if (ss.selectedIndex == 0) {
+    document.interfaceURL.elements[0].value = "";
+  } else {
+    document.interfaceURL.elements[0].value = "http://helm.cs.unibo.it/helm";
+  }
+}
+
+function selectProfile(ss, interfaceURL)
+{
+  location = getUwoboURL() +
+    'apply?keys=SPK&param.processorURL=' + escape(getUwoboURL()) +
+    '&param.profile=' + escape(ss.options[ss.selectedIndex].value) +
+    '&xmluri=' + escape(interfaceURL + 'html/configuration.html');
+}
+
+function saveProfile(origProfileId)
+{
+  var profileId = getProfileId();
+  var exists = false;
+  var i;
+  var options = document.profileList.elements[0];
+  for (i = 0; i < options.length; i++)
+    if (profileId == options[i].value) exists = true;
+  if (exists) {
+    if (confirm('Update the profile \'' + profileId + '\'?'))
+      location = getUwoboURL() + 'setparams?id=' + profileId + getUpdateURL();
+  } else {
+    if (confirm('Create a new profile \'' + profileId + '\' with the current settings?'))
+      location = getUwoboURL() + 'createprofile?id=' + profileId + '&orig=' + origProfileId + getUpdateURL();
+  }
+}
+