merge changes from mdp adaptation for remie
authorymh <ymh.work@gmail.com>
Sat, 18 Jul 2015 14:11:23 +0200
changeset 1395 3097cb0581ac
parent 1386 0679b00bb2f1 (current diff)
parent 1394 5eecb7d31547 (diff)
child 1396 2d1c483e9a14
merge changes from mdp adaptation for remie
--- a/src/ldt/ldt/api/ldt/resources/annotation.py	Thu Jul 16 12:59:15 2015 +0200
+++ b/src/ldt/ldt/api/ldt/resources/annotation.py	Sat Jul 18 14:11:23 2015 +0200
@@ -84,7 +84,7 @@
         meta = a['meta']
         author = meta['creator']
         date = meta['created']
-        #                       add(media,      cutting_id, cutting_title,  title,               text,                         tags_list,  begin, dur, author, date
+        #                                    add(media,      cutting_id, cutting_title,  title,                 text,                        tags_list, begin, dur, author, date
         type_id, new_id, ensemble_id = adder.add(a['media'], a['type'], a['type_title'], a['content']['title'], a['content']['description'], a['tags'], begin, dur, author, date, None, "2194379", audio_src, audio_href)
         if not new_id:
             protect_models()
--- a/src/ldt/ldt/ldt_utils/projectserializer.py	Thu Jul 16 12:59:15 2015 +0200
+++ b/src/ldt/ldt/ldt_utils/projectserializer.py	Sat Jul 18 14:11:23 2015 +0200
@@ -152,8 +152,7 @@
                         decoupage_created = datetime.strptime(date_str, date_format).isoformat()
                         break
                     except Exception:
-                        decoupage_created = None
-                                            
+                        decoupage_created = None   
             if decoupage_created is None:
                 decoupage_created = datetime.utcnow().isoformat()
             decoupage_modified = decoupage_created
@@ -190,6 +189,7 @@
                 element_media = content.iri_id
                 element_color = element_node.attrib.get(u"color", "")
                 element_ldt_src = element_node.attrib.get(u"src", "")
+                element_created = element_node.attrib["date"]
                 
                 element_title = reduce_text_node(element_node, "title/text()")        
                 element_description = reduce_text_node(element_node, "abstract/text()")                
@@ -262,6 +262,7 @@
                     "begin": int(float(element_begin)),
                     "end": int(float(element_begin)) + int(float(element_duration)),
                     "id": element_id,
