diff options
author | Kabir <kabir@gnowledge.org> | 2012-05-11 13:22:46 +0530 |
---|---|---|
committer | Kabir <kabir@gnowledge.org> | 2012-05-11 13:22:46 +0530 |
commit | a78bf21087bf5891a0c41fde335f4faef9d3eb0e (patch) | |
tree | 58a5d4ed47e1fe964fe39fdbfdb4e22727ab8cca /objectapp | |
parent | 0ea8ff7c34af66f2c8028ea51950f9415537c4ee (diff) | |
parent | efaedaf3619e14ecc9392a977d576eec6d33130b (diff) | |
download | gnowsys-a78bf21087bf5891a0c41fde335f4faef9d3eb0e.tar.gz |
Merge branch 'master' of https://github.com/gnowgi/gnowsys-studio
Diffstat (limited to 'objectapp')
-rw-r--r-- | objectapp/models.py | 26 | ||||
-rw-r--r-- | objectapp/settings.py | 2 | ||||
-rw-r--r-- | objectapp/static/objectapp/css/screen.css | 24 | ||||
-rw-r--r-- | objectapp/templates/objectapp/_gbobject_detail.html | 4 | ||||
-rw-r--r-- | objectapp/templates/objectapp/skeleton.html | 83 |
5 files changed, 89 insertions, 50 deletions
diff --git a/objectapp/models.py b/objectapp/models.py index 182b0f2..4ed7279 100644 --- a/objectapp/models.py +++ b/objectapp/models.py @@ -367,6 +367,7 @@ class Gbobject(Node): g_json = {} g_json["node_metadata"]= [] g_json["relations"]=[] + g_json["relset"]=[] global counter global attr_counter @@ -383,6 +384,7 @@ class Gbobject(Node): this_node = {"_id":str(self.id),"title":self.title,"screen_name":self.title, "url":self.get_absolute_url(),"expanded":"true"} g_json["node_metadata"].append(this_node) + g_json["relset"].append(self.id) for key in predicate_id.keys(): if nbh[key]: @@ -394,13 +396,27 @@ class Gbobject(Node): 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]: + 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 }) - + 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["relset"].append(item.id) + # 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"} #this_node[str(key)]=nbh[key] key, nbh[key] diff --git a/objectapp/settings.py b/objectapp/settings.py index 727b716..ba6004d 100644 --- a/objectapp/settings.py +++ b/objectapp/settings.py @@ -56,7 +56,7 @@ SAVE_PING_EXTERNAL_URLS = getattr(settings, 'OBJECTAPP_PING_EXTERNAL_URLS', True COPYRIGHT = getattr(settings, 'OBJECTAPP_COPYRIGHT', 'Objectapp') -PAGINATION = getattr(settings, 'OBJECTAPP_PAGINATION', 10) +PAGINATION = getattr(settings, 'OBJECTAPP_PAGINATION', 4) ALLOW_EMPTY = getattr(settings, 'OBJECTAPP_ALLOW_EMPTY', True) ALLOW_FUTURE = getattr(settings, 'OBJECTAPP_ALLOW_FUTURE', True) diff --git a/objectapp/static/objectapp/css/screen.css b/objectapp/static/objectapp/css/screen.css index c69ca99..408dd84 100644 --- a/objectapp/static/objectapp/css/screen.css +++ b/objectapp/static/objectapp/css/screen.css @@ -1,4 +1,4 @@ -body { line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 75%; height:1500px;width:1500px} +body { line-height: 1.5; font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 75%; height:1500px; width: 85%; } h1, h2, h3, h4, h5, h6 { font-weight: normal; color: #000000; border-radius:15px; } h1 img, h2 img, h3 img, h4 img, h5 img, h6 img { margin: 0; } @@ -424,7 +424,7 @@ ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 3.333em; } a { text-decoration: none; } a:hover { text-decoration: underline; } -#header { margin-bottom: 1em; border-bottom: 1px solid #e9e9f3; } +#header { margin-bottom: 1em; border-bottom: 1px solid #e9e9f3; background: #2b3959; color: white;} #header h1 { font-size: 2em; font-weight: bold; margin-bottom: 0; } #header .top-navigation { float: right; } #header .top-navigation img { border: 0; } @@ -440,7 +440,7 @@ a:hover { text-decoration: underline; } #b1 {position:relative; center:5%; background-color:#43AEE7; color: white; border: 1px solid #000000; font-size:1em;} #b2 {position:relative; center:6%; background-color:#43AEE7; color: white; border: 1px solid #000000; font-size:1em;} -#body { margin-bottom: 1em; border-bottom: 1px solid #e9e9f3; } +#body { margin-bottom: 1em; border-bottom: 0px solid #e9e9f3; width: 100%;} #content h1, #content h2, #content h3 { margin-top: 10px; } @@ -450,10 +450,10 @@ a:hover { text-decoration: underline; } float: left; clear: both; margin-bottom: 10px; - margin-left: 0; - margin-right: 60px; + margin-left: 0%; + margin-right: 0%; margin-top: 10px; - padding-right: 30px; + padding-right: 0%; width:250px; } @@ -479,14 +479,14 @@ a:hover { text-decoration: underline; } font-weight: bold; } #graphcss{ - margin-left: 230px; - margin-right: 150px; + margin-left: 237px; + margin-right: 0px; margin-top: 1px; position: absolute; - width: 300px; + width: 46%; height: 900px } -#sidebar{position:absolute; margin-left:600px; margin-right:150px; margin-top:10px; width:300px;} +#sidebar{position:relative; margin-left:92%; margin-right:0px; margin-top:10px; width:23%;} #sidebar div:first-child h3 { margin-top:0px; } #sidebar h3 { background-color: #FFE9E8; padding: 0.5em; } #sidebar p { padding-left: 1em; } @@ -508,7 +508,7 @@ a:hover { text-decoration: underline; } #sidebar .tags div ul .tag_4 { font-size: 2em; color: #0070a8; } #sidebar .tags div ul .tag_5 { font-size: 2.25em; color: #0099e5; } #sidebar .tags div ul .tag_6 { font-size: 3em; color: #00adff; } - +#footer{ position:static; border-bottom: 1px solid #E9E9F3; margin-top: 85px; } th.month{padding:0cm 2.5cm;} table.month { margin-bottom: 0; } table.month th.month { text-transform: uppercase; color: #555555; background: none; } @@ -516,7 +516,7 @@ table.month th { text-transform: capitalize; color: #555555; background-color: # table.month td { text-align: center; font-weight: bold; } table.month td.objecttype { background-color: #C4EBF4; } -div.paginator { margin-bottom: 1em; } +div.paginator { margin-bottom: 2em; } div.paginator span { font-size: 1.2em; margin-left: 0.3em; padding: 0 0.5em 0 0.5em; float: left; border: 1px solid #e9e9f3; } div.paginator span.index { margin-left: 0; } div.paginator span.page:hover, div.paginator span.next:hover, div.paginator span.previous:hover { background-color: #006699; } diff --git a/objectapp/templates/objectapp/_gbobject_detail.html b/objectapp/templates/objectapp/_gbobject_detail.html index 6b21356..ee43aba 100644 --- a/objectapp/templates/objectapp/_gbobject_detail.html +++ b/objectapp/templates/objectapp/_gbobject_detail.html @@ -28,7 +28,7 @@ </div> -</div> + <p> <b>Name: </b> {{ object.title }} <br/> @@ -76,7 +76,7 @@ </p> - +</div> <div class="gbobject-body span-16 last"> diff --git a/objectapp/templates/objectapp/skeleton.html b/objectapp/templates/objectapp/skeleton.html index 2990d9a..928c0e6 100644 --- a/objectapp/templates/objectapp/skeleton.html +++ b/objectapp/templates/objectapp/skeleton.html @@ -47,8 +47,8 @@ display: block; } svg { - margin-left: 10%; - margin-right: 10%; + margin-left: 0%; + margin-right: 0%; display: block; position: absolute; } @@ -224,27 +224,26 @@ $.getJSON('/nodetypes/graphs/graph_json/' + {{object.id}}, function (json1) { function load(key) { - -var a = 800 * s; - - if ( a > 700 ) - { - var w = 700; - } - else - { - var w = a; - } - - var h = 232 * s, + +if ( s > 0) { +var w = 700; +var p = 122 + "%"; +var h = 800; +var q = 3 * s + 60 + "%"; +}else{ +var w = 700; +var p = 122 + "%"; +var h = 800; +var q = 110 + "%"; +} fill = d3.scale.category20(); var vis = d3.select("#chart") .append("svg:svg") .attr("id", "amazingViz") - .attr("width", w) - .attr("height", h); + .attr("width", p) + .attr("height", q); vis.append("svg:g").attr("class", "edges"); vis.append("svg:g").attr("class", "nodes"); @@ -264,7 +263,7 @@ var a = 800 * s; .charge(-5000) .friction(0.7) .gravity(0.7) - .linkDistance(75) + .linkDistance(50) .nodes([]) .links([]) .size([w, h]) @@ -290,12 +289,12 @@ var a = 800 * s; force.links(edges); force.start(); - link = d3.select("#chart g.edges").selectAll("line.link") + link = d3.select("#chart g.edges").selectAll("line.link").select(this.arrowhead) .data(edges, function(e){return e.from + "-" + e.to + "-" + e.type}); link.enter().append("svg:line") .attr("class", "link") - .style("stroke-width", 2 /* function(d) { + .style("stroke-width", 2/* function(d) { return Math.sqrt(d.value); } */ ) .attr("x1", function(d) { @@ -313,9 +312,8 @@ var a = 800 * s; .attr("text", function(d) { return d.type; }) - - .append("a") - .text(function(d) { return d.type; }); + + .attr("marker-end", "url(#arrowhead)"); @@ -332,6 +330,23 @@ var a = 800 * s; .call(force.drag); + new_g.append("svg:marker") + .attr("id", "arrowhead") + .attr("viewBox","0 0 10 10") + .attr("refX","20") + .attr("refY","5") + .attr("markerUnits","strokeWidth") + .attr("markerWidth","9") + .attr("markerHeight","5") + .attr("orient","auto") + .append("svg:path") + .attr("d","M 0 0 L 10 5 L 0 10 z") + .attr("fill", "#6D6666"); + + + + + $(window).bind('keydown',function(event){ @@ -408,8 +423,8 @@ $(window).bind('keydown',function(event){ .attr("cx", bbox.x+25) .attr("cy", bbox.y+13) .call(force.drag) - .attr("rx",function(d) {var ttx=d.screen_name ; return (ttx.length + 40)}) - .attr("ry",13) + .attr("rx",function(d) {var ttx=d.screen_name ; return (ttx.length + 55)}) + .attr("ry",14) .style("fill-opacity", ".2") .style("stroke", "#666") .style("stroke-width", "1.5px") @@ -458,16 +473,24 @@ $(window).bind('keydown',function(event){ </script> {% block graph %} {% endblock %} </div> - <div id="sidebar" class="span-8 last"> + <div id="sidebar"> {% block sidebar %} {% endblock %} </div> - </div> - <div id="footer" class="span-24 last"> - <p>Powered by <a href="http://www.djangoproject.com" title="http://www.djangoproject.com">Django</a> and <a href="http://github.com/gnowgi/django-gstudio" title="http://github.com/gnowgi/django-gstudio">Gstudio {{ GSTUDIO_VERSION }}</a>.</p> + + <div id="footer"> + <p> + + <a rel="license" + href="http://creativecommons.org/licenses/by-sa/3.0/" title="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative + Commons License" style="border-width:0"src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png"/></a> All material is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/" title = "http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a> unless mentioned otherwise. + <br/> + Poweredby <a href="http://www.djangoproject.com" title="https://www.djangoproject.com/">Django</a> + and <a href="https://github.com/gnowgi/gnowsys-studio" title="https://github.com/gnowgi/gnowsys-studio">Gstudio + {{ GSTUDIO_VERSION }}</a>. + </p> </div> </div> </body> </html> - |