summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-05-17 16:18:26 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2012-05-17 16:18:26 +0200
commit6bbda5aaa2714750ec21fc9dc1c13a16cc1f4cc1 (patch)
treecef88e6e70931ca4b388ec188076e75ec62befdc
parent53258ceafbf07b759f6ea557452b77debe8095ad (diff)
Multi board/observes in the client.
-rw-r--r--munia.html5
-rw-r--r--proto.js30
2 files changed, 26 insertions, 9 deletions
diff --git a/munia.html b/munia.html
index cddf8da..0989b49 100644
--- a/munia.html
+++ b/munia.html
@@ -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>
diff --git a/proto.js b/proto.js
index 74eeabd..e81083b 100644
--- a/proto.js
+++ b/proto.js
@@ -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);
}