+                    "created": element_created,
                     "media": element_media,
                     "color": element_color,
                     "content": {
--- a/src/ldt/ldt/ldt_utils/views/ldt_json.py	Thu Jul 16 12:59:15 2015 +0200
+++ b/src/ldt/ldt/ldt_utils/views/ldt_json.py	Sat Jul 18 14:11:23 2015 +0200
@@ -72,9 +72,12 @@
     one_content_bool = False
     if one_content_str:
         one_content_bool = {'true': True, 'false': False, "0": False, "1": True}.get(one_content_str.lower())
-        
-        
-    ps = ProjectJsonSerializer(project, serialize_contents, first_cutting=first_cutting)
+    
+    from_display_str = request.GET.get("from_display", "")
+    from_display_bool = True
+    if from_display_str:
+        from_display_bool = {'true': True, 'false': False, "0": False, "1": True}.get(from_display_str.lower())
+    ps = ProjectJsonSerializer(project, serialize_contents, from_display=from_display_bool, first_cutting=first_cutting)
     project_dict = ps.serialize_to_cinelab(one_content_bool)
     
     json_str = json.dumps(project_dict, ensure_ascii=False, indent=indent)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsController.css	Sat Jul 18 14:11:23 2015 +0200
@@ -0,0 +1,43 @@
+
+.Ldt-AnnotationsController{
+	background: url(img/pinstripe.png);
+	width: 535px;
+    max-height: 280px;
+	margin: 0px;
+	margin-top: 4px;
+	border-style: solid;
+    border-width: 1px;
+    border-color: #b7b7b7;
+}
+
+.Ldt-AnnotationsController-ButtonsContainer{
+	width: 100%;
+	min-height: 30px;
+	text-align: center;
+}
+
+.Ldt-AnnotationsController-Button{
+	display: inline-block;
+    background-color: #d93c71;
+    color: #ffffff;
+    cursor: pointer;
+    height: 25px;
+    width: 150px;
+    font-size: 14px;
+    border: 1px solid;
+    border-color: #eca3bc #631e34 #36101c #e16e93;
+    cursor: pointer;
+    margin-right: 10px;
+    margin-left: 10px;
+    margin-bottom: 5px;
+    margin-top: 5px;
+    padding: 4px;
+    text-align: center;
+	vertical-align: middle;
+	line-height: 30px;
+}
+
+.Ldt-AnnotationsController-Button:hover{
+	background-color: #e15581;
+	border-color: #222222 #e87d9f #f0adc3 #68273c;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsController.js	Sat Jul 18 14:11:23 2015 +0200
@@ -0,0 +1,109 @@
+/* 
+ * Widget that ties AnnotationList and CreateAnnotation together
+ * using buttons to hide/show AnnotationList and CreateAnnotation widgets.
+ * 
+ */
+
+IriSP.Widgets.AnnotationsController = function(player, config){
+    IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.AnnotationsController.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.AnnotationsController.prototype.defaults = {
+    // If true, displaying AnnotationList will hide CreateAnnotation and vice versa.
+    display_or_write: false,
+    starts_hidden: false,
+    hide_without_segment: false,
+    segments_annotation_type: "chap"
+};
+
+IriSP.Widgets.AnnotationsController.prototype.template = 
+    "<div class='Ldt-AnnotationsController'>"
+    + "<div class='Ldt-AnnotationsController-ButtonsContainer'>"
+    + "    <div class='Ldt-AnnotationsController-Button Ldt-AnnotationsController-ShowAnnotationsListButton'>{{l10n.display}}</div>"
+    + "    <div class='Ldt-AnnotationsController-Button Ldt-AnnotationsController-ShowCreateAnnotationButton'>{{l10n.write}}</div>"
+    + "</div>"
+    + "</div>"
+
+IriSP.Widgets.AnnotationsController.prototype.messages = {
+    en : {
+        write : "Write",
+        display : "Display",
+    },
+    fr : {
+        write : "Ecrire",
+        display : "Voir"
+    }
+};
+
+IriSP.Widgets.AnnotationsController.prototype.draw = function() { 
+    this.renderTemplate();
+    var _this = this;
+    this.element_$ = this.$.find(".Ldt-AnnotationsController")
+    
+    this.displayButton_$ = this.$.find(".Ldt-AnnotationsController-ShowAnnotationsListButton");
+    this.writeButton_$ = this.$.find(".Ldt-AnnotationsController-ShowCreateAnnotationButton");
+    
+    this.writeButton_$.click(function(){
+        _this.player.trigger("CreateAnnotation.toggle");
+        if (_this.display_or_write){
+            _this.player.trigger("AnnotationsList.hide");
+        }
+    });
+    this.displayButton_$.click(function(){
+        _this.player.trigger("AnnotationsList.toggle");
+        if (_this.display_or_write){
+            _this.player.trigger("CreateAnnotation.hide");
+        }
+    })
+    this.onMediaEvent("timeupdate", "onTimeUpdate")
+    
+    if (this.starts_hidden) {
+        this.visible = true
+        this.hide();
+    }
+    else{
+        this.visible = false
+        this.show();
+    }
+    
+};
+
+IriSP.Widgets.AnnotationsController.prototype.onTimeUpdate = function(){
+    if (this.hide_without_segment){
+        _currentTime = this.media.getCurrentTime() 
+        _segmentsAnnotations = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type)
+        _currentSegments = _segmentsAnnotations.filter(function(_segment){
+            return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
+        });
+        if (_currentSegments.length == 0){
+            if (this.visible){
+                this.hide();
+                _this.player.trigger("CreateAnnotation.hide");
+                _this.player.trigger("AnnotationsList.hide");
+            }
+        }
+        else {
+            if (!this.visible){
+                this.show();
+                _this.player.trigger("CreateAnnotation.hide");
+                _this.player.trigger("AnnotationsList.hide");
+            }
+        }
+    }
+}
+
+IriSP.Widgets.AnnotationsController.prototype.hide = function() {
+    if (this.visible){
+        this.visible = false;
+        this.element_$.hide()
+    }
+}
+
+IriSP.Widgets.AnnotationsController.prototype.show = function() {
+    if(!this.visible){
+        this.visible = true;
+        this.element_$.show()
+    }
+}
--- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css	Thu Jul 16 12:59:15 2015 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css	Sat Jul 18 14:11:23 2015 +0200
@@ -13,6 +13,33 @@
     width: 1px; height: 1px;
 }
 
+.Ldt-AnnotationsList-Filters {
+	display: table-cell;
+	width: 100%;
+	height: 30px;
+	vertical-align: middle;
+    text-align: center;
+	
+}
+
+.Ldt-AnnotationsList-filter-text {
+    text-align: left;
+	display: inline;
+	margin: 4px 2px;
+}
+
+.Ldt-AnnotationsList-filter-dropdown {
+    text-align: center;
+	display: inline;
+	margin: 4px 2px;
+}
+
+.Ldt-AnnotationsList-filter-checkbox {
+    text-align: center;
+	display: inline;
+	margin: 4px 2px;
+}
+
 ul.Ldt-AnnotationsList-ul {
     list-style: none;
     padding: 2px;
@@ -48,6 +75,12 @@
     font-size: 12px;
     margin: 2px;
 }
+.Ldt-AnnotationsList-CreationDate {
+    color: #f7268e;
+    text-align: left;
+    font-size: 12px;
+    margin: 2px 2px 0 82px;
+}
 h3.Ldt-AnnotationsList-Title {
     color: #0068c4;
     font-size: 13px;
--- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js	Thu Jul 16 12:59:15 2015 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js	Sat Jul 18 14:11:23 2015 +0200
@@ -12,23 +12,47 @@
 IriSP.Widgets.AnnotationsList.prototype = new IriSP.Widgets.Widget();
 
 IriSP.Widgets.AnnotationsList.prototype.defaults = {
-    /* URL when the annotations are to be reloaded from an LDT-like segment API
-     * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?
+    /*
+     * URL when the annotations are to be reloaded from an LDT-like segment API
+     * e.g.
+     * http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?
      */
     ajax_url : false,
-    /* number of milliseconds before/after the current timecode when calling the segment API
+    /*
+     * number of milliseconds before/after the current timecode when calling the
+     * segment API
      */
     ajax_granularity : 600000, 
     default_thumbnail : "",
-    /* URL when the annotation is not in the current project,
-     * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}}
+    /*
+     * URL when the annotation is not in the current project, e.g.
+     * http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}}
      */
     foreign_url : "",
     annotation_type : false,
     refresh_interval : 0,
     limit_count : 20,
     newest_first : false,
-    show_audio: true,
+    always_visible : false,
+    start_visible: true,
+    show_audio : true,
+    show_filters : false,
+    show_creation_date : false,
+    show_timecode : true, 
+    /*
+     * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget.
+     */
+    filter_by_segments: false,
+    segments_annotation_type: "chap",
+    /*
+     * Set to a username if you only want to display annotations from a given user
+     */
+    show_only_annotation_from_user: false,
+    /*
+     * Show a text field that filter annotations by username
+     */
+    filter_by_user: false,
+    tags : true,
     polemics : [{
         keyword: "++",
         background_color: "#c9ecc6"
@@ -57,6 +81,13 @@
 
 IriSP.Widgets.AnnotationsList.prototype.template =
     '<div class="Ldt-AnnotationsListWidget">'
+    + '{{#show_filters}}'
+    + '<div class="Ldt-AnnotationsList-Filters">'
+    +    '<input class="Ldt-AnnotationsList-filter-text" type="text" value="Mot-clés"></input>'
+    +    '<select class="Ldt-AnnotationsList-filter-dropdown"></select>'
+    +    '<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox">Toutes annotations</label>'
+    + '</div>'
+    + '{{/show_filters}}'
     + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}'
     + '<ul class="Ldt-AnnotationsList-ul">'
     + '</ul>'
@@ -69,11 +100,14 @@
     + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />'
     + '</a>'
     + '</div>'
-    + '<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>'
+    + '{{#show_timecode}}<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>{{/show_timecode}}'
     + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">'
     + '<a href="{{url}}">{{{htitle}}}</a>'
     + '</h3>'
     + '<p class="Ldt-AnnotationsList-Description">{{{hdescription}}}</p>'
+    + '{{#created}}'
+    + '<div class="Ldt-AnnotationsList-CreationDate">{{{created}}}</div>'
+    + '{{/created}}'
     + '{{#tags.length}}'
     + '<ul class="Ldt-AnnotationsList-Tags">'
     + '{{#tags}}'
@@ -88,7 +122,8 @@
     + '{{#audio}}<div class="Ldt-AnnotationsList-Play" data-annotation-id="{{id}}">{{l10n.voice_annotation}}</div>{{/audio}}'
     + '</li>';
 
-//obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
+// obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project
+// + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
 
 IriSP.Widgets.AnnotationsList.prototype.ajaxSource = function() {
     var _currentTime = this.media.getCurrentTime(),
@@ -142,6 +177,32 @@
     _list = _list.filter(function(_annotation) {
         return _annotation.found !== false;
     });
+    if (this.filter_by_segments) {
+        /*
+         *  A given annotation is considered "in" segment if the middle of it is between the segment beginning and the segment end. 
+         *  Note this is meant to be used for "markings" annotations (not segments)
+         */
+        _segmentsAnnotation = this.currentSource.getAnnotationsByTypeTitle(this.segments_annotation_type)
+        _currentSegments = _segmentsAnnotation.filter(function(_segment){
+            return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
+        });
+        if (_currentSegments.length == 0) {
+            _list = _list.filter(function(_annotation){
+                return false;
+            });
+        }
+        else {
+            _list = _list.filter(function(_annotation){
+                _annotation_time = (_annotation.begin+_annotation.end)/2;
+                return (_currentSegments[0].begin <= _annotation_time && _currentSegments[0].end >= _annotation_time)
+            });
+        }
+    }
+    if (this.show_only_annotation_from_user){
+        _list = _list.filter(function(_annotation){
+           return _annotation.creator == _this.show_only_annotation_from_user;
+        });
+    }
     if (this.limit_count) {
         /* Get the n annotations closest to current timecode */
         _list = _list.sortBy(function(_annotation) {
@@ -188,13 +249,13 @@
                 _thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail);
             // Update : display creator
             if (_annotation.creator) {
-            	_title = _annotation.creator;
+                _title = _annotation.creator;
             }
             if (_annotation.title) {
-            	var tempTitle = _annotation.title;
-            	if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){
-            		_title = "";
-            	}
+                var tempTitle = _annotation.title;
+                if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){
+                    _title = "";
+                }
                 _title = _title + ( (_title=="") ? "" : ": ") + _annotation.title;
             }
             var _bgcolor;
@@ -204,6 +265,16 @@
                     _bgcolor = _polemic.background_color;
                 }
             });
+            var _created = false;
+            if (_this.show_creation_date) {
+                _created = _annotation.created.toLocaleDateString()+", "+_annotation.created.toLocaleTimeString();
+            }
+            if(this.tags == true){
+                var _tags = _annotation.getTagTexts();
+            }
+            else {
+                var _tags = false;
+            }
             var _data = {
                 id : _annotation.id,
                 media_id : _annotation.getMedia().id,
@@ -211,9 +282,11 @@
                 hdescription : IriSP.textFieldHtml(_description),
                 begin : _annotation.begin.toString(),
                 end : _annotation.end.toString(),
+                created : _created,
+                show_timecode : _this.show_timecode,
                 thumbnail : _thumbnail,
                 url : _url,
-                tags : _annotation.getTagTexts(),
+                tags : _tags,
                 specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""),
                 l10n: _this.l10n
             };
@@ -263,10 +336,10 @@
                 })
                 .appendTo(_this.list_$);
             IriSP.attachDndData(_el.find("[draggable]"), {
-            	title: _title,
-            	description: _description,
-            	uri: _url,
-            	image: _annotation.thumbnail
+                title: _title,
+                description: _description,
+                uri: _url,
+                image: _annotation.thumbnail
             });
             _el.on("remove", function() {
                 _annotation.off("select", _onselect);
@@ -315,9 +388,35 @@
             }
         }
     }
