Merge with bd5f9dea97910caae6c2fb1ef8fc2e119e47d248
authorcavaliet
Tue, 06 Nov 2012 13:56:54 +0100
changeset 895 e76df6d34e6f
parent 894 c430d169ecc3 (current diff)
parent 893 bd5f9dea9791 (diff)
child 896 72f7ec8a8789
Merge with bd5f9dea97910caae6c2fb1ef8fc2e119e47d248
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Tue Nov 06 13:55:56 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Tue Nov 06 13:56:54 2012 +0100
@@ -87,7 +87,6 @@
         },{% if annotation_block %}{
             type: "CreateAnnotation",
             api_endpoint_template: "{{WEB_URL}}{% url api_dispatch_list resource_name='annotations' api_name='1.0' %}",
-            api_method: "PUT",
             after_send_timeout: 8000,
             show_mic_record: {% if show_mic_record %}true{% else %}false{% endif %},
             close_after_send: false,
--- a/src/ldt/ldt/ldt_utils/views/workspace.py	Tue Nov 06 13:55:56 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py	Tue Nov 06 13:56:54 2012 +0100
@@ -23,6 +23,7 @@
 import django.core.urlresolvers
 import ldt.auth as ldt_auth
 from django.utils.safestring import mark_safe
+import logging
 
 
 
@@ -106,6 +107,7 @@
     embed_rendered = dict((typestr,
                            (lambda s:escape(render_to_string("ldt/ldt_utils/partial/embed_%s.html" % (s), rend_dict, context_instance=RequestContext(request))))(typestr))
                            for typestr in ('player', 'seo_body', 'seo_meta', 'links'))
+
     rend_dict['embed_rendered'] = embed_rendered
     return render_to_response("ldt/ldt_utils/embed_popup.html", rend_dict, context_instance=RequestContext(request))
 
@@ -161,8 +163,8 @@
     if stream_mode != "video":
         stream_mode = 'radio'
 
-    player_width = 650
-    player_height = 480
+    player_width = 550
+    player_height = 380
     
     if stream_mode == 'radio':
         player_height = 1
--- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js	Tue Nov 06 13:55:56 2012 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js	Tue Nov 06 13:56:54 2012 +0100
@@ -43,7 +43,7 @@
     annotation_type: "Contributions",
     api_serializer: "ldt_annotate",
     api_endpoint_template: "",
-    api_method: "PUT",
+    api_method: "POST",
     after_send_timeout: 0,
     close_after_send: false,
 }
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Tue Nov 06 13:55:56 2012 +0100
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Tue Nov 06 13:56:54 2012 +0100
@@ -1734,14 +1734,42 @@
             }
         }
     },
+    deserializeAnnotation : function(_anndata, _source) {
+        var _ann = new IriSP.Model.Annotation(_anndata.id, _source);
+        _ann.description = _anndata.content.description || "";
+        _ann.title = _anndata.content.title || "";
+        _ann.creator = _anndata.meta.creator || "";
+        _ann.created = new Date(_anndata.meta.created);
+        _ann.setMedia(_anndata.media, _source);
+        var _anntype = _source.getElement(_anndata.type);
+        if (!_anntype) {
+            _anntype = new IriSP.Model.AnnotationType(_anndata.type, _source);
+            _anntype.title = _anndata.type_title;
+            _source.getAnnotationTypes().push(_anntype);
+        }
+        _ann.setAnnotationType(_anntype.id);
+        var _tagIds = IriSP._(_anndata.tags).map(function(_title) {
+            var _tags = _source.getTags(true).searchByTitle(_title, true);
+            if (_tags.length) {
+                var _tag = _tags[0];
+            }
+            else {
+                _tag = new IriSP.Model.Tag(_title.replace(/\W/g,'_'),_source);
+                _tag.title = _title;
+                _source.getTags().push(_tag);
+            }
+            return _tag.id;
+        });
+        _ann.setTags(_tagIds);
+        _ann.setBegin(_anndata.begin);
+        _ann.setEnd(_anndata.end);
+        if (typeof _anndata.content.audio !== "undefined" && _anndata.content.audio.href) {
+            _ann.audio = _anndata.content.audio;
+        }
+        _source.getAnnotations().push(_ann);
+    },
     serialize : function(_source) {
-        var _this = this
-            _res = {
-                "objects": _source.getAnnotations().map(function(_annotation) {
-                    return _this.serializeAnnotation(_annotation, _source);
-                })
-            };
-        return JSON.stringify(_res);
+        return JSON.stringify(this.serializeAnnotation(_source.getAnnotations()[0], _source));
     },
     deSerialize : function(_data, _source) {
         if (typeof _data == "string") {
@@ -1751,39 +1779,6 @@
         _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));
-        IriSP._(_data.objects).each(function(_anndata) {
-            var _ann = new IriSP.Model.Annotation(_anndata.id, _source);
-            _ann.description = _anndata.content.description || "";
-            _ann.title = _anndata.content.title || "";
-            _ann.creator = _anndata.meta.creator || "";
-            _ann.created = new Date(_anndata.meta.created);
-            _ann.setMedia(_anndata.media, _source);
-            var _anntype = _source.getElement(_anndata.type);
-            if (!_anntype) {
-                _anntype = new IriSP.Model.AnnotationType(_anndata.type, _source);
-                _anntype.title = _anndata.type_title;
-                _source.getAnnotationTypes().push(_anntype);
-            }
-            _ann.setAnnotationType(_anntype.id);
-            var _tagIds = IriSP._(_anndata.tags).map(function(_title) {
-                var _tags = _source.getTags(true).searchByTitle(_title, true);
-                if (_tags.length) {
-                    var _tag = _tags[0];
-                }
-                else {
-                    _tag = new IriSP.Model.Tag(_title.replace(/\W/g,'_'),_source);
-                    _tag.title = _title;
-                    _source.getTags().push(_tag);
-                }
-                return _tag.id;
-            });
-            _ann.setTags(_tagIds);
-            _ann.setBegin(_anndata.begin);
-            _ann.setEnd(_anndata.end);
-            if (typeof _anndata.content.audio !== "undefined" && _anndata.content.audio.href) {
-                _ann.audio = _anndata.content.audio;
-            }
-            _source.getAnnotations().push(_ann);
-        });
+        this.deserializeAnnotation(_data, _source);
     }
 }
\ No newline at end of file