--- /dev/null
+function tasks_link(anc, a, b, type) {
+ var cur;
+ this.anc = anc;
+ this.o = document.createElement("div");
+ this.o.style.top = "0px";
+ this.o.style.left = "0px";
+ this.o.style.position = "absolute";
+ this.o.style.visibility = "hidden";
+ this.beg = document.createElement("div");
+ this.end = document.createElement("div");
+ this.arr = document.createElement("img");
+ this.arr.style.position = "absolute";
+ this.o.appendChild(this.arr);
+ this.anc.appendChild(this.o);
+ for (var i = 0 ; i < 2 ; i++) {
+ cur = i == 0 ? this.beg : this.end;
+ cur.style.width = '5px';
+ cur.style.height = '5px';
+ cur.style.backgroundColor = 'gray';
+ cur.style.visibility = 'inherit';
+ cur.style.zIndex = 20;
+ cur.style.position = 'absolute';
+ this.o.appendChild(cur);
+ // alert("gugu");
+ }
+
+ this.a = a;
+ this.b = b;
+ this.type = type;
+
+ if (typeof(a.connected) != 'object')
+ return null;
+
+ if (typeof(b.connected) != 'object')
+ return null;
+
+ for (var i = 0 ; i < 2 ; i++) {
+ cur = (i == 0 ? a : b);
+ cur.connected[cur.connected.length++] = this;
+ for( ; cur.parentNode != null && cur.parentNode != anc ; cur = cur.parentNode) {
+ cur.connect(this);
+ }
+ }
+ this.update()
+}
+
+tasks_link.prototype = {
+ a: null,
+ b: null,
+ type: null,
+
+ update: function(method, obj)
+ {
+ /*
+ if (method == 'end') {
+ if (this.o.style.visibility == 'visible')
+ this.o.style.visibility = 'hidden';
+ else
+ this.o.style.visibility = 'visible';
+ }
+ */
+
+ // FIXME you need to user the width of the border instead of +2
+ this.beg.style.left = (parseInt(this.a.style.left) + parseInt(this.a.style.width) + 2 + parseInt(this.a.parentNode.style.left))+"px";
+ this.beg.style.top = (parseInt(this.a.style.top) + parseInt(((parseInt(this.a.style.height) + 2) / 2)) + parseInt(this.a.parentNode.style.top))+"px";
+ 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";
+ this.beg.style.height = "1px";
+
+ this.end.style.left = (parseInt(this.beg.style.left) + parseInt(this.beg.style.width))+"px";
+ this.arr.style.left = (parseInt(this.end.style.left) - 3)+"px";
+ /* this.end.style.left = (parseInt(this.b.style.left) + parseInt(this.b.parentNode.style.left))+"px";
+ this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))+"px"; */
+ endpty = parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top)+10;
+ this.end.style.width = "1px";
+
+ if (parseInt(this.beg.style.top) < endpty) {
+ this.end.style.top = this.beg.style.top;
+ 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";
+ this.arr.style.top = (parseInt(this.end.style.top) + parseInt(this.end.style.height) - 5)+"px";
+ this.arr.src = "img/arrow_do.png";
+ }
+ else {
+ this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) + 23)+"px";
+ 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";
+
+ this.arr.style.top = this.end.style.top;
+ this.arr.src = "img/arrow_up.png";
+ }
+
+
+ this.o.style.visibility = "visible";
+
+ console.log("met: " + method + " obj: " + (obj == this.a ? "Obj A" : (obj == this.b ? "Obj B" : "Other")) );
+ }
+}