2 function getParam(name, def)
4 var search = top.location.search;
5 search = search.slice(1);
6 var args = search.split("&");
8 for (var i = 0 ; i < args.length ; i++) {
9 var couple = args[i].split("=");
10 if (couple[0] == name) value = couple[1];
12 if (value == "-1") value = def;
16 function getInitialPort()
21 function getInitialProcessorURL()
23 return getParam("processorURL", "http://mowgli.cs.unibo.it:58080/");
26 function getInitialGetterURL()
28 return getParam("getterURL", "http://mowgli.cs.unibo.it:58081/");
31 function getUwoboURL()
33 return document.uwoboURL.elements[0].value;
36 function getGetterURL()
38 return document.getterURL.elements[0].value;
41 function selectUwoboURL(ss)
43 if (ss.selectedIndex == 0) {
44 document.uwoboURL.elements[0].value = "";
46 document.uwoboURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":58080/";
50 function selectGetterURL(ss)
52 if (ss.selectedIndex == 0) {
53 document.getterURL.elements[0].value = "";
55 document.getterURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":8081/";
59 function getPredefinedStylesheetKey(i)
61 var v = document.predefinedStylesheets.elements[0].options[i].value;
62 var va = v.split(",");
66 function getPredefinedStylesheetURI(i)
68 var v = document.predefinedStylesheets.elements[0].options[i].value;
69 var va = v.split(",");
73 function getPredefinedStylesheetUseGetter(i)
75 var v = document.predefinedStylesheets.elements[0].options[i].value;
76 var va = v.split(",");
80 function selectPredefinedStylesheet(ss)
82 if (ss.selectedIndex == 0) {
83 document.stylesheetURI.elements[0].value = "";
84 document.stylesheetKey.elements[0].value = "";
86 document.stylesheetURI.elements[0].value = getPredefinedStylesheetURI(ss.selectedIndex);
87 document.stylesheetKey.elements[0].value = getPredefinedStylesheetKey(ss.selectedIndex);
90 document.loadUseGetter.elements[0].checked = getPredefinedStylesheetUseGetter(ss.selectedIndex) == "true" ? true : false;
91 document.loadEscape.elements[0].checked = true;
94 function getProfileParams()
96 var password = document.getParamsProfilePassword.elements[0].value;
97 if (password != "") { password = "&password=" + password; };
99 top.result.location.replace(getUwoboURL() + "getparams?id=" + document.getParamsProfileID.elements[0].value + password);
102 function setProfileParam()
104 var password = document.setParamProfilePassword.elements[0].value;
105 if (password != "") { password = "&password=" + password; };
107 top.result.location.replace(getUwoboURL() + "setparam?id=" + document.setParamProfileID.elements[0].value + "&key=" + document.setParamProfileKey.elements[0].value + "&value=" + document.setParamProfileValue.elements[0].value + password);
110 function createProfile()
112 var id = document.createProfileID.elements[0].value;
113 if (id != "") { id = "&id=" + id; };
115 var password = document.createProfilePassword.elements[0].value;
116 if (password != "") { password = "&password=" + password; };
118 var clone = document.createProfileClone.elements[0].value;
119 if (clone != "") { clone = "&orig=" + clone; };
121 top.result.location.replace(getUwoboURL() + "createprofile?foo=x" + id + password + clone);
124 function removeProfile()
126 var password = document.removeProfilePassword.elements[0].value;
127 if (password != "") { password = "&password=" + password; };
129 top.result.location.replace(getUwoboURL() + "removeprofile?id=" + document.removeProfileID.elements[0].value + password);
132 function getStylesheetURL()
136 if (document.loadUseGetter.elements[0].checked) {
137 s = getGetterURL() + "getxslt?uri=" + document.stylesheetURI.elements[0].value;
139 s = document.stylesheetURI.elements[0].value;
142 if (document.loadEscape.elements[0].checked) s = escape(s);
147 function loadStylesheet()
149 top.result.location.replace(getUwoboURL() + "add?bind=" + document.stylesheetKey.elements[0].value + "," + getStylesheetURL());
152 function removeStylesheet()
154 top.result.location.replace(getUwoboURL() + "remove?keys=" + document.stylesheetKey.elements[0].value);
157 function removeAllStylesheets()
159 top.result.location.replace(getUwoboURL() + "remove?keys=");
162 function reloadStylesheet()
164 top.result.location.replace(getUwoboURL() + "reload?keys=" + document.stylesheetKey.elements[0].value);
167 function reloadAllStylesheets()
169 top.result.location.replace(getUwoboURL() + 'reload?keys=');
172 function loadAllPredefined()
174 with (document.predefinedStylesheets.elements[0]) {
178 for (i = 1; i < length; i++)
180 (request == "" ? "" : "&") +
181 "bind=" + getPredefinedStylesheetKey(i) + "," + escape((getPredefinedStylesheetUseGetter(i) == "true" ? (getGetterURL() + "getxslt?uri=") : "") + getPredefinedStylesheetURI(i));
182 top.result.location.replace(getUwoboURL() + "add?" + request);
186 function removeAllPredefined()
188 with (document.predefinedStylesheets.elements[0]) {
192 for (i = 1; i < length; i++)
193 request += getPredefinedStylesheetKey(i) + (i == length - 1 ? "" : ",");
194 top.result.location.replace(getUwoboURL() + "remove?keys=" + request);
198 function applyStylesheets()
201 var keyList = document.keyList.elements[0].value.split(" ");
203 var url = getUwoboURL() + "apply?xmluri=";
207 if (document.applyUseGetter.elements[0].checked)
208 sourceURL += getGetterURL() + "getxml?uri=";
210 sourceURL += document.sourceDocument.elements[0].value;
212 if (document.escapeSource.elements[0].checked)
213 url += escape(sourceURL);
218 for (i = 0; i < keyList.length; i++) {
220 if (i < keyList.length - 1) url += ",";
223 var paramList = document.parameters.elements[0].value.split(" ");
224 for (i = 0; i < paramList.length; i++)
225 if (paramList[i].length > 0) {
226 if (document.escapeParameters.elements[0].checked) {
227 var p = paramList[i].split("=");
228 url += "¶m." + p[0] + "=" + escape(p[1]);
230 url += "¶m." + paramList[i];
233 top.result.location.replace(url);