Revize d1804332
Přidáno uživatelem Martin Matas před více než 5 roky(ů)
sources/imiger-core/src/main/webapp/js/timeline/auxiliary/RestSource.js | ||
---|---|---|
89 | 89 |
startPrecision: "none", |
90 | 90 |
endPrecision: "none" |
91 | 91 |
}; |
92 |
|
|
92 | 93 |
var archetype = archetypes[v.archetype].name.toLowerCase(); |
93 | 94 |
if (archetype !== 'person') { |
94 | 95 |
archetype = 'item'; |
95 | 96 |
} |
97 |
|
|
96 | 98 |
var node = { |
97 | 99 |
id: v.id, |
98 | 100 |
name: v.name, |
... | ... | |
100 | 102 |
stereotype: archetype, |
101 | 103 |
properties: prop |
102 | 104 |
}; |
105 |
|
|
106 |
// spade search |
|
107 |
if (beginAttrIdx === -1 || endAttrIdx === -1) { |
|
108 |
attrNames = v.attributes.map(function(attr) { return attr[0]; }); |
|
109 |
beginAttrIdx = attrNames.indexOf('begin'); |
|
110 |
endAttrIdx = attrNames.indexOf('end'); |
|
111 |
} |
|
112 |
|
|
113 |
var parsed, date; |
|
103 | 114 |
if (beginAttrIdx !== -1 && typeof v.attributes[beginAttrIdx] !== 'undefined') { |
104 |
node.begin = v.attributes[beginAttrIdx][1]; |
|
115 |
parsed = parseInt(v.attributes[beginAttrIdx][1], 10); |
|
116 |
|
|
117 |
if (isNaN(parsed)) { |
|
118 |
node.begin = v.attributes[beginAttrIdx][1]; |
|
119 |
} else { |
|
120 |
date = new Date(parsed); |
|
121 |
node.begin = date.getFullYear() + '-' + date.getMonth() + '-' + date.getDate() |
|
122 |
+ ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds(); |
|
123 |
} |
|
105 | 124 |
} |
106 | 125 |
if (endAttrIdx !== -1 && typeof v.attributes[endAttrIdx] !== 'undefined') { |
107 |
node.end = v.attributes[endAttrIdx][1]; |
|
126 |
parsed = parseInt(v.attributes[endAttrIdx][1], 10); |
|
127 |
|
|
128 |
if (isNaN(parsed)) { |
|
129 |
node.end = v.attributes[endAttrIdx][1]; |
|
130 |
} else { |
|
131 |
date = new Date(parsed); |
|
132 |
node.end = date.getFullYear() + '-' + date.getMonth() + '-' + date.getDate() |
|
133 |
+ ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds(); |
|
134 |
} |
|
108 | 135 |
} |
136 |
|
|
109 | 137 |
nodes[i] = node; |
110 | 138 |
} |
111 | 139 |
|
112 | 140 |
for(var j = 0; j < data.edges.length; j++) { |
113 |
var e = data.edges[i];
|
|
114 |
edges[i] = {
|
|
141 |
var e = data.edges[j];
|
|
142 |
edges[j] = {
|
|
115 | 143 |
id: e.id, |
116 | 144 |
name: e.text, |
117 | 145 |
from: e.from, |
... | ... | |
131 | 159 |
var entities = new Collection(), |
132 | 160 |
relations = new Collection(); |
133 | 161 |
|
134 |
// map entities
|
|
162 |
// map entities |
|
135 | 163 |
for(var nodeIdx in data.nodes) { |
136 | 164 |
entities.add(new this._objectMapping.entity(data.nodes[nodeIdx])); |
137 | 165 |
} |
Také k dispozici: Unified diff
Fixed support for multiple date formats (refs #7562)