6 |
6 |
7 IriSP.serializers.ldt = { |
7 IriSP.serializers.ldt = { |
8 types : { |
8 types : { |
9 media : { |
9 media : { |
10 serialized_name : "medias", |
10 serialized_name : "medias", |
11 model_name : "media", |
|
12 deserializer : function(_data, _source) { |
11 deserializer : function(_data, _source) { |
13 var _res = new IriSP.Model.Media(_data.id, _source); |
12 var _res = new IriSP.Model.Media(_data.id, _source); |
14 _res.video = ( |
13 _res.video = ( |
15 typeof _data.url !== "undefined" |
14 typeof _data.url !== "undefined" |
16 ? _data.url |
15 ? _data.url |
103 return _res; |
102 return _res; |
104 }, |
103 }, |
105 serializer : function(_data, _source) { |
104 serializer : function(_data, _source) { |
106 return { |
105 return { |
107 id : _source.unNamespace(_data.id), |
106 id : _source.unNamespace(_data.id), |
|
107 begin : _data.begin.milliseconds, |
|
108 end : _data.end.milliseconds, |
108 content : { |
109 content : { |
109 title : _data.title, |
110 title : _data.title, |
110 description : _data.description |
111 description : _data.description |
111 }, |
112 }, |
112 media : _source.unNamespace(_data.media.id), |
113 media : _source.unNamespace(_data.media.id), |
114 "id-ref" : _source.unNamespace(_data.annotationType.id), |
115 "id-ref" : _source.unNamespace(_data.annotationType.id), |
115 "dc:created" : IriSP.Model.dateToIso(_data.created), |
116 "dc:created" : IriSP.Model.dateToIso(_data.created), |
116 "dc:creator" : _data.creator, |
117 "dc:creator" : _data.creator, |
117 project : _source.projectId |
118 project : _source.projectId |
118 }, |
119 }, |
119 tags : IriSP._(_data.tag.id).map(function(_d) { |
120 tags : IriSP._(_data.tag.id).map(function(_id) { |
120 return { |
121 return { |
121 "id-ref" : _source.unNamespace(_id) |
122 "id-ref" : _source.unNamespace(_id) |
122 } |
123 } |
123 }) |
124 }) |
124 } |
125 } |
125 } |
126 } |
126 }, |
127 }, |
127 mashup : { |
128 mashup : { |
128 serialized_name : "mashups", |
129 serialized_name : "mashups", |
129 model_name : "mashup", |
|
130 deserializer : function(_data, _source) { |
130 deserializer : function(_data, _source) { |
131 var _res = new IriSP.Model.Mashup(_data.id, _source); |
131 var _res = new IriSP.Model.Mashup(_data.id, _source); |
132 _res.title = _data.meta["dc:title"]; |
132 _res.title = _data.meta["dc:title"]; |
133 _res.description = _data.meta["dc:description"]; |
133 _res.description = _data.meta["dc:description"]; |
134 for (var _i = 0; _i < _data.segments.length; _i++) { |
134 for (var _i = 0; _i < _data.segments.length; _i++) { |
155 _res[_this.types[_typename].serialized_name] = _list.map(function(_el) { |
155 _res[_this.types[_typename].serialized_name] = _list.map(function(_el) { |
156 return _this.types[_typename].serializer(_el, _source); |
156 return _this.types[_typename].serializer(_el, _source); |
157 }); |
157 }); |
158 } |
158 } |
159 }); |
159 }); |
160 return _res; |
160 return JSON.stringify(_res); |
161 }, |
161 }, |
162 loadData : function(_url, _callback) { |
162 loadData : function(_url, _callback) { |
163 IriSP.jQuery.getJSON(_url, _callback) |
163 IriSP.jQuery.getJSON(_url, _callback) |
164 }, |
164 }, |
165 deSerialize : function(_data, _source) { |
165 deSerialize : function(_data, _source) { |