1 Rkns.Bins.LdtJson = Rkns.Utils.inherit(Rkns.Bins._Base); |
1 Rkns.Bins.LdtJson = Rkns.Utils.inherit(Rkns.Bins._Base); |
2 |
2 |
3 Rkns.Bins.LdtJson.prototype.tagTemplate = Rkns._.template( |
3 Rkns.Bins.LdtJson.prototype.tagTemplate = Rkns._.template( |
4 '<li class="Rk-Bin-Item" data-uri="http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/search/?search=<%=encodedtitle%>&field=all" data-title="<%-title%>" data-description="Tag \'<%-title%>\'">' |
4 '<li class="Rk-Bin-Item" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/search/?search=<%=encodedtitle%>&field=all" data-title="<%-title%>" data-description="Tag \'<%-title%>\'">' |
5 + '<div class="Rk-Ldt-Icon Rk-Ldt-TagIcon"></div><h4><%-title%></h4></li>' |
5 + '<div class="Rk-Ldt-Icon Rk-Ldt-TagIcon"></div><h4><%-title%></h4></li>' |
6 ); |
6 ); |
7 |
7 |
8 Rkns.Bins.LdtJson.prototype.annotationTemplate = Rkns._.template( |
8 Rkns.Bins.LdtJson.prototype.annotationTemplate = Rkns._.template( |
9 '<li class="Rk-Bin-Item" data-uri="http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">' |
9 '<li class="Rk-Bin-Item" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">' |
10 + '<div class="Rk-Ldt-Icon Rk-Ldt-<%=type%>Icon"></div><h4><%-title%></h4><p><%-description%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p></li>' |
10 + '<div class="Rk-Ldt-Icon Rk-Ldt-<%=type%>Icon"></div><h4><%-title%></h4><p><%-description%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p></li>' |
11 ); |
11 ); |
12 |
12 |
13 Rkns.Bins.LdtJson.prototype._init = function(_renkan, _opts) { |
13 Rkns.Bins.LdtJson.prototype._init = function(_renkan, _opts) { |
14 this.proj_id = _opts.project_id; |
14 this.proj_id = _opts.project_id; |
|
15 this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; |
15 this.title_$.html(_opts.title); |
16 this.title_$.html(_opts.title); |
16 var _this = this; |
17 var _this = this; |
17 function convertTC(_ms) { |
18 function convertTC(_ms) { |
18 function pad(_n) { |
19 function pad(_n) { |
19 var _res = _n.toString(); |
20 var _res = _n.toString(); |
32 } |
33 } |
33 _res += pad(_minutes) + ':' + pad(_seconds); |
34 _res += pad(_minutes) + ':' + pad(_seconds); |
34 return _res; |
35 return _res; |
35 } |
36 } |
36 Rkns.$.getJSON( |
37 Rkns.$.getJSON( |
37 'http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/cljson/id/' + this.proj_id + '?callback=?', |
38 this.ldt_platform + 'ldtplatform/ldt/cljson/id/' + this.proj_id + '?callback=?', |
38 function(_data) { |
39 function(_data) { |
39 var _html = '<li><h3>Tags</h3></li>', |
40 var _html = '<li><h3>Tags</h3></li>', |
40 _projtitle = _data.meta["dc:title"]; |
41 _projtitle = _data.meta["dc:title"]; |
41 _this.title_$.html('LDT Project: "' + _projtitle + '"'); |
42 _this.title_$.html('LDT Project: "' + _projtitle + '"'); |
42 _html += Rkns._(_data.tags).map(function(_tag) { |
43 _html += Rkns._(_data.tags).map(function(_tag) { |
43 var _title = _tag.meta["dc:title"] |
44 var _title = _tag.meta["dc:title"] |
44 return _this.tagTemplate({ |
45 return _this.tagTemplate({ |
|
46 ldt_platform: _this.ldt_platform, |
45 title: _title, |
47 title: _title, |
46 encodedtitle : encodeURIComponent(_title) |
48 encodedtitle : encodeURIComponent(_title) |
47 }) |
49 }) |
48 }).join(""); |
50 }).join(""); |
49 _html += '<li><h3>Annotations</h3></li>'; |
51 _html += '<li><h3>Annotations</h3></li>'; |
50 _html += Rkns._(_data.annotations).map(function(_annotation) { |
52 _html += Rkns._(_data.annotations).map(function(_annotation) { |
51 var _description = _annotation.content.description, |
53 var _description = _annotation.content.description, |
52 _title = _annotation.content.title.replace(_description,""), |
54 _title = _annotation.content.title.replace(_description,""), |
53 _duration = _annotation.end - _annotation.begin; |
55 _duration = _annotation.end - _annotation.begin; |
54 return _this.annotationTemplate({ |
56 return _this.annotationTemplate({ |
|
57 ldt_platform: _this.ldt_platform, |
55 title: _title, |
58 title: _title, |
56 description: _description, |
59 description: _description, |
57 start: convertTC(_annotation.begin), |
60 start: convertTC(_annotation.begin), |
58 end: convertTC(_annotation.end), |
61 end: convertTC(_annotation.end), |
59 duration: convertTC(_duration), |
62 duration: convertTC(_duration), |