summaryrefslogtreecommitdiff
path: root/gstudio
diff options
context:
space:
mode:
authorshefali shetty <sshefali44@gmail.com>2012-05-09 11:24:16 +0530
committershefali shetty <sshefali44@gmail.com>2012-05-09 11:24:16 +0530
commitbe7765e07e626c8be1e3d433ddb2e4f84259cf59 (patch)
treeae040295d5633b2f920349a1fcb1ef28459c5fed /gstudio
parentee3c53484190eab032c28471d2082310b04dab86 (diff)
downloadgnowsys-be7765e07e626c8be1e3d433ddb2e4f84259cf59.tar.gz
bug related to 'relation' is rectified
Diffstat (limited to 'gstudio')
-rw-r--r--gstudio/models.py32
-rw-r--r--gstudio/static/gstudio/css/screen.css6
-rw-r--r--gstudio/templates/gstudio/skeleton.html19
3 files changed, 38 insertions, 19 deletions
diff --git a/gstudio/models.py b/gstudio/models.py
index 65262cc4..0b6886de 100644
--- a/gstudio/models.py
+++ b/gstudio/models.py
@@ -729,7 +729,7 @@ class Nodetype(Node):
predicate_id = {}
for key in nbh.keys():
- val = str(counter)+"a"
+ val = str(counter) + "a"
predicate_id[key] = val
counter = counter + 1
#print predicate_id
@@ -750,14 +750,30 @@ class Nodetype(Node):
#g_json[str(key)].append({"from":self.id , "to":predicate_id[key],"value":1, "level":1 })
g_json["relations"].append({"from":self.id ,"type":str(key),"value":1,"to":predicate_id[key] })
+
if not isinstance(nbh[key],basestring):
for item in nbh[key]:
- #create nodes
- g_json["node_metadata"].append({"_id":str(item.id),"screen_name":item.title,"title":self.title, "url":item.get_absolute_url(),"expanded":"false"})
-
- # g_json[str(key)].append({"from":predicate_id[key] , "to":item.id ,"value":1 })
- #create links
- g_json["relations"].append({"from":predicate_id[key] ,"type":str(key), "value":1,"to":item.id })
+ if item.reftype!="Relation":
+ # create nodes
+
+ g_json["node_metadata"].append({"_id":str(item.id),"screen_name":item.title,"title":self.title, "url":item.get_absolute_url(),"expanded":"false"})
+
+ # g_json[str(key)].append({"from":predicate_id[key] , "to":item.id ,"value":1 })
+ #create links
+ g_json["relations"].append({"from":predicate_id[key] ,"type":str(key), "value":1,"to":item.id })
+
+ else:
+
+ if item.left_subject.id==self.id:
+ item1=item.right_subject
+ elif item.right_subject.id==self.id:
+ item1=item.left_subject
+
+ g_json["node_metadata"].append({"_id":str(item1.id),"screen_name":item1.title,"title":self.title, "url":item1.get_absolute_url(),"expanded":"false"})
+
+ # g_json[str(key)].append({"from":predicate_id[key] , "to":item.id ,"value":1 })
+ #create links
+ g_json["relations"].append({"from":predicate_id[key] ,"type":str(key), "value":1,"to":item1.id })
else:
#value={nbh["plural"]:"a4",nbh["altnames"]:"a5"}
@@ -765,7 +781,7 @@ class Nodetype(Node):
#for item in value.keys():
g_json["node_metadata"].append({"_id":(str(attr_counter)+"a"),"screen_name":nbh[key]})
#g_json[str(key)].append({"from":predicate_id[key] , "to":attr_counter ,"value":1, "level":2 })
- g_json["relations"].append({"from":predicate_id[key] ,"type":str(key) ,"value":1,"to":(str(attr_counter)+"a") })
+ g_json["relations"].append({"from":predicate_id[key] ,"type":str(key) ,"value":1,"to":(str(attr_counter)+"a")})
attr_counter-=1
except:
diff --git a/gstudio/static/gstudio/css/screen.css b/gstudio/static/gstudio/css/screen.css
index f786de60..a5e3ba39 100644
--- a/gstudio/static/gstudio/css/screen.css
+++ b/gstudio/static/gstudio/css/screen.css
@@ -475,9 +475,9 @@ a:hover { text-decoration: underline; }
font-weight: bold;
}
#graphcss {
- margin-left: 224px;
- margin-right: 150px;
- margin-top: 1px;
+ margin-left: 180px;
+ margin-right: 200px;
+ margin-top: -150px;
position: absolute;
width: 300px;
height: 900px
diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html
index 41df7564..c5a15c3c 100644
--- a/gstudio/templates/gstudio/skeleton.html
+++ b/gstudio/templates/gstudio/skeleton.html
@@ -192,10 +192,10 @@ function init(a,b)
all_edges =_(b).chain().map(function(e) {
e.source = nodes_by_id[e.from];
e.target = nodes_by_id[e.to];
-
+ //`e.type = nodes_by_id[e.type]
return e;
}).filter(function(e){
- return nodes_by_id[e.from] && nodes_by_id[e.to]&& e.type!="title" && e.type!="content"
+ return nodes_by_id[e.from] && nodes_by_id[e.to]&& e.type!="title" && e.type!="content"
}).value();
@@ -253,7 +253,7 @@ var a = 25 * s;
.charge(-5000)
.friction(0.7)
.gravity(0.7)
- .linkDistance(75)
+ .linkDistance(50)
.nodes([])
.links([])
.size([w, h])
@@ -304,12 +304,13 @@ var a = 25 * s;
})
.attr("text", function(d) {
return d.type;
- })
+ });
+
+
+
+
- .append("a")
- .text(function(d) { return d.type; });
-
var node = d3.select("#chart g.nodes").selectAll("g.node").data(nodes);
@@ -383,7 +384,8 @@ $(window).bind('keydown',function(event){
new_g.filter(function(d) { return (d._id).charAt(0)=="-"; }).append("svg:rect")
- .attr("x",bbox.x-22)
+ .attr("x",bbox.x-22
+ )
.attr("y", bbox.y)
.attr("width", function(d) {var ttx=d.screen_name ; return (ttx.length+bbox.width+40)})
.attr("height", bbox.height)
@@ -411,6 +413,7 @@ $(window).bind('keydown',function(event){
+
node.exit().remove();