equal
deleted
inserted
replaced
42 "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified), |
42 "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified), |
43 "dc:creator" : _data.creator || _source.creator, |
43 "dc:creator" : _data.creator || _source.creator, |
44 "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, |
44 "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, |
45 "dc:duration" : _data.duration.milliseconds |
45 "dc:duration" : _data.duration.milliseconds |
46 } |
46 } |
47 } |
47 }; |
48 _dest.medias.push(_res); |
48 _dest.medias.push(_res); |
49 var _list = { |
49 var _list = { |
50 id: IriSP.Model.getUID(), |
50 id: IriSP.Model.getUID(), |
51 meta : { |
51 meta : { |
52 "dc:title": _data.title || "", |
52 "dc:title": _data.title || "", |
75 } |
75 } |
76 return false; |
76 return false; |
77 }).map(function(_at) { |
77 }).map(function(_at) { |
78 return { |
78 return { |
79 "id-ref": _at.id |
79 "id-ref": _at.id |
80 } |
80 }; |
81 }) |
81 }) |
82 } |
82 }; |
83 _dest.lists.push(_list); |
83 _dest.lists.push(_list); |
84 _dest.views[0].contents.push(_data.id); |
84 _dest.views[0].contents.push(_data.id); |
85 } |
85 } |
86 }, |
86 }, |
87 tag : { |
87 tag : { |
88 serialized_name : "tags", |
88 serialized_name : "tags", |
89 model_name : "tag", |
|
90 deserializer : function(_data, _source) { |
89 deserializer : function(_data, _source) { |
91 var _res = new IriSP.Model.Tag(_data.id, _source); |
90 var _res = new IriSP.Model.Tag(_data.id, _source); |
92 _res.title = _data.meta["dc:title"]; |
91 _res.title = _data.meta["dc:title"]; |
93 return _res; |
92 return _res; |
94 }, |
93 }, |
104 "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created), |
103 "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created), |
105 "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified), |
104 "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified), |
106 "dc:creator" : _data.creator || _source.creator, |
105 "dc:creator" : _data.creator || _source.creator, |
107 "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, |
106 "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, |
108 } |
107 } |
109 } |
108 }; |
110 _dest.tags.push(_res); |
109 _dest.tags.push(_res); |
111 } |
110 } |
112 }, |
111 }, |
113 annotationType : { |
112 annotationType : { |
114 serialized_name : "annotation-types", |
113 serialized_name : "annotation-types", |
125 "dc:description": _data.description || "", |
124 "dc:description": _data.description || "", |
126 "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created), |
125 "dc:created" : IriSP.Model.dateToIso(_data.created || _source.created), |
127 "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified), |
126 "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified), |
128 "dc:creator" : _data.creator || _source.creator, |
127 "dc:creator" : _data.creator || _source.creator, |
129 "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, |
128 "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, |
130 } |
129 }; |
131 _dest["annotation-types"].push(_res); |
130 _dest["annotation-types"].push(_res); |
132 _dest.views[0].annotation_types.push(_data.id); |
131 _dest.views[0].annotation_types.push(_data.id); |
133 } |
132 } |
134 }, |
133 }, |
135 annotation : { |
134 annotation : { |
175 content : IriSP._.defaults( |
174 content : IriSP._.defaults( |
176 {}, |
175 {}, |
177 { |
176 { |
178 title : _data.title, |
177 title : _data.title, |
179 description : _data.description, |
178 description : _data.description, |
180 audio : _data.audio, |
179 audio : _data.audio, |
181 img: { |
180 img: { |
182 src: _data.thumbnail |
181 src: _data.thumbnail |
183 } |
182 } |
184 }, |
183 }, |
185 _data.content, |
184 _data.content, |
186 { |
185 { |
187 title: "", |
186 title: "", |
188 description: "" |
187 description: "" |
189 } |
188 } |
196 "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified), |
195 "dc:modified" : IriSP.Model.dateToIso(_data.modified || _source.modified), |
197 "dc:creator" : _data.creator || _source.creator, |
196 "dc:creator" : _data.creator || _source.creator, |
198 "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, |
197 "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, |
199 // project : _source.projectId |
198 // project : _source.projectId |
200 } |
199 } |
201 } |
200 }; |
202 if (_source.regenerateTags) { |
201 if (_source.regenerateTags) { |
203 _res.tags = IriSP._(_data.keywords).map(function(_kw) { |
202 _res.tags = IriSP._(_data.keywords).map(function(_kw) { |
204 return { |
203 return { |
205 "id-ref": _source.__keywords[_kw.toLowerCase()].id |
204 "id-ref": _source.__keywords[_kw.toLowerCase()].id |
206 } |
205 }; |
207 }); |
206 }); |
208 } else { |
207 } else { |
209 _res.tags = IriSP._(_data.tag.id).map(function(_id) { |
208 _res.tags = IriSP._(_data.tag.id).map(function(_id) { |
210 return { |
209 return { |
211 "id-ref" : _id |
210 "id-ref" : _id |
212 } |
211 }; |
213 }); |
212 }); |
214 } |
213 } |
215 _res.content.title = _data.title || _res.content.title || ""; |
214 _res.content.title = _data.title || _res.content.title || ""; |
216 _dest.annotations.push(_res); |
215 _dest.annotations.push(_res); |
217 } |
216 } |
242 }, |
241 }, |
243 items: _data.segments.map(function(_annotation) { |
242 items: _data.segments.map(function(_annotation) { |
244 return _annotation.annotation.id; |
243 return _annotation.annotation.id; |
245 }), |
244 }), |
246 id: _data.id |
245 id: _data.id |
247 } |
246 }; |
248 _dest.lists.push(_res); |
247 _dest.lists.push(_res); |
249 } |
248 } |
250 } |
249 } |
251 }, |
250 }, |
252 serialize : function(_source) { |
251 serialize : function(_source) { |
282 if (typeof _source.__keywords[lkw] === "undefined") { |
281 if (typeof _source.__keywords[lkw] === "undefined") { |
283 _source.__keywords[lkw] = { |
282 _source.__keywords[lkw] = { |
284 id: IriSP.Model.getUID(), |
283 id: IriSP.Model.getUID(), |
285 title: kw, |
284 title: kw, |
286 regenerated: true |
285 regenerated: true |
287 } |
286 }; |
288 } |
287 } |
289 }); |
288 }); |
290 }); |
289 }); |
291 IriSP._(_source.__keywords).each(function(kw) { |
290 IriSP._(_source.__keywords).each(function(kw) { |
292 _this.types.tag.serializer(kw, _source, _res); |
291 _this.types.tag.serializer(kw, _source, _res); |
293 }) |
292 }); |
294 } |
293 } |
295 _source.forEach(function(_list, _typename) { |
294 _source.forEach(function(_list, _typename) { |
296 if (typeof _this.types[_typename] !== "undefined") { |
295 if (typeof _this.types[_typename] !== "undefined") { |
297 _list.forEach(function(_el) { |
296 _list.forEach(function(_el) { |
298 _this.types[_typename].serializer(_el, _source, _res); |
297 _this.types[_typename].serializer(_el, _source, _res); |