X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fon-line%2Fjavascript%2Fcontrol.js;h=bc52d02b617d6a2948d56b65dcaf4d103528d862;hb=d8b76c102e4f540c3ecfa550267331a7a72810c2;hp=dca05a8b2e71b9ec44f142be2a54ab0bf0bbe1e2;hpb=e056db635d42bf61eeccbba580c6a0e3a78c3f01;p=helm.git diff --git a/helm/on-line/javascript/control.js b/helm/on-line/javascript/control.js index dca05a8b2..bc52d02b6 100644 --- a/helm/on-line/javascript/control.js +++ b/helm/on-line/javascript/control.js @@ -14,17 +14,14 @@ function updateMode(i, s) top.mode = res; } -function updateOutput(output,format) +function updateOutput(output,format,processorURL,interfaceURL) { var theoryuri = top.theoryuri; var cicuri = top.cicuri; var mode = top.mode; - var topurl = top.topurl; - var processorURL = top.processorURL; - var getterURL = top.getterURL; 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 + "&mode="; if (new_mode != mode_list[0]) { updateMode(0, new_mode); @@ -32,17 +29,17 @@ function updateOutput(output,format) else updateMode(1, format.options[format.selectedIndex].value); var href = - top.processorURL + 'apply' + + processorURL + 'apply' + '?keys=RT' + '¶m.topurl=' + topurl + '&xmluri=' + - escape(top.topurl + '/html/library/control.html' + dest + top.mode); + escape(interfaceURL + '/html/library/control.html' + dest + top.mode); location.href = href; } } -function updateFormat(format) +function updateFormat(format,profile,processorURL,interfaceURL) { var mode = top.mode; var mode_list = mode.split(","); @@ -53,64 +50,61 @@ function updateFormat(format) updateMode(2, format.options[format.selectedIndex].value); } - refreshReload(); + refreshReload(profile,processorURL,interfaceURL); } -function updateNatural(checkbox) +function updateNatural(checkbox,profile,processorURL,interfaceURL) { if (checkbox.checked) updateMode(3, "yes"); else updateMode(3, "no"); - refreshReload(); + refreshReload(profile,processorURL,interfaceURL); } -function updateAnnotations(checkbox) +function updateAnnotations(checkbox,profile,processorURL,interfaceURL) { if (checkbox.checked) updateMode(4, "yes"); else updateMode(4, "no"); - refreshReload(); + refreshReload(profile,processorURL,interfaceURL); } -function updateCompressed(checkbox) +function updateCompressed(checkbox,profile,processorURL,interfaceURL) { if (checkbox.checked) updateMode(5, "gz"); else updateMode(5, "normal"); - refreshReload(); + refreshReload(profile,processorURL,interfaceURL); } -function updateDTDPatched(checkbox) +function updateDTDPatched(checkbox,profile,processorURL,interfaceURL) { if (checkbox.checked) updateMode(6, "yes"); else updateMode(6, "no"); - refreshReload(); + refreshReload(profile,processorURL,interfaceURL); } -function refreshReload() +function refreshReload(profile, processorURL, interfaceURL) { var search = "?mode=" + top.mode + "&cicuri=" + top.cicuri + - "&theoryuri=" + top.theoryuri + - "&processorURL=" + top.processorURL + - "&getterURL=" + top.getterURL + - "&UNICODEvsSYMBOL=" + top.UNICODEvsSYMBOL; + "&theoryuri=" + top.theoryuri; - var href = - top.processorURL + 'apply' + + var href = processorURL + + 'apply' + '?keys=RT' + - '¶m.topurl=' + top.topurl + + '&profile=' + profile + + '¶m.profile=' + profile + '&xmluri=' + - escape(top.topurl + '/html/library/index.html' + search); + escape(interfaceURL + '/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; + interfaceURL + '/html/index.html' + search; return true; } function refreshcicHeader(headerURL) { -// Qui e sotto da modificare per usare UWOBO!!! top.cicheader.location.search = "?keys=GP&xmluri=" + headerURL + "¶m.uri=" + top.cicuri; return true; } @@ -123,23 +117,39 @@ function refreshtheoryHeader(headerURL) function getCICMathMLKeys() { - //Important note: do not modify this function without modifying makeURL return escape("d_c,C1,G,C2,L"); } -function makeURL(type,uri,cicflags,typesflags) +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 processorURL = top.processorURL; - var getterURL = top.getterURL; - 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 interfaceURLidx = interfaceURL + "/html/cic/index.html"; + var thinterfaceURLidx = interfaceURL + "/html/theory/index.html"; var output = mode_list[0]; var format; @@ -148,101 +158,103 @@ function makeURL(type,uri,cicflags,typesflags) if (output == "raw") { var ext = ""; + var rdfprefix = ""; if (format == "types") ext = ".types" - else if (format == "ann") ext = ".ann"; - url = getterURL + "getxml?uri=" + uri + ext + "&format=" + mode_list[5] + - "&patch_dtd=" + mode_list[6]; + 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") { - //Important note: do not modify this function without modifying - //getCICMathMLKeys - keys = escape("d_c,C1,HC2,L")+"¶m.processorURL=" + escape(processorURL) + - "¶m.getterURL=" + escape(getterURL) + - "¶m.UNICODEvsSYMBOL=" + escape(UNICODEvsSYMBOL) + + 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=" + escape("d_c,C1,HC2,L") + - "¶m.interfaceURL=" + escape(interfaceURL); + "¶m.keys=" + getCICHTMLKeys(); } else if (format == "html" && type == "theory") { - keys = escape("T1,T2,L,E")+ - "¶m.processorURL=" + escape(processorURL) + - "¶m.getterURL=" + escape(getterURL) + - "¶m.UNICODEvsSYMBOL=" + escape(UNICODEvsSYMBOL) + - "¶m.keys=" + escape("d_c,C1,HC2,L") + - "¶m.thkeys=" + escape("T1,T2,L,E") + - "¶m.embedkeys=" + escape("d_c,TC1,HC2,L") + + 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" + - "¶m.interfaceURL=" + escape(interfaceURL) + - "¶m.thinterfaceURL=" + escape(thinterfaceURL); + "¶m.thmedia-type=text/html"; } else if (format == "mml_cont" && type == "cic") { - keys = escape("d_c,C1"); + 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.processorURL=" + escape(processorURL) + - "¶m.getterURL=" + escape(getterURL) + "¶m.doctype-public=" + "¶m.encoding=" + "¶m.thencoding=iso-8859-1" + "¶m.media-type=text/xml" + - "¶m.thmedia-type=text/html" + - "¶m.interfaceURL=" + escape(interfaceURL) + - "¶m.thinterfaceURL=" + escape(thinterfaceURL); + "¶m.thmedia-type=text/html"; } else if (format == "mml_pres" && type == "cic") { - keys = escape("d_c,C1,G,C2,L")+ - "¶m.processorURL=" + escape(processorURL) + - "¶m.getterURL=" + escape(getterURL) + + keys = getCICMathMLKeys()+ + "&profile=" + profile + + "¶m.profile=" + profile + "&prop.doctype-public="+ - "&prop.encoding=" + "&prop.media-type=text/xml" + "¶m.doctype-public=" + "¶m.encoding=" + "¶m.media-type=text/xml" + - "¶m.keys=" + escape("d_c,C1,G,C2,L") + - "¶m.interfaceURL=" + escape(interfaceURL); + "¶m.keys=" + getCICMathMLKeys(); } else if (format == "mml_pres" && type == "theory") { - keys = escape("T1,T2,L,E")+ - "¶m.keys=d_c,C1,G,C2,L" + - "¶m.thkeys=T1,T2,L,E" + - "¶m.embedkeys=d_c,TC1,G,C2,L" + - "¶m.processorURL=" + escape(processorURL) + - "¶m.getterURL=" + escape(getterURL) + + 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" + - "¶m.interfaceURL=" + escape(interfaceURL) + - "¶m.thinterfaceURL=" + escape(thinterfaceURL); - } - - var naturalLanguage = typesflags; - if (typesflags != "NO" || type == "theory") { - naturalLanguage = mode_list[3]; - } - var annotations = cicflags; - if (cicflags != "NO" || type == "theory") { - annotations = mode_list[4]; + "¶m.thmedia-type=text/html"; } - url = processorURL + "apply?xmluri=" + escape(getterURL + "getxml?uri=" + uri) + "&keys=" + keys + "¶m.CICURI=" + uri + "¶m.naturalLanguage=" + naturalLanguage + "¶m.annotations=" + annotations + "¶m.topurl=" + top.topurl; } if (output == "raw") return url; else if (type == "cic") - return interfaceURL + "?url=" + escape(url); + return processorURL + "apply?keys=RT&xmluri=" + escape(interfaceURLidx) + "¶m.ignore=" + keys + "¶m.CICURI=" + uri; else if (type == "theory") - return thinterfaceURL + "?url=" + escape(url) + return processorURL + "apply?keys=RT&xmluri=" + escape(thinterfaceURLidx) + "¶m.ignore=" + keys + "¶m.CICURI=" + uri; } -