+++ /dev/null
-function updateMode(i, s)
-{
- var mode = top.mode;
- var mode_list = mode.split(",");
- var res = "";
- var j;
-
- for (j = 0; j < mode_list.length; j++) {
- if (j == i) res += s;
- else res += mode_list[j];
- if (j < mode_list.length - 1) res += ",";
- }
-
- top.mode = res;
-}
-
-function updateOutput(output,format,processorURL,interfaceURL)
-{
- var theoryuri = top.theoryuri;
- var cicuri = top.cicuri;
- var mode = top.mode;
- var mode_list = mode.split(",");
- var new_mode = output.options[output.selectedIndex].value;
- var dest = "?theoryuri=" + theoryuri + "&cicuri=" + cicuri + "&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);
-
- var href =
- processorURL + 'apply' +
- '?keys=RT' +
- '¶m.topurl=' + topurl +
- '&xmluri=' +
- escape(interfaceURL + '/html/library/control.html' + dest + top.mode);
-
- location.href = href;
- }
-}
-
-function updateFormat(format,profile,processorURL,interfaceURL)
-{
- var mode = top.mode;
- var mode_list = mode.split(",");
-
- if (mode_list[0] == "raw") {
- updateMode(1, format.options[format.selectedIndex].value);
- } else {
- updateMode(2, format.options[format.selectedIndex].value);
- }
-
- refreshReload(profile,processorURL,interfaceURL);
-}
-
-function updateNatural(checkbox,profile,processorURL,interfaceURL)
-{
- if (checkbox.checked) updateMode(3, "yes");
- else updateMode(3, "no");
- refreshReload(profile,processorURL,interfaceURL);
-}
-
-function updateAnnotations(checkbox,profile,processorURL,interfaceURL)
-{
- if (checkbox.checked) updateMode(4, "yes");
- else updateMode(4, "no");
- refreshReload(profile,processorURL,interfaceURL);
-}
-
-function updateCompressed(checkbox,profile,processorURL,interfaceURL)
-{
- if (checkbox.checked) updateMode(5, "gz");
- else updateMode(5, "normal");
- refreshReload(profile,processorURL,interfaceURL);
-}
-
-function updateDTDPatched(checkbox,profile,processorURL,interfaceURL)
-{
- if (checkbox.checked) updateMode(6, "yes");
- else updateMode(6, "no");
- refreshReload(profile,processorURL,interfaceURL);
-}
-
-function refreshReload(profile, processorURL, interfaceURL)
-{
- var search =
- "?mode=" + top.mode +
- "&cicuri=" + top.cicuri +
- "&theoryuri=" + top.theoryuri;
-
- var href = processorURL +
- 'apply' +
- '?keys=RT' +
- '&profile=' + profile +
- '¶m.profile=' + profile +
- '&xmluri=' +
- escape(interfaceURL + '/html/library/index.html' + search);
-
- top.frames[0].document.links[0].href = href;
- top.frames[0].document.links[1].href =
- interfaceURL + '/html/index.html' + search;
-
- return true;
-}
-
-function refreshcicHeader(headerURL)
-{
- top.cicheader.location.search = "?keys=GP&xmluri=" + headerURL + "¶m.uri=" + top.cicuri;
- return true;
-}
-
-function refreshtheoryHeader(headerURL)
-{
- top.theoryheader.location.search = "?keys=GP&xmluri=" + headerURL + "¶m.uri=" + top.theoryuri;
- 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,profile,processorURL,interfaceURL,getterURL)
-{
- var mode = top.mode;
- var mode_list = mode.split(",");
-
- var keys = "";
- var url = "";
-
- var interfaceURLidx = interfaceURL + "/html/cic/index.html";
- var thinterfaceURLidx = interfaceURL + "/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") {
- 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 {
- var uri_len = uri.length;
- if (format == "html" && type == "cic" && uri.substring(uri.length - 10, uri.length) == "proof_tree") {
- keys = getCICProofTreeXHTMLMathMLKeys() +
- "&profile=" + profile +
- "&default.profile=" + profile +
- "&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" +
- "¶m.doctype-public="+escape("-//W3C//DTD XHTML 1.0 Transitional//EN")+
- "¶m.encoding=iso-8859-1" +
- "¶m.media-type=text/html" +
- "¶m.keys=" + getCICHTMLKeys() +
- "¶m.framewidth=150";
- } else if (format == "html" && type == "cic") {
- keys = getCICHTMLKeys() +
- "&profile=" + profile +
- "¶m.profile=" + profile +
- "&prop.doctype-public="+escape("-//W3C//DTD XHTML 1.0 Transitional//EN")+
- "&prop.encoding=iso-8859-1" +
- "&prop.media-type=text/html" +
- "&prop.method=html" +
- "¶m.doctype-public="+escape("-//W3C//DTD XHTML 1.0 Transitional//EN")+
- "¶m.encoding=iso-8859-1" +
- "¶m.media-type=text/html" +
- "¶m.keys=" + getCICHTMLKeys();
- } else if (format == "html" && type == "theory") {
- keys = getTheoryKeys()+
- "&profile=" + profile +
- "¶m.profile=" + profile +
- "¶m.keys=" + getCICHTMLKeys() +
- "¶m.thkeys=" + getTheoryKeys() +
- "¶m.embedkeys=" + getEmbedKeys() +
- "¶m.doctype-public="+escape("-//W3C//DTD XHTML 1.0 Transitional//EN")+
- "¶m.encoding=iso-8859-1" +
- "¶m.thencoding=iso-8859-1" +
- "¶m.media-type=text/html" +
- "¶m.thmedia-type=text/html";
- } else if (format == "mml_cont" && type == "cic") {
- keys = escape("d_c,C1")+
- "&profile=" + profile +
- "¶m.profile=" + profile +
- "&prop.doctype-public="+
- "&prop.media-type=text/xml" +
- "¶m.doctype-public=" +
- "¶m.encoding=" +
- "¶m.media-type=text/xml";
- } else if (format == "mml_cont" && type == "theory") {
- keys = escape("T1,L,E")+
- "&profile=" + profile +
- "¶m.profile=" + profile +
- "¶m.keys=" + escape("d_c,C1") +
- "¶m.thkeys=T1,L,E" +
- "¶m.embedkeys=" + escape("d_c,TC1") +
- "¶m.doctype-public=" +
- "¶m.encoding=" +
- "¶m.thencoding=iso-8859-1" +
- "¶m.media-type=text/xml" +
- "¶m.thmedia-type=text/html";
- } else if (format == "mml_pres" && type == "cic") {
- keys = getCICMathMLKeys()+
- "&profile=" + profile +
- "¶m.profile=" + profile +
- "&prop.doctype-public="+
- "&prop.media-type=text/xml" +
- "¶m.doctype-public=" +
- "¶m.encoding=" +
- "¶m.media-type=text/xml" +
- "¶m.keys=" + getCICMathMLKeys();
- } else if (format == "mml_pres" && type == "theory") {
- keys = getTheoryKeys()+
- "&profile=" + profile +
- "¶m.profile=" + profile +
- "¶m.keys=" + getCICMathMLKeys() +
- "¶m.thkeys=" + getTheoryKeys() +
- "¶m.embedkeys=" + escape("d_c,TC1,G,C2,L") +
- "¶m.doctype-public=" +
- "¶m.encoding=" +
- "¶m.thencoding=iso-8859-1" +
- "¶m.media-type=text/xml" +
- "¶m.thmedia-type=text/html";
- }
- }
-
- if (output == "raw")
- return url;
- else if (type == "cic")
- return processorURL + "apply?keys=RT&xmluri=" + escape(interfaceURLidx) + "¶m.ignore=" + keys + "¶m.CICURI=" + uri;
- else if (type == "theory")
- return processorURL + "apply?keys=RT&xmluri=" + escape(thinterfaceURLidx) + "¶m.ignore=" + keys + "¶m.CICURI=" + uri;
-}
-
+++ /dev/null
-function mkBackwardRDFURI(uri)
-{
- var prefix = "helm:rdf:www.cs.unibo.it/helm/rdf/backward//";
- var re1 = /#xpointer\(1\/(\d+)\/(\d+)\)/;
- var re2 = /#xpointer\(1\/(\d+)\)/;
- // Just one of the following replace will do something
- uri = uri.replace(re1,",$1,$2");
- uri = uri.replace(re2,",$1");
-
- return (prefix + uri);
-}
-
-function removeXPointer(uri)
-{
- //var re = /#xpointer(\.*)/;
- // CSC: Why the r.e.s below work and the one above does not?
- var re1 = /#xpointer\(1\/(\d+)\/(\d+)\)/;
- var re2 = /#xpointer\(1\/(\d+)\)/;
- var res = uri.replace(re1,"");
- res = res.replace(re2,"");
-
- return res;
-}
-
-
-function mkGraphURL(uri,keys)
-{
- var getterURL = unescape(getParam("param.getterURL"));
- var draw_graphURL = unescape(getParam("param.draw_graphURL"));
- var url= setParam(location.href,"keys",keys);
- url = setParam(url,"xmluri", getterURL + 'getempty');
- url = setParam(url,"param.CICURI",escape(uri));
- var uri_set_size = document.uri_set_size.elements[0].value;
- url = setParam(url,"param.uri_set_size",uri_set_size);
-
- // The generated URL is sometimes too long for I.E.
- // So it is now better to remove some unuseful pararams from the inner URL
- url = dropParam(url,"param.processorURL");
-
- url = draw_graphURL + 'draw?url=' + escape(url);
- var url2 = setParam(location.href,"keys","MGL,RT");
- url2 = setParam(url2,"xmluri",escape(url));
- url2 = setParam(url2,"param.uri_set_size",uri_set_size);
- return url2;
-}
-
-function mkDepURL(uri)
-{
- return mkGraphURL(uri,"MDG");
-}
-
-
-function mkMetaURL(uri)
-{
- return mkGraphURL(uri,"MMG");
-}
-
-function mkCICURL(uri)
-{
- var rawuri = removeXPointer(uri);
- var getterURL = getParam("param.getterURL");
- var interfaceURL = unescape(getParam("param.interfaceURL"));
- var url= setParam(location.href,"keys",getParam("param.keys"));
- url = setParam(url,"xmluri", getterURL + 'getxml%3Furi%3D' + rawuri);
- url = setParam(url,"param.CICURI",rawuri);
- url = interfaceURL + "?url=" + escape(url);
- return url;
-}
-
-function mkMetaTheoryURL(uri)
-{
- var rdflyURL = "http://mowgli.cs.unibo.it:58086/";
- var url = setParam(location.href,"keys","meta_theory," + unescape(getTheoryKeys()));
- url = setParam(url,"param.embedkeys", getEmbedKeys());
- url = setParam(url,"xmluri", rdflyURL + "get%3Fkind%3Dbackward%26object%3D" + escape(escape(uri)));
- return url;
-}
+++ /dev/null
-function dropBodySuffix(url)
-{ var length = url.length;
- if (url.slice(length - 5, length) == '.body')
- return (url.slice(0, length - 5));
- else
- return url;
-}
-
-function chopSlash(url)
-{
- return url.slice(0,url.lastIndexOf('/'));
-}
-
-function dropParam(url,name)
-{
- var urla = url.split("?");
- var search = urla[1];
- var args = search.split("&");
- var newargs = new Array();
- var j = 0;
-
- for (var i = 0 ; i < args.length ; i++) {
- var couple = args[i].split("=");
- if (couple[0] != name) {
- newargs[j] = args[i];
- j++;
- }
- }
-
- return (urla[0] + "?" + newargs.join("&"));
-}
-
-function setParam(url,name,value)
-{
- var urla = url.split("?");
- var search = urla[1];
- var args = search.split("&");
- var found = false;
-
- for (var i = 0 ; i < args.length ; i++) {
- var couple = args[i].split("=");
- if (couple[0] == name) {
- found = true;
- args[i] = name + "=" + value;
- }
- }
-
- return (urla[0] + "?" + args.join("&") + (found ? "" : ("&" + name + "=" + value)));
-}
-
-function extractParam(url,name)
-{
- var search = url.split("?")[1];
- search = search.split("#")[0];
- var args = search.split("&");
- var value = "???";
-
- for (var i = 0 ; i < args.length ; i++) {
- var couple = args[i].split("=");
- if (couple[0] == name) value = couple[1];
- }
-
- if (value == "???") value = getDefaultParam(name);
-
- return value;
-}
-
-function getParam0(search,name)
-{
- var args = search.split("&");
- var value = "???";
-
- for (var i = 0 ; i < args.length ; i++) {
- var couple = args[i].split("=");
- if (couple[0] == name) value = couple[1];
- }
-
- if (value == "???") value = getDefaultParam(name);
-
- return value;
-}
-
-function getParam(name)
-{
- return getParam0(location.search.slice(1),name);
-}
-
-function getParam2(name)
-{
- var url = unescape(getParam('xmluri'));
- var tmp = url.split("?");
-
- if (tmp.length > 1)
- return getParam0(tmp[1],name);
- else
- return getDefaultParam(name);
-}
-
-
-function outputOption(doc, value, content, selected)
-{
- doc.write("<option value=\"" + value + "\" ");
- if (value == selected) doc.write("selected ");
- doc.write(">" + content + "</option>");
-}
-
-function outputCheckbox(doc, onclick, content, checked)
-{
- doc.write("<input type=\"checkbox\" onClick=\"" + onclick + "\" ");
- if (checked) doc.write("checked");
- doc.write(">" + content + "</input>");
-}
-