|
249
|
1 |
# Renkan - Client configuration |
|
|
2 |
|
|
|
3 |
Renkan is a tool to simply build oriented graphs by creating nodes and drag'n'droping links, |
|
|
4 |
pictures and html elements from web pages. Each node can have title, description, uri/url, color, |
|
|
5 |
image and specific size. Each node can have title, uri/url and color. |
|
|
6 |
|
|
|
7 |
|
|
|
8 |
## Embedding Renkan in a web page |
|
|
9 |
|
|
|
10 |
Whatever configuration you have, you need to import those javascript files **in that order**... |
|
|
11 |
|
|
|
12 |
<script src="[...]/jquery.min.js"></script> |
|
|
13 |
<script src="[...]/jquery.mousewheel.min.js"></script> |
|
|
14 |
<script src="[...]/underscore-min.js"></script> |
|
|
15 |
<script src="[...]/backbone.js"></script> |
|
|
16 |
<script src="[...]/backbone-relational.js"></script> |
|
|
17 |
<script src="[...]/paper.js"></script> |
|
|
18 |
<script src="[...]/renkan.js"></script> |
|
|
19 |
|
|
|
20 |
... and the renkan css file : |
|
|
21 |
|
|
|
22 |
<link rel="stylesheet" href="[...]/renkan.css" /> |
|
|
23 |
|
|
|
24 |
Finally, add the div in you DOM : |
|
|
25 |
|
|
|
26 |
<div id="renkan"></div> |
|
|
27 |
|
|
|
28 |
Your Renkan should be displayed. Now let's see more specifically the 2 displays possibilities : in body 100% or in a div with set width and height. |
|
|
29 |
|
|
251
|
30 |
N.B. : renkan.js is the concatenation of those js files : header.js main.js models.js defaults.js i18n.js paper-renderer.js full-json.js ldtjson-bin.js list-bin.js wikipedia-bin.js. |
|
|
31 |
It is built with the script available in sbin/build/compil.sh. |
|
249
|
32 |
|
|
|
33 |
### In body 100% |
|
|
34 |
|
|
|
35 |
Nothing to add, the html is very simple : |
|
|
36 |
|
|
|
37 |
<body> |
|
|
38 |
<div id="renkan"></div> |
|
|
39 |
</body> |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
### In a div |
|
|
43 |
|
|
250
|
44 |
The renkan div has the css attributes position:absolute/top:0/left:0/bottom:0/right:0, |
|
|
45 |
so the parent div has to be in position:relative and define width and height. Here is a simple example including css and partial html : |
|
249
|
46 |
|
|
|
47 |
<head> |
|
|
48 |
<style type="text/css"> |
|
|
49 |
body{ |
|
|
50 |
margin: 0 auto; |
|
|
51 |
width: 960px; |
|
|
52 |
} |
|
|
53 |
.header, .footer { |
|
|
54 |
font-size: 14px; |
|
|
55 |
height: 40px; |
|
|
56 |
padding-top: 10px; |
|
|
57 |
} |
|
|
58 |
.rnk-container{ |
|
|
59 |
height: 500px; |
|
|
60 |
position: relative; |
|
|
61 |
width: 700px; |
|
|
62 |
} |
|
|
63 |
</style> |
|
|
64 |
</head> |
|
|
65 |
<body> |
|
|
66 |
<div class="header"> |
|
|
67 |
This is a header |
|
|
68 |
</div> |
|
|
69 |
<div class="rnk-container"> |
|
|
70 |
<div id="renkan"></div> |
|
|
71 |
</div> |
|
|
72 |
<div class="footer"> |
|
|
73 |
This is a footer |
|
|
74 |
</div> |
|
|
75 |
</body> |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
## Embedding a read only Renkan |
|
|
79 |
|
|
|
80 |
To embed a read only Renkan, just add this script tag : |
|
|
81 |
|
|
|
82 |
<script type="text/javascript"> |
|
|
83 |
var _renkan; |
|
|
84 |
$(function() { |
|
|
85 |
_renkan = new Rkns.Renkan({ |
|
|
86 |
editor_mode: false, |
|
|
87 |
show_bins: false, |
|
|
88 |
}); |
|
|
89 |
Rkns.jsonIO(_renkan, { |
|
|
90 |
url: "any_local_or_jsonp_url" |
|
|
91 |
}); |
|
|
92 |
}); |
|
|
93 |
</script> |
|
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
## Embedding a writable Renkan |
|
|
98 |
|
|
|
99 |
### Simple mode : no bins on the left, just the canvas |
|
|
100 |
|
|
|
101 |
To embed a simple writable Renkan, just add this script tag. In the client folder, "data/simple-persist.php" makes a very simple persistent url. |
|
|
102 |
The persistent url is supposed to give the json data on GET request at page load, and save datas at PUT request sent by the browser : |
|
|
103 |
|
|
|
104 |
<script type="text/javascript"> |
|
|
105 |
var _renkan; |
|
|
106 |
$(function() { |
|
|
107 |
_renkan = new Rkns.Renkan({ |
|
|
108 |
show_bins: false |
|
|
109 |
}); |
|
|
110 |
Rkns.jsonIO(_renkan, { |
|
|
111 |
url: "url_of_a_persistent_connection" |
|
|
112 |
}); |
|
|
113 |
}); |
|
|
114 |
</script> |
|
|
115 |
|
|
|
116 |
|
|
251
|
117 |
## Search and bins |
|
|
118 |
|
|
|
119 |
On the right of your renkan interface, you can add some search engine and data bins. |
|
|
120 |
|
|
|
121 |
Search engine can be the current [IRI's Lignes de temps platform](http://ldt.iri.centrepompidou.fr/) and wikipedia in any available language. |
|
|
122 |
Here is an example of configuration : |
|
|
123 |
|
|
|
124 |
_renkan = new Rkns.Renkan({ |
|
|
125 |
search: [ |
|
|
126 |
{ |
|
|
127 |
type: "Ldt" |
|
|
128 |
}, |
|
|
129 |
{ |
|
|
130 |
type: "Wikipedia", |
|
|
131 |
lang: "fr" |
|
|
132 |
}, |
|
|
133 |
{ |
|
|
134 |
type: "Wikipedia", |
|
|
135 |
lang: "ja" |
|
|
136 |
} |
|
|
137 |
] |
|
|
138 |
}); |
|
|
139 |
Rkns.jsonIO(_renkan, { |
|
|
140 |
url: "data/simple-persist.php" |
|
|
141 |
}); |
|
|
142 |
|
|
|
143 |
You can also define data bins : annotations loaded from IRI's Lignes de temps projects, and any resources which can be drag and dropped into the renkan. |
|
|
144 |
Resources can be simple texts, links or objects with title, description, url and image. Here is an example of configuration : |
|
|
145 |
|
|
|
146 |
_renkan = new Rkns.Renkan({ |
|
|
147 |
search: [ |
|
|
148 |
... |
|
|
149 |
], |
|
|
150 |
bins: [ |
|
|
151 |
{ |
|
|
152 |
title: "To be or not to be on Lignes de Temps", |
|
|
153 |
type: "Ldt", |
|
|
154 |
ldt_type: "Project", |
|
|
155 |
project_id: "6af4019c-8283-11e2-9678-00145ea4a2be", |
|
|
156 |
ldt_platform: "http://ldt.iri.centrepompidou.fr/" |
|
|
157 |
}, |
|
|
158 |
{ |
|
|
159 |
type: "ResourceList", |
|
|
160 |
title: "Ressources", |
|
|
161 |
list: [ |
|
|
162 |
{ |
|
|
163 |
url: "http://www.google.com/", |
|
|
164 |
title: "Google", |
|
|
165 |
description: "Search engine", |
|
|
166 |
image: "http://www.google.fr/images/srpr/logo4w.png" |
|
|
167 |
}, |
|
|
168 |
"Polemic Tweet http://www.polemictweet.com", |
|
|
169 |
"Twitter http://www.twitter.com/" |
|
|
170 |
] |
|
|
171 |
} |
|
|
172 |
] |
|
|
173 |
}); |
|
|
174 |
Rkns.jsonIO(_renkan, { |
|
|
175 |
url: "data/simple-persist.php" |
|
|
176 |
}); |
|
249
|
177 |
|
|
253
|
178 |
If you embed the renkan in a div, the renkan container css should have overflow:hidden in order to hide bins when the user wants to. |
|
249
|
179 |
|
|
251
|
180 |
## More configuration |
|
|
181 |
|
|
|
182 |
You can configure several things : |
|
|
183 |
* the language of your interface, english (default) or french |
|
|
184 |
* you can fill your nodes with black color instead of transparent. |
|
|
185 |
* thanks to an external file, you can define properties for links between node. |
|
|
186 |
|
|
|
187 |
|
|
|
188 |
_renkan = new Rkns.Renkan({ |
|
|
189 |
... |
|
|
190 |
property_files: [ "data/properties.json" ], |
|
|
191 |
node_fill_color: true, |
|
|
192 |
language: "fr" |
|
|
193 |
}); |
|
|
194 |
|
|
|
195 |
Here is an example of properties file : |
|
249
|
196 |
|
|
251
|
197 |
[ |
|
|
198 |
{ |
|
|
199 |
"label": "Dublin Core Metadata", |
|
|
200 |
"base-uri": "http://purl.org/dc/elements/1.1/", |
|
|
201 |
"properties": [ |
|
|
202 |
{ |
|
|
203 |
"uri": "creator", |
|
|
204 |
"label": "created by" |
|
|
205 |
}, { |
|
|
206 |
"uri": "date", |
|
|
207 |
"label": "has date" |
|
|
208 |
}, { |
|
|
209 |
"uri": "subject", |
|
|
210 |
"label": "has subject" |
|
|
211 |
} |
|
|
212 |
] |
|
|
213 |
}, { |
|
|
214 |
"label": "SKOS Semantic relations", |
|
|
215 |
"base-uri": "http://www.w3.org/2004/02/skos/core#", |
|
|
216 |
"properties": [ |
|
|
217 |
{ |
|
|
218 |
"uri": "broader", |
|
|
219 |
"label": "has broader" |
|
|
220 |
}, { |
|
|
221 |
"uri": "narrower", |
|
|
222 |
"label": "has narrower" |
|
|
223 |
}, { |
|
|
224 |
"uri": "related", |
|
|
225 |
"label": "has related" |
|
|
226 |
} |
|
|
227 |
] |
|
|
228 |
} |
|
|
229 |
] |
|
249
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
251
|
233 |
Finally, here is an example of full configuration : |
|
249
|
234 |
|
|
251
|
235 |
<script type="text/javascript"> |
|
|
236 |
var _renkan; |
|
|
237 |
$(function() { |
|
|
238 |
_renkan = new Rkns.Renkan({ |
|
|
239 |
search: [ |
|
|
240 |
{ |
|
|
241 |
type: "Ldt" |
|
|
242 |
}, |
|
|
243 |
{ |
|
|
244 |
type: "Wikipedia", |
|
|
245 |
lang: "fr" |
|
|
246 |
}, |
|
|
247 |
{ |
|
|
248 |
type: "Wikipedia", |
|
|
249 |
lang: "ja" |
|
|
250 |
} |
|
|
251 |
], |
|
|
252 |
bins: [ |
|
|
253 |
{ |
|
|
254 |
title: "Projet Lignes de Temps", |
|
|
255 |
type: "Ldt", |
|
|
256 |
ldt_type: "Project", |
|
|
257 |
project_id: "6af4019c-8283-11e2-9678-00145ea4a2be", |
|
|
258 |
ldt_platform: "http://ldt.iri.centrepompidou.fr/" |
|
|
259 |
}, |
|
|
260 |
{ |
|
|
261 |
type: "ResourceList", |
|
|
262 |
title: "Ressources", |
|
|
263 |
list: [ |
|
|
264 |
{ |
|
|
265 |
url: "http://www.google.com/", |
|
|
266 |
title: "Google", |
|
|
267 |
description: "Search engine", |
|
|
268 |
image: "http://www.google.fr/images/srpr/logo4w.png" |
|
|
269 |
}, |
|
|
270 |
"Polemic Tweet http://www.polemictweet.com", |
|
|
271 |
"Twitter http://www.twitter.com/" |
|
|
272 |
] |
|
|
273 |
} |
|
|
274 |
], |
|
|
275 |
property_files: [ "data/properties.json" ], |
|
|
276 |
node_fill_color: false, |
|
|
277 |
language: "fr" |
|
|
278 |
}); |
|
|
279 |
Rkns.jsonIO(_renkan, { |
|
|
280 |
url: "data/simple-persist.php" |
|
|
281 |
}); |
|
|
282 |
}); |
|
253
|
283 |
</script> |
|
|
284 |
|
|
|
285 |
## Tests |
|
|
286 |
|
|
|
287 |
Because of a simple php file enabling persistent connection, you can not test the writables examples by only opening them in your browser. |
|
|
288 |
A url like file:///path/to/folder/test-writable-\*.html will not work. |
|
|
289 |
You need to run a localhost server that executes php and go to a url like http://localhost/renkan/test/test-writable-\*.html. |
|
|
290 |
|
|
|
291 |
For read only examples, it appears that for security reasons urls like file:///path/to/folder/test-readonly-\*.html only work on Firefox. |
|
|
292 |
To see those examples with other browsers, you also need to run a localhost server and go to a url like http://localhost/renkan/test/test-readonly-\*.html. |
|
|
293 |
|
|
|
294 |
|