+    
     return _list.length;
 };
 
+IriSP.Widgets.AnnotationsList.prototype.hide = function() {
+    if (this.visible){
+        this.visible = false;
+        this.widget_$.slideUp()
+    }
+}
+
+IriSP.Widgets.AnnotationsList.prototype.show = function() {
+    if(!this.visible){
+        this.visible = true;
+        this.widget_$.slideDown()
+    }
+}
+
+
+IriSP.Widgets.AnnotationsList.prototype.toggle = function() {
+    if (!this.always_visible) {
+        if (this.visible) {
+            this.hide();
+        } else {
+            this.show();
+        }
+    }
+};
+
 IriSP.Widgets.AnnotationsList.prototype.draw = function() {
     
     this.jwplayers = {};
@@ -328,6 +427,7 @@
     var _this = this;
         
     this.list_$ = this.$.find(".Ldt-AnnotationsList-ul");
+    this.widget_$ = this.$.find(".Ldt-AnnotationsListWidget");
     
     
     this.source.getAnnotations().on("search", function(_text) {
@@ -380,7 +480,11 @@
         }, this.refresh_interval);
     }
     
-    this.onMdpEvent("createAnnotationWidget.addedAnnotation");
+    this.onMdpEvent("AnnotationsList.toggle","toggle");
+    this.onMdpEvent("AnnotationsList.hide", "hide");
+    this.onMdpEvent("AnnotationsList.show", "show");
+    
+    this.onMdpEvent("createAnnotationWidget.addedAnnotation", "refresh");
     var _events = [
         "timeupdate",
         "seeked",
@@ -391,5 +495,10 @@
     }
     
     this.throttledRefresh();
