Commit 0a131fdf authored by Bas Lijnse's avatar Bas Lijnse
Browse files

Updated javascript for dual line debug

parent 0ad200d4
......@@ -150,6 +150,9 @@ function sendForm(formid, onclient) {
return;
}
serverDebug("");
clientDebug("");
//Add state and focus information to the form
addState(form);
......@@ -341,6 +344,9 @@ function ajaxSendForm(form) {
//Re-initialize ajax (MAY NOT BE NECCESARY. REQUIRES ADDITIONAL TESTING)
initAjax();
//Show a short status message
serverDebug("handling request...");
//Send request
xmlHttp.open("POST", "/" + getAppName() + "_ajax" ,true);
xmlHttp.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + msg[0]);
......@@ -349,9 +355,6 @@ function ajaxSendForm(form) {
xmlHttp.onreadystatechange = ajaxCallback;
xmlHttp.send(msg[1]);
//Show a short status message
document.getElementById("iTaskInfo").innerHTML = "<font color=\"yellow\"><b>Server is handling request...</b><hr/>";
}
function ajaxCallback() {
......@@ -377,8 +380,7 @@ function saplSendForm(form) {
}
lock = true;
document.getElementById("iTaskInfo").innerHTML = "<font color=\"yellow\"><b>Client is handling request...</b></font><hr/>";
clientDebug("handling request...");
//Encode the form and create an HTTP request message
var msg = multipartEncodeForm(form);
......@@ -395,11 +397,13 @@ function saplSendForm(form) {
var rsp = saplApplet.getOutput();
if(rsp == null) {
clientDebug("Applet returned null");
lock = false;
return false;
}
if(rsp.substring(0,5) == "ABORT") {
clientDebug("Applet aborted: " + rsp);
lock = false;
return false;
}
......@@ -407,11 +411,13 @@ function saplSendForm(form) {
var parts = rsp.split(Sapl_ToServer_Separator);
if( parts.length != 2) {
clientDebug("Unable to split response" + rsp);
lock = false;
return false;
}
if( parts[0] == "True") {
clientDebug("Switch to server");
lock = false;
return false;
}
......@@ -432,8 +438,6 @@ function splitResponseAndUpdate(response, fromserver) {
}
function updateDivs(divcodes, fromserver) {
for (var i=0; i < divcodes.length ; i++) {
var thisupdate = divcodes[i].split(FormName_Content_Separator);
......@@ -445,6 +449,20 @@ function updateDivs(divcodes, fromserver) {
}
}
function serverDebug(message) {
var div = document.getElementById("debug-server");
if(div != undefined) {
div.innerHTML = "<span style=\"color: yellow; font-weight: bold;\">Server: </span>" + message + "<hr />";
}
}
function clientDebug(message) {
var div = document.getElementById("debug-client");
if(div != undefined) {
div.innerHTML = "<span style=\"color: yellow; font-weight: bold;\">Client: </span>" + message + "<hr />";
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment