diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-05-17 16:18:26 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-05-17 16:18:26 +0200 |
commit | 6bbda5aaa2714750ec21fc9dc1c13a16cc1f4cc1 (patch) | |
tree | cef88e6e70931ca4b388ec188076e75ec62befdc | |
parent | 53258ceafbf07b759f6ea557452b77debe8095ad (diff) |
Multi board/observes in the client.
-rw-r--r-- | munia.html | 5 | ||||
-rw-r--r-- | proto.js | 30 |
2 files changed, 26 insertions, 9 deletions
@@ -1,4 +1,5 @@ -<!DOCTYPE html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en"> <head> <title>Munia</title> @@ -54,7 +55,7 @@ TaskProto: <input type="text" id="input_task_data" value="observe 0" onfocus="cl <input type="button" value="submit" onclick="task_submit()"/><br/> TaskMessages: <span id="wstask_lastmsg"></span><br/> </div> -<div id="board" class="board"></div> +<div id="boards" class="boards">!</div> <script type="text/javascript" charset="utf-8" src="/proto.js"></script> </body> @@ -83,7 +83,7 @@ function get_appropriate_ws_url() var socket_task; -var board = document.getElementById("board"); +var boards = document.getElementById("boards"); if (BrowserDetect.browser == "Firefox") { socket_task = new MozWebSocket(get_appropriate_ws_url(), "lws-task-protocol"); @@ -141,15 +141,31 @@ try { var cmd = msg[1]; var id = msg[2]; + var board = document.getElementById("board_" + observeid); + if(!board) { + //alert('missing board') + board = document.createElement("div"); + + board.name = "board"; + board.setAttribute("class", "board"); + board.setAttribute("style", "background-color: black; fixed-width: 100px; min-height: 200px; margin: 4px;"); + //board.setAttribute("ondrop", "drop(this, event)"); + //board.setAttribute("ondragover", "return false"); + //board.setAttribute("draggable", true); + //board.setAttribute("ondragstart", "drag(this, event)"); + board.id = "board_" + observeid; + boards.appendChild(board); + } + if(cmd == "remove") { - var task = document.getElementById("task_" + id); + var task = document.getElementById("board_" + observeid + "task_" + id); task.parentNode.removeChild(task); } else if(cmd == "move") { var parent_id = msg[3]; - var task = document.getElementById("task_" + id); + var task = document.getElementById("board_" + observeid + "task_" + id); if(parent_id != -1) { - var parent_task = document.getElementById("task_" + parent_id); + var parent_task = document.getElementById("board_" + observeid + "task_" + parent_id); parent_task.appendChild(task); } else { @@ -167,13 +183,13 @@ try { task.setAttribute("draggable", true); task.setAttribute("ondragstart", "drag(this, event)"); - task.id = "task_" + id; + task.id = "board_" + observeid + "task_" + id; var taskText = document.createTextNode('[' + task.id + ']'); taskText.id = "txt"; task.appendChild(taskText); - var parent_task = document.getElementById("task_" + parent_id); + var parent_task = document.getElementById("board_" + observeid + "task_" + parent_id); if(parent_task) { parent_task.appendChild(task); @@ -184,7 +200,7 @@ try { } else if(cmd == "update") { var title = msg[3]; - var task = document.getElementById("task_" + id); + var task = document.getElementById("board_" + observeid + "task_" + id); var taskText = document.createTextNode(title); task.appendChild(taskText); } |