src/js/serializers/ldt_annotate.js
changeset 1068 7623f9af9272
parent 1045 b06345320ffb
child 1072 ac1eacb3aa33
--- a/src/js/serializers/ldt_annotate.js	Fri Sep 25 14:45:38 2015 +0200
+++ b/src/js/serializers/ldt_annotate.js	Fri Oct 02 11:27:17 2015 +0200
@@ -8,9 +8,11 @@
     serializeAnnotation : function(_data, _source) {
         var _annType = _data.getAnnotationType();
         return {
+            id: _data.id,
             begin: _data.begin.milliseconds,
             end: _data.end.milliseconds,
             content: {
+                data: (_data.content ? _data.content.data || {} : {}),
                 description: _data.description,
                 title: _data.title,
                 audio: _data.audio
@@ -23,7 +25,9 @@
             type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id ),
             meta: {
                 created: _data.created,
-                creator: _data.creator
+                creator: _data.creator,
+                modified: _data.modified,
+                contributor: _data.contributor
             }
         };
     },
@@ -54,11 +58,13 @@
             return _tag.id;
         });
         _ann.setTags(_tagIds);
-        _ann.setBegin(_anndata.begin);
-        _ann.setEnd(_anndata.end);
+        _ann.setBeginEnd(_anndata.begin, _anndata.end);
         if (typeof _anndata.content.audio !== "undefined" && _anndata.content.audio.href) {
             _ann.audio = _anndata.content.audio;
-        }
+        };
+        if (_anndata.content.data) {
+            _ann.content = { data: _anndata.content.data };
+        };
         _source.getAnnotations().push(_ann);
     },
     serialize : function(_source) {
@@ -68,7 +74,7 @@
         if (typeof _data == "string") {
             _data = JSON.parse(_data);
         }
-        
+
         _source.addList('tag', new IriSP.Model.List(_source.directory));
         _source.addList('annotationType', new IriSP.Model.List(_source.directory));
         _source.addList('annotation', new IriSP.Model.List(_source.directory));
@@ -76,4 +82,4 @@
     }
 };
 
-/* End ldt_annotate serializer */
\ No newline at end of file
+/* End ldt_annotate serializer */