diff options
author | labadmin <labadmin@labadmin-P5E-Deluxe.(none)> | 2012-04-11 18:17:25 +0530 |
---|---|---|
committer | labadmin <labadmin@labadmin-P5E-Deluxe.(none)> | 2012-04-11 18:17:25 +0530 |
commit | 4d2412db1b99a1b430d308e3c7c49a31aac4026d (patch) | |
tree | 90c6da3f19a3770649dc05e3386aacde3a98fde4 /gstudio | |
parent | 9539983c6e85c0888c32ab2d5ea1036ae755ffd9 (diff) | |
download | gnowsys-4d2412db1b99a1b430d308e3c7c49a31aac4026d.tar.gz |
Added count function in models of gstudio to count node data.Skeleton and css files changed to readjust dynamically with the data count
Diffstat (limited to 'gstudio')
-rw-r--r-- | gstudio/models.py | 22 | ||||
-rw-r--r-- | gstudio/static/gstudio/css/screen.css | 16 | ||||
-rw-r--r-- | gstudio/templates/gstudio/nodetype_detail.html | 96 | ||||
-rw-r--r-- | gstudio/templates/gstudio/skeleton.html | 74 |
4 files changed, 160 insertions, 48 deletions
diff --git a/gstudio/models.py b/gstudio/models.py index 3c3748d..80b57d1 100644 --- a/gstudio/models.py +++ b/gstudio/models.py @@ -878,38 +878,47 @@ class Nodetype(Node): """ nbh = {} nbh['title'] = self.title + nbh['count_title'] = len(nbh['title']) nbh['altnames'] = self.altnames - nbh['plural'] = self.plural + nbh['count_altnames'] = len(nbh['altnames']) + nbh['plural'] = self.plural + nbh['count_plural'] = len(nbh['plural']) #get all MTs member_of_dict = {} for each in self.metatypes.all(): member_of_dict[each.title]= each.get_absolute_url() nbh['member_of_metatypes']=member_of_dict + nbh['count_member_of_metatypes'] = len(nbh['member_of_metatypes']) typeof={} - parent=self.parent + parent=self.parent_id if parent: typeof[parent] = parent.get_absolute_url() nbh['type_of']=typeof + nbh['count_type_of'] = len(nbh['type_of']) #get all subtypes subtypes={} for each in Nodetype.objects.filter(parent=self.id): subtypes[each.title] =each.get_absolute_url() - nbh['contains_subtypes']=subtypes + nbh['contains_subtypes']=subtypes + nbh['count_contains_subtypes'] = len(nbh['contains_subtypes']) # get all the objects inheriting this OT contains_members_dict = {} for each in self.member_objects.all(): contains_members_dict[each.title]= each.get_absolute_url() nbh['contains_members'] = contains_members_dict + nbh['count_contains_members'] = len(nbh['contains_members']) #get prior nodes priornodes_dict = {} for each in self.prior_nodes.all(): priornodes_dict[each.title]= each.get_absolute_url() nbh['priornodes'] = priornodes_dict + nbh['count_priornodes'] = len(nbh['priornodes']) #get posterior nodes posteriornodes_dict = {} for each in self.posterior_nodes.all(): posteriornodes_dict[each.title]= each.get_absolute_url() nbh['posteriornodes'] = posteriornodes_dict + nbh['count_posteriornodes'] = len(nbh['posteriornodes']) #get authors author_dict = {} for each in self.authors.all(): @@ -920,6 +929,7 @@ class Nodetype(Node): for each in self.get_siblings(): siblings[each.title]=each.get_absolute_url() nbh['siblings']=siblings + nbh['count_siblings'] = len(nbh['siblings']) #get Relations relns={} rellft={} @@ -953,10 +963,13 @@ class Nodetype(Node): rellft[lftkey]=relnvalue nbh['relations']=relrgt + nbh['relations'].update(rellft) + nbh['count_relations'] = len(nbh['relations']) #get Attributes attributes =self.get_attributes nbh['attributes']=attributes + nbh['count_attributes'] = len(nbh['attributes']) #get ATs attributetypes={} for each in self.subjecttype_of.all(): @@ -967,10 +980,13 @@ class Nodetype(Node): for each in self.left_subjecttype_of.all(): leftroles[each.title]=each.get_absolute_url() nbh['leftroles']=leftroles + nbh['count_leftroles'] = len(nbh['leftroles']) rightroles = {} for each in self.right_subjecttype_of.all(): rightroles[each.title]=each.get_absolute_url() nbh['rightroles']=rightroles + nbh['count_rightroles'] = len(nbh['rightroles']) + return nbh diff --git a/gstudio/static/gstudio/css/screen.css b/gstudio/static/gstudio/css/screen.css index 4ef6458..f786de6 100644 --- a/gstudio/static/gstudio/css/screen.css +++ b/gstudio/static/gstudio/css/screen.css @@ -15,7 +15,7 @@ h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.50em; } h6 { font-size: 1em; font-weight: bold; } -p { margin: 0 0 1.5em; } +p { margin: 0 0 1.em; } p .left { display: inline; float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; } p .right { display: inline; float: right; margin: 1.5em 0 1.5em 1.5em; padding: 0; } @@ -130,7 +130,7 @@ caption { background: #eeeeee; } .span-15 { width: 590px; } -.span-16 { width: 500px; } +.span-16 { width: 150px; } .span-17 { width: 670px; } @@ -395,7 +395,7 @@ input.span-24, textarea.span-24, select.span-24 { width: 950px; } label { font-weight: bold; } -fieldset { padding: 1.4em; margin: 0 0 1.5em 0; } +fieldset { padding: 1.4em; margin: 0 0 1em 0; } legend { font-weight: bold; font-size: 1.2em; } @@ -415,7 +415,7 @@ select { background-color: #fff; border-width: 1px; border-style: solid; } input.text, input.title, input[type=email], input[type=text], input[type=password] { width: 300px; } -textarea { width: 390px; height: 250px; } +textarea { width: 200px; height: 110px; } body { background: transparent url(../img/background.gif) repeat-x scroll left top; } @@ -474,6 +474,14 @@ a:hover { text-decoration: underline; } font-size: 11px; font-weight: bold; } +#graphcss { + margin-left: 224px; + margin-right: 150px; + margin-top: 1px; + position: absolute; + width: 300px; + height: 900px +} #sidebar{position:absolute; margin-left:1000px; margin-right:150px; margin-top:10px; width:300px;} #sidebar div:first-child h3 { margin-top:0px; } #sidebar h3 { background-color: #C4EBF4; padding: 0.5em; } diff --git a/gstudio/templates/gstudio/nodetype_detail.html b/gstudio/templates/gstudio/nodetype_detail.html index 34ac7e2..b69c404 100644 --- a/gstudio/templates/gstudio/nodetype_detail.html +++ b/gstudio/templates/gstudio/nodetype_detail.html @@ -38,7 +38,7 @@ <a href="{{ object.get_absolute_url }}" title="{{ object.title }}" rel="bookmark"> {{ object.title }} </a> - <a href="{{ object.ref.get_edit_url }}" target="_blank" >[edit]</a> + <a href="{{ object.ref.get_edit_url }}" target="_blank" title = "edit">[edit]</a> </h2> {% with object.html_content|safe as object_content %} @@ -57,7 +57,7 @@ {% if object.get_rendered_nbh.type_of %} <b> Type of:<nbsp></b> {% for typekey,typevalue in object.get_rendered_nbh.type_of.items %} - <a href="{{typevalue}}">{{typekey}}</a>; + <a href="{{typevalue}}" title = "{{typekey}}">{{typekey}}</a>; {% endfor %}<br/> {% endif %} @@ -67,7 +67,7 @@ <b> Member of Metatypes:<nbsp></b> {% for mkey,mvalue in object.get_rendered_nbh.member_of_metatypes.items %} - <a href="{{mvalue}}">{{mkey}}</a>; + <a href="{{mvalue}}" title = "{{mkey}}">{{mkey}}</a>; {% endfor %}<br/> {% endif %} @@ -76,7 +76,7 @@ {% if object.get_rendered_nbh.contains_subtypes %} <b> Contains SubTypes:<nbsp></b> {% for stkey,stvalue in object.get_rendered_nbh.contains_subtypes.items %} - <a href="{{stvalue}}">{{stkey}}</a>; + <a href="{{stvalue}}" title = "{{stkey}}">{{stkey}}</a>; {% endfor %}<br/> {% endif %} @@ -86,7 +86,7 @@ <b>Contains Members:<nbsp></b> {% for mkey,mvalue in object.get_rendered_nbh.contains_members.items %} - <a href="{{mvalue}}">{{mkey}}</a>; + <a href="{{mvalue}}" title = "{{mkey}}">{{mkey}}</a>; {% endfor %}<br/> {% endif %} @@ -114,7 +114,7 @@ <b>Prior nodes:<nbsp></b> {% for mkey,mvalue in object.get_rendered_nbh.priornodes.items %} - <a href="{{mvalue}}">{{mkey}}</a>; + <a href="{{mvalue}}" title = "{{mkey}}">{{mkey}}</a>; {% endfor %}<br/> {% endif %} @@ -123,7 +123,7 @@ <b>Posterior nodes:<nbsp></b> {% for mkey,mvalue in object.get_rendered_nbh.posteriornodes.items %} - <a href="{{mvalue}}">{{mkey}}</a>; + <a href="{{mvalue}}" title = "{{mkey}}">{{mkey}}</a>; {% endfor %}<br/> {% endif %} @@ -133,7 +133,7 @@ {% for relkey,relvalue in object.get_rendered_nbh.relations.items %} <b>{{relkey}}:<nbsp></b> {% for relk, relv in relvalue.items %} - <a href="{{relv}}">{{relk}}</a>; + <a href="{{relv}}" title = "{{relk}}">{{relk}}</a>; {% endfor %}<br/> {% endfor %} {% endif %} @@ -155,7 +155,7 @@ <b>Left roles:<nbsp> </b> {% for lrkey,lrvalue in object.get_rendered_nbh.leftroles.items %} - <a href="{{lrvalue}}">{{lrkey}}</a>; + <a href="{{lrvalue}}" title = "{{lrkey}}">{{lrkey}}</a>; {% endfor %} <br/> {% endif %} @@ -164,7 +164,7 @@ <b>Right roles:<nbsp> </b> {% for rrkey,rrvalue in object.get_rendered_nbh.rightroles.items %} - <a href="{{rrvalue}}">{{rrkey}}</a>; + <a href="{{rrvalue}}" title = "{{rrkey}}">{{rrkey}}</a>; {% endfor %} <br/> {% endif %} @@ -175,13 +175,75 @@ <b>Subjecttype of:<nbsp> </b> {% for atkey,atvalue in object.get_rendered_nbh.ats.items %} - <a href="{{atvalue}}">{{atkey}}</a>; + <a href="{{atvalue}}" title = "{{atkey}}">{{atkey}}</a>; {% endfor %} <br/> {% endif %} {% if object.content %} <b>Content:<nbsp></b>{{object_content}} {% endif %} + + <script type="text/javascript" > + var s = 0 + var i + {% if object.get_rendered_nbh.count_plural %} + var i = parseInt({{ object.get_rendered_nbh.count_plural }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_altnames %} + i = parseInt({{ object.get_rendered_nbh.count_altnames }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_type_of %} + i = parseInt({{ object.get_rendered_nbh.count_type_of }}) + s = s + i + {% endif %} + {% if object.get_rendered_nbh.count_member_of_metatypes %} + i = parseInt({{ object.get_rendered_nbh.count_member_of_metatypes }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_member_of_metatypes %} + i = parseInt({{ object.get_rendered_nbh.count_member_of_metatypes }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_contains_members %} + var b = parseInt({{ object.get_rendered_nbh.count_contains_members }}) + s = parseInt(s + i) + {% endif %} + /* {% if object.get_rendered_nbh.count_siblings %} + i = parseInt({{ object.get_rendered_nbh.count_siblings }}) + s = parseInt(s + i) + {% endif %}*/ + {% if object.get_rendered_nbh.count_priornodes %} + i = parseInt({{ object.get_rendered_nbh.count_priornodes }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_posteriornodes %} + i = parseInt({{ object.get_rendered_nbh.count_posteriornodes }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_relations %} + i = parseInt({{ object.get_rendered_nbh.count_relations }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_attributes %} + i = parseInt({{ object.get_rendered_nbh.count_attributes }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_leftroles %} + i = parseInt({{ object.get_rendered_nbh.count_leftroles }}) + s = parseInt(s + i) + {% endif %} + {% if object.get_rendered_nbh.count_rightroles %} + i = parseInt({{ object.get_rendered_nbh.count_rightroles }}) + s = parseInt(s + i) + {% endif %} + if ( s > 0) + { + s = parseInt(s) + //alert(s) + } + </script> @@ -198,7 +260,7 @@ <div class="nodetype-next"> <h5>{% trans "Posterior node" %}</h5> {% for items in object.posteriornodes.all %} - <a href="{{ items.get_absolute_url }}"> {{ items.title }}</a>; + <a href="{{ items.get_absolute_url }}" title = "{{ items.title }}"> {{ items.title }}</a>; {% endfor %} </div> {% endif %} @@ -208,7 +270,7 @@ <div class="nodetype-next"> <h5>{% trans "Prior node" %}</h5> {% for items in object.priornodes.all %} - <a href="{{ items.get_absolute_url }}"> {{ items.title }}</a>; + <a href="{{ items.get_absolute_url }}" title = "{{ items.title }}"> {{ items.title }}</a>; {% endfor %} </div> {% endif %} @@ -242,7 +304,7 @@ <div class="comment-body span-13 last"> <div class="comment-author span-13 last"> {% if comment.url %} - <a href="{{ comment.url }}" class="fn url">{{ comment.user_name }}</a> + <a href="{{ comment.url }}" class="fn url" title = "{{ comment.user_name }}">{{ comment.user_name }}</a> {% else %} {{ comment.user_name }} {% endif %} @@ -279,7 +341,7 @@ <li id="pingback_{{ pingback.pk }}" class="pingback {% cycle box1,box2 %} span-15 last"> <div class="pingback-body span-15 last"> <div class="pingback-author span-15 last"> - <a href="{{ pingback.url }}">{{ pingback.user_name }}</a> + <a href="{{ pingback.url }}" title = "{{ pingback.user_name }}">{{ pingback.user_name }}</a> {% trans "on" %} {{ pingback.submit_date|date:"SHORT_DATETIME_FORMAT" }} </div> <div class="span-15 last"> @@ -312,7 +374,7 @@ <li id="trackback_{{ trackback.pk }}" class="trackback {% cycle box1,box2 %} span-15 last"> <div class="trackback-body span-15 last"> <div class="trackback-author span-15 last"> - <a href="{{ trackback.url }}">{{ trackback.user_name }}</a> + <a href="{{ trackback.url }}" title = "{{ trackback.user_name }}">{{ trackback.user_name }}</a> {% trans "on" %} {{ trackback.submit_date|date:"SHORT_DATETIME_FORMAT" }} </div> <div class="span-15 last"> @@ -327,7 +389,7 @@ {% endif %} {% if object.pingback_enabled %} <p> - <a href="{% url gstudio_nodetype_trackback object.pk %}" rel="trackback"> + <a href="{% url gstudio_nodetype_trackback object.pk %}" rel="trackback" title = "Trackback URL"> {% trans "Trackback URL" %}</a> </p> {% endif %} diff --git a/gstudio/templates/gstudio/skeleton.html b/gstudio/templates/gstudio/skeleton.html index da7591a..1fcf9cc 100644 --- a/gstudio/templates/gstudio/skeleton.html +++ b/gstudio/templates/gstudio/skeleton.html @@ -124,8 +124,7 @@ {% block script %}{% endblock %} <title>Gnowledge Studio - {% block title %}{% endblock %}</title> </head> <body id="gstudio"> - <div class="body" > - <div class="content"> + <!-- <div id="relation_type" class="ui-buttonset"> <span>Relation type:</span> @@ -134,8 +133,26 @@ <input value="hashtags" type="radio" id="hashtags" name="radio"/><label for="hashtags">Shared interests</label> </div> --> + + + + + + + {% include "gstudio/_header.html" %} + <div id="breadcrumbs" class="span-24 last"> + / {% block breadcrumbs %}{% endblock %} + </div> + <div id="body" class="span-24 last"> + <div id="content" class="hfeed span-16 border"> + {% block content %} <h3>The content block need to be overrided!</h3> + {% endblock %} + </div> + + + <div id="graphcss"> <div id="chart"> - <svg width="960" height="700" style="opacity: 1; "> + </div> <script type="text/javascript" src="/static/gstudio/js/jquery.min.js" ></script> <script type="text/javascript" src="/static/gstudio/js/jquery-ui.js" ></script> @@ -147,11 +164,28 @@ Javascript for Object type force graph --> + <script type="text/javascript" > - - var w = 700, - h = 300, - fill = d3.scale.category20(); + //alert(s) + //if ( parseInt(s) > 0 ){ + var a = 25 * s; + + if ( a > 700 ) + { + var w = 700; + } + else + { + var w = a; + } + + var h = 24 * s, + // } +// else{ + // var w = 700, + // h = 300, + // } + fill = d3.scale.category20(); var vis = d3.select("#chart") .append("svg:svg") @@ -496,34 +530,26 @@ $(function fgraph(gid) { </script> - </div> - </div> - <div> - {% include "gstudio/_header.html" %} - <div id="breadcrumbs" class="span-24 last"> - / {% block breadcrumbs %}{% endblock %} - </div> - <div id="body" class="span-24 last"> - <div id="content" class="hfeed span-16 border"> - {% block content %} <h3>The content block need to be overrided!</h3> - {% endblock %} </div> <div id="sidebar"> {% block sidebar %} {% endblock %} </div> + <div id="footer" class="span-24 last"> - <p> + <p> + <a rel="license" - href="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/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a> unless mentioned otherwise. + 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/> - Powered by <a href="http://www.djangoproject.com">Django</a> - and <a href="http://github.com/gnowgi/django-gstudio">Gstudio + Powered by <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> - + + </body> </html> |