Added a filter based on annotation user name for AnnotationList metadataplayer widget + Added a way to make the creator field readonly for CreateAnnotation widget (so you can define a given annotation creator name for the widget that the user can't change)
--- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Wed Jun 10 16:24:24 2015 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Wed Jun 10 18:36:40 2015 +0200
@@ -35,9 +35,15 @@
newest_first : false,
show_audio: true,
show_creation_date: false,
+ /*
+ * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget.
+ */
filter_by_segments: false,
- show_only_from_user: 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,
polemics : [{
keyword: "++",
background_color: "#c9ecc6"
@@ -173,8 +179,11 @@
return (_current_segments[0].begin <= _annotation_time && _current_segments[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 */
--- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js Wed Jun 10 16:24:24 2015 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js Wed Jun 10 18:36:40 2015 +0200
@@ -9,6 +9,7 @@
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,
@@ -104,7 +105,7 @@
+ '<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_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}}" />'