# HG changeset patch
# User hamidouk
# Date 1328540610 -3600
# Node ID cce3b4845f224a444520470319ec6dcf72924c5f
# Parent d2c99cb0318702424690dd9239b22af5b5216ba5
bug fixes. enabled tags.
diff -r d2c99cb03187 -r cce3b4845f22 src/ldt/ldt/static/ldt/js/LdtPlayer-release.js
--- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Mon Feb 06 11:52:17 2012 +0100
+++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Mon Feb 06 16:03:30 2012 +0100
@@ -1088,7 +1088,7 @@
};
IriSP.SparklineWidget_template = "
";
IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}";
-IriSP.annotationWidget_template = "{{! template for the annotation widget }}";
+IriSP.annotationWidget_template = "{{! template for the annotation widget }}";
IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}";
IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}";
IriSP.arrowWidget_template = "";
@@ -2431,7 +2431,10 @@
if (IriSP.null_or_undefined(annotations))
return;
+ /*
+ commented in case we wanted to discriminate against some annotation types.
var view_types = serializer.getIds("Contributions");
+ */
var l = [];
var media = this._serializer.currentMedia()["id"];
@@ -2525,6 +2528,7 @@
var begin = +annotation.begin / 1000;
var end = +annotation.end / 1000;
var duration = +this._serializer.currentMedia().meta["dc:duration"];
+ var tags = "";
var title_templ = "{{title}} - ( {{begin}} - {{end}} )";
var endstr = Mustache.to_html(title_templ, {title: title, begin: IriSP.secondsToTime(begin), end: IriSP.secondsToTime(end)});
@@ -2532,6 +2536,28 @@
this.selector.find(".Ldt-SaTitle").text(endstr);
this.selector.find(".Ldt-SaDescription").text(description);
+
+ if (!IriSP.null_or_undefined(annotation.tags) && !IriSP.null_or_undefined(this._serializer._data.tags)) {
+ /* save the tag id and keywords in a unique structure */
+ var tag_list = {};
+ for (var i = 0; i < this._serializer._data.tags.length; i++) {
+ var id = this._serializer._data.tags[i]["id"];
+ var keyword = this._serializer._data.tags[i]["meta"]["dc:title"];
+
+ tag_list[id] = keyword;
+ }
+
+ /* then browse the list of defined tags for the current annotation */
+ for (var i = 0; i < annotation.tags.length; i++) {
+ if (tag_list.hasOwnProperty(annotation.tags[i]["id-ref"]))
+ tags += tag_list[annotation.tags[i]["id-ref"]] + ", ";
+ }
+ }
+
+ tags = "Keywords: " + tags.slice(0, tags.length - 2);
+
+ this.selector.find(".Ldt-SaKeywords").text(tags);
+
// update sharing buttons
var defaults = IriSP.widgetsDefaults.AnnotationsWidget;
var text = defaults.share_text;
@@ -5426,7 +5452,11 @@
name = name.toUpperCase();
var e;
e = IriSP.underscore.find(this._data["annotation-types"],
- function(entry) { return (entry["dc:title"].toUpperCase().indexOf(name) !== -1) });
+ function(entry) {
+ if (IriSP.null_or_undefined(entry["dc:title"]))
+ return false;
+
+ return (entry["dc:title"].toUpperCase().indexOf(name) !== -1) });
if (typeof(e) === "undefined")
return;