1 function tasks_link(o, anc, a, b, type) {
5 this.beg = document.createElement("div");
6 this.end = document.createElement("div");
7 this.arr = document.createElement("img");
8 this.arr.style.position = "absolute";
9 o.appendChild(this.arr);
10 for (var i = 0 ; i < 2 ; i++) {
11 cur = i == 0 ? this.beg : this.end;
12 cur.style.width = '5px';
13 cur.style.height = '5px';
14 cur.style.backgroundColor = 'gray';
15 cur.style.visibility = 'inherit';
16 cur.style.zIndex = 20;
17 cur.style.position = 'absolute';
26 if (typeof(a.connected) != 'object')
29 if (typeof(b.connected) != 'object')
32 for (var i = 0 ; i < 2 ; i++) {
33 cur = (i == 0 ? a : b);
34 cur.connected[cur.connected.length++] = this;
35 for( ; cur.parentNode != null && cur.parentNode != anc ; cur = cur.parentNode) {
36 cur.parentNode.connected[cur.parentNode.connected.length++] = this;
42 tasks_link.prototype = {
47 update: function(method, obj)
50 if (method == 'end') {
51 if (this.o.style.visibility == 'visible')
52 this.o.style.visibility = 'hidden';
54 this.o.style.visibility = 'visible';
58 // FIXME you need to user the width of the border instead of +2
59 this.beg.style.left = (parseInt(this.a.style.left) + parseInt(this.a.style.width) + 2 + parseInt(this.a.parentNode.style.left))+"px";
60 this.beg.style.top = (parseInt(this.a.style.top) + parseInt(((parseInt(this.a.style.height) + 2) / 2)) + parseInt(this.a.parentNode.style.top))+"px";
61 this.beg.style.width = (parseInt(this.b.style.left) - (parseInt(this.a.style.left) + 2 + parseInt(this.b.style.width) + 2)+ parseInt(this.b.parentNode.style.left) + 5)+"px";
62 this.beg.style.height = "1px";
64 this.end.style.left = (parseInt(this.beg.style.left) + parseInt(this.beg.style.width))+"px";
65 this.arr.style.left = (parseInt(this.end.style.left) - 3)+"px";
66 /* this.end.style.left = (parseInt(this.b.style.left) + parseInt(this.b.parentNode.style.left))+"px";
67 this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))+"px"; */
68 endpty = parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top)+10;
69 this.end.style.width = "1px";
71 if (parseInt(this.beg.style.top) < endpty) {
72 this.end.style.top = this.beg.style.top;
73 this.end.style.height = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) - ((parseInt(this.a.style.top) + parseInt(this.a.parentNode.style.top))) ) - 11 +"px";
74 this.arr.style.top = (parseInt(this.end.style.top) + parseInt(this.end.style.height) - 5)+"px";
75 this.arr.src = "img/arrow_do.png";
78 this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) + 23)+"px";
79 this.end.style.height = (parseInt(this.a.style.top) + parseInt(this.a.parentNode.style.top) - ((parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))) ) - 11 +"px";
81 this.arr.style.top = this.end.style.top;
82 this.arr.src = "img/arrow_up.png";
86 this.o.style.visibility = "visible";
88 console.log("met: " + method + " obj: " + (obj == this.a ? "Obj A" : (obj == this.b ? "Obj B" : "Other")) );