diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-05-05 10:52:29 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-05-05 10:52:29 +0200 |
commit | 19fe0e08586e9e4063d507ff45b25315f5cf5bc7 (patch) | |
tree | f21cca360ac145395a51515964031063028412fa | |
parent | 7da71469707ae9394e457f1d212b192aa3970707 (diff) |
More fixes for new protocol.
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | munia.html | 1 | ||||
-rw-r--r-- | proto.js | 58 |
3 files changed, 22 insertions, 38 deletions
@@ -0,0 +1 @@ +Server segfaults on 'remove 0' @@ -50,7 +50,6 @@ body { </head> <body id="body"> <div id="wstask_status">TaskProto not initialized</div> -<div id="wsobserve_status">ObserveProto not initialized</div> TaskProto: <input type="text" id="input_task_data" value="observe 0" onfocus="clear()"/> <input type="button" value="submit" onclick="task_submit()"/><br/> TaskMessages: <span id="wstask_lastmsg"></span><br/> @@ -161,15 +161,13 @@ try { var observeid = msg[0]; var cmd = msg[1]; + var id = msg[2]; - if(cmd == "del") { - var id = msg[2]; + if(cmd == "remove") { var task = document.getElementById("task_" + id); - //todo: remove from parent not board - board.removeChild(task); + task.parentNode.removeChild(task); } else if(cmd == "move") { - var id = msg[2]; var parent_id = msg[3]; var task = document.getElementById("task_" + id); if(parent_id != -1) { @@ -179,19 +177,11 @@ try { else { board.appendChild(task); } - // task.parentNode.removeChild(task); - // board.removeChild(task); - // parent_task.appendChild(task); - // task.style.left = left + "px"; - // task.style.top = top + "px"; } else if(cmd == "create") { - var id = msg[2]; var parent_id = msg[3]; - // var title = msg[3]; - // var description = msg[4]; - var task = document.createElement("div"); + task.name = "task"; task.setAttribute("class", "task"); task.setAttribute("ondrop", "drop(this, event)"); @@ -203,24 +193,23 @@ try { task.id = "task_" + id; - // var taskText = document.createTextNode(title + ": " + description + " :" + task.id); var taskText = document.createTextNode('[' + task.id + ']'); taskText.id = "txt"; task.appendChild(taskText); - // task.style.position = "absolute"; - // task.style.left = left + "px"; - // task.style.top = top + "px"; - // task.setAttribute("onMouseDown", "dragged = '" + id + "';"); - - // var dlButton = document.createElement("input"); - // dlButton.type = "button"; - // dlButton.value = "Remove"; - // dlButton.onclick = "deleteTask(document.getElementById(" + task.id + ").id"; - // dlButton.setAttribute("onclick", "deleteTask(" + id +")"); - // task.appendChild(dlButton); - - // board.appendChild(task); + //task.style.position = "absolute"; + //task.style.left = left + "px"; + //task.style.top = top + "px"; + //task.setAttribute("onMouseDown", "dragged = '" + id + "';"); + + //var dlButton = document.createElement("input"); + //dlButton.type = "button"; + //dlButton.value = "Remove"; + //dlButton.onclick = "deleteTask(document.getElementById(" + task.id + ").id"; + //dlButton.setAttribute("onclick", "deleteTask(" + id +")"); + //task.appendChild(dlButton); + + //board.appendChild(task); var parent_task = document.getElementById("task_" + parent_id); @@ -232,20 +221,15 @@ try { } } else if(cmd == "update") { - - var id = msg[2]; var title = msg[3]; - var description = 'N/A';//msg[3]; - var task = document.getElementById("task_" + id); - - var taskText = document.createTextNode(title + ": " + description + " :" + task.id); + var taskText = document.createTextNode(title); task.appendChild(taskText); } f++; - // document.getElementById("box").style.top = i[3] + "px"; - // document.getElementById("box").style.left = i[2] + "px"; - // document.getElementById("box").style.display = "block"; + //document.getElementById("box").style.top = i[3] + "px"; + //document.getElementById("box").style.left = i[2] + "px"; + //document.getElementById("box").style.display = "block"; } } |