1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
define(['underscore', 'util'],
function(_, util)
{
var nodetypes,
type_attributes = {
'internship': {
'title': 'Internship',
'attributes':
['status', 'startdate', 'enddate', 'description', 'url',
'internship-type',
'facility',
'facility-affiliation',
'cnrs-inserm-unit-code',
'street-address',
'city',
'country',
],
},
'skill': {
'title': 'Skill',
'attributes': ['description', 'url'],
},
'interest': {
'title': 'Interesst',
'attributes': ['description', 'url'],
},
'person': {
'title': 'Person',
'attributes': ['description', 'url'],
},
'club': {
'title': 'Club',
'attributes': ['description', 'url'],
}
},
all_attributes,
attribute_titles = {
'name': 'Name',
'type': 'Type',
'description': 'Description',
'url': 'URL',
'status': 'Status',
'startdate': 'Start Date',
'enddate': 'End Date',
'internship-type': 'Internship Type',
'facility': 'Lab/Company',
'facility-affiliation': 'Lab affiliation',
'cnrs-inserm-unit-code': 'CNRS / INSERM unit code',
'street-address': 'Street address',
'city': 'City',
'country': 'Country',
};
nodetypes = _.keys(type_attributes);
type_attributes['_defaults'] = {
'title': 'default',
'attributes':['description', 'url']
};
_.pluck(_.values(type_attributes), 'attributes').map(function (attributes) {
attributes.push('name');
attributes.push('type');
attributes.sort();
});
all_attributes = _.union(_.flatten(_.pluck(_.values(type_attributes), 'attributes'))).sort();
util.assert(_.isEqual(all_attributes, _.keys(attribute_titles).sort()));
return (
{
nodetypes: nodetypes,
type_attributes: function (type) {
util.assert(type[0] !== '_', 'invalid type name');
return type_attributes[type_attributes.hasOwnProperty(type) ? type : '_defaults'].attributes;
},
all_attributes: all_attributes,
attribute_titles: attribute_titles,
});
}
)
|