# HG changeset patch # User veltr # Date 1337358231 -7200 # Node ID 510ebab76fa3ad4598f57466d1a74f34adff3bff # Parent d9da52e20f7f3f31c7170d4e13fd85b7d929210f Work on CreateAnnotation Widget diff -r d9da52e20f7f -r 510ebab76fa3 .hgignore --- a/.hgignore Tue May 15 15:50:19 2012 +0200 +++ b/.hgignore Fri May 18 18:23:51 2012 +0200 @@ -16,4 +16,6 @@ syntax: regexp ^test/libs$ syntax: regexp -^test/metadataplayer$ \ No newline at end of file +^test/metadataplayer$ +syntax: regexp +\.mp4$ \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 assets/psd/polemic.psd Binary file assets/psd/polemic.psd has changed diff -r d9da52e20f7f -r 510ebab76fa3 assets/psd/submit_annotation.psd Binary file assets/psd/submit_annotation.psd has changed diff -r d9da52e20f7f -r 510ebab76fa3 assets/psd/tag.psd Binary file assets/psd/tag.psd has changed diff -r d9da52e20f7f -r 510ebab76fa3 sbin/build/compil.sh --- a/sbin/build/compil.sh Tue May 15 15:50:19 2012 +0200 +++ b/sbin/build/compil.sh Fri May 18 18:23:51 2012 +0200 @@ -1,4 +1,4 @@ #!/bin/sh sh ../res/ant/bin/ant -f client.xml cp ../../build/LdtPlayer-core.js ../../test/metadataplayer/LdtPlayer-core.js -cp ../../src/widgets/* ../../test/metadataplayer \ No newline at end of file +cp -R ../../src/widgets/* ../../test/metadataplayer \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 src/css/LdtPlayer.css --- a/src/css/LdtPlayer.css Tue May 15 15:50:19 2012 +0200 +++ b/src/css/LdtPlayer.css Fri May 18 18:23:51 2012 +0200 @@ -707,8 +707,8 @@ .Ldt-createAnnotation-userAvatar { float: right; - width: 48px; - height: 48px; + width: 50px; + height: 50px; margin: 7px 0; border: 1px solid #babcbc; } @@ -716,8 +716,8 @@ .Ldt-createAnnotation-userAvatar img { float: right; display: block; - max-width: 100%; - max-height: 100%; + max-width: 48px; + max-height: 48px; } .Ldt-createAnnotation-profileArrow { diff -r d9da52e20f7f -r 510ebab76fa3 src/js/model.js --- a/src/js/model.js Tue May 15 15:50:19 2012 +0200 +++ b/src/js/model.js Fri May 18 18:23:51 2012 +0200 @@ -753,6 +753,11 @@ return this.getList("media", _global); } +IriSP.Model.Source.prototype.getTags = function(_global) { + _global = (typeof _global !== "undefined" && _global); + return this.getList("tag", _global); +} + IriSP.Model.Source.prototype.getMashups = function(_global) { _global = (typeof _global !== "undefined" && _global); return this.getList("mashup", _global); diff -r d9da52e20f7f -r 510ebab76fa3 src/js/pop.js --- a/src/js/pop.js Tue May 15 15:50:19 2012 +0200 +++ b/src/js/pop.js Fri May 18 18:23:51 2012 +0200 @@ -26,7 +26,7 @@ "muted": false }; - this.container = container.slice(1); //eschew the '#' + this.container = container.replace(/^#/,''); //eschew the '#' this.msgPump = {}; /* dictionnary used to receive and send messages */ this.__codes = []; /* used to schedule the execution of a piece of code in diff -r d9da52e20f7f -r 510ebab76fa3 src/js/serializers/CinecastSerializer.js --- a/src/js/serializers/CinecastSerializer.js Tue May 15 15:50:19 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,186 +0,0 @@ -/* Cinecast Cinelab Serializer */ - -if (typeof IriSP.serializers === "undefined") { - IriSP.serializers = {} -} - -IriSP.serializers.cinecast = { - types : { - media : { - serialized_name : "medias", - model_name : "media", - deserializer : function(_data, _source) { - var _res = new IriSP.Model.Media(_data.id, _source); - _res.video = _data.url; - _res.title = _data.meta.title; - _res.description = _data.meta.synopsis; - _res.setDuration(_data.meta.duration); - return _res; - }, - serializer : function(_data, _source) { - return { - id : _source.unNamespace(_data.id), - url : _data.video, - meta : { - title : _data.title, - synopsis : _data.description, - duration : _data.duration.milliseconds - } - } - } - }, - tag : { - serialized_name : "tags", - model_name : "tag", - deserializer : function(_data, _source) { - var _res = new IriSP.Model.Tag(_data.id, _source); - _res.title = _data.meta.description; - return _res; - }, - serializer : function(_data, _source) { - return { - id : _source.unNamespace(_data.id), - meta : { - description : _data.title - } - } - } - }, - annotationType : { - serialized_name : "annotation_types", - deserializer : function(_data, _source) { - var _res = new IriSP.Model.AnnotationType(_data.id, _source); - _res.title = _source.getNamespaced(_data.id).name; - _res.description = _data.meta.description; - return _res; - }, - serializer : function(_data, _source) { - return { - id : _source.unNamespace(_data.id), - meta : { - description : _data.description - } - } - } - }, - annotation : { - serialized_name : "annotations", - deserializer : function(_data, _source) { - var _res = new IriSP.Model.Annotation(_data.id, _source); - _res.title = _data.meta.creator_name; - _res.description = _data.content.data; - _res.created = IriSP.Model.isoToDate(_data.meta.created); - _res.setMedia(_data.media, _source); - _res.setAnnotationType(_data.type); - _res.setTags(IriSP._(_data.tags).map(function(_t) { - if (typeof _source.contents.tag === "undefined") { - _source.contents.tag = new IriSP.Model.List(_source.directory); - } - if (_source.contents.tag.hasId(_t)) { - return _t; - } else { - var _id = _t.toLowerCase() - .replace(/#/g,'') - .replace(/^(\d)/,'_$1') - .replace(/[áâäàã]/g,'a') - .replace(/ç/g,'c') - .replace(/[éèêë]/g,'e') - .replace(/[íìîï]/g,'i') - .replace(/ñ/g,'n') - .replace(/[óòôöõ]/g,'o') - .replace(/œ/g,'oe') - .replace(/[úùûü]/g,'u') - .replace(/ÿ/g,'y') - .replace(/[^A-Za-z0-9_]/g,''), - _tag = new IriSP.Model.Tag(_id, _source); - _tag.title = _t; - _source.contents.tag.push(_tag); - return _id; - } - })); - _res.setBegin(_data.begin); - _res.setEnd(_data.end); - _res.creator = _data.meta.creator; - return _res; - }, - serializer : function(_data, _source) { - return { - id : _source.unNamespace(_data.id), - content : { - data : _data.description - }, - begin : _data.begin.milliseconds, - end : _data.begin.milliseconds, - media : _source.unNamespace(_data.media.id), - type : _source.unNamespace(_data.annotationType.id), - meta : { - created : IriSP.Model.dateToIso(_data.created), - creator : _data.creator, - creator_name : _data.title - }, - tags : _data.tag.id.map(function(_id) { - return _source.unNamespace(_id) - }) - } - } - } - }, - serialize : function(_source) { - var _res = { - format : "http://advene.org/ns/cinelab/" - }, - _this = this, - _nsls = _source.listNamespaces(true); - _res.imports = []; - for (var _i = 0; _i < _nsls.length; _i++) { - if (typeof _source.directory.namespaces[_nsls[_i]] !== "undefined") { - _res.imports.push({ - id : _nsls[_i], - url : _source.directory.namespaces[_nsls[_i]] - }) - } - } - _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); - }); - } - }); - return _res; - }, - loadData : function(_url, _callback) { - IriSP.jQuery.getJSON(_url, _callback) - }, - deSerialize : function(_data, _source) { - if (typeof _data !== "object" || _data === null) { - return; - } - if (typeof _data.imports !== "undefined") { - IriSP._(_data.imports).forEach(function(_import) { - _source.directory.namespaces[_import.id] = _import.url; - }) - } - IriSP._(this.types).forEach(function(_type, _typename) { - var _listdata = _data[_type.serialized_name]; - if (typeof _listdata !== "undefined" && _listdata !== null) { - var _list = new IriSP.Model.List(_source.directory); - if (_listdata.hasOwnProperty("length")) { - var _l = _listdata.length; - for (var _i = 0; _i < _l; _i++) { - _list.push(_type.deserializer(_listdata[_i], _source)); - } - } else { - _list.push(_type.deserializer(_listdata, _source)); - } - _source.addList(_typename, _list); - } - }); - - if (typeof _data.meta !== "undefined" && typeof _data.meta.main_media !== "undefined" && typeof _data.meta.main_media["id-ref"] !== "undefined") { - _source.setCurrentMediaId(_data.meta.id); - } - _source.setDefaultCurrentMedia(); - } -} - diff -r d9da52e20f7f -r 510ebab76fa3 src/js/serializers/PlatformAnnotateSerializer.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/js/serializers/PlatformAnnotateSerializer.js Fri May 18 18:23:51 2012 +0200 @@ -0,0 +1,43 @@ +/* Used when Putting annotations on the platform */ + +if (typeof IriSP.serializers === "undefined") { + IriSP.serializers = {} +} + +IriSP.serializers.ldt_annotate = { + types : { + annotation : { + serialized_name : "annotations", + serializer : function(_data, _source) { + return { + begin: _data.begin.milliseconds, + end: _data.end.milliseconds, + content: { + data: _data.description + }, + tags: _data.getTagTexts(), + media: _source.unNamespace(_data.getMedia().id), + title: _data.title, + type_title: _data.getAnnotationType().title, + type: _source.unNamespace(_data.getAnnotationType().id) + } + } + } + }, + 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 + } + return JSON.stringify(_res); + } +} \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 src/js/serializers/PlatformSerializer.js --- a/src/js/serializers/PlatformSerializer.js Tue May 15 15:50:19 2012 +0200 +++ b/src/js/serializers/PlatformSerializer.js Fri May 18 18:23:51 2012 +0200 @@ -8,7 +8,6 @@ types : { media : { serialized_name : "medias", - model_name : "media", deserializer : function(_data, _source) { var _res = new IriSP.Model.Media(_data.id, _source); _res.video = ( @@ -105,6 +104,8 @@ serializer : function(_data, _source) { return { id : _source.unNamespace(_data.id), + begin : _data.begin.milliseconds, + end : _data.end.milliseconds, content : { title : _data.title, description : _data.description @@ -116,7 +117,7 @@ "dc:creator" : _data.creator, project : _source.projectId }, - tags : IriSP._(_data.tag.id).map(function(_d) { + tags : IriSP._(_data.tag.id).map(function(_id) { return { "id-ref" : _source.unNamespace(_id) } @@ -126,7 +127,6 @@ }, mashup : { serialized_name : "mashups", - model_name : "mashup", deserializer : function(_data, _source) { var _res = new IriSP.Model.Mashup(_data.id, _source); _res.title = _data.meta["dc:title"]; @@ -157,7 +157,7 @@ }); } }); - return _res; + return JSON.stringify(_res); }, loadData : function(_url, _callback) { IriSP.jQuery.getJSON(_url, _callback) diff -r d9da52e20f7f -r 510ebab76fa3 src/js/widgets/createAnnotationWidget.js --- a/src/js/widgets/createAnnotationWidget.js Tue May 15 15:50:19 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,506 +0,0 @@ -/* Internationalization for this widget */ - -IriSP.i18n.addMessages( - { - "en": { - "submit": "Submit", - "add_keywords": "Add keywords", - "add_polemic_keywords": "Add polemic keywords", - "your_name": "Your name", - "type_here": "Type your annotation here.", - "wait_while_processed": "Please wait while your request is being processed...", - "error_while_contacting": "An error happened while contacting the server. Your annotation has not been saved.", - "empty_annotation": "Your annotation is empty. Please write something before submitting.", - "annotation_saved": "Thank you, your annotation has been saved.", - "share_annotation": "Would you like to share it on social networks ?", - "share_on": "Share on", - "more_tags": "More tags" - }, - "fr": { - "submit": "Envoyer", - "add_keywords": "Ajouter des mots-clés", - "add_polemic_keywords": "Ajouter des mots-clés polémiques", - "your_name": "Votre nom", - "type_here": "Rédigez votre annotation ici.", - "wait_while_processed": "Veuillez patienter pendant le traitement de votre requête...", - "error_while_contacting": "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée", - "empty_annotation": "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.", - "annotation_saved": "Merci, votre annotation a été enregistrée.", - "share_annotation": "Souhaitez-vous la partager sur les réseaux sociaux ?", - "share_on": "Partager sur", - "more_tags": "Plus de mots-clés" - } - } -); - -IriSP.createAnnotationWidget = function(Popcorn, config, Serializer) { - IriSP.Widget.call(this, Popcorn, config, Serializer); - this._hidden = true; - - if (!IriSP.null_or_undefined(IriSP.user)) { - if (!IriSP.null_or_undefined(IriSP.user.avatar)) { - this.user_avatar = IriSP.user.avatar; - } - if (!IriSP.null_or_undefined(IriSP.user.name)) { - this.user_name = IriSP.user.name; - } - } - - /* variables to save the current position of the slicer */ - if (this.cinecast_version) { - this.sliceLeft = 0; - this.sliceWidth = 0; - } -}; - - -IriSP.createAnnotationWidget.prototype = new IriSP.Widget(); - -IriSP.createAnnotationWidget.prototype.clear = function() { - this.selector.find(".Ldt-SaTitle").text(""); - this.selector.find(".Ldt-SaDescription").text(""); - this.selector.find(".Ldt-SaKeywordText").text(""); -}; - -IriSP.createAnnotationWidget.prototype.draw = function() { - var _this = this; - if (typeof this.remote_tags == "object") { - IriSP.jQuery.getJSON((typeof this.remote_tags.alias == "string" ? this.remote_tags.alias : this.remote_tags.url), function(_json) { - _this.tags = _json.tags; - _this.drawCallback(); - }); - } else { - this.drawCallback(); - } -} - -IriSP.createAnnotationWidget.prototype.drawCallback = function() { - var _this = this; - - var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template, - this); - - this.selector.append(annotationMarkup); - - if (!this.cinecast_version) - this.selector.hide(); - else { - this.showStartScreen(); - } - - if (this.random_tags) { - this.selector.find(".Ldt-createAnnotation-keywords li").hide(); - this.showMoreTags(); - this.selector.find('.Ldt-createAnnotation-moar-keywordz').click(function() { - _this.showMoreTags(); - }) - } - // Add onclick event to both polemic and keywords buttons - - this.selector.find(".Ldt-createAnnotation-keyword-button, .Ldt-createAnnotation-polemic-button").click(function() { - _this.addKeyword(IriSP.jQuery(this).text()); - return false; - }); - - // js_mod is a custom event because there's no simple way to test for a js - // change in a textfield. - this.selector.find(".Ldt-createAnnotation-Description") - .bind("propertychange keyup input paste click js_mod", IriSP.wrap(this, this.handleTextChanges)); - - /* the cinecast version of the player is supposed to pause when the user clicks on the button */ - - /* the cinecast version expects the user to comment on a defined segment. - As the widget is always shown, we need a way to update it's content as - time passes. We do this like we did with the annotationsWidget : we schedule - a .code start function which will be called at the right time. - */ - if (this.cinecast_version) { - var legal_ids; - if (typeof(this._serializer.getChapitrage()) !== "undefined") - legal_id = this._serializer.getChapitrage(); - else - legal_id = this._serializer.getNonTweetIds()[0]; - - var annotations = this._serializer._data.annotations; - var i; - - for (i in annotations) { - var annotation = annotations[i]; - if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" - && legal_id !== annotation.meta["id-ref"]) { - continue; - } - - code = {start: annotation.begin / 1000, end: annotation.end / 1000, - onStart: function(annotation) { return function() { - if (typeof(annotation.content) !== "undefined") - _this.selector.find(".Ldt-createAnnotation-Title").html(annotation.content.title); - - _this._currentAnnotation = annotation; - var beginTime = IriSP.msToTime(annotation.begin); - var endTime = IriSP.msToTime(annotation.end); - var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime }); - _this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate); - } }(annotation) - }; - - this._Popcorn.code(code); - } - } - - this.selector.find(".Ldt-createAnnotation-submitButton").click(IriSP.wrap(this, this.handleButtonClick)); - - if (!this.cinecast_version) { - this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", - IriSP.wrap(this, this.handleAnnotateSignal)); - - // handle clicks on the cancel button too. - this.selector.find(".Ldt-createAnnotation-Minimize").click(IriSP.wrap(this, - function() { - // we've got to simulate the pressing of the button because there's no - // other way to minimize the widget and show the widgets that were hidden - // same time - this._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked"); - } - )); - } -}; - -IriSP.createAnnotationWidget.prototype.showMoreTags = function() { - for (var j=0; j < this.random_tags; j++) { - var _jq = this.selector.find(".Ldt-createAnnotation-keywords li:hidden"); - if (_jq.length > 1) { - IriSP.jQuery(_jq[Math.floor(_jq.length*Math.random())]).show(); - } else { - _jq.show(); - break; - } - } - if (this.selector.find(".Ldt-createAnnotation-keywords li:hidden").length == 0) { - this.selector.find('.Ldt-createAnnotation-moar-keywordz').hide(); - } -} - -/* Handles adding keywords and polemics */ -IriSP.createAnnotationWidget.prototype.addKeyword = function(_keyword) { - var _field = this.selector.find(".Ldt-createAnnotation-Description"), - _rx = IriSP.regexpFromText(_keyword), - _contents = _field.val(); - _contents = ( _rx.test(_contents) - ? _contents.replace(_rx,"").replace(" "," ").trim() - : _contents.trim() + " " + _keyword - ); - _field.val(_contents.trim()).trigger("js_mod"); -} - -/** handles clicks on the annotate button. Works only for the non-cinecast version */ -IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() { - - if (this._hidden == false && this._state == 'startScreen') { - this.selector.hide(); - this._hidden = true; - - // free the arrow. - this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow"); - this._Popcorn.trigger("IriSP.SliceWidget.hide"); - this._Popcorn.trigger("IriSP.AnnotationsWidget.show"); - - } else { - this._Popcorn.trigger("IriSP.AnnotationsWidget.hide"); - this.showStartScreen(); - this.selector.show(); - this._hidden = false; - var currentTime = this._Popcorn.currentTime(); - - // block the arrow. - this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow"); - - var duration = this.getDuration(); - - var currentChapter = this._serializer.currentChapitre(currentTime); - - if (IriSP.null_or_undefined(currentChapter)) { - var left = this.selector.width() / 2; - var width = this.selector.width() / 10; - } else { - var left = (currentChapter.begin / duration) * this.selector.width(); - var width = (currentChapter.end / duration) * this.selector.width() - left; - } - - // slider position and length is kept in percents. - this.sliceLeft = (left / this.selector.width()) * 100; - this.sliceWidth = (width / this.selector.width()) * 100; - - this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]); - this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges)); - this._Popcorn.trigger("IriSP.SliceWidget.show"); - - if (!IriSP.null_or_undefined(currentChapter)) { - this.selector.find(".Ldt-createAnnotation-Title").html(currentChapter.content.title); - - this._currentcurrentChapter = currentChapter; - var beginTime = IriSP.msToTime(currentChapter.begin); - var endTime = IriSP.msToTime(currentChapter.end); - var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime }); - this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate); - } - } -}; - - -/** watch for changes in the textfield and change the buttons accordingly */ -IriSP.createAnnotationWidget.prototype.handleTextChanges = function(event) { - var contents = this.selector.find(".Ldt-createAnnotation-Description").val(); - if (this.cinecast_version) { - this._Popcorn.pause(); - } - this.selector.find(".Ldt-createAnnotation-btnblock button").each(function() { - var _rx = IriSP.regexpFromText(IriSP.jQuery(this).text()); - if (_rx.test(contents)) { - IriSP.jQuery(this).parent().addClass("Ldt-createAnnotation-active-button"); - } else { - IriSP.jQuery(this).parent().removeClass("Ldt-createAnnotation-active-button"); - } - }); - -}; - -IriSP.createAnnotationWidget.prototype.showStartScreen = function() { - this.selector.find(".Ldt-createAnnotation-screen").hide(); - this.selector.find(".Ldt-createAnnotation-startScreen").show(); - - var jqTextfield = this.selector.find(".Ldt-createAnnotation-Description"); // handle on the textfield. used for the closure - - /* test if the browser supports the placeholder attribute */ - if (!IriSP.null_or_undefined(jqTextfield.get(0).placeholder)) { - jqTextfield.attr("placeholder", IriSP.i18n.getMessage('type_here')); - } else { - jqTextfield.val(IriSP.i18n.getMessage('type_here')); - jqTextfield.one("click", IriSP.wrap(this, function() { jqTextfield.val(""); })); - } - - - - this._state = "startScreen"; -}; - -IriSP.createAnnotationWidget.prototype.showWaitScreen = function() { - this.selector.find(".Ldt-createAnnotation-screen").hide(); - this.selector.find(".Ldt-createAnnotation-waitScreen").show(); - this._state = "waitScreen"; -}; - -IriSP.createAnnotationWidget.prototype.showErrorScreen = function() { - this.selector.find(".Ldt-createAnnotation-screen").hide(); - this.selector.find(".Ldt-createAnnotation-errorScreen").show(); - this._state = "errorScreen"; - var _this = this; - window.setTimeout(function() { _this.showStartScreen(); }, 2000); -}; - -/** update show the final screen with links to share the created annotation */ -IriSP.createAnnotationWidget.prototype.showEndScreen = function(annotation) { - this.selector.find(".Ldt-createAnnotation-screen").hide(); - - if (this.cinecast_version) { - this.selector.find(".Ldt-createAnnotation-Title").parent().show(); - } - - var url = ( (typeof annotation.meta == "object" && typeof annotation.meta.url == "string" && annotation.meta.url.length) - ? annotation.meta.url - : ( document.location.href + "#id=" + annotation.id ) ); - var twStatus = IriSP.mkTweetUrl(url); - var gpStatus = IriSP.mkGplusUrl(url); - var fbStatus = IriSP.mkFbUrl(url); - - this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus); - this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus); - this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href", gpStatus); - - this.selector.find(".Ldt-createAnnotation-endScreen").show(); - this._state = "endScreen"; -}; - -/** handle clicks on "send annotation" button */ -IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) { - var _this = this; - var textfield = this.selector.find(".Ldt-createAnnotation-Description"); - var contents = textfield.val(); - - if (contents === "") { - if (this.selector.find(".Ldt-createAnnotation-errorMessage").length === 0) { - this.selector.find(".Ldt-createAnnotation-Container") - .after(IriSP.templToHTML(IriSP.createAnnotation_errorMessage_template)); - textfield.css("background-color", "#d93c71"); - } else { - this.selector.find(".Ldt-createAnnotation-errorMessage").show(); - } - - textfield.one("js_mod propertychange keyup input paste", IriSP.wrap(this, function() { - var contents = textfield.val(); - - if (contents !== "") { - this.selector.find(".Ldt-createAnnotation-errorMessage").hide(); - textfield.css("background-color", ""); - } - })); - } else { - this.showWaitScreen(); - - this.sendLdtData(contents, function(annotation) { - if (_this.cinecast_version) { - if (_this._Popcorn.media.paused) - _this._Popcorn.play(); - } - - if (_this._state == "waitScreen") { - _this.showEndScreen(annotation); - if (_this.cinecast_version) { - window.setTimeout(function() { _this.showStartScreen(); }, 5000); - } - } - // hide the slicer widget - if (!_this.cinecast_version) { - _this._Popcorn.trigger("IriSP.SliceWidget.hide"); - } - }); - } -}; - -IriSP.createAnnotationWidget.prototype.handleSliderChanges = function(params) { - this.sliceLeft = params[0]; - this.sliceWidth = params[1]; -}; - -IriSP.createAnnotationWidget.prototype.sendLdtData = function(contents, callback) { - var _this = this; - var apiJson = { - format : "http://advene.org/ns/cinelab/", - annotations : [ - {} - ], - meta: {}}; - var annotation = apiJson.annotations[0]; - - annotation.media = this.currentMedia()["id"]; - - if (this.cinecast_version) { - annotation.begin = Math.round(this._Popcorn.currentTime() * 1000); - annotation.end = annotation.begin; - } else { - var duration = this.getDuration(); - annotation.begin = +((duration * (this.sliceLeft / 100)).toFixed(0)); - annotation.end = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0)); - } - - // boundary checks - annotation.begin = Math.max(0, annotation.begin); - annotation.end = Math.min(this.getDuration(), annotation.end); - - annotation.type = ( this.cinecast_version ? "cinecast:UserAnnotation" : ( this._serializer.getContributions() || "" )); - if (typeof(annotation.type) === "undefined") - annotation.type = ""; - - annotation.type_title = "Contributions"; - annotation.content = {}; - annotation.content.data = contents; - if (this.cinecast_version) { - var _extract = IriSP.underscore(this._serializer._data.annotations) - .filter(function(_a) { - return (_a.begin <= annotation.begin && _a.end >= annotation.begin && _a.type == "cinecast:MovieExtract"); - }) - if (_extract.length) { - annotation.extract = _extract[0].id; - } - } - - var meta = apiJson.meta; - - - var _username = this.selector.find(".Ldt-createAnnotation-userName").val(); - meta.creator = ( - (_username && _username.length) - ? _username - : ( - (!IriSP.null_or_undefined(IriSP.user) && !IriSP.null_or_undefined(IriSP.user.name)) - ? IriSP.user.name - : "Anonymous user" - ) - ); - - meta.created = Date().toString(); - - var _tags = []; - IriSP._(this.tags).each(function(_v) { - var _rx = IriSP.regexpFromText(_v.meta.description); - if (_rx.test(contents)) { - _tags.push(_v.id); - } - }); - - if (typeof this.remote_tags == "object") { - _tags = IriSP._(_tags).map(function(_t) { - return _this.remote_tags.id + ':' + _t - }); - if (typeof apiJson.imports == "undefined") { - apiJson.imports = []; - } - apiJson.imports.push({ - "id" : this.remote_tags.id, - "url" : this.remote_tags.url - }) - } - annotation.tags = IriSP.underscore.uniq(_tags); - - var jsonString = JSON.stringify(apiJson); - var project_id = this._serializer._data.meta.id; - - //TODO: extract magic url - var url = Mustache.to_html(this.api_endpoint_template, - {id: project_id}); - - IriSP.jQuery.ajax({ - url: url, - type: this.api_method, - contentType: 'application/json', - data: jsonString, - //dataType: 'json', - success: IriSP.wrap(this, function(json, textStatus, XMLHttpRequest) { - /* add the annotation to the annotation and tell the world */ - var annotation = json.annotations[0]; - - if (!this.cinecast_version) { - /* if the media doesn't have a contributions line, we need to add one */ - if (typeof(this._serializer.getContributions()) === "undefined") { - /* set up a basic view */ - var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions", - "id": json.annotations[0].type} - - - IriSP.get_aliased(this._serializer._data, ["annotation_types", "annotation-types"]).push(tmp_view); - } - - delete annotation.tags; - annotation.content.description = annotation.content.data; - annotation.content.title = ""; - delete annotation.content.data; - annotation.id = json.annotations[0].id; - - annotation.meta = meta; - annotation.meta["id-ref"] = json.annotations[0]["type"]; - } else { - annotation.type = "cinecast:UserAnnotation"; - } - annotation.is_new = true; - // everything is shared so there's no need to propagate the change - _this._serializer._data.annotations.push(annotation); - _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation); - this.selector.find(".Ldt-createAnnotation-Description").val("").trigger("js_mod"); - callback(annotation); - }), - error: - function(jqXHR, textStatus, errorThrown) { - console.log("an error occured while contacting " - + url + " and sending " + jsonString + textStatus ); - _this.showErrorScreen(); } }); -}; \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 src/obsolete-files/CinecastSerializer.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/obsolete-files/CinecastSerializer.js Fri May 18 18:23:51 2012 +0200 @@ -0,0 +1,186 @@ +/* Cinecast Cinelab Serializer */ + +if (typeof IriSP.serializers === "undefined") { + IriSP.serializers = {} +} + +IriSP.serializers.cinecast = { + types : { + media : { + serialized_name : "medias", + model_name : "media", + deserializer : function(_data, _source) { + var _res = new IriSP.Model.Media(_data.id, _source); + _res.video = _data.url; + _res.title = _data.meta.title; + _res.description = _data.meta.synopsis; + _res.setDuration(_data.meta.duration); + return _res; + }, + serializer : function(_data, _source) { + return { + id : _source.unNamespace(_data.id), + url : _data.video, + meta : { + title : _data.title, + synopsis : _data.description, + duration : _data.duration.milliseconds + } + } + } + }, + tag : { + serialized_name : "tags", + model_name : "tag", + deserializer : function(_data, _source) { + var _res = new IriSP.Model.Tag(_data.id, _source); + _res.title = _data.meta.description; + return _res; + }, + serializer : function(_data, _source) { + return { + id : _source.unNamespace(_data.id), + meta : { + description : _data.title + } + } + } + }, + annotationType : { + serialized_name : "annotation_types", + deserializer : function(_data, _source) { + var _res = new IriSP.Model.AnnotationType(_data.id, _source); + _res.title = _source.getNamespaced(_data.id).name; + _res.description = _data.meta.description; + return _res; + }, + serializer : function(_data, _source) { + return { + id : _source.unNamespace(_data.id), + meta : { + description : _data.description + } + } + } + }, + annotation : { + serialized_name : "annotations", + deserializer : function(_data, _source) { + var _res = new IriSP.Model.Annotation(_data.id, _source); + _res.title = _data.meta.creator_name; + _res.description = _data.content.data; + _res.created = IriSP.Model.isoToDate(_data.meta.created); + _res.setMedia(_data.media, _source); + _res.setAnnotationType(_data.type); + _res.setTags(IriSP._(_data.tags).map(function(_t) { + if (typeof _source.contents.tag === "undefined") { + _source.contents.tag = new IriSP.Model.List(_source.directory); + } + if (_source.contents.tag.hasId(_t)) { + return _t; + } else { + var _id = _t.toLowerCase() + .replace(/#/g,'') + .replace(/^(\d)/,'_$1') + .replace(/[áâäàã]/g,'a') + .replace(/ç/g,'c') + .replace(/[éèêë]/g,'e') + .replace(/[íìîï]/g,'i') + .replace(/ñ/g,'n') + .replace(/[óòôöõ]/g,'o') + .replace(/œ/g,'oe') + .replace(/[úùûü]/g,'u') + .replace(/ÿ/g,'y') + .replace(/[^A-Za-z0-9_]/g,''), + _tag = new IriSP.Model.Tag(_id, _source); + _tag.title = _t; + _source.contents.tag.push(_tag); + return _id; + } + })); + _res.setBegin(_data.begin); + _res.setEnd(_data.end); + _res.creator = _data.meta.creator; + return _res; + }, + serializer : function(_data, _source) { + return { + id : _source.unNamespace(_data.id), + content : { + data : _data.description + }, + begin : _data.begin.milliseconds, + end : _data.begin.milliseconds, + media : _source.unNamespace(_data.media.id), + type : _source.unNamespace(_data.annotationType.id), + meta : { + created : IriSP.Model.dateToIso(_data.created), + creator : _data.creator, + creator_name : _data.title + }, + tags : _data.tag.id.map(function(_id) { + return _source.unNamespace(_id) + }) + } + } + } + }, + serialize : function(_source) { + var _res = { + format : "http://advene.org/ns/cinelab/" + }, + _this = this, + _nsls = _source.listNamespaces(true); + _res.imports = []; + for (var _i = 0; _i < _nsls.length; _i++) { + if (typeof _source.directory.namespaces[_nsls[_i]] !== "undefined") { + _res.imports.push({ + id : _nsls[_i], + url : _source.directory.namespaces[_nsls[_i]] + }) + } + } + _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); + }); + } + }); + return _res; + }, + loadData : function(_url, _callback) { + IriSP.jQuery.getJSON(_url, _callback) + }, + deSerialize : function(_data, _source) { + if (typeof _data !== "object" || _data === null) { + return; + } + if (typeof _data.imports !== "undefined") { + IriSP._(_data.imports).forEach(function(_import) { + _source.directory.namespaces[_import.id] = _import.url; + }) + } + IriSP._(this.types).forEach(function(_type, _typename) { + var _listdata = _data[_type.serialized_name]; + if (typeof _listdata !== "undefined" && _listdata !== null) { + var _list = new IriSP.Model.List(_source.directory); + if (_listdata.hasOwnProperty("length")) { + var _l = _listdata.length; + for (var _i = 0; _i < _l; _i++) { + _list.push(_type.deserializer(_listdata[_i], _source)); + } + } else { + _list.push(_type.deserializer(_listdata, _source)); + } + _source.addList(_typename, _list); + } + }); + + if (typeof _data.meta !== "undefined" && typeof _data.meta.main_media !== "undefined" && typeof _data.meta.main_media["id-ref"] !== "undefined") { + _source.setCurrentMediaId(_data.meta.id); + } + _source.setDefaultCurrentMedia(); + } +} + diff -r d9da52e20f7f -r 510ebab76fa3 src/obsolete-files/createAnnotationWidget.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/obsolete-files/createAnnotationWidget.js Fri May 18 18:23:51 2012 +0200 @@ -0,0 +1,506 @@ +/* Internationalization for this widget */ + +IriSP.i18n.addMessages( + { + "en": { + "submit": "Submit", + "add_keywords": "Add keywords", + "add_polemic_keywords": "Add polemic keywords", + "your_name": "Your name", + "type_here": "Type your annotation here.", + "wait_while_processed": "Please wait while your request is being processed...", + "error_while_contacting": "An error happened while contacting the server. Your annotation has not been saved.", + "empty_annotation": "Your annotation is empty. Please write something before submitting.", + "annotation_saved": "Thank you, your annotation has been saved.", + "share_annotation": "Would you like to share it on social networks ?", + "share_on": "Share on", + "more_tags": "More tags" + }, + "fr": { + "submit": "Envoyer", + "add_keywords": "Ajouter des mots-clés", + "add_polemic_keywords": "Ajouter des mots-clés polémiques", + "your_name": "Votre nom", + "type_here": "Rédigez votre annotation ici.", + "wait_while_processed": "Veuillez patienter pendant le traitement de votre requête...", + "error_while_contacting": "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée", + "empty_annotation": "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.", + "annotation_saved": "Merci, votre annotation a été enregistrée.", + "share_annotation": "Souhaitez-vous la partager sur les réseaux sociaux ?", + "share_on": "Partager sur", + "more_tags": "Plus de mots-clés" + } + } +); + +IriSP.createAnnotationWidget = function(Popcorn, config, Serializer) { + IriSP.Widget.call(this, Popcorn, config, Serializer); + this._hidden = true; + + if (!IriSP.null_or_undefined(IriSP.user)) { + if (!IriSP.null_or_undefined(IriSP.user.avatar)) { + this.user_avatar = IriSP.user.avatar; + } + if (!IriSP.null_or_undefined(IriSP.user.name)) { + this.user_name = IriSP.user.name; + } + } + + /* variables to save the current position of the slicer */ + if (this.cinecast_version) { + this.sliceLeft = 0; + this.sliceWidth = 0; + } +}; + + +IriSP.createAnnotationWidget.prototype = new IriSP.Widget(); + +IriSP.createAnnotationWidget.prototype.clear = function() { + this.selector.find(".Ldt-SaTitle").text(""); + this.selector.find(".Ldt-SaDescription").text(""); + this.selector.find(".Ldt-SaKeywordText").text(""); +}; + +IriSP.createAnnotationWidget.prototype.draw = function() { + var _this = this; + if (typeof this.remote_tags == "object") { + IriSP.jQuery.getJSON((typeof this.remote_tags.alias == "string" ? this.remote_tags.alias : this.remote_tags.url), function(_json) { + _this.tags = _json.tags; + _this.drawCallback(); + }); + } else { + this.drawCallback(); + } +} + +IriSP.createAnnotationWidget.prototype.drawCallback = function() { + var _this = this; + + var annotationMarkup = IriSP.templToHTML(IriSP.createAnnotationWidget_template, + this); + + this.selector.append(annotationMarkup); + + if (!this.cinecast_version) + this.selector.hide(); + else { + this.showStartScreen(); + } + + if (this.random_tags) { + this.selector.find(".Ldt-createAnnotation-keywords li").hide(); + this.showMoreTags(); + this.selector.find('.Ldt-createAnnotation-moar-keywordz').click(function() { + _this.showMoreTags(); + }) + } + // Add onclick event to both polemic and keywords buttons + + this.selector.find(".Ldt-createAnnotation-keyword-button, .Ldt-createAnnotation-polemic-button").click(function() { + _this.addKeyword(IriSP.jQuery(this).text()); + return false; + }); + + // js_mod is a custom event because there's no simple way to test for a js + // change in a textfield. + this.selector.find(".Ldt-createAnnotation-Description") + .bind("propertychange keyup input paste click js_mod", IriSP.wrap(this, this.handleTextChanges)); + + /* the cinecast version of the player is supposed to pause when the user clicks on the button */ + + /* the cinecast version expects the user to comment on a defined segment. + As the widget is always shown, we need a way to update it's content as + time passes. We do this like we did with the annotationsWidget : we schedule + a .code start function which will be called at the right time. + */ + if (this.cinecast_version) { + var legal_ids; + if (typeof(this._serializer.getChapitrage()) !== "undefined") + legal_id = this._serializer.getChapitrage(); + else + legal_id = this._serializer.getNonTweetIds()[0]; + + var annotations = this._serializer._data.annotations; + var i; + + for (i in annotations) { + var annotation = annotations[i]; + if (typeof(annotation.meta) !== "undefined" && typeof(annotation.meta["id-ref"]) !== "undefined" + && legal_id !== annotation.meta["id-ref"]) { + continue; + } + + code = {start: annotation.begin / 1000, end: annotation.end / 1000, + onStart: function(annotation) { return function() { + if (typeof(annotation.content) !== "undefined") + _this.selector.find(".Ldt-createAnnotation-Title").html(annotation.content.title); + + _this._currentAnnotation = annotation; + var beginTime = IriSP.msToTime(annotation.begin); + var endTime = IriSP.msToTime(annotation.end); + var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime }); + _this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate); + } }(annotation) + }; + + this._Popcorn.code(code); + } + } + + this.selector.find(".Ldt-createAnnotation-submitButton").click(IriSP.wrap(this, this.handleButtonClick)); + + if (!this.cinecast_version) { + this._Popcorn.listen("IriSP.PlayerWidget.AnnotateButton.clicked", + IriSP.wrap(this, this.handleAnnotateSignal)); + + // handle clicks on the cancel button too. + this.selector.find(".Ldt-createAnnotation-Minimize").click(IriSP.wrap(this, + function() { + // we've got to simulate the pressing of the button because there's no + // other way to minimize the widget and show the widgets that were hidden + // same time + this._Popcorn.trigger("IriSP.PlayerWidget.AnnotateButton.clicked"); + } + )); + } +}; + +IriSP.createAnnotationWidget.prototype.showMoreTags = function() { + for (var j=0; j < this.random_tags; j++) { + var _jq = this.selector.find(".Ldt-createAnnotation-keywords li:hidden"); + if (_jq.length > 1) { + IriSP.jQuery(_jq[Math.floor(_jq.length*Math.random())]).show(); + } else { + _jq.show(); + break; + } + } + if (this.selector.find(".Ldt-createAnnotation-keywords li:hidden").length == 0) { + this.selector.find('.Ldt-createAnnotation-moar-keywordz').hide(); + } +} + +/* Handles adding keywords and polemics */ +IriSP.createAnnotationWidget.prototype.addKeyword = function(_keyword) { + var _field = this.selector.find(".Ldt-createAnnotation-Description"), + _rx = IriSP.regexpFromText(_keyword), + _contents = _field.val(); + _contents = ( _rx.test(_contents) + ? _contents.replace(_rx,"").replace(" "," ").trim() + : _contents.trim() + " " + _keyword + ); + _field.val(_contents.trim()).trigger("js_mod"); +} + +/** handles clicks on the annotate button. Works only for the non-cinecast version */ +IriSP.createAnnotationWidget.prototype.handleAnnotateSignal = function() { + + if (this._hidden == false && this._state == 'startScreen') { + this.selector.hide(); + this._hidden = true; + + // free the arrow. + this._Popcorn.trigger("IriSP.ArrowWidget.releaseArrow"); + this._Popcorn.trigger("IriSP.SliceWidget.hide"); + this._Popcorn.trigger("IriSP.AnnotationsWidget.show"); + + } else { + this._Popcorn.trigger("IriSP.AnnotationsWidget.hide"); + this.showStartScreen(); + this.selector.show(); + this._hidden = false; + var currentTime = this._Popcorn.currentTime(); + + // block the arrow. + this._Popcorn.trigger("IriSP.ArrowWidget.blockArrow"); + + var duration = this.getDuration(); + + var currentChapter = this._serializer.currentChapitre(currentTime); + + if (IriSP.null_or_undefined(currentChapter)) { + var left = this.selector.width() / 2; + var width = this.selector.width() / 10; + } else { + var left = (currentChapter.begin / duration) * this.selector.width(); + var width = (currentChapter.end / duration) * this.selector.width() - left; + } + + // slider position and length is kept in percents. + this.sliceLeft = (left / this.selector.width()) * 100; + this.sliceWidth = (width / this.selector.width()) * 100; + + this._Popcorn.trigger("IriSP.SliceWidget.position", [left, width]); + this._Popcorn.listen("IriSP.SliceWidget.zoneChange", IriSP.wrap(this, this.handleSliderChanges)); + this._Popcorn.trigger("IriSP.SliceWidget.show"); + + if (!IriSP.null_or_undefined(currentChapter)) { + this.selector.find(".Ldt-createAnnotation-Title").html(currentChapter.content.title); + + this._currentcurrentChapter = currentChapter; + var beginTime = IriSP.msToTime(currentChapter.begin); + var endTime = IriSP.msToTime(currentChapter.end); + var timeTemplate = IriSP.templToHTML("- ({{begin}} - {{ end }})", {begin: beginTime, end: endTime }); + this.selector.find(".Ldt-createAnnotation-TimeFrame").html(timeTemplate); + } + } +}; + + +/** watch for changes in the textfield and change the buttons accordingly */ +IriSP.createAnnotationWidget.prototype.handleTextChanges = function(event) { + var contents = this.selector.find(".Ldt-createAnnotation-Description").val(); + if (this.cinecast_version) { + this._Popcorn.pause(); + } + this.selector.find(".Ldt-createAnnotation-btnblock button").each(function() { + var _rx = IriSP.regexpFromText(IriSP.jQuery(this).text()); + if (_rx.test(contents)) { + IriSP.jQuery(this).parent().addClass("Ldt-createAnnotation-active-button"); + } else { + IriSP.jQuery(this).parent().removeClass("Ldt-createAnnotation-active-button"); + } + }); + +}; + +IriSP.createAnnotationWidget.prototype.showStartScreen = function() { + this.selector.find(".Ldt-createAnnotation-screen").hide(); + this.selector.find(".Ldt-createAnnotation-startScreen").show(); + + var jqTextfield = this.selector.find(".Ldt-createAnnotation-Description"); // handle on the textfield. used for the closure + + /* test if the browser supports the placeholder attribute */ + if (!IriSP.null_or_undefined(jqTextfield.get(0).placeholder)) { + jqTextfield.attr("placeholder", IriSP.i18n.getMessage('type_here')); + } else { + jqTextfield.val(IriSP.i18n.getMessage('type_here')); + jqTextfield.one("click", IriSP.wrap(this, function() { jqTextfield.val(""); })); + } + + + + this._state = "startScreen"; +}; + +IriSP.createAnnotationWidget.prototype.showWaitScreen = function() { + this.selector.find(".Ldt-createAnnotation-screen").hide(); + this.selector.find(".Ldt-createAnnotation-waitScreen").show(); + this._state = "waitScreen"; +}; + +IriSP.createAnnotationWidget.prototype.showErrorScreen = function() { + this.selector.find(".Ldt-createAnnotation-screen").hide(); + this.selector.find(".Ldt-createAnnotation-errorScreen").show(); + this._state = "errorScreen"; + var _this = this; + window.setTimeout(function() { _this.showStartScreen(); }, 2000); +}; + +/** update show the final screen with links to share the created annotation */ +IriSP.createAnnotationWidget.prototype.showEndScreen = function(annotation) { + this.selector.find(".Ldt-createAnnotation-screen").hide(); + + if (this.cinecast_version) { + this.selector.find(".Ldt-createAnnotation-Title").parent().show(); + } + + var url = ( (typeof annotation.meta == "object" && typeof annotation.meta.url == "string" && annotation.meta.url.length) + ? annotation.meta.url + : ( document.location.href + "#id=" + annotation.id ) ); + var twStatus = IriSP.mkTweetUrl(url); + var gpStatus = IriSP.mkGplusUrl(url); + var fbStatus = IriSP.mkFbUrl(url); + + this.selector.find(".Ldt-createAnnotation-endScreen-TweetLink").attr("href", twStatus); + this.selector.find(".Ldt-createAnnotation-endScreen-FbLink").attr("href", fbStatus); + this.selector.find(".Ldt-createAnnotation-endScreen-GplusLink").attr("href", gpStatus); + + this.selector.find(".Ldt-createAnnotation-endScreen").show(); + this._state = "endScreen"; +}; + +/** handle clicks on "send annotation" button */ +IriSP.createAnnotationWidget.prototype.handleButtonClick = function(event) { + var _this = this; + var textfield = this.selector.find(".Ldt-createAnnotation-Description"); + var contents = textfield.val(); + + if (contents === "") { + if (this.selector.find(".Ldt-createAnnotation-errorMessage").length === 0) { + this.selector.find(".Ldt-createAnnotation-Container") + .after(IriSP.templToHTML(IriSP.createAnnotation_errorMessage_template)); + textfield.css("background-color", "#d93c71"); + } else { + this.selector.find(".Ldt-createAnnotation-errorMessage").show(); + } + + textfield.one("js_mod propertychange keyup input paste", IriSP.wrap(this, function() { + var contents = textfield.val(); + + if (contents !== "") { + this.selector.find(".Ldt-createAnnotation-errorMessage").hide(); + textfield.css("background-color", ""); + } + })); + } else { + this.showWaitScreen(); + + this.sendLdtData(contents, function(annotation) { + if (_this.cinecast_version) { + if (_this._Popcorn.media.paused) + _this._Popcorn.play(); + } + + if (_this._state == "waitScreen") { + _this.showEndScreen(annotation); + if (_this.cinecast_version) { + window.setTimeout(function() { _this.showStartScreen(); }, 5000); + } + } + // hide the slicer widget + if (!_this.cinecast_version) { + _this._Popcorn.trigger("IriSP.SliceWidget.hide"); + } + }); + } +}; + +IriSP.createAnnotationWidget.prototype.handleSliderChanges = function(params) { + this.sliceLeft = params[0]; + this.sliceWidth = params[1]; +}; + +IriSP.createAnnotationWidget.prototype.sendLdtData = function(contents, callback) { + var _this = this; + var apiJson = { + format : "http://advene.org/ns/cinelab/", + annotations : [ + {} + ], + meta: {}}; + var annotation = apiJson.annotations[0]; + + annotation.media = this.currentMedia()["id"]; + + if (this.cinecast_version) { + annotation.begin = Math.round(this._Popcorn.currentTime() * 1000); + annotation.end = annotation.begin; + } else { + var duration = this.getDuration(); + annotation.begin = +((duration * (this.sliceLeft / 100)).toFixed(0)); + annotation.end = +((duration * ((this.sliceWidth + this.sliceLeft) / 100)).toFixed(0)); + } + + // boundary checks + annotation.begin = Math.max(0, annotation.begin); + annotation.end = Math.min(this.getDuration(), annotation.end); + + annotation.type = ( this.cinecast_version ? "cinecast:UserAnnotation" : ( this._serializer.getContributions() || "" )); + if (typeof(annotation.type) === "undefined") + annotation.type = ""; + + annotation.type_title = "Contributions"; + annotation.content = {}; + annotation.content.data = contents; + if (this.cinecast_version) { + var _extract = IriSP.underscore(this._serializer._data.annotations) + .filter(function(_a) { + return (_a.begin <= annotation.begin && _a.end >= annotation.begin && _a.type == "cinecast:MovieExtract"); + }) + if (_extract.length) { + annotation.extract = _extract[0].id; + } + } + + var meta = apiJson.meta; + + + var _username = this.selector.find(".Ldt-createAnnotation-userName").val(); + meta.creator = ( + (_username && _username.length) + ? _username + : ( + (!IriSP.null_or_undefined(IriSP.user) && !IriSP.null_or_undefined(IriSP.user.name)) + ? IriSP.user.name + : "Anonymous user" + ) + ); + + meta.created = Date().toString(); + + var _tags = []; + IriSP._(this.tags).each(function(_v) { + var _rx = IriSP.regexpFromText(_v.meta.description); + if (_rx.test(contents)) { + _tags.push(_v.id); + } + }); + + if (typeof this.remote_tags == "object") { + _tags = IriSP._(_tags).map(function(_t) { + return _this.remote_tags.id + ':' + _t + }); + if (typeof apiJson.imports == "undefined") { + apiJson.imports = []; + } + apiJson.imports.push({ + "id" : this.remote_tags.id, + "url" : this.remote_tags.url + }) + } + annotation.tags = IriSP.underscore.uniq(_tags); + + var jsonString = JSON.stringify(apiJson); + var project_id = this._serializer._data.meta.id; + + //TODO: extract magic url + var url = Mustache.to_html(this.api_endpoint_template, + {id: project_id}); + + IriSP.jQuery.ajax({ + url: url, + type: this.api_method, + contentType: 'application/json', + data: jsonString, + //dataType: 'json', + success: IriSP.wrap(this, function(json, textStatus, XMLHttpRequest) { + /* add the annotation to the annotation and tell the world */ + var annotation = json.annotations[0]; + + if (!this.cinecast_version) { + /* if the media doesn't have a contributions line, we need to add one */ + if (typeof(this._serializer.getContributions()) === "undefined") { + /* set up a basic view */ + var tmp_view = {"dc:contributor": "perso", "dc:creator": "perso", "dc:title": "Contributions", + "id": json.annotations[0].type} + + + IriSP.get_aliased(this._serializer._data, ["annotation_types", "annotation-types"]).push(tmp_view); + } + + delete annotation.tags; + annotation.content.description = annotation.content.data; + annotation.content.title = ""; + delete annotation.content.data; + annotation.id = json.annotations[0].id; + + annotation.meta = meta; + annotation.meta["id-ref"] = json.annotations[0]["type"]; + } else { + annotation.type = "cinecast:UserAnnotation"; + } + annotation.is_new = true; + // everything is shared so there's no need to propagate the change + _this._serializer._data.annotations.push(annotation); + _this._Popcorn.trigger("IriSP.createAnnotationWidget.addedAnnotation", annotation); + this.selector.find(".Ldt-createAnnotation-Description").val("").trigger("js_mod"); + callback(annotation); + }), + error: + function(jqXHR, textStatus, errorThrown) { + console.log("an error occured while contacting " + + url + " and sending " + jsonString + textStatus ); + _this.showErrorScreen(); } }); +}; \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/Annotation.css --- a/src/widgets/Annotation.css Tue May 15 15:50:19 2012 +0200 +++ b/src/widgets/Annotation.css Fri May 18 18:23:51 2012 +0200 @@ -79,17 +79,18 @@ display: none; } -span.Ldt-Annotation-TagTitle { - display: inline-block; margin: 5px 2px 0 0; font-size: 12px; +.Ldt-Annotation-TagTitle { + margin: 5px 0 2px; font-size: 12px; } ul.Ldt-Annotation-Tags { - display: inline-block; list-style: none; padding: 0; margin: 5px 0; + display: inline; list-style: none; padding: 0; margin: 5px 0; } li.Ldt-Annotation-TagLabel { display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px; - background: url(img/tag.png) left top no-repeat; font-weight: bold; + background: url(img/tag.png) left top no-repeat; + cursor: pointer; } .Ldt-Annotation-TagLabel span { @@ -97,6 +98,14 @@ background: url(img/tag.png) right top no-repeat; } +li.Ldt-Annotation-TagLabel:hover { + background-position: left -23px; +} + +.Ldt-Annotation-TagLabel:hover span { + background-position: right -23px; +} + .Ldt-Annotation-MashupOrigin { display: none; } diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/Annotation.js --- a/src/widgets/Annotation.js Tue May 15 15:50:19 2012 +0200 +++ b/src/widgets/Annotation.js Fri May 18 18:23:51 2012 +0200 @@ -35,7 +35,7 @@ + '

