changeset 15:ed6b969b2fc8 draft

modified show.html
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Wed, 20 Mar 2013 22:44:39 +0900
parents 6b91db54a9f3
children 1af36503e849
files show.html
diffstat 1 files changed, 13 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/show.html	Wed Mar 20 19:36:47 2013 +0900
+++ b/show.html	Wed Mar 20 22:44:39 2013 +0900
@@ -23,7 +23,8 @@
 	<li>&gt; <a href="@{AAEvidenceSiftingModel.Projects.show(desktop.id)}">&{'AAEvidenceSiftingModel.projects.show.title'}</a></li>
     </ul>
 
-<div id="traverseDisplay" style='position:fixed; width:250px; height:250px; border:solid 1px; border-radius:5px; opacity:1; z-index:10; visibility:visible;'>
+<div id="traverseDisplay" style='position:fixed; width:250px; height:250px; border:solid 
+1px; border-radius:5px; opacity:1; z-index:10; visibility:visible;'>
     <div style='position:absolute; left:0; top:0; width:100%; height:100%; background:black; opacity:0.7;'></div>
     <div id="closeTraverseDisplay" style='position:absolute; right:5px; top:-3px; z-index:10; color:white;' onclick="$('#traverseDisplay').css('visibility','hidden');" onmouseover="$('#closeTraverseDisplay').css('color','yellow');" onmouseout="$('#closeTraverseDisplay').css('color','white')" >CLOSE</div>
     <div style='position:absolute; width:90%; height:90%;'>
@@ -70,8 +71,6 @@
 
 <script type="text/javascript">
 var BASE_URL = "";
-
-
 if(!Array.prototype.filter){
     Array.prototype.filter=function(func){
 	var arr=[];
@@ -87,7 +86,6 @@
     return graphData;
 }
 
-
 function Edge(fromNode, toNode, relation) {
     var obj = {from:fromNode, to:toNode, rel:relation };
     return obj;
@@ -105,11 +103,6 @@
 	oElem.onmousedown = DragHandler._dragBegin;
 	return oElem;
     },
-    attach : function(oElem, id) {
-	oElem.onmousedown = DragHandler._dragBegin;
-	_id = id;
-	return oElem;
-    },
     _dragBegin : function(e) {
 	var oElem = DragHandler._oElem = this;
 	if (isNaN(parseInt(oElem.style.left))) { oElem.style.left = '0px'; }
@@ -120,7 +113,7 @@
 	oElem.mouseX = e.clientX;
 	oElem.mouseY = e.clientY;
 	document.onmousemove = DragHandler._drag;
-	document.onmouseup = DragHandler._dragEnd;
+ 	document.onmouseup = DragHandler._dragEnd;
 	return false;
     },
     _drag : function(e) {
@@ -134,10 +127,11 @@
 	oElem.style.top = nextY  + 'px';
 	oElem.mouseX = e.clientX;
 	oElem.mouseY = e.clientY;
-	if (_id) {
-	    var node = GRAPH_DATA.nodes[_id];
+	if (oElem.nodeId) {
+	    var id = oElem.nodeId;
+	    var node = GRAPH_DATA.nodes[id];
 	    node.position.x = nextX;
-	    node.position.x = nextY;	    
+	    node.position.y = nextY;	    
 	}
 	return false;
     },
@@ -312,7 +306,7 @@
 }
 
 function getEvidence(id, kind, direction) {
-    var u = "/aat/aaevidencesiftingmodel.userdesktops/get?id="+id+"&kind="+kind/*+"?direction="+direction;*/;
+    var u = "/aat/aaevidencesiftingmodel.userdesktops/get?id="+id+"&kind="+kind+"&direction="+direction;
     $.ajax({
 	url:u,
 	success:function(o) { parseJSONGraphData(GRAPH_DATA, o); recursiveCalcPosition(GRAPH_DATA, GRAPH_DATA.nodes[id]);  showEdgesAndNodes(GRAPH_DATA, o, kind);},
@@ -321,7 +315,7 @@
     });
 }
 
-function traverseAction() {
+ function traverseAction() {
     var inDirChecked = $('#direction_in')[0].checked;
     var outDirChecked = $('#direction_out')[0].checked;
     var labelTags = $('[id=traverseLabel]');
@@ -347,6 +341,7 @@
     if(!node.position) node.position = calcNewNodePosition();
     node.view.hover();
     var div = $("<div class='graphNodeContent' />")[0];
+    div.id = node.property.id;
     div.innerHTML = node.property.title;
     node.view[0].appendChild(div);
     return node;
@@ -359,9 +354,10 @@
 	createNodeDiv(node);
     }
     var div = node.view;
+    node.view[0].nodeId = node.property.id;
     //    div.text(node.property.title);
     div.click(function(){showMiniDisplay(node); showTraverseDisplay(node);});
-    DragHandler.attach($(node.view)[0], node.property.id);
+    DragHandler.attach($(node.view)[0]);
     var kindBackground = {agree:"#aaf", rejected:"#fff"};
     var kindBorder = {agree:"#66a", rejected:"#a66"};
     div.css("background", kindBackground[node.kind]||"white");
@@ -369,7 +365,7 @@
     div.css({
 	left: node.position.x,
 	top: node.position.y
-    });
+    }); 
     return created;    
 }