5 |
5 |
6 var Ldt = Rkns.Ldt = {}; |
6 var Ldt = Rkns.Ldt = {}; |
7 |
7 |
8 var Bin = Ldt.Bin = function(_renkan, _opts) { |
8 var Bin = Ldt.Bin = function(_renkan, _opts) { |
9 if (_opts.ldt_type) { |
9 if (_opts.ldt_type) { |
10 var resclass = Ldt[_opts.ldt_type+"Bin"]; |
10 var Resclass = Ldt[_opts.ldt_type+"Bin"]; |
11 if (resclass) { |
11 if (Resclass) { |
12 return new resclass(_renkan, _opts); |
12 return new Resclass(_renkan, _opts); |
13 } |
13 } |
14 } |
14 } |
15 console.error("No such LDT Bin Type"); |
15 console.error("No such LDT Bin Type"); |
16 }; |
16 }; |
17 |
17 |
18 var ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin); |
18 var ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin); |
19 |
19 |
20 ProjectBin.prototype.tagTemplate = _.template( |
20 ProjectBin.prototype.tagTemplate = _.template( |
21 '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(static_url+\'img/ldt-tag.png\') %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/search/?search=<%=encodedtitle%>&field=all" data-title="<%-title%>" data-description="Tag \'<%-title%>\'">' |
21 '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(static_url+\'img/ldt-tag.png\') %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/search/?search=<%=encodedtitle%>&field=all" data-title="<%-title%>" data-description="Tag \'<%-title%>\'">' + |
22 + '<img class="Rk-Ldt-Tag-Icon" src="<%-static_url%>img/ldt-tag.png" /><h4><%=htitle%></h4><div class="Rk-Clear"></div></li>' |
22 '<img class="Rk-Ldt-Tag-Icon" src="<%-static_url%>img/ldt-tag.png" /><h4><%=htitle%></h4><div class="Rk-Clear"></div></li>' |
23 ); |
23 ); |
24 |
24 |
25 ProjectBin.prototype.annotationTemplate = _.template( |
25 ProjectBin.prototype.annotationTemplate = _.template( |
26 '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(image) %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">' |
26 '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(image) %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">' + |
27 + '<img class="Rk-Ldt-Annotation-Icon" src="<%=image%>"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class="Rk-Clear"></div></li>' |
27 '<img class="Rk-Ldt-Annotation-Icon" src="<%=image%>"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class="Rk-Clear"></div></li>' |
28 ); |
28 ); |
29 |
29 |
30 ProjectBin.prototype._init = function(_renkan, _opts) { |
30 ProjectBin.prototype._init = function(_renkan, _opts) { |
31 this.renkan = _renkan; |
31 this.renkan = _renkan; |
32 this.proj_id = _opts.project_id; |
32 this.proj_id = _opts.project_id; |
59 _res += pad(_hours) + ':'; |
59 _res += pad(_hours) + ':'; |
60 } |
60 } |
61 _res += pad(_minutes) + ':' + pad(_seconds); |
61 _res += pad(_minutes) + ':' + pad(_seconds); |
62 return _res; |
62 return _res; |
63 } |
63 } |
64 |
64 |
65 var _html = '<li><h3>Tags</h3></li>', |
65 var _html = '<li><h3>Tags</h3></li>', |
66 _projtitle = this.data.meta["dc:title"], |
66 _projtitle = this.data.meta["dc:title"], |
67 _this = this, |
67 _this = this, |
68 count = 0; |
68 count = 0; |
69 _this.title_$.text('LDT Project: "' + _projtitle + '"'); |
69 _this.title_$.text('LDT Project: "' + _projtitle + '"'); |
89 return; |
89 return; |
90 } |
90 } |
91 count++; |
91 count++; |
92 var _duration = _annotation.end - _annotation.begin, |
92 var _duration = _annotation.end - _annotation.begin, |
93 _img = ( |
93 _img = ( |
94 (_annotation.content && _annotation.content.img && _annotation.content.img.src) |
94 (_annotation.content && _annotation.content.img && _annotation.content.img.src) ? |
95 ? _annotation.content.img.src |
95 _annotation.content.img.src : |
96 : ( _duration ? _this.renkan.options.static_url+"img/ldt-segment.png" : _this.renkan.options.static_url+"img/ldt-point.png" ) |
96 ( _duration ? _this.renkan.options.static_url+"img/ldt-segment.png" : _this.renkan.options.static_url+"img/ldt-point.png" ) |
97 ); |
97 ); |
98 _html += _this.annotationTemplate({ |
98 _html += _this.annotationTemplate({ |
99 ldt_platform: _this.ldt_platform, |
99 ldt_platform: _this.ldt_platform, |
100 title: _title, |
100 title: _title, |
101 htitle: highlight(_title), |
101 htitle: highlight(_title), |
108 annotationid: _annotation.id, |
108 annotationid: _annotation.id, |
109 image: _img, |
109 image: _img, |
110 static_url: _this.renkan.options.static_url |
110 static_url: _this.renkan.options.static_url |
111 }); |
111 }); |
112 }); |
112 }); |
113 |
113 |
114 this.main_$.html(_html); |
114 this.main_$.html(_html); |
115 if (!search.isempty && count) { |
115 if (!search.isempty && count) { |
116 this.count_$.text(count).show(); |
116 this.count_$.text(count).show(); |
117 } else { |
117 } else { |
118 this.count_$.hide(); |
118 this.count_$.hide(); |
159 }; |
159 }; |
160 |
160 |
161 var ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin); |
161 var ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin); |
162 |
162 |
163 ResultsBin.prototype.segmentTemplate = _.template( |
163 ResultsBin.prototype.segmentTemplate = _.template( |
164 '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(image) %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">' |
164 '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(image) %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">' + |
165 + '<img class="Rk-Ldt-Annotation-Icon" src="<%=image%>"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class="Rk-Clear"></div></li>' |
165 '<img class="Rk-Ldt-Annotation-Icon" src="<%=image%>"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class="Rk-Clear"></div></li>' |
166 ); |
166 ); |
167 |
167 |
168 ResultsBin.prototype._init = function(_renkan, _opts) { |
168 ResultsBin.prototype._init = function(_renkan, _opts) { |
169 this.renkan = _renkan; |
169 this.renkan = _renkan; |
170 this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; |
170 this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; |
201 _res += pad(_hours) + ':'; |
201 _res += pad(_hours) + ':'; |
202 } |
202 } |
203 _res += pad(_minutes) + ':' + pad(_seconds); |
203 _res += pad(_minutes) + ':' + pad(_seconds); |
204 return _res; |
204 return _res; |
205 } |
205 } |
206 |
206 |
207 var _html = '', |
207 var _html = '', |
208 _this = this, |
208 _this = this, |
209 count = 0; |
209 count = 0; |
210 _(this.data.objects).each(function(_segment) { |
210 _(this.data.objects).each(function(_segment) { |
211 var _description = _segment['abstract'], |
211 var _description = _segment.abstract, |
212 _title = _segment.title; |
212 _title = _segment.title; |
213 if (!search.isempty && !search.test(_title) && !search.test(_description)) { |
213 if (!search.isempty && !search.test(_title) && !search.test(_description)) { |
214 return; |
214 return; |
215 } |
215 } |
216 count++; |
216 count++; |
217 var _duration = _segment.duration, |
217 var _duration = _segment.duration, |
218 _begin = _segment.start_ts, |
218 _begin = _segment.start_ts, |
219 _end = + _segment.duration + _begin, |
219 _end = + _segment.duration + _begin, |
220 _img = ( |
220 _img = ( |
221 _duration |
221 _duration ? |
222 ? _this.renkan.options.static_url + "img/ldt-segment.png" |
222 _this.renkan.options.static_url + "img/ldt-segment.png" : |
223 : _this.renkan.options.static_url + "img/ldt-point.png" |
223 _this.renkan.options.static_url + "img/ldt-point.png" |
224 ); |
224 ); |
225 _html += _this.segmentTemplate({ |
225 _html += _this.segmentTemplate({ |
226 ldt_platform: _this.ldt_platform, |
226 ldt_platform: _this.ldt_platform, |
227 title: _title, |
227 title: _title, |
228 htitle: highlight(_title), |
228 htitle: highlight(_title), |
236 //cuttingid: _segment.cutting_id, |
236 //cuttingid: _segment.cutting_id, |
237 annotationid: _segment.element_id, |
237 annotationid: _segment.element_id, |
238 image: _img |
238 image: _img |
239 }); |
239 }); |
240 }); |
240 }); |
241 |
241 |
242 this.main_$.html(_html); |
242 this.main_$.html(_html); |
243 if (!search.isempty && count) { |
243 if (!search.isempty && count) { |
244 this.count_$.text(count).show(); |
244 this.count_$.text(count).show(); |
245 } else { |
245 } else { |
246 this.count_$.hide(); |
246 this.count_$.hide(); |