{{l10n.excerpt_from}} ' + '( - )

' + '

' - + '
{{l10n.tags}}
'; + + '
{{l10n.tags}}
'; IriSP.Widgets.Annotation.prototype.defaults = { annotation_type : "chap", @@ -86,6 +86,18 @@ }).join(""); this.$.find(".Ldt-Annotation-Tags").html(_html); this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-NoTags"); + + /* Correct the empty tag bug */ + this.$.find('.Ldt-Annotation-TagLabel').each(function() { + var _el = IriSP.jQuery(this); + if (!_el.text().replace(/(^\s+|\s+$)/g,'')) { + _el.detach(); + } + }); + + this.$.find('.Ldt-Annotation-TagLabel').click(function() { + _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); + }); } else { this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-NoTags"); } diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/AnnotationsList.css --- a/src/widgets/AnnotationsList.css Tue May 15 15:50:19 2012 +0200 +++ b/src/widgets/AnnotationsList.css Fri May 18 18:23:51 2012 +0200 @@ -69,7 +69,7 @@ li.Ldt-AnnotationsList-Tag-Li { display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px; - background: url(img/tag.png) left top no-repeat; font-weight: bold; + background: url(img/tag.png) left top no-repeat; cursor: pointer; } @@ -79,9 +79,9 @@ } li.Ldt-AnnotationsList-Tag-Li:hover { - background-position: left bottom; + background-position: left -23px; } .Ldt-AnnotationsList-Tag-Li:hover span { - background-position: right bottom; + background-position: right -23px; } \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/Controller.js --- a/src/widgets/Controller.js Tue May 15 15:50:19 2012 +0200 +++ b/src/widgets/Controller.js Fri May 18 18:23:51 2012 +0200 @@ -100,7 +100,7 @@ this.$playButton.click(this.functionWrapper("playHandler")); this.$.find(".Ldt-Ctrl-Annotate").click(function() { - _this.player.popcorn.trigger("IriSP.Player.AnnotateButton.clicked"); + _this.player.popcorn.trigger("IriSP.CreateAnnotation.toggle"); }); this.$.find(".Ldt-Ctrl-SearchBtn").click(this.functionWrapper("searchButtonHandler")); diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/CreateAnnotation.css --- a/src/widgets/CreateAnnotation.css Tue May 15 15:50:19 2012 +0200 +++ b/src/widgets/CreateAnnotation.css Fri May 18 18:23:51 2012 +0200 @@ -1,4 +1,136 @@ /* - * + * */ +.Ldt-CreateAnnotation { + border-style: none solid solid; + border-width: 1px; + border-color: #b7b7b7; + padding: 0 1px 1px; + margin: 0; +} + +.Ldt-CreateAnnotation-Inner { + background: url(img/pinstripe.png); + padding: 5px; + margin: 0; + min-height: 150px; +} + +.Ldt-CreateAnnotation-Inner h3 { + margin: 5px 0; + font-size: 14px; + font-weight: bold; +} + +.Ldt-CreateAnnotation-Title { + margin-right: 2px; + font-size: 14px; + font-weight: bold; + color: #0068c4; + border: 1px solid #666666; + border-radius: 2px; +} + +.Ldt-CreateAnnotation-Times { + color: #ff3b77 +} + +.Ldt-CreateAnnotation-Submit { + position: absolute; + bottom: 7px; + right: 7px; + color: #ffffff; + cursor: pointer; + background: url('img/submit_annotation.png'); + height: 50px; + width: 50px; + padding: 28px 0 0; + font-size: 12px; + border: none; + text-align: center; + cursor: pointer; +} + +.Ldt-CreateAnnotation-Submit:hover { + background-position: -50px 0; +} + +.Ldt-CreateAnnotation-Description { + height: 56px; + padding: 2px; + resize: none; + width: 520px; + border: 1px solid #666666; + border-radius: 2px; +} + +.Ldt-CreateAnnotation-Avatar { + float: right; + width: 48px; + height: 48px; + margin: 5px 0; + padding: 0 0 0 15px; + background: url('img/profile_arrow.png') left no-repeat; +} + +.Ldt-CreateAnnotation-Avatar img { + float: right; + display: block; + max-width: 100%; + max-height: 100%; + border: 1px solid #bbbbbb; +} + +.Ldt-CreateAnnotation-Tags, .Ldt-CreateAnnotation-Polemics { + width: 520px; +} + +.Ldt-CreateAnnotation-TagTitle, .Ldt-CreateAnnotation-PolemicTitle { + display: block; margin: 5px 0 2px; font-size: 12px; +} + +.Ldt-CreateAnnotation-TagList, .Ldt-CreateAnnotation-PolemicList { + list-style: none; +} + +li.Ldt-CreateAnnotation-TagLi { + display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px; + background: url(img/tag.png) left top no-repeat; + cursor: pointer; +} + +.Ldt-CreateAnnotation-TagButton { + display: inline-block; font-size: 12px; height: 19px; padding: 4px 5px 0 0; border: none; margin: 0; + background: url(img/tag.png) right top no-repeat; +} + +li.Ldt-CreateAnnotation-TagLi:hover { + background-position: left -23px; +} + +.Ldt-CreateAnnotation-TagLi:hover .Ldt-CreateAnnotation-TagButton { + background-position: right -23px; +} + +li.Ldt-CreateAnnotation-TagLi.selected { + background-position: left -46px; +} + +.Ldt-CreateAnnotation-TagLi.selected .Ldt-CreateAnnotation-TagButton { + background-position: right -46px; +} + +li.Ldt-CreateAnnotation-PolemicLi { + display: inline-block; border: none; margin: 0 5px 0; height: 21px; width: 26px; padding: 2px 0 0; + background: url(img/polemic.png) left top no-repeat; font-size: 14px; font-weight: bold; text-align: center; + cursor: pointer; +} + +li.Ldt-CreateAnnotation-PolemicLi:hover { + background-position: 0 -23px; +} + +li.Ldt-CreateAnnotation-PolemicLi.selected { + background-position: 0 -46px; +} \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/CreateAnnotation.js --- a/src/widgets/CreateAnnotation.js Tue May 15 15:50:19 2012 +0200 +++ b/src/widgets/CreateAnnotation.js Fri May 18 18:23:51 2012 +0200 @@ -6,24 +6,32 @@ IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget(); IriSP.Widgets.CreateAnnotation.prototype.defaults = { - single_time_mode : false, - show_title_field : true, - user_avatar : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png" + show_title_field : false, + user_avatar : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", + tags : false, + max_tags : 8, + polemics : [{ + keyword: "++", + background_color: "#00a000", + text_color: "#ffffff" + },{ + keyword: "--", + background_color: "#c00000", + text_color: "#ffffff" + },{ + keyword: "??", + background_color: "#0000e0", + text_color: "#ffffff" + },{ + keyword: "==", + background_color: "#f0e000", + text_color: "#000000" + }], + annotation_type: "Contributions", + creator_name: "", + api_serializer: "ldt_annotate" /* - tags : [ - { - id: "digitalstudies", - meta: { - description: "#digital-studies" - } - }, - { - id: "amateur", - meta: { - description: "#amateur" - }, - } - ], + remote_tags : false, random_tags : false, show_from_field : false, @@ -55,10 +63,9 @@ en: { from_time: "from", to_time: "to", - at_time: "at", submit: "Submit", - add_keywords: "Add keywords", - add_polemic_keywords: "Add polemic keywords", + add_keywords_: "Add keywords:", + add_polemic_keywords_: "Add polemic keywords:", your_name: "Your name", no_title: "Annotate this video", type_title: "Annotation title", @@ -73,12 +80,11 @@ cancel: "Cancel" }, fr: { - from_time: "from", + from_time: "de", to_time: "à", - at_time: "à", submit: "Envoyer", - add_keywords: "Ajouter des mots-clés", - add_polemic_keywords: "Ajouter des mots-clés polémiques", + add_keywords_: "Ajouter des mots-clés :", + add_polemic_keywords_: "Ajouter des mots-clés polémiques :", your_name: "Votre nom", no_title: "Annoter cette vidéo", type_title: "Titre de l'annotation", @@ -98,17 +104,143 @@ '
' + '
' + '

{{#show_title_field}}{{/show_title_field}}' - + '{{^show_title_field}}{{l10n.no_title}}{{/show_title_field}}' - + ' {{#single_time_mode}}{{l10n.at_time}}{{/single_time_mode}}' - + '{{^single_time_mode}}{{l10n.from_time}}{{/single_time_mode}} ' - + ' {{^single_time_mode}}{{l10n.to_time}} {{/single_time_mode}}

' - + '' - + '' + + '{{^show_title_field}}{{l10n.no_title}} {{/show_title_field}}' + + ' {{l10n.from_time}} ' + + ' {{l10n.to_time}} ' + + '' + + '
' + + '' + + '{{#tags.length}}
{{l10n.add_keywords_}}
    ' + + '{{#tags}}
  • {{title}}
  • {{/tags}}
{{/tags.length}}' + + '{{#polemics.length}}
{{l10n.add_polemic_keywords_}}
    ' + + '{{#polemics}}
  • {{keyword}}
  • {{/polemics}}
{{/polemics.length}}' + '
' - + '
'; + + '
'; IriSP.Widgets.CreateAnnotation.prototype.draw = function() { + if (!this.tags) { + this.tags = this.source.getTags() + .sortBy(function (_tag) { + return -_tag.getAnnotations().length; + }) + .slice(0, this.max_tags) + .map(function(_tag) { + return _tag; + }); + // We have to use the map function because Mustache doesn't like our tags object + } this.renderTemplate(); + var _this = this; + this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").click(function() { + _this.addKeyword(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); + return false; + }); + this.$.find(".Ldt-CreateAnnotation-Description").bind("change keyup input paste", this.functionWrapper("onDescriptionChange")); + if (this.show_title_field) { + this.$.find(".Ldt-CreateAnnotation-Title").bind("change keyup input paste", this.functionWrapper("onTitleChange")); + } + + this.$.hide(); + this.hide(); + this.bindPopcorn("IriSP.CreateAnnotation.toggle","toggle"); + this.bindPopcorn("IriSP.Slice.boundsChanged","onBoundsChanged"); + this.begin = new IriSP.Model.Time(); + this.end = this.source.getDuration(); + this.$.find("form").submit(this.functionWrapper("onSubmit")); +} + +IriSP.Widgets.CreateAnnotation.prototype.show = function() { + this.visible = true; + this.$.slideDown(); + this.player.popcorn.trigger("IriSP.Annotation.minimize"); + this.player.popcorn.trigger("IriSP.Slice.show"); +} + +IriSP.Widgets.CreateAnnotation.prototype.hide = function() { + this.visible = false; + this.$.slideUp(); + this.player.popcorn.trigger("IriSP.Annotation.maximize"); + this.player.popcorn.trigger("IriSP.Slice.hide"); +} + +IriSP.Widgets.CreateAnnotation.prototype.toggle = function() { + if (this.visible) { + this.hide(); + } else { + this.show(); + } +} + +IriSP.Widgets.CreateAnnotation.prototype.onBoundsChanged = function(_values) { + this.begin = new IriSP.Model.Time(_values[0]); + this.end = new IriSP.Model.Time(_values[1]); + this.$.find(".Ldt-CreateAnnotation-Begin").html(this.begin.toString()); + this.$.find(".Ldt-CreateAnnotation-End").html(this.end.toString()); +} + +IriSP.Widgets.CreateAnnotation.prototype.addKeyword = function(_keyword) { + var _field = this.$.find(".Ldt-CreateAnnotation-Description"), + _rx = IriSP.Model.regexpFromTextOrArray(_keyword), + _contents = _field.val(); + _contents = ( _rx.test(_contents) + ? _contents.replace(_rx,"") + : _contents + " " + _keyword + ); + _field.val(_contents.replace(/\s{2,}/g,' ').replace(/(^\s+|\s+$)/g,'')); + this.onDescriptionChange(); +} + +IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function() { + var _field = this.$.find(".Ldt-CreateAnnotation-Description"), + _contents = _field.val(); + _field.css("border-color", !!_contents ? "#666666" : "#c00000"); + this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").each(function() { + var _rx = IriSP.Model.regexpFromTextOrArray(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); + if (_rx.test(_contents)) { + IriSP.jQuery(this).addClass("selected"); + } else { + IriSP.jQuery(this).removeClass("selected"); + } + }); + return !!_contents; +} + +IriSP.Widgets.CreateAnnotation.prototype.onTitleChange = function() { + var _field = this.$.find(".Ldt-CreateAnnotation-Title"), + _contents = _field.val(); + _field.css("border-color", !!_contents ? "#666666" : "#c00000"); + return !!_contents; +} + +IriSP.Widgets.CreateAnnotation.prototype.onSubmit = function() { + if (!this.onDescriptionChange() || (!this.onTitleChange() && this.show_title_field)) { + return; + } + + var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager); + _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), + _annotation = new IriSP.Model.Annotation(false, _export), + _annotationType = new IriSP.Model.AnnotationType(false, _export); + + _annotationType.title = this.annotation_type; + _annotation.setBegin(this.begin); + _annotation.setEnd(this.end); + _annotation.setMedia(this.source.currentMedia.id); + _annotation.setAnnotationType(_annotationType.id); + if (this.show_title_field) { + _annotation.title = this.$.find(".Ldt-CreateAnnotation-Title").val() + } + _annotation.created = new Date(); + _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); + _annotation.setTags(this.$.find(".Ldt-CreateAnnotation-TagLi.selected").map(function() { return IriSP.jQuery(this).attr("tag-id")})); + + _export.creator = this.creator; + _export.created = new Date(); + _exportedAnnotations.push(_annotation); + _export.addList("annotation",_exportedAnnotations); + console.log(_export.serialize()); + + return false; } /* diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/Slice.js --- a/src/widgets/Slice.js Tue May 15 15:50:19 2012 +0200 +++ b/src/widgets/Slice.js Fri May 18 18:23:51 2012 +0200 @@ -20,7 +20,7 @@ this.$.append(this.$slider); this.min = 0; - this.max = this.source.getDuration().getSeconds(); + this.max = this.source.getDuration().valueOf(); var _this = this; @@ -32,9 +32,9 @@ change: function(event, ui) { _this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{ widget:_this.type, - time:Math.floor((ui.values[0]+ui.values[1])*500) + time:Math.floor((ui.values[0]+ui.values[1])/2) }); - _this.player.popcorn.trigger("IriSP.Slice.valuesChanged",[ui.values[0]*1000, ui.values[1]*1000]); + _this.player.popcorn.trigger("IriSP.Slice.boundsChanged",[ui.values[0], ui.values[1]]); } }); this.$slider.find(".ui-slider-handle:first").addClass("Ldt-Slice-left-handle"); @@ -46,7 +46,7 @@ } this.bindPopcorn("IriSP.Slice.show","show"); this.bindPopcorn("IriSP.Slice.hide","hide"); - this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds") + this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds"); }; IriSP.Widgets.Slice.prototype.show = function() { @@ -61,6 +61,6 @@ } IriSP.Widgets.Slice.prototype.storeBounds = function(_values) { - this.min = Math.floor(_values[0]/1000); - this.max = Math.floor(_values[1]/1000); + this.min = _values[0]; + this.max = _values[1]; } \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/img/polemic.png Binary file src/widgets/img/polemic.png has changed diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/img/profile_arrow.png Binary file src/widgets/img/profile_arrow.png has changed diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/img/submit_annotation.png Binary file src/widgets/img/submit_annotation.png has changed diff -r d9da52e20f7f -r 510ebab76fa3 src/widgets/img/tag.png Binary file src/widgets/img/tag.png has changed diff -r d9da52e20f7f -r 510ebab76fa3 test/jwplayer.htm --- a/test/jwplayer.htm Tue May 15 15:50:19 2012 +0200 +++ b/test/jwplayer.htm Fri May 18 18:23:51 2012 +0200 @@ -15,7 +15,7 @@
diff -r d9da52e20f7f -r 510ebab76fa3 test/mashup/bab_files/mashup-local.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/mashup/bab_files/mashup-local.xml Fri May 18 18:23:51 2012 +0200 @@ -0,0 +1,133 @@ + + + + + + + + + + + + Mon découpage + + + + + <abstract/> + <audio source=""/> + <tags/> + </element> + <element id="s_7EB7522B-82D7-4FD6-2C5F-3C4D6945539E" begin="1090000" dur="15000" author="admin" date="2012-05-11T16:30:39" color="13369344" src=""> + <title/> + <abstract/> + <audio source=""/> + <tags/> + </element> + <element id="s_E8C653B6-2B35-B2D6-1040-3C4D75BDF31B" begin="2030000" dur="5000" author="admin" date="2012-05-11T16:30:36" color="10027008" src=""> + <title/> + <abstract/> + <audio source=""/> + <tags/> + </element> + <element id="s_971168A0-A9B3-064D-46B4-3C4D7FA5DFD5" begin="2922000" dur="18000" author="admin" date="2012-05-11T16:30:33" color="10027008" src=""> + <title/> + <abstract/> + <audio source=""/> + <tags/> + </element> + </elements> + </decoupage> + </ensemble> + </content> + <content id="c1a84ff8-e2b0-11e0-8472-00145ea49a02"> + <ensemble id="g_F84E6DE7-FB3E-4672-3E87-3C4B87BA959E" idProject="5afd8bbe-9b75-11e1-9e5d-00145ea4a2be" title="Découpages personnels" author="undefined" abstract=""> + <decoupage id="c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67" author="perso"> + <title>Mon découpage + + + + + <abstract/> + <audio source=""/> + <tags/> + </element> + <element id="s_5D30DD53-BE06-49E0-EB72-3C4B99BA0AA4" begin="980096" dur="15000" author="admin" date="2012-05-11T16:32:08" color="16763904" src=""> + <title/> + <abstract/> + <audio source=""/> + <tags/> + </element> + <element id="s_2B3C5B17-FB5E-8B99-AEDA-3C4BA2EB4234" begin="1833044" dur="27000" author="admin" date="2012-05-11T16:28:12" color="16763904" src=""> + <title/> + <abstract/> + <audio source=""/> + <tags/> + </element> + <element id="s_2376F9F0-AC9A-229C-9A60-3C4BAEE2D03F" begin="2436996" dur="23100" author="admin" date="2012-05-11T16:28:18" color="16763904" src=""> + <title/> + <abstract/> + <audio source=""/> + <tags/> + </element> + <element id="s_0DB7AABB-3973-9352-95DF-3C4BC3DCFB2D" begin="3240000" dur="10000" author="admin" date="2012-05-11T16:28:26" color="16763904" src=""> + <title/> + <abstract/> + <audio source=""/> + <tags/> + </element> + </elements> + </decoupage> + </ensemble> + </content> + </annotations> + <displays> + <display id="v_33227665-49F3-7111-2BC6-3C4B6E90411C" title="Init view" idsel="c1a84ff8-e2b0-11e0-8472-00145ea49a02" tc="0" zoom="68" scroll="0" infoBAB=""> + <audio source=""/> + <content id="c1a84ff8-e2b0-11e0-8472-00145ea49a02"> + <decoupage idens="g_F84E6DE7-FB3E-4672-3E87-3C4B87BA959E" id="c_3B9ADA5A-DBB7-00AC-BA4E-3C4B87B9EA67" tagsSelect=""/> + </content> + <content id="c4ff2454-9842-11e1-9f9f-00145ea4a2be"> + <decoupage idens="g_5665330A-7789-1E08-13C2-3C4D26B44EAF" id="c_3D9A9B5D-E144-4920-A9CA-3C4D26B48425" tagsSelect=""/> + </content> + </display> + </displays> + <edits> + <editing id="0" tags=""> + <title>Bout à bout 1 + + + + + + + + + + + + + + + + + + + + + + diff -r d9da52e20f7f -r 510ebab76fa3 test/mashup/player-local.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/mashup/player-local.htm Fri May 18 18:23:51 2012 +0200 @@ -0,0 +1,108 @@ + + + + Preuve de concept Mashup + + + + + +
+
+

Hash Cut #

+
+
+

Créer un Hash-cut en 3 étapes :

+
+
+
+
S'inscrire et
créer un projet
+
+
+
+
+
Découper et
Assembler
+
+
+
+
+
Partager et
regarder !
+
+
+
+
+

Mon HashCut

+
+
+
+
+
+

Annotations

+
+
+
+ +
+ + + \ No newline at end of file diff -r d9da52e20f7f -r 510ebab76fa3 test/test-config.js --- a/test/test-config.js Tue May 15 15:50:19 2012 +0200 +++ b/test/test-config.js Fri May 18 18:23:51 2012 +0200 @@ -21,8 +21,10 @@ { type: "Controller" }, { type: "Polemic" }, { type: "Segments" }, + { type: "Slice" }, { type: "Arrow" }, { type: "Annotation" }, + { type: "CreateAnnotation" }, { type: "Tweet" }, { type: "Tagcloud" }, {