changeset 114:2c280381bd53 draft

create traverse function
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Mon, 18 Mar 2013 05:42:11 +0900
parents 790f37202698
children 509d350a4768
files public/viewer/viewer_white.html
diffstat 1 files changed, 31 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/public/viewer/viewer_white.html	Mon Mar 18 05:28:06 2013 +0900
+++ b/public/viewer/viewer_white.html	Mon Mar 18 05:42:11 2013 +0900
@@ -161,12 +161,6 @@
     });
 }
 
-$(function() {
-    userName = localStorage.userName;
-//    start();
-    testStart();
-})
-
 function beginScript() {
     DragHandler.attach($('#miniDisplay')[0]);
 }
@@ -295,12 +289,26 @@
  *
  */
 function clickNodeDiv(id) {
-    
+    var graphData = GRAPH_DATA;
+    var node = graphData.nodes[id];
+    var inputDivs = $('.relation_input');
+    var rels = {};
+    for (var i=0; i<inputDivs.length; i++) {
+	var div = inputDivs[i];
+	if (div.checked) {
+	    rels[div.value] = 1;
+	}
+    }
+    showRelationNodes(graphData, node, rels);    
+}
+
+function returnCheckdRelation() {
+
 }
 
 function createNodeDiv(node) {
     node.view = $("<div class='graphNode'/>");
-    node.view.click(function(){clickNodeDiv(node.property.id)});
+    node.view.click(function(){ clickNodeDiv(node.property.id) });
     if(!node.position) node.position = calcNewNodePosition();
     node.view.hover();
     var div = $("<div class='graphNodeContent' />")[0];
@@ -568,14 +576,19 @@
     agreement:'agreement'
 };
 
+$(function() {
+    userName = localStorage.userName;
+    testStart();
+})
+
+var GRAPH_DATA = new GraphData();
 function testStart() {
     init();
-    var graphData = new GraphData();
-    parseJSONGraphData(graphData, sampleJSONData);
+    var graphData = parseJSONGraphData(GRAPH_DATA, sampleJSONData);
     var rootNodeId = "1";
     var rootNode = graphData.nodes[rootNodeId];
     updateNode(rootNode);
-    showRelationNodes(graphData, rootNode, {dependency:1});
+//    showRelationNodes(graphData, rootNode, {dependency:1});
 //    recursiveShowRelationNodes(graphData, rootNode);
 //    showAllEdge(graphData);
 
@@ -593,7 +606,7 @@
             id:"1",
 	    title:"context1",
             kind:"agree",
-	    createdUser:"osrhiro"
+	    createdUser:"oshiro"
 	},
         {
             id:"2",
@@ -611,6 +624,12 @@
 	    title:"task4",
 	    kind:"agree",
 	    createdUser:"oshiro"
+	},
+	{
+	    id:"5",
+	    title:"5",
+	    kind:"agree",
+ 	    createdUser:"oshiro"
 	}
     ],
     edges: [