mongo3 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.bnignore +3 -0
- data/.bnsignore +16 -0
- data/.gitignore +1 -0
- data/HISTORY +2 -0
- data/README.rdoc +78 -0
- data/Rakefile +31 -0
- data/bin/mongo3 +29 -0
- data/config/mongo3.yml +33 -0
- data/lib/controllers/collections.rb +7 -0
- data/lib/controllers/databases.rb +7 -0
- data/lib/controllers/explore.rb +46 -0
- data/lib/helpers/crumb_helper.rb +46 -0
- data/lib/helpers/main_helper.rb +43 -0
- data/lib/main.rb +41 -0
- data/lib/mongo3/connection.rb +191 -0
- data/lib/mongo3/node.rb +80 -0
- data/lib/mongo3.rb +57 -0
- data/lib/public/images/c292199_a.jpg +0 -0
- data/lib/public/images/close.png +0 -0
- data/lib/public/images/close.psd +0 -0
- data/lib/public/images/cluster.png +0 -0
- data/lib/public/images/cluster.psd +0 -0
- data/lib/public/images/db.jpg +0 -0
- data/lib/public/images/db.png +0 -0
- data/lib/public/images/db.psd +0 -0
- data/lib/public/images/delete.png +0 -0
- data/lib/public/images/header.png +0 -0
- data/lib/public/images/header.psd +0 -0
- data/lib/public/images/li_select.png +0 -0
- data/lib/public/images/li_select.psd +0 -0
- data/lib/public/images/lock.png +0 -0
- data/lib/public/images/lock.psd +0 -0
- data/lib/public/images/mongo.png +0 -0
- data/lib/public/images/mongo.psd +0 -0
- data/lib/public/images/mongo3.png +0 -0
- data/lib/public/images/mongo3.psd +0 -0
- data/lib/public/images/mongo3_db.png +0 -0
- data/lib/public/images/mongo3_db.psd +0 -0
- data/lib/public/images/mongo_10.psd +0 -0
- data/lib/public/images/mongo_db.jpg +0 -0
- data/lib/public/images/mongo_db.png +0 -0
- data/lib/public/images/mongo_db.psd +0 -0
- data/lib/public/images/mongo_db_1.jpg +0 -0
- data/lib/public/images/mongo_db_2 +0 -0
- data/lib/public/images/mongo_db_4 +0 -0
- data/lib/public/images/monkey.jpg +0 -0
- data/lib/public/images/monkey.png +0 -0
- data/lib/public/images/monkey.psd +0 -0
- data/lib/public/images/monkey_1.jpg +8 -0
- data/lib/public/images/monkey_10.jpg +8 -0
- data/lib/public/javascripts/Jit/Examples/Hypertree/example1.html +57 -0
- data/lib/public/javascripts/Jit/Examples/Hypertree/example1.js +427 -0
- data/lib/public/javascripts/Jit/Examples/Hypertree/example2.html +58 -0
- data/lib/public/javascripts/Jit/Examples/Hypertree/example2.js +310 -0
- data/lib/public/javascripts/Jit/Examples/Hypertree/example3.html +199 -0
- data/lib/public/javascripts/Jit/Examples/Hypertree/example3.js +615 -0
- data/lib/public/javascripts/Jit/Examples/Other/example1.html +58 -0
- data/lib/public/javascripts/Jit/Examples/Other/example1.js +566 -0
- data/lib/public/javascripts/Jit/Examples/Other/example2.html +58 -0
- data/lib/public/javascripts/Jit/Examples/Other/example2.js +304 -0
- data/lib/public/javascripts/Jit/Examples/Other/example3.html +58 -0
- data/lib/public/javascripts/Jit/Examples/Other/example3.js +304 -0
- data/lib/public/javascripts/Jit/Examples/RGraph/example1.html +57 -0
- data/lib/public/javascripts/Jit/Examples/RGraph/example1.js +475 -0
- data/lib/public/javascripts/Jit/Examples/RGraph/example2.html +58 -0
- data/lib/public/javascripts/Jit/Examples/RGraph/example2.js +356 -0
- data/lib/public/javascripts/Jit/Examples/RGraph/example3.html +199 -0
- data/lib/public/javascripts/Jit/Examples/RGraph/example3.js +622 -0
- data/lib/public/javascripts/Jit/Examples/Spacetree/example1.html +91 -0
- data/lib/public/javascripts/Jit/Examples/Spacetree/example1.js +890 -0
- data/lib/public/javascripts/Jit/Examples/Spacetree/example2.html +90 -0
- data/lib/public/javascripts/Jit/Examples/Spacetree/example2.js +213 -0
- data/lib/public/javascripts/Jit/Examples/Spacetree/example3.html +75 -0
- data/lib/public/javascripts/Jit/Examples/Spacetree/example3.js +863 -0
- data/lib/public/javascripts/Jit/Examples/Treemap/example1.html +56 -0
- data/lib/public/javascripts/Jit/Examples/Treemap/example1.js +95 -0
- data/lib/public/javascripts/Jit/Examples/Treemap/example2.html +61 -0
- data/lib/public/javascripts/Jit/Examples/Treemap/example2.js +750 -0
- data/lib/public/javascripts/Jit/Examples/Treemap/example3.html +62 -0
- data/lib/public/javascripts/Jit/Examples/Treemap/example3.js +775 -0
- data/lib/public/javascripts/Jit/Examples/css/Hypertree.css +0 -0
- data/lib/public/javascripts/Jit/Examples/css/Other.css +8 -0
- data/lib/public/javascripts/Jit/Examples/css/RGraph.css +0 -0
- data/lib/public/javascripts/Jit/Examples/css/Spacetree.css +0 -0
- data/lib/public/javascripts/Jit/Examples/css/Treemap.css +78 -0
- data/lib/public/javascripts/Jit/Examples/css/base.css +106 -0
- data/lib/public/javascripts/Jit/Examples/css/col1.png +0 -0
- data/lib/public/javascripts/Jit/Examples/css/col2.png +0 -0
- data/lib/public/javascripts/Jit/Examples/css/gradient.png +0 -0
- data/lib/public/javascripts/Jit/Extras/excanvas.js +35 -0
- data/lib/public/javascripts/Jit/jit-yc.js +1 -0
- data/lib/public/javascripts/Jit/jit.js +9052 -0
- data/lib/public/javascripts/Jit-1.1.3.zip +0 -0
- data/lib/public/javascripts/application.js +28 -0
- data/lib/public/javascripts/jit.min.js +1 -0
- data/lib/public/javascripts/jquery.tools.min.js +38 -0
- data/lib/public/javascripts/jquery_min.js +19 -0
- data/lib/public/javascripts/jquery_ui_min.js +298 -0
- data/lib/public/stylesheets/mongo3.css +275 -0
- data/lib/utils.rb +3 -0
- data/lib/views/_cltn_info.erb +95 -0
- data/lib/views/_collection.erb +5 -0
- data/lib/views/_crumbs.erb +13 -0
- data/lib/views/_dump_array.erb +5 -0
- data/lib/views/_dump_hash.erb +14 -0
- data/lib/views/_info.erb +15 -0
- data/lib/views/center_js.erb +3 -0
- data/lib/views/cltn_show.erb +1 -0
- data/lib/views/collection.erb +44 -0
- data/lib/views/database.erb +37 -0
- data/lib/views/db_show.erb +1 -0
- data/lib/views/explore.erb +250 -0
- data/lib/views/landscape.erb +45 -0
- data/lib/views/layout.erb +28 -0
- data/lib/views/more_data_js.erb +3 -0
- data/lib/views/show_cltn.erb +1 -0
- data/lib/views/update_crumb_js.erb +1 -0
- data/spec/mongo3/node_spec.rb +84 -0
- data/spec/spec_helper.rb +8 -0
- data/tasks/bones.rake +20 -0
- data/tasks/gem.rake +201 -0
- data/tasks/git.rake +40 -0
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +32 -0
- data/tasks/rdoc.rake +56 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +292 -0
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- data/tasks/zentest.rake +36 -0
- metadata +213 -0
data/lib/mongo3.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
|
2
|
+
module Mongo3
|
3
|
+
|
4
|
+
# :stopdoc:
|
5
|
+
VERSION = '0.0.1'
|
6
|
+
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
7
|
+
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
8
|
+
# :startdoc:
|
9
|
+
|
10
|
+
# Returns the version string for the library.
|
11
|
+
#
|
12
|
+
def self.version
|
13
|
+
VERSION
|
14
|
+
end
|
15
|
+
|
16
|
+
# Returns the library path for the module. If any arguments are given,
|
17
|
+
# they will be joined to the end of the libray path using
|
18
|
+
# <tt>File.join</tt>.
|
19
|
+
#
|
20
|
+
def self.libpath( *args )
|
21
|
+
args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns the lpath for the module. If any arguments are given,
|
25
|
+
# they will be joined to the end of the path using
|
26
|
+
# <tt>File.join</tt>.
|
27
|
+
#
|
28
|
+
def self.path( *args )
|
29
|
+
args.empty? ? PATH : ::File.join(PATH, args.flatten)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Utility method used to require all files ending in .rb that lie in the
|
33
|
+
# directory below this file that has the same name as the filename passed
|
34
|
+
# in. Optionally, a specific _directory_ name can be passed in such that
|
35
|
+
# the _filename_ does not have to be equivalent to the directory.
|
36
|
+
#
|
37
|
+
def self.require_all_libs_relative_to( fname, dir = nil )
|
38
|
+
dir ||= ::File.basename(fname, '.*')
|
39
|
+
search_me = ::File.expand_path(
|
40
|
+
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
41
|
+
|
42
|
+
Dir.glob(search_me).sort.each {|rb| require rb}
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.load_all_libs_relative_to( fname, dir = nil )
|
46
|
+
dir ||= ::File.basename(fname, '.*')
|
47
|
+
search_me = ::File.expand_path(
|
48
|
+
::File.join(::File.dirname(fname), dir, '**', '*.rb'))
|
49
|
+
|
50
|
+
Dir.glob(search_me).sort.each {|rb| load rb}
|
51
|
+
end
|
52
|
+
|
53
|
+
end # module Mongo3
|
54
|
+
|
55
|
+
Mongo3.require_all_libs_relative_to(__FILE__)
|
56
|
+
|
57
|
+
# EOF
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
5
|
+
<title>Hypertree - Tree Animation</title>
|
6
|
+
|
7
|
+
<!-- CSS Files -->
|
8
|
+
<link type="text/css" href="../css/base.css" rel="stylesheet" />
|
9
|
+
<link type="text/css" href="../css/Hypertree.css" rel="stylesheet" />
|
10
|
+
|
11
|
+
<!--[if IE]><script language="javascript" type="text/javascript" src="../../Extras/excanvas.js"></script><![endif]-->
|
12
|
+
|
13
|
+
<!-- JIT Library File -->
|
14
|
+
<script language="javascript" type="text/javascript" src="../../jit.js"></script>
|
15
|
+
|
16
|
+
<!-- Example File -->
|
17
|
+
<script language="javascript" type="text/javascript" src="example1.js"></script>
|
18
|
+
</head>
|
19
|
+
|
20
|
+
<body onload="init();">
|
21
|
+
<div id="container">
|
22
|
+
|
23
|
+
<div id="left-container">
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
<div class="text">
|
28
|
+
<h4>
|
29
|
+
Tree Animation
|
30
|
+
</h4>
|
31
|
+
|
32
|
+
A static JSON Tree structure is used as input for this animation.<br /><br />
|
33
|
+
Clicking on a node should move the tree and center that node.<br /><br />
|
34
|
+
The centered node's children are displayed in a relations list in the right column.
|
35
|
+
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="id-list"></div>
|
39
|
+
|
40
|
+
|
41
|
+
<div style="text-align:center;"><a href="example1.js">See the Example Code</a></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="center-container">
|
45
|
+
<div id="infovis"></div>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<div id="right-container">
|
49
|
+
|
50
|
+
<div id="inner-details"></div>
|
51
|
+
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<div id="log"></div>
|
55
|
+
</div>
|
56
|
+
</body>
|
57
|
+
</html>
|
@@ -0,0 +1,427 @@
|
|
1
|
+
var Log = {
|
2
|
+
elem: false,
|
3
|
+
write: function(text){
|
4
|
+
if (!this.elem)
|
5
|
+
this.elem = document.getElementById('log');
|
6
|
+
this.elem.innerHTML = text;
|
7
|
+
this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px';
|
8
|
+
}
|
9
|
+
};
|
10
|
+
|
11
|
+
function addEvent(obj, type, fn) {
|
12
|
+
if (obj.addEventListener) obj.addEventListener(type, fn, false);
|
13
|
+
else obj.attachEvent('on' + type, fn);
|
14
|
+
};
|
15
|
+
|
16
|
+
|
17
|
+
function init(){
|
18
|
+
//init data
|
19
|
+
var json = {
|
20
|
+
"id": "347_0",
|
21
|
+
"name": "Nine Inch Nails",
|
22
|
+
"children": [{
|
23
|
+
"id": "126510_1",
|
24
|
+
"name": "Jerome Dillon",
|
25
|
+
"data": {
|
26
|
+
"band": "Nine Inch Nails",
|
27
|
+
"relation": "member of band"
|
28
|
+
},
|
29
|
+
"children": [{
|
30
|
+
"id": "52163_2",
|
31
|
+
"name": "Howlin' Maggie",
|
32
|
+
"data": {
|
33
|
+
"band": "Jerome Dillon",
|
34
|
+
"relation": "member of band"
|
35
|
+
},
|
36
|
+
"children": []
|
37
|
+
}, {
|
38
|
+
"id": "324134_3",
|
39
|
+
"name": "nearLY",
|
40
|
+
"data": {
|
41
|
+
"band": "Jerome Dillon",
|
42
|
+
"relation": "member of band"
|
43
|
+
},
|
44
|
+
"children": []
|
45
|
+
}]
|
46
|
+
}, {
|
47
|
+
"id": "173871_4",
|
48
|
+
"name": "Charlie Clouser",
|
49
|
+
"data": {
|
50
|
+
"band": "Nine Inch Nails",
|
51
|
+
"relation": "member of band"
|
52
|
+
},
|
53
|
+
"children": []
|
54
|
+
}, {
|
55
|
+
"id": "235952_5",
|
56
|
+
"name": "James Woolley",
|
57
|
+
"data": {
|
58
|
+
"band": "Nine Inch Nails",
|
59
|
+
"relation": "member of band"
|
60
|
+
},
|
61
|
+
"children": []
|
62
|
+
}, {
|
63
|
+
"id": "235951_6",
|
64
|
+
"name": "Jeff Ward",
|
65
|
+
"data": {
|
66
|
+
"band": "Nine Inch Nails",
|
67
|
+
"relation": "member of band"
|
68
|
+
},
|
69
|
+
"children": [{
|
70
|
+
"id": "2382_7",
|
71
|
+
"name": "Ministry",
|
72
|
+
"data": {
|
73
|
+
"band": "Jeff Ward",
|
74
|
+
"relation": "member of band"
|
75
|
+
},
|
76
|
+
"children": []
|
77
|
+
}, {
|
78
|
+
"id": "2415_8",
|
79
|
+
"name": "Revolting Cocks",
|
80
|
+
"data": {
|
81
|
+
"band": "Jeff Ward",
|
82
|
+
"relation": "member of band"
|
83
|
+
},
|
84
|
+
"children": []
|
85
|
+
}, {
|
86
|
+
"id": "3963_9",
|
87
|
+
"name": "Pigface",
|
88
|
+
"data": {
|
89
|
+
"band": "Jeff Ward",
|
90
|
+
"relation": "member of band"
|
91
|
+
},
|
92
|
+
"children": []
|
93
|
+
}, {
|
94
|
+
"id": "7848_10",
|
95
|
+
"name": "Lard",
|
96
|
+
"data": {
|
97
|
+
"band": "Jeff Ward",
|
98
|
+
"relation": "member of band"
|
99
|
+
},
|
100
|
+
"children": []
|
101
|
+
}]
|
102
|
+
}, {
|
103
|
+
"id": "235950_11",
|
104
|
+
"name": "Richard Patrick",
|
105
|
+
"data": {
|
106
|
+
"band": "Nine Inch Nails",
|
107
|
+
"relation": "member of band"
|
108
|
+
},
|
109
|
+
"children": [{
|
110
|
+
"id": "1007_12",
|
111
|
+
"name": "Filter",
|
112
|
+
"data": {
|
113
|
+
"band": "Richard Patrick",
|
114
|
+
"relation": "member of band"
|
115
|
+
},
|
116
|
+
"children": []
|
117
|
+
}, {
|
118
|
+
"id": "327924_13",
|
119
|
+
"name": "Army of Anyone",
|
120
|
+
"data": {
|
121
|
+
"band": "Richard Patrick",
|
122
|
+
"relation": "member of band"
|
123
|
+
},
|
124
|
+
"children": []
|
125
|
+
}]
|
126
|
+
}, {
|
127
|
+
"id": "2396_14",
|
128
|
+
"name": "Trent Reznor",
|
129
|
+
"data": {
|
130
|
+
"band": "Nine Inch Nails",
|
131
|
+
"relation": "member of band"
|
132
|
+
},
|
133
|
+
"children": [{
|
134
|
+
"id": "3963_15",
|
135
|
+
"name": "Pigface",
|
136
|
+
"data": {
|
137
|
+
"band": "Trent Reznor",
|
138
|
+
"relation": "member of band"
|
139
|
+
},
|
140
|
+
"children": []
|
141
|
+
}, {
|
142
|
+
"id": "32247_16",
|
143
|
+
"name": "1000 Homo DJs",
|
144
|
+
"data": {
|
145
|
+
"band": "Trent Reznor",
|
146
|
+
"relation": "member of band"
|
147
|
+
},
|
148
|
+
"children": []
|
149
|
+
}, {
|
150
|
+
"id": "83761_17",
|
151
|
+
"name": "Option 30",
|
152
|
+
"data": {
|
153
|
+
"band": "Trent Reznor",
|
154
|
+
"relation": "member of band"
|
155
|
+
},
|
156
|
+
"children": []
|
157
|
+
}, {
|
158
|
+
"id": "133257_18",
|
159
|
+
"name": "Exotic Birds",
|
160
|
+
"data": {
|
161
|
+
"band": "Trent Reznor",
|
162
|
+
"relation": "member of band"
|
163
|
+
},
|
164
|
+
"children": []
|
165
|
+
}]
|
166
|
+
}, {
|
167
|
+
"id": "36352_19",
|
168
|
+
"name": "Chris Vrenna",
|
169
|
+
"data": {
|
170
|
+
"band": "Nine Inch Nails",
|
171
|
+
"relation": "member of band"
|
172
|
+
},
|
173
|
+
"children": [{
|
174
|
+
"id": "1013_20",
|
175
|
+
"name": "Stabbing Westward",
|
176
|
+
"data": {
|
177
|
+
"band": "Chris Vrenna",
|
178
|
+
"relation": "member of band"
|
179
|
+
},
|
180
|
+
"children": []
|
181
|
+
}, {
|
182
|
+
"id": "3963_21",
|
183
|
+
"name": "Pigface",
|
184
|
+
"data": {
|
185
|
+
"band": "Chris Vrenna",
|
186
|
+
"relation": "member of band"
|
187
|
+
},
|
188
|
+
"children": []
|
189
|
+
}, {
|
190
|
+
"id": "5752_22",
|
191
|
+
"name": "Jack Off Jill",
|
192
|
+
"data": {
|
193
|
+
"band": "Chris Vrenna",
|
194
|
+
"relation": "member of band"
|
195
|
+
},
|
196
|
+
"children": []
|
197
|
+
}, {
|
198
|
+
"id": "33602_23",
|
199
|
+
"name": "Die Warzau",
|
200
|
+
"data": {
|
201
|
+
"band": "Chris Vrenna",
|
202
|
+
"relation": "member of band"
|
203
|
+
},
|
204
|
+
"children": []
|
205
|
+
}, {
|
206
|
+
"id": "40485_24",
|
207
|
+
"name": "tweaker",
|
208
|
+
"data": {
|
209
|
+
"band": "Chris Vrenna",
|
210
|
+
"relation": "is person"
|
211
|
+
},
|
212
|
+
"children": []
|
213
|
+
}, {
|
214
|
+
"id": "133257_25",
|
215
|
+
"name": "Exotic Birds",
|
216
|
+
"data": {
|
217
|
+
"band": "Chris Vrenna",
|
218
|
+
"relation": "member of band"
|
219
|
+
},
|
220
|
+
"children": []
|
221
|
+
}]
|
222
|
+
}, {
|
223
|
+
"id": "236021_26",
|
224
|
+
"name": "Aaron North",
|
225
|
+
"data": {
|
226
|
+
"band": "Nine Inch Nails",
|
227
|
+
"relation": "member of band"
|
228
|
+
},
|
229
|
+
"children": []
|
230
|
+
}, {
|
231
|
+
"id": "236024_27",
|
232
|
+
"name": "Jeordie White",
|
233
|
+
"data": {
|
234
|
+
"band": "Nine Inch Nails",
|
235
|
+
"relation": "member of band"
|
236
|
+
},
|
237
|
+
"children": [{
|
238
|
+
"id": "909_28",
|
239
|
+
"name": "A Perfect Circle",
|
240
|
+
"data": {
|
241
|
+
"band": "Jeordie White",
|
242
|
+
"relation": "member of band"
|
243
|
+
},
|
244
|
+
"children": []
|
245
|
+
}, {
|
246
|
+
"id": "237377_29",
|
247
|
+
"name": "Twiggy Ramirez",
|
248
|
+
"data": {
|
249
|
+
"band": "Jeordie White",
|
250
|
+
"relation": "is person"
|
251
|
+
},
|
252
|
+
"children": []
|
253
|
+
}]
|
254
|
+
}, {
|
255
|
+
"id": "235953_30",
|
256
|
+
"name": "Robin Finck",
|
257
|
+
"data": {
|
258
|
+
"band": "Nine Inch Nails",
|
259
|
+
"relation": "member of band"
|
260
|
+
},
|
261
|
+
"children": [{
|
262
|
+
"id": "1440_31",
|
263
|
+
"name": "Guns N' Roses",
|
264
|
+
"data": {
|
265
|
+
"band": "Robin Finck",
|
266
|
+
"relation": "member of band"
|
267
|
+
},
|
268
|
+
"children": []
|
269
|
+
}]
|
270
|
+
}, {
|
271
|
+
"id": "235955_32",
|
272
|
+
"name": "Danny Lohner",
|
273
|
+
"data": {
|
274
|
+
"band": "Nine Inch Nails",
|
275
|
+
"relation": "member of band"
|
276
|
+
},
|
277
|
+
"children": [{
|
278
|
+
"id": "909_33",
|
279
|
+
"name": "A Perfect Circle",
|
280
|
+
"data": {
|
281
|
+
"band": "Danny Lohner",
|
282
|
+
"relation": "member of band"
|
283
|
+
},
|
284
|
+
"children": []
|
285
|
+
}, {
|
286
|
+
"id": "1695_34",
|
287
|
+
"name": "Killing Joke",
|
288
|
+
"data": {
|
289
|
+
"band": "Danny Lohner",
|
290
|
+
"relation": "member of band"
|
291
|
+
},
|
292
|
+
"children": []
|
293
|
+
}, {
|
294
|
+
"id": "1938_35",
|
295
|
+
"name": "Methods of Mayhem",
|
296
|
+
"data": {
|
297
|
+
"band": "Danny Lohner",
|
298
|
+
"relation": "member of band"
|
299
|
+
},
|
300
|
+
"children": []
|
301
|
+
}, {
|
302
|
+
"id": "5138_36",
|
303
|
+
"name": "Skrew",
|
304
|
+
"data": {
|
305
|
+
"band": "Danny Lohner",
|
306
|
+
"relation": "member of band"
|
307
|
+
},
|
308
|
+
"children": []
|
309
|
+
}, {
|
310
|
+
"id": "53549_37",
|
311
|
+
"name": "Angkor Wat",
|
312
|
+
"data": {
|
313
|
+
"band": "Danny Lohner",
|
314
|
+
"relation": "member of band"
|
315
|
+
},
|
316
|
+
"children": []
|
317
|
+
}, {
|
318
|
+
"id": "113510_38",
|
319
|
+
"name": "Puscifer",
|
320
|
+
"data": {
|
321
|
+
"band": "Danny Lohner",
|
322
|
+
"relation": "member of band"
|
323
|
+
},
|
324
|
+
"children": []
|
325
|
+
}, {
|
326
|
+
"id": "113512_39",
|
327
|
+
"name": "Renhold\u00ebr",
|
328
|
+
"data": {
|
329
|
+
"band": "Danny Lohner",
|
330
|
+
"relation": "is person"
|
331
|
+
},
|
332
|
+
"children": []
|
333
|
+
}]
|
334
|
+
}],
|
335
|
+
"data": []
|
336
|
+
};
|
337
|
+
//end
|
338
|
+
var infovis = document.getElementById('infovis');
|
339
|
+
var w = infovis.offsetWidth - 50, h = infovis.offsetHeight - 50;
|
340
|
+
|
341
|
+
//init canvas
|
342
|
+
//Create a new canvas instance.
|
343
|
+
var canvas = new Canvas('mycanvas', {
|
344
|
+
'injectInto': 'infovis',
|
345
|
+
'width': w,
|
346
|
+
'height': h
|
347
|
+
});
|
348
|
+
//end
|
349
|
+
var style = document.getElementById('mycanvas').style;
|
350
|
+
style.marginLeft = style.marginTop = "25px";
|
351
|
+
//init Hypertree
|
352
|
+
var ht = new Hypertree(canvas, {
|
353
|
+
//Change node and edge styles such as
|
354
|
+
//color, width and dimensions.
|
355
|
+
Node: {
|
356
|
+
dim: 9,
|
357
|
+
color: "#f00"
|
358
|
+
},
|
359
|
+
|
360
|
+
Edge: {
|
361
|
+
lineWidth: 2,
|
362
|
+
color: "#088"
|
363
|
+
},
|
364
|
+
|
365
|
+
onBeforeCompute: function(node){
|
366
|
+
Log.write("centering");
|
367
|
+
},
|
368
|
+
//Attach event handlers and add text to the
|
369
|
+
//labels. This method is only triggered on label
|
370
|
+
//creation
|
371
|
+
onCreateLabel: function(domElement, node){
|
372
|
+
domElement.innerHTML = node.name;
|
373
|
+
addEvent(domElement, 'click', function () {
|
374
|
+
ht.onClick(node.id);
|
375
|
+
});
|
376
|
+
},
|
377
|
+
//Change node styles when labels are placed
|
378
|
+
//or moved.
|
379
|
+
onPlaceLabel: function(domElement, node){
|
380
|
+
var style = domElement.style;
|
381
|
+
style.display = '';
|
382
|
+
style.cursor = 'pointer';
|
383
|
+
if (node._depth <= 1) {
|
384
|
+
style.fontSize = "0.8em";
|
385
|
+
style.color = "#ddd";
|
386
|
+
|
387
|
+
} else if(node._depth == 2){
|
388
|
+
style.fontSize = "0.7em";
|
389
|
+
style.color = "#555";
|
390
|
+
|
391
|
+
} else {
|
392
|
+
style.display = 'none';
|
393
|
+
}
|
394
|
+
|
395
|
+
var left = parseInt(style.left);
|
396
|
+
var w = domElement.offsetWidth;
|
397
|
+
style.left = (left - w / 2) + 'px';
|
398
|
+
},
|
399
|
+
|
400
|
+
onAfterCompute: function(){
|
401
|
+
Log.write("done");
|
402
|
+
|
403
|
+
//Build the right column relations list.
|
404
|
+
//This is done by collecting the information (stored in the data property)
|
405
|
+
//for all the nodes adjacent to the centered node.
|
406
|
+
var node = Graph.Util.getClosestNodeToOrigin(ht.graph, "pos");
|
407
|
+
var html = "<h4>" + node.name + "</h4><b>Connections:</b>";
|
408
|
+
html += "<ul>";
|
409
|
+
Graph.Util.eachAdjacency(node, function(adj){
|
410
|
+
var child = adj.nodeTo;
|
411
|
+
if (child.data) {
|
412
|
+
var rel = (child.data.band == node.name) ? child.data.relation : node.data.relation;
|
413
|
+
html += "<li>" + child.name + " " + "<div class=\"relation\">(relation: " + rel + ")</div></li>";
|
414
|
+
}
|
415
|
+
});
|
416
|
+
html += "</ul>";
|
417
|
+
document.getElementById('inner-details').innerHTML = html;
|
418
|
+
}
|
419
|
+
});
|
420
|
+
|
421
|
+
//load JSON data.
|
422
|
+
ht.loadJSON(json);
|
423
|
+
//compute positions and plot.
|
424
|
+
ht.refresh();
|
425
|
+
//end
|
426
|
+
ht.controller.onAfterCompute();
|
427
|
+
}
|