summaryrefslogtreecommitdiff
path: root/view.js
diff options
context:
space:
mode:
Diffstat (limited to 'view.js')
-rw-r--r--view.js93
1 files changed, 48 insertions, 45 deletions
diff --git a/view.js b/view.js
index 74e91ff..8bb9f87 100644
--- a/view.js
+++ b/view.js
@@ -12,16 +12,6 @@ function createTask()
}
*/
-function createId(boardid, taskid)
-{
- return "b" + boardid + "_t" + taskid;
-}
-
-function idFromStr(str)
-{
- return str.substring(str.search('t') + 1, str.length);
-}
-
function getTask(observeid, id)
{
@@ -53,7 +43,7 @@ function clear() {
}
function deleteTask(id) {
- socket_task.send("remove " + id + ";");
+ remove(id);
}
function drag(target, e) {
@@ -67,19 +57,19 @@ function drop(target, e) {
var id = e.dataTransfer.getData('Text');
var task = document.getElementById(id);
- socket_task.send("move " + idFromStr(id) + " " + idFromStr(target.id) + ";");
+ move(idFromStr(id), idFromStr(target.id));
}
function observeMe(target, e)
{
- e.stopPropagation();
- socket_task.send("observe "+target.title+";");
+ e.stopPropagation();
+ observe(target.title);
}
function unobserveMe(target, e)
{
- e.stopPropagation();
- socket_task.send("unobserve "+target.title+";");
+ e.stopPropagation();
+ unobserve(target.title);
}
function showHideChildren(target, e)
@@ -99,6 +89,19 @@ function showHideChildren(target, e)
}
}
+function task_submit() {
+ var data = document.getElementById("input_task_data");
+ transmit(data.value);
+ data.value = "";
+}
+
+function task_submit_KeyUpHandler(target, e)
+{
+ if(e.which == 13) { // enter
+ task_submit();
+ }
+}
+
//
// Butt ugly.. but hey! it works...
//
@@ -108,41 +111,41 @@ var oldtxt;
var oldtitle;
function onKeyUpHandler(target, e)
{
- if(e.which == 13) { // enter
- divtxt.removeChild(target);
- oldtxt.nodeValue = 'updating...';
- socket_task.send("update " + updateid + " \""+target.value+"\";");
- }
- if(e.which == 27) { // escape
- divtxt.removeChild(target);
- oldtxt.nodeValue = oldtitle;
- }
+ if(e.which == 13) { // enter
+ divtxt.removeChild(target);
+ oldtxt.nodeValue = 'updating...';
+ update(updateid, "title", target.value);
+ }
+ if(e.which == 27) { // escape
+ divtxt.removeChild(target);
+ oldtxt.nodeValue = oldtitle;
+ }
}
function onLostFocusHandler(target, e)
{
- if(target.value == oldtitle) {
- divtxt.removeChild(target);
- oldtxt.nodeValue = oldtitle;
- }
+ if(target.value == oldtitle) {
+ divtxt.removeChild(target);
+ oldtxt.nodeValue = oldtitle;
+ }
}
function editTitle(target, e)
{
- e.stopPropagation();
- updateid = idFromStr(target.id);
- if(updateid < 10) return;
- var inp = document.createElement("input");
- var txtdiv = document.getElementById(target.id + "_txt");
- divtxt = txtdiv;
- oldtxt = txtdiv.firstChild;
- oldtitle = oldtxt.nodeValue;
- oldtxt.nodeValue = "";
- inp.setAttribute("onkeyup", "onKeyUpHandler(this, event)");
- inp.setAttribute("onblur", "onLostFocusHandler(this, event)");
- inp.setAttribute("style", "border: inherit; padding: inherit; margin: inherit; background: inherit;");
- inp.value = oldtitle;
- lineedit = inp;
- txtdiv.appendChild(inp);
- inp.focus();
+ e.stopPropagation();
+ updateid = idFromStr(target.id);
+ if(updateid < 10) return;
+ var inp = document.createElement("input");
+ var txtdiv = document.getElementById(target.id + "_txt");
+ divtxt = txtdiv;
+ oldtxt = txtdiv.firstChild;
+ oldtitle = oldtxt.nodeValue;
+ oldtxt.nodeValue = "";
+ inp.setAttribute("onkeyup", "onKeyUpHandler(this, event)");
+ inp.setAttribute("onblur", "onLostFocusHandler(this, event)");
+ inp.setAttribute("style", "border: inherit; padding: inherit; margin: inherit; background: inherit;");
+ inp.value = oldtitle;
+ lineedit = inp;
+ txtdiv.appendChild(inp);
+ inp.focus();
}