-
+    
+    this.visible = true;
+    if (!this.start_visible){
+        this.hide();
+    }
+    
 };
--- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js	Thu Jul 16 12:59:15 2015 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js	Sat Jul 18 14:11:23 2015 +0200
@@ -9,12 +9,14 @@
 IriSP.Widgets.CreateAnnotation.prototype.defaults = {
     show_title_field : true,
     show_creator_field : true,
+    creator_field_readonly : false,
     start_visible : true,
     always_visible : false,
     show_slice : true,
     show_arrow : true,
     show_mic_record: false,
     show_mic_play: false,
+    show_time: true,
     minimize_annotation_widget : true,
     creator_name : "",
     creator_avatar : "",
@@ -41,9 +43,12 @@
     }],
     slice_annotation_type: "chap",
     annotation_type: "Contributions",
+    post_at_segment_time: false,
+    segment_annotation_type: "chap",
     api_serializer: "ldt_annotate",
     api_endpoint_template: "",
     api_method: "POST",
+    project_id: "",
     after_send_timeout: 0,
     close_after_send: false,
     tag_prefix: "#"
@@ -101,9 +106,9 @@
     + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">'
     + '<h3><span class="Ldt-CreateAnnotation-h3Left">{{l10n.annotate_video}}{{#show_title_field}}</span></h3>'
     + '<h3><span class="Ldt-CreateAnnotation-h3Left"><input class="Ldt-CreateAnnotation-Title empty" placeholder="{{l10n.type_title}}" />{{/show_title_field}}'
-    + '<span class="Ldt-CreateAnnotation-Times"> {{#show_slice}}{{l10n.from_time}} {{/show_slice}}{{^show_slice}}{{l10n.at_time}} {{/show_slice}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>'
+    + '{{#show_time}}<span class="Ldt-CreateAnnotation-Times"> {{#show_slice}}{{l10n.from_time}} {{/show_slice}}{{^show_slice}}{{l10n.at_time}} {{/show_slice}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>{{/show_time}}'
     + '{{#show_slice}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">{{end}}</span>{{/show_slice}}</span></span>'
-    + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator empty" value="{{creator_name}}" />{{/show_creator_field}}</h3>'
+    + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator empty" value="{{creator_name}}" {{#creator_field_readonly}}readonly{{/creator_field_readonly}}/>{{/show_creator_field}}</h3>'
     + '<textarea class="Ldt-CreateAnnotation-Description empty" placeholder="{{l10n.type_description}}"></textarea>'
     + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>'
     + '<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{l10n.submit}}" />'
@@ -252,6 +257,8 @@
     }
     
     this.onMdpEvent("CreateAnnotation.toggle","toggle");
+    this.onMdpEvent("CreateAnnotation.hide", "hide");
+    this.onMdpEvent("CreateAnnotation.show", "show");
     this.$.find("form").submit(this.functionWrapper("onSubmit"));
 };
 
@@ -261,34 +268,38 @@
 }
 
 IriSP.Widgets.CreateAnnotation.prototype.show = function() {
-    this.visible = true;
-    this.showScreen('Main');
-    this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666").addClass("empty");
-    if (this.show_title_field) {
-        this.$.find(".Ldt-CreateAnnotation-Title").val("").css("border-color", "#666666").addClass("empty");
-    }
-    if (this.show_creator_field) {
-        this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666");
-        if (!this.creator_name) {
-            this.$.find(".Ldt-CreateAnnotation-Creator").addClass("empty");
+    if (!this.visible){
+        this.visible = true;
+        this.showScreen('Main');
+        this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666").addClass("empty");
+        if (this.show_title_field) {
+            this.$.find(".Ldt-CreateAnnotation-Title").val("").css("border-color", "#666666").addClass("empty");
         }
-    }
-    this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected");
-    this.$.slideDown();
-    if (this.minimize_annotation_widget) {
-        this.player.trigger("Annotation.minimize");
+        if (this.show_creator_field) {
+            this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666");
+            if (!this.creator_name) {
+                this.$.find(".Ldt-CreateAnnotation-Creator").addClass("empty");
+            }
+        }
+        this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected");
+        this.$.slideDown();
+        if (this.minimize_annotation_widget) {
+            this.player.trigger("Annotation.minimize");
+        }
     }
 };
 
 IriSP.Widgets.CreateAnnotation.prototype.hide = function() {
-    if (this.recorder) {
-        this.recorder.stopRecord();
-    }
-    if (!this.always_visible) {
-        this.visible = false;
-        this.$.slideUp();
-        if (this.minimize_annotation_widget) {
-            this.player.trigger("Annotation.maximize");
+    if (this.visible){
+        if (this.recorder) {
+            this.recorder.stopRecord();
+        }
+        if (!this.always_visible) {
+            this.visible = false;
+            this.$.slideUp();
+            if (this.minimize_annotation_widget) {
+                this.player.trigger("Annotation.maximize");
+            }
         }
     }
 };
@@ -401,13 +412,33 @@
      * ATTENTION: Si nous sommes sur un MASHUP, ces éléments doivent se référer AU MEDIA D'ORIGINE
      * */
     _annotation.setMedia(this.source.currentMedia.id); /* Id du média annoté */
-    _annotation.setBegin(this.begin); /*Timecode de début */
-    _annotation.setEnd(this.end); /* Timecode de fin */
-   
+    
+    if (this.post_at_segment_time){
+        var _currentTime = this.media.getCurrentTime() 
+        var _segmentsAnnotations = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type)
+        var _currentSegments = _segmentsAnnotations.filter(function(_segment){
+            return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
+        });
+        if (_currentSegments.length == 0){
+            _annotation.setBegin(this.begin); /* Timecode de début du widget */
+            _annotation.setEnd(this.end); /* Timecode de fin du widget */
+        }
+        else {
+            _annotation.setBegin(_currentSegments[0].begin); /* Timecode de début du segment */
+            _annotation.setEnd(_currentSegments[0].end); /* Timecode de fin du segment */
+        }
+    }
+    else {
+        _annotation.setBegin(this.begin); /*Timecode de début du widget */
+        _annotation.setEnd(this.end); /* Timecode de fin du widget */
+    }
     _annotation.setAnnotationType(_annotationType.id); /* Id du type d'annotation */
     if (this.show_title_field) {
         /* Champ titre, seulement s'il est visible */
         _annotation.title = this.$.find(".Ldt-CreateAnnotation-Title").val();
+    }if (this.project_id != ""){
+    	/* Champ id projet, seulement si on l'a renseigné dans la config */
+    	_annotation.project_id = this.project_id;
     }
     _annotation.created = new Date(); /* Date de création de l'annotation */
     _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); /* Champ description */
@@ -449,7 +480,6 @@
     }
     _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */
     _export.addList("annotation",_exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */
-    
     var _this = this;
     /* Envoi de l'annotation via AJAX au serveur ! */
     IriSP.jQuery.ajax({
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CurrentSegmentInfobox.css	Sat Jul 18 14:11:23 2015 +0200
@@ -0,0 +1,48 @@
+.Ldt-CurrentSegmentInfobox{
+	background: url(img/pinstripe.png);
+	width: 535px;
+	max-height: 280px;
+	margin: 0px;
+	margin-top: 4px;
+	border-style: solid;
+	border-width: 1px;
+	border-color: #b7b7b7;
+}
+
+.Ldt-CurrentSegmentInfobox-Element{
+	margin: 5px;
+	vertical-align: top;
+}
+
+.Ldt-CurrentSegmentInfobox-Tags-Ul{
+	list-style: none;
+	margin: 2px;
+}
+
+.Ldt-CurrentSegmentInfobox-Tags-Li{
+	display: inline-block;
+	background-color: #ffffff;
+	margin: 2px;
+	padding: 2px;
+	border: solid 1px;
+	border-color: #aeaeae;
+}
+
+.Ldt-CurrentSegmentInfobox-Title{
+	color: #0068c4;
+    font-size: 15px;
+    font-weight: bold;
+}
+
+.Ldt-CurrentSegmentInfobox-Description{
+	font-size: 13px;
+	font-weight: bold;
+}
+
+.Ldt-CurrentSegmentInfobox-Tags{
+}
+
+.Ldt-CurrentSegmentInfobox-NoSegment{
+	font-size: 15px;
+	font-weight: bold;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CurrentSegmentInfobox.js	Sat Jul 18 14:11:23 2015 +0200
@@ -0,0 +1,76 @@
+/* Widget displays info on the current segment, with possibility of config for editing description and tags */
+
+IriSP.Widgets.CurrentSegmentInfobox = function(player, config){
+    IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.defaults = {
+    annotation_type: "chap",
+    readonly: true,
+    empty_message: false
+};
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.template = 
+    "<div class='Ldt-CurrentSegmentInfobox'>" 
+    + "    <div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Title'>{{title}}</div>" 
+    + "    <div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Description'>{{description}}</div>" 
+    + "    <div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-Tags'>"
+    + '        {{#tags.length}}'
+    + '        <ul class="Ldt-CurrentSegmentInfobox-Tags-Ul">'
+    + '        {{#tags}}'
+    + '            {{#.}}'
+    + '            <li class="Ldt-CurrentSegmentInfobox-Tags-Li">'
+    + '                <span>{{.}}</span>'
+    + '            </li>'
+    + '            {{/.}}'
+    + '        {{/tags}}'
+    + '        </ul>'
+    + '        {{/tags.length}}'
+    + "    </div>" 
+    + "</div>"
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.messages = {
+    fr : {
+        empty : "Le player vidéo ne lit actuellement aucun segment"
+    },
+    en: {
+        empty: "The player currently doesn't read any segment"
+    }
+}    
+    
+IriSP.Widgets.CurrentSegmentInfobox.prototype.draw = function() {
+    var _this = this;
+    this.segments = this.getWidgetAnnotations();
+    
+    this.renderTemplate();
+    this.refresh();
+    
+    this.onMediaEvent("timeupdate", "refresh");
+}
+
+IriSP.Widgets.CurrentSegmentInfobox.prototype.refresh = function() {
+    var _list = this.segments;
+    
+    _currentTime = this.media.getCurrentTime();
+    _list = _list.filter(function(_segment){
+        return (_segment.begin <= _currentTime && _segment.end >= _currentTime);
+    })
+    if (_list.length > 0){
+        _currentSegment = _list[0];
+        _data = {
+            title: _currentSegment.title,
+            description : _currentSegment.description,
+            tags : _currentSegment.getTagTexts()
+        }
+        this.$.html(Mustache.to_html(this.template, _data))
+    }
+    else {
+        var _empty_message = this.l10n.empty
+        if (this.empty_message) {
+            _empty_message = this.empty_message
+        }
+        this.$.find(".Ldt-CurrentSegmentInfobox").html("<div class='Ldt-CurrentSegmentInfobox-Element Ldt-CurrentSegmentInfobox-NoSegment'>"+_empty_message+"</div>");
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LatestAnnotation.css	Sat Jul 18 14:11:23 2015 +0200
@@ -0,0 +1,39 @@
+.Ldt-LatestAnnotation{
+	background: url(img/pinstripe.png);
+	width: 535px;
+	max-height: 180px;
+	margin: 0px;
+	margin-top: 4px;
+	border-style: solid;
+	border-width: 1px;
+	border-color: #b7b7b7;
+}
+
+.Ldt-LatestAnnotation-Element{
+	margin: 5px;
+	display: inline-block;
+	vertical-align: top;
+}
+
+.Ldt-LatestAnnotation-Box{
+	background-color: #ffffff;
+	margin: 3px;
+}
+
+.Ldt-LatestAnnotation-CreationDate{
+	color: #f7268e;
+}
+
+.Ldt-LatestAnnotation-Content{
+}
+
+.Ldt-LatestAnnotation-Title{
+	color: #0068c4;
+    font-size: 14px;
+    font-weight: bold;
+}
+
+.Ldt-LatestAnnotation-NoAnnotation{
+	font-size: 14px;
+    font-weight: bold;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LatestAnnotation.js	Sat Jul 18 14:11:23 2015 +0200
@@ -0,0 +1,138 @@
+/* Widget that displays the last annotation that was posted, optionally for current segment, optionally for a given username */
+
+IriSP.Widgets.LatestAnnotation = function(player, config){
+    IriSP.Widgets.Widget.call(this, player, config);
+};
+
+IriSP.Widgets.LatestAnnotation.prototype = new IriSP.Widgets.Widget();
+
+IriSP.Widgets.LatestAnnotation.prototype.defaults = {
+    from_user: false,
+    filter_by_segment: false,
+    segments_annotation_type: "chap",
+    hide_without_segment: false,
+    annotation_type: "contribution",
+    /*
+     * Set to a username if you only want to display annotations from a given user
+     */
+    show_only_annotation_from_user: false,
+    empty_message: false,
+    starts_hidden: false,
+};
+
+IriSP.Widgets.LatestAnnotation.prototype.template = 
+    "<div class='Ldt-LatestAnnotation'>"
+    + "</div>";
+
+IriSP.Widgets.LatestAnnotation.prototype.annotationTemplate =
+    "<div class='Ldt-LatestAnnotation-Box'>"
+    + "    <div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-CreationDate'>{{{annotation_created}}}</div>" 
+    + "    <div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-Title'>{{{annotation_creator}}}{{#annotation_title}}: {{{annotation_title}}}{{/annotation_title}}</div>" 
+    + "    <div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-Content'>"
+    +         "{{{annotation_content}}}"
+    + "    </div>"
+    + "</div>"
+
+IriSP.Widgets.LatestAnnotation.prototype.draw = function(){
+    var _this = this;
+    
+    this.renderTemplate();
+    
+    this.annotationContainer_$ = this.$.find('.Ldt-LatestAnnotation');
+    
+    this.onMediaEvent("timeupdate", "refresh");
+    
+    if (this.starts_hidden){
+        this.visible = true;
+        this.hide();
+    }
+    else{
+        this.visible = false;
+        this.show();
+    }
+    
+    this.refresh();
+}
+
+IriSP.Widgets.LatestAnnotation.prototype.messages = {
+    fr : {
+        empty : "Aucune annotation à afficher"
+    },
+    en: {
+        empty: "No annotation to display"
+    }
+}
+
+IriSP.Widgets.LatestAnnotation.prototype.refresh = function(){ 
+    var _currentTime = this.media.getCurrentTime() 
+    var _segmentsAnnotations = this.source.getAnnotationsByTypeTitle(this.segments_annotation_type)
+    var _currentSegments = _segmentsAnnotations.filter(function(_segment){
+        return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
+    });
+    if (this.hide_without_segment){
+        if (_currentSegments.length == 0){
+            if (this.visible){
+                this.hide()
+            }
+        }
+        else {
+            if (!this.visible){
+                this.show()
+            }
+        }
+    }
+    if (this.visible){
+        var _list = this.getWidgetAnnotations();
+        if(this.filter_by_segment){
+            if (_currentSegments.length == 0) {
+                _list = _list.filter(function(_annotation){
+                    return false;
+                });
+            }
+            else {
+                _list = _list.filter(function(_annotation){
+                    _annotationTime = (_annotation.begin+_annotation.end)/2;
+                    return (_currentSegments[0].begin <= _annotationTime && _currentSegments[0].end >= _annotationTime);
+                });
+            }
+            _list.sortBy(function(_annotation){
+                return _annotation.created;
+            });
+            
+            var _latestAnnotation = false;
+            var _html="";
+            if (_list.length != 0){
+                _latestAnnotation = _list.pop();
+                _html = Mustache.to_html(this.annotationTemplate, {
+                    annotation_created: _latestAnnotation.created.toLocaleDateString()+", "+_latestAnnotation.created.toLocaleTimeString(),
+                    annotation_creator: _latestAnnotation.creator,
+                    annotation_title: _latestAnnotation.title,
+                    annotation_content: _latestAnnotation.description,
+                });
+            }
+            else {
+                var _empty_message = this.l10n.empty
+                if (this.empty_message) {
+                    _empty_message = this.empty_message
+                }
+                _html = "<div class='Ldt-LatestAnnotation-Element Ldt-LatestAnnotation-NoAnnotation'>"+_empty_message+"</div>";
+            }
+            this.annotationContainer_$.html(_html);
+            
+        }
+    }
+}
+
+IriSP.Widgets.LatestAnnotation.prototype.hide = function() {
+    if (this.visible){
+        this.visible = false;
+        this.annotationContainer_$.hide()
+    }
+}
+
+IriSP.Widgets.LatestAnnotation.prototype.show = function() {
+    if(!this.visible){
+        this.visible = true;
+        this.annotationContainer_$.show()
+    }
+}
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Thu Jul 16 12:59:15 2015 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Sat Jul 18 14:11:23 2015 +0200
@@ -1695,7 +1695,7 @@
                 if (typeof _data.content.img !== "undefined" && _data.content.img.src !== "undefined") {
                     _res.thumbnail = _data.content.img.src;
                 }
-                _res.created = IriSP.Model.isoToDate(_data.meta["dc:created"]);
+                _res.created = IriSP.Model.isoToDate(_data.created);
                 if (typeof _data.color !== "undefined") {
                     var _c = parseInt(_data.color).toString(16);
                     while (_c.length < 6) {
@@ -1915,6 +1915,7 @@
             },
             tags: _data.getTagTexts(),
             media: _data.getMedia().id,
+            project: _data.project_id,
             type_title: _annType.title,
             type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id ),
             meta: {