# HG changeset patch # User veltr # Date 1352138590 -3600 # Node ID 934a7b13a2cabd30ab097dd885746d82aad3f03c # Parent 638fe8541a2ee0a22d5e7fd40f57bafc7aa8167a# Parent 4b9ec475026a3a67082c4d66f8bbd4248599964d Merge with 4b9ec475026a3a67082c4d66f8bbd4248599964d diff -r 638fe8541a2e -r 934a7b13a2ca src/js/model.js --- a/src/js/model.js Fri Oct 26 15:49:29 2012 +0200 +++ b/src/js/model.js Mon Nov 05 19:03:10 2012 +0100 @@ -356,7 +356,7 @@ var _hms = this.getHMS(), _res = ''; if (_hms.hours) { - _res += pad(_hms.hours) + ':' + _res += _hms.hours + ':' } _res += pad(_hms.minutes) + ':' + pad(_hms.seconds); return _res; @@ -619,11 +619,17 @@ Model.Annotation.prototype = new Model.Element(); Model.Annotation.prototype.setBegin = function(_beginMs) { - this.begin.setMilliseconds(_beginMs); + this.begin.setMilliseconds(Math.max(0,_beginMs)); + this.trigger("change-begin"); } -Model.Annotation.prototype.setEnd = function(_beginMs) { - this.end.setMilliseconds(_beginMs); +Model.Annotation.prototype.setEnd = function(_endMs) { + this.end.setMilliseconds(Math.min(_endMs)); + this.trigger("change-end"); +} + +Model.Annotation.prototype.setDuration = function(_durMs) { + this.setEnd(_durMs + this.begin.milliseconds); } Model.Annotation.prototype.setMedia = function(_idRef) { diff -r 638fe8541a2e -r 934a7b13a2ca src/js/serializers/ldt_annotate.js --- a/src/js/serializers/ldt_annotate.js Fri Oct 26 15:49:29 2012 +0200 +++ b/src/js/serializers/ldt_annotate.js Mon Nov 05 19:03:10 2012 +0100 @@ -5,67 +5,59 @@ } IriSP.serializers.ldt_annotate = { - types : { - annotation : { - serialized_name : "annotations", - serializer : function(_data, _source) { - var _annType = _data.getAnnotationType(); - return { - begin: _data.begin.milliseconds, - end: _data.end.milliseconds, - content: { - data: _data.description, - audio: _data.audio - }, - tags: _data.getTagTexts(), - media: _data.getMedia().id, - type_title: _annType.title, - type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id ) - } + serializeAnnotation : function(_data, _source) { + var _annType = _data.getAnnotationType(); + return { + begin: _data.begin.milliseconds, + end: _data.end.milliseconds, + content: { + description: _data.description, + title: _data.title, + audio: _data.audio + }, + tags: _data.getTagTexts(), + media: _data.getMedia().id, + type_title: _annType.title, + type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id ), + meta: { + created: _data.created, + creator: _data.creator } } }, serialize : function(_source) { - var _res = {}, - _this = this; - _source.forEach(function(_list, _typename) { - if (typeof _this.types[_typename] !== "undefined") { - _res[_this.types[_typename].serialized_name] = _list.map(function(_el) { - return _this.types[_typename].serializer(_el, _source); - }); - } - }); - _res.meta = { - creator: _source.creator, - created: _source.created - } + var _this = this + _res = { + "objects": _source.getAnnotations().map(function(_annotation) { + return _this.serializeAnnotation(_annotation, _source); + }) + }; return JSON.stringify(_res); }, deSerialize : function(_data, _source) { 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)); - if (typeof _data.annotations == "object" && _data.annotations && _data.annotations.length) { - var _anndata = _data.annotations[0], - _ann = new IriSP.Model.Annotation(_anndata.id, _source); - _ann.description = _anndata.content.data || ""; - _ann.title = _data.creator || ""; - _ann.created = new Date(_data.meta.created); + 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 _anntypes = _source.getAnnotationTypes(true).searchByTitle(_anndata.type_title); - if (_anntypes.length) { - var _anntype = _anntypes[0]; - } else { - var _anntype = new IriSP.Model.AnnotationType(_anndata.type, _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); + var _tags = _source.getTags(true).searchByTitle(_title, true); if (_tags.length) { var _tag = _tags[0]; } @@ -79,11 +71,10 @@ _ann.setTags(_tagIds); _ann.setBegin(_anndata.begin); _ann.setEnd(_anndata.end); - _ann.creator = _data.meta.creator; if (typeof _anndata.content.audio !== "undefined" && _anndata.content.audio.href) { _ann.audio = _anndata.content.audio; } _source.getAnnotations().push(_ann); - } + }); } } \ No newline at end of file diff -r 638fe8541a2e -r 934a7b13a2ca src/widgets/AutoPlayer.js --- a/src/widgets/AutoPlayer.js Fri Oct 26 15:49:29 2012 +0200 +++ b/src/widgets/AutoPlayer.js Mon Nov 05 19:03:10 2012 +0100 @@ -18,6 +18,14 @@ _opts = {}, _types = [ { + regexp: /^rtmp:\/\//, + type: "JwpPlayer" + }, + { + regexp: /\.(mp4|m4v)$/, + type: "AdaptivePlayer" + }, + { regexp: /\.(ogg|ogv|webm)$/, type: "PopcornPlayer" }, @@ -33,7 +41,8 @@ regexp: /^(https?:\/\/)?(www\.)?dailymotion\.com/, type: "DailymotionPlayer" } - ]; + ], + _rtmprgx = /^rtmp:\/\//; for (var i = 0; i < _types.length; i++) { if (_types[i].regexp.test(this.video)) { @@ -45,12 +54,16 @@ _opts.type = this.default_type } + if (_rtmprgx.test(this.video)) { + _opts.provider = "rtmp"; + _opts.live = true; + } + for (var i = 0; i < _props.length; i++) { if (typeof this[_props[i]] !== "undefined") { _opts[_props[i]] = this[_props[i]]; } } - this.insertSubwidget(this.$, _opts); diff -r 638fe8541a2e -r 934a7b13a2ca src/widgets/CreateAnnotation.css --- a/src/widgets/CreateAnnotation.css Fri Oct 26 15:49:29 2012 +0200 +++ b/src/widgets/CreateAnnotation.css Mon Nov 05 19:03:10 2012 +0100 @@ -34,6 +34,11 @@ border-radius: 2px; } +.Ldt-CreateAnnotation-Title.empty, .Ldt-CreateAnnotation-Creator.empty { + font-style: italic; + color: #90b0d0; +} + .Ldt-CreateAnnotation-Times { color: #ff3b77 } @@ -67,6 +72,10 @@ border-radius: 2px; } +.Ldt-CreateAnnotation-Description.empty { + font-style: italic; color: #999999; +} + .Ldt-CreateAnnotation-Avatar { float: right; width: 48px; diff -r 638fe8541a2e -r 934a7b13a2ca src/widgets/CreateAnnotation.js --- a/src/widgets/CreateAnnotation.js Fri Oct 26 15:49:29 2012 +0200 +++ b/src/widgets/CreateAnnotation.js Mon Nov 05 19:03:10 2012 +0100 @@ -7,7 +7,7 @@ IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget(); IriSP.Widgets.CreateAnnotation.prototype.defaults = { - show_title_field : false, /* For the moment, titles can't be sent to ldtplatform */ + show_title_field : true, show_creator_field : true, start_visible : true, always_visible : false, @@ -106,12 +106,12 @@ + '{{^show_slice}}{{#show_arrow}}
{{/show_arrow}}{{/show_slice}}' + '