| author | rougeronj |
| Thu, 05 Feb 2015 13:19:42 +0100 | |
| changeset 383 | ba1f278841a2 |
| parent 293 | fba23fde14ba |
| child 433 | e457ec945e50 |
| permissions | -rw-r--r-- |
| 52 | 1 |
/* Imports a KC graph */ |
2 |
||
3 |
Rkns.retrieveKC = function(_renkan, _opts) { |
|
4 |
if (typeof _opts === "undefined") { |
|
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
170
diff
changeset
|
5 |
_opts = {}; |
| 52 | 6 |
} |
7 |
var _proj = _renkan.project, |
|
8 |
_username = _opts.user_name || "Yves-Marie", |
|
9 |
_userid = _opts.user_id || "yves-marie.haussonne@centrepompidou.fr", |
|
10 |
_usercolor = _opts.user_color || "#800000", |
|
11 |
_allid = _opts.all_id || "B0000044", |
|
12 |
_projid = _opts.proj || "ozu_silent", |
|
| 170 | 13 |
_kcept = _opts.endpoint || "/sites/kcproxy/allRetrieve.jsp"; |
| 52 | 14 |
var _load = function() { |
15 |
Rkns.$.getJSON(_kcept, |
|
16 |
{ |
|
17 |
all_id: _allid, |
|
18 |
proj: _projid, |
|
19 |
uid: _userid |
|
20 |
}, |
|
21 |
function(_data) { |
|
22 |
_proj.addUser({ |
|
23 |
id: _userid, |
|
24 |
color: _usercolor, |
|
25 |
title: _username |
|
26 |
}); |
|
27 |
Rkns._(_data.node).each(function(_node) { |
|
28 |
_proj.addNode({ |
|
29 |
id: _node.id, |
|
30 |
title: _node.name, |
|
31 |
description: 'Knowledge concierge node from project "' + _projid + '" belonging to group "' + _node.grp + '"', |
|
32 |
position: { |
|
33 |
x: _node.x, |
|
34 |
y: _node.y |
|
35 |
}, |
|
36 |
created_by: _userid |
|
| 170 | 37 |
}); |
| 52 | 38 |
}); |
39 |
Rkns._(_data.edge).each(function(_edge) { |
|
40 |
_proj.addEdge({ |
|
41 |
id: _edge.asc_id, |
|
42 |
from: _edge.id, |
|
43 |
to: _edge.to_id, |
|
44 |
created_by: _userid, |
|
45 |
title: _edge.r_name |
|
46 |
}); |
|
47 |
}); |
|
48 |
}); |
|
| 170 | 49 |
}; |
| 52 | 50 |
_load(); |
| 170 | 51 |
}; |