--- /dev/null
+
+function getParam(name, def)
+{
+ var search = top.location.search;
+ search = search.slice(1);
+ var args = search.split("&");
+ var value = "-1";
+ for (var i = 0 ; i < args.length ; i++) {
+ var couple = args[i].split("=");
+ if (couple[0] == name) value = couple[1];
+ }
+ if (value == "-1") value = def;
+ return value;
+}
+
+function getInitialProcessorURL()
+{
+ return getParam("processorURL", "http://phd.cs.unibo.it:8080/helm/servlet/uwobo/");
+}
+
+function getInitialGetterURL()
+{
+ return getParam("getterURL", "http://phd.cs.unibo.it:8081/");
+}
+
+function getUwoboURL()
+{
+ return document.uwoboURL.elements[0].value;
+}
+
+function getGetterURL()
+{
+ return document.getterURL.elements[0].value;
+}
+
+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/";
+ }
+}
+
+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/";
+ }
+}
+
+function getPredefinedStylesheetKey(i)
+{
+ var v = document.predefinedStylesheets.elements[0].options[i].value;
+ var va = v.split(",");
+ return va[0];
+}
+
+function getPredefinedStylesheetURI(i)
+{
+ var v = document.predefinedStylesheets.elements[0].options[i].value;
+ var va = v.split(",");
+ return va[1];
+}
+
+function getPredefinedStylesheetUseGetter(i)
+{
+ var v = document.predefinedStylesheets.elements[0].options[i].value;
+ var va = v.split(",");
+ return va[2];
+}
+
+function selectPredefinedStylesheet(ss)
+{
+ if (ss.selectedIndex == 0) {
+ document.stylesheetURI.elements[0].value = "";
+ document.stylesheetKey.elements[0].value = "";
+ } else {
+ document.stylesheetURI.elements[0].value = getPredefinedStylesheetURI(ss.selectedIndex);
+ document.stylesheetKey.elements[0].value = getPredefinedStylesheetKey(ss.selectedIndex);
+ }
+
+ document.loadUseGetter.elements[0].checked = getPredefinedStylesheetUseGetter(ss.selectedIndex) == "true" ? true : false;
+ document.loadEscape.elements[0].checked = true;
+}
+
+function getStylesheetURL()
+{
+ var s;
+
+ if (document.loadUseGetter.elements[0].checked) {
+ s = getGetterURL() + "getxslt?uri=" + document.stylesheetURI.elements[0].value;
+ } else {
+ s = document.stylesheetURI.elements[0].value;
+ }
+
+ if (document.loadEscape.elements[0].checked) s = escape(s);
+
+ return s;
+}
+
+function loadStylesheet()
+{
+ top.result.location = getUwoboURL() + "add?xsluri=" + getStylesheetURL() + "&key=" + document.stylesheetKey.elements[0].value;
+}
+
+function removeStylesheet()
+{
+ top.result.location = getUwoboURL() + "remove?key=" + document.stylesheetKey.elements[0].value;
+}
+
+function removeAllStylesheets()
+{
+ top.result.location = getUwoboURL() + "remove";
+}
+
+function reloadStylesheet()
+{
+ top.result.location = getUwoboURL() + "reload?key=" + document.stylesheetKey.elements[0].value;
+}
+
+function loadAllPredefined()
+{
+ with (document.predefinedStylesheets.elements[0]) {
+ var i;
+
+ for (i = 1; i < length; i++)
+ open(getUwoboURL() +
+ "add?xsluri=" + escape((getPredefinedStylesheetUseGetter(i) == "true" ? (getGetterURL() + "getxslt?uri=") : "") + getPredefinedStylesheetURI(i)) +
+ "&key=" + getPredefinedStylesheetKey(i),
+ getPredefinedStylesheetKey(i),
+ "toolbar=0,location=0,directories=0,status=0,menubar=0,width=400,height=200");
+ }
+}
+
+function removeAllPredefined()
+{
+ with (document.predefinedStylesheets.elements[0]) {
+ var i;
+
+ for (i = 1; i < length; i++)
+ open(getUwoboURL() + "remove?key=" + getPredefinedStylesheetKey(i),
+ getPredefinedStylesheetKey(i),
+ "toolbar=0,location=0,directories=0,status=0,menubar=0,width=400,height=200");
+ }
+}
+
+function applyStylesheets()
+{
+ var i = 0;
+ var keyList = document.keyList.elements[0].value.split(" ");
+
+ var url = getUwoboURL() + "apply?xmluri=";
+
+ var sourceURL = "";
+
+ if (document.applyUseGetter.elements[0].checked)
+ sourceURL += getGetterURL() + "getxml?uri=";
+
+ sourceURL += document.sourceDocument.elements[0].value;
+
+ if (document.escapeSource.elements[0].checked)
+ url += escape(sourceURL);
+ else
+ url += sourceURL;
+
+ url += "&keys=";
+ for (i = 0; i < keyList.length; i++) {
+ url += keyList[i];
+ if (i < keyList.length - 1) url += ",";
+ }
+
+ var paramList = document.parameters.elements[0].value.split(" ");
+ for (i = 0; i < paramList.length; i++)
+ if (paramList[i].length > 0) {
+ if (document.escapeParameters.elements[0].checked) {
+ var p = paramList[i].split("=");
+ url += "¶m." + p[0] + "=" + escape(p[1]);
+ } else
+ url += "¶m." + paramList[i];
+ }
+
+ top.result.location = url;
+}