changeset 8:07191a24a9a4 draft

modified getEvidence function
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Wed, 20 Mar 2013 06:09:42 +0900
parents 29db6ff1d63e
children 35ee0b1d8719
files index.html
diffstat 1 files changed, 54 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/index.html	Wed Mar 20 05:23:49 2013 +0900
+++ b/index.html	Wed Mar 20 06:09:42 2013 +0900
@@ -28,15 +28,11 @@
 		<label style='position:relative;'><input id="direction_out" type='checkbox' checked value='out'/>OUT</label>   
 	    </div>
     	    <div id="traverseDisplayBody" style='position:absolute; left:20px; top:50px;'>
-<!--
-		<div>
-		    <label id='traverseLabel'><input type='checkbox' checkd value=''/>commited-user </label><br>in:3 out:4
-		</div>
--->
+    Please click any node.
 	    </div>
 	</div>
     </div>
-    <span class='button display' style='position:absolute; width:100; left:75; bottom:5; opacity:1;'>traverse</span>
+    <span class='button display' style='position:absolute; width:100; left:75; bottom:5; opacity:1;' onclick='traverseAction();'>traverse</span>
 </div>
 
 <div id="miniDisplay" style='position:fixed; width:250px; height:250px; border:solid 1px; border-radius:5px; opacity:0.5; z-index:10; visibility:visible;'>
@@ -60,6 +56,9 @@
 
 
 <script type="text/javascript">
+var BASE_URL = "";
+
+
 if(!Array.prototype.filter){
     Array.prototype.filter=function(func){
 	var arr=[];
@@ -77,6 +76,13 @@
     });
 }
 
+function GraphData() {
+    var graphData = {};
+    graphData.nodes = {};
+    graphData.edges = {};
+    return graphData;
+}
+
 function beginScript() {
     DragHandler.attach($('#miniDisplay')[0]);
     DragHandler.attach($('#traverseDisplay')[0]);
@@ -159,7 +165,7 @@
 }
 
 function getTraverseDivTemplate(kind, inNum, outNum) {
-    return "<div><label id='traverseLabel'><input type='checkbox' checked/>"+kind+"</label><br>in:"+inNum+" out:"+outNum;
+    return "<div><label id='traverseLabel'><input type='checkbox' checked value='"+kind+"'/>"+kind+"</label><br>in:"+inNum+" out:"+outNum+"</div>";
 }
 
 function createTraverseView(info) {
@@ -179,7 +185,7 @@
     return viewHtml;
 }
 
-function writeEdgeInfoTraverseDisplay(node) {
+function createEdgeInfoView(node) {
     var id = node.property.id;
     var edgeInfo = node.property.edgeInfo;
     var str = "";
@@ -196,11 +202,6 @@
     $('#traverseDisplayBody')[0].innerHTML = viewHTML;
 }
 
-function createTraverseDisplayInfo(info) {
-    
-    
-}
-
 function init() {
     jsPlumb.importDefaults({
 	Connector : [ "Straight", { curviness:50 } ],
@@ -229,10 +230,12 @@
 }
 
 function showTraverseDisplay(node) {
+    this.id = node.property.id;
     if (!node.property.edgeInfo) { console.log("not found node.edgeInfo "); return; }
     if (!node.property.edgeInfo.viewHtml) {
-	writeEdgeInfoTraverseDisplay(node);
+	createEdgeInfoView(node);
     }
+    $('#traverseDisplayBody')[0].innerHTML = node.property.edgeInfo.viewHtml;	
     $("#traverseDisplay").css("visibility", "visible");
 }
 
@@ -262,10 +265,39 @@
     showRelationNodes(graphData, node, rels);    
 }
 
+function addEdgeInfo(id, kind, direction) {
+    var nodes = GRAPH_DATA.nodes;
+    var edges = GRAPH_DATA.edges;
+    
+}
+
+function getEvidence(id, kind, direction) {
+    $.ajax({
+	url:"/aat/aaevidencesiftingmodel.userdesktops/get?id="+id+"?kind="kind+"?direction="+direction,
+	success:function(o) { parseJSONGraphData(GRAPH_DATA, o); },
+	type:"GET", cache:fasel;
+	error:function(o) { console.log("getEvidence error : ", o); }
+    });
+}
+
 function traverseAction() {
-    var isInDirTrue = $('#direction_in')[0].checked;
-    var isOutDirTrue = $('#direction_out')[0].checked;
-
+    var inDirChecked = $('#direction_in')[0].checked;
+    var outDirChecked = $('#direction_out')[0].checked;
+    var labelTags = $('[id=traverseLabel]');
+    var kinds = [];
+    for (var i=0;i<labelTags.length; i++ ) { 
+	var inputTag = labelTags[i].children[0];
+	if (inputTag.checked) {
+	    kinds.push(inputTag.value);
+	}
+    }
+    var id = this.id;
+    for (var i=0; i<kinds.length; i++) {
+	var kind = kinds[i];
+	if (inDirChecked) getEvidence(id, kind, "in");
+	if (outDirChecked) getEvidence(id, kind, "out");
+    }
+    
 }
 
 function returnCheckdRelation() {
@@ -350,13 +382,6 @@
     endpoint:"Blank",
 };
 
-function GraphData() {
-    var graphData = {};
-    graphData.nodes = {};
-    graphData.edges = {};
-    return graphData;
-}
-
 function parseJSONGraphData(memory ,jsonObj) {
     var nodes = jsonObj.nodes;
     for (var i=0; i<nodes.length; i++) {
@@ -439,7 +464,7 @@
 }
 
 /*
- * This function output all NODE thath are related [node]
+ * This function output all NODE that are related [node]
  */
 function updateRelationNodes(graphData, node) {
     var id = node.property.id;
@@ -500,11 +525,6 @@
     agreement:'agreement'
 };
 
-$(function() {
-    userName = localStorage.userName;
-    testStart();
-})
-
 function recursiveCalcPosition(graphData, parentNode) {
     if (!parentNode.position) updateNode(parentNode);
     childNodeIds = getRelationNodeIds(graphData, parentNode);
@@ -534,8 +554,6 @@
     }
 }
 
-
-
 var GRAPH_DATA = new GraphData();
 var rootNode = {};
 function startUserDesktopUI() {
@@ -555,11 +573,10 @@
     startUserDesktopUI();
 }
 
-function logProperty(d) {
-    for(var key in d) {
-	console.log("key: "+key+ "\nvalue: "+d[key]);
-    }
-}
+$(function() {
+    userName = localStorage.userName;
+    testStart();
+})
 
 
 edgeInfo1 = [