| author | durandn |
| Fri, 18 Sep 2015 15:04:39 +0200 | |
| changeset 1055 | b45522b1b2af |
| parent 1053 | 149a4ea20ea7 |
| child 1059 | 8158421193e3 |
| permissions | -rw-r--r-- |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
1 |
IriSP.Widgets.AnnotationsList = function(player, config) { |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
2 |
IriSP.Widgets.Widget.call(this, player, config); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
3 |
this.lastIds = []; |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
4 |
var _this = this; |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
5 |
this.throttledRefresh = IriSP._.throttle(function() { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
6 |
_this.refresh(false); |
| 983 | 7 |
}, 800); |
8 |
this.searchString = false; |
|
9 |
this.lastSearch = false; |
|
| 585 | 10 |
}; |
11 |
||
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
12 |
IriSP.Widgets.AnnotationsList.prototype = new IriSP.Widgets.Widget(); |
| 585 | 13 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
14 |
IriSP.Widgets.AnnotationsList.prototype.defaults = { |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
15 |
pre_draw_callback: function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
16 |
return this.importUsers(); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
17 |
}, |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
18 |
/* |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
19 |
* URL when the annotations are to be reloaded from an LDT-like segment API |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
20 |
* e.g. |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
21 |
* http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=? |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
22 |
*/ |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
23 |
ajax_url : false, |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
24 |
/* |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
25 |
* number of milliseconds before/after the current timecode when calling the |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
26 |
* segment API |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
27 |
*/ |
| 967 | 28 |
ajax_granularity : 600000, |
| 925 | 29 |
default_thumbnail : "", |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
30 |
/* |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
31 |
* URL when the annotation is not in the current project, e.g. |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
32 |
* http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}} |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
33 |
*/ |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
34 |
foreign_url : "", |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
35 |
annotation_type : false, |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
36 |
refresh_interval : 0, |
| 966 | 37 |
limit_count : 20, |
| 924 | 38 |
newest_first : false, |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
39 |
always_visible : false, |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
40 |
start_visible: true, |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
41 |
show_audio : true, |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
42 |
show_filters : false, |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
43 |
keyword_filter: true, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
44 |
date_filter: true, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
45 |
user_filter: true, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
46 |
segment_filter: true, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
47 |
latest_contributions_filter: false, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
48 |
current_day_filter: true, |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
49 |
show_header : false, |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
50 |
custom_header : false, |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
51 |
annotations_count_header : true, |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
52 |
show_creation_date : false, |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
53 |
show_timecode : true, |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
54 |
/* |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
55 |
* Only annotation in the current segment will be displayed. Designed to work with the Segments Widget. |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
56 |
*/ |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
57 |
allow_annotations_deletion: false, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
58 |
/* |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
59 |
* URL to call when deleting annotation. Expects a mustache template with {{annotation_id}}, ex /api/anotations/{{annotation_id}}/ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
60 |
*/ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
61 |
api_delete_endpoint : "", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
62 |
api_delete_method: "DELETE", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
63 |
api_users_endpoint: "", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
64 |
api_users_method: "GET", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
65 |
make_name_string_function: function(params){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
66 |
return params.username ? params.username : "Anonymous"; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
67 |
}, |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
68 |
filter_by_segments: false, |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
69 |
segment_filter: true, |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
70 |
segments_annotation_type: "chap", |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
71 |
/* |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
72 |
* Set to a username if you only want to display annotations from a given user |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
73 |
*/ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
74 |
show_only_annotation_from_user: false, |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
75 |
/* |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
76 |
* Show a text field that filter annotations by username |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
77 |
*/ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
78 |
tags : true, |
| 924 | 79 |
polemics : [{ |
80 |
keyword: "++", |
|
81 |
background_color: "#c9ecc6" |
|
82 |
},{ |
|
83 |
keyword: "--", |
|
84 |
background_color: "#f9c5c6" |
|
85 |
},{ |
|
86 |
keyword: "??", |
|
87 |
background_color: "#cec5f9" |
|
88 |
},{ |
|
89 |
keyword: "==", |
|
90 |
background_color: "#f9f4c6" |
|
91 |
}] |
|
| 585 | 92 |
}; |
93 |
||
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
94 |
IriSP.Widgets.AnnotationsList.prototype.importUsers = function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
95 |
if (!this.source.users_data){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
96 |
this.usernames = Array(); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
97 |
var _this = this, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
98 |
_list = this.getWidgetAnnotations(), |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
99 |
usernames_list_string = ""; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
100 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
101 |
_list.forEach(function(_annotation){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
102 |
if(_this.usernames.indexOf(_annotation.creator) == -1){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
103 |
_this.usernames.push(_annotation.creator); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
104 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
105 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
106 |
this.usernames.forEach(function(_username){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
107 |
usernames_list_string+=_username+"," |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
108 |
}) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
109 |
usernames_list_string = usernames_list_string.substring(0, usernames_list_string.length - 1); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
110 |
_url = Mustache.to_html(this.api_users_endpoint, {usernames_list_string: encodeURIComponent(usernames_list_string), usernames_list_length: this.usernames.length}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
111 |
return IriSP.jQuery.ajax({ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
112 |
async: false, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
113 |
url: _url, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
114 |
type: "GET", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
115 |
success: function(_data) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
116 |
_this.source.users_data = _data.objects |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
117 |
}, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
118 |
error: function(_xhr, _error, _thrown) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
119 |
console.log(_xhr) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
120 |
console.log(_error) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
121 |
console.log(_thrown) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
122 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
123 |
}) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
124 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
125 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
126 |
|
| 966 | 127 |
IriSP.Widgets.AnnotationsList.prototype.messages = { |
128 |
en: { |
|
129 |
voice_annotation: "Voice Annotation", |
|
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
130 |
now_playing: "Now playing...", |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
131 |
everyone: "Everyone", |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
132 |
header: "Annotations for this content", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
133 |
segment_filter: "All cuttings", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
134 |
latest_contributions: "Latest contributions", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
135 |
close_widget: "Close", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
136 |
confirm: "Confirm", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
137 |
cancel: "Cancel", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
138 |
annotation_deletion_delete: "You will delete this annotation : ", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
139 |
annotation_deletion_sending: "Your deletion request is being sent ... ", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
140 |
annotation_deletion_success: "The annotation has been deleted.", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
141 |
annotation_deletion_error: "There was an error contacting the server. The annotation has not been deleted." |
| 966 | 142 |
}, |
143 |
fr: { |
|
144 |
voice_annotation: "Annotation Vocale", |
|
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
145 |
now_playing: "Lecture en cours...", |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
146 |
everyone: "Tous", |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
147 |
header: "Annotations sur ce contenu", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
148 |
segment_filter: "Tous les segments", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
149 |
latest_contributions: "Dernières contributions", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
150 |
close_widget: "Fermer", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
151 |
confirm: "Confirmer", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
152 |
cancel: "Annuler", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
153 |
annotation_deletion_delete: "Vous allez supprimer cette annotation: ", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
154 |
annotation_deletion_sending: "Votre demande de suppression est en cours d'envoi ... ", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
155 |
annotation_deletion_success: "L'annotation a été supprimée.", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
156 |
annotation_deletion_error: "Une erreur s'est produite en contactant le serveur. L'annotation n'a pas été supprimée." |
| 966 | 157 |
} |
| 1013 | 158 |
}; |
| 966 | 159 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
160 |
IriSP.Widgets.AnnotationsList.prototype.template = |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
161 |
'{{#show_header}}<p class="Ldt-AnnotationsList-header">' |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
162 |
+ '{{#custom_header}}{{custom_header}}{{/custom_header}}' |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
163 |
+ '{{^custom_header}}{{l10n.header}}{{/custom_header}}' |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
164 |
+ '</p>{{/show_header}}' |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
165 |
+ '<div class="Ldt-AnnotationsListWidget">' |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
166 |
+ '<div class="Ldt-AnnotationsList-ScreenMain">' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
167 |
+ '{{#show_filters}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
168 |
+ '<div class="Ldt-AnnotationsList-Filters">' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
169 |
+ '{{#keyword_filter}}<input class="Ldt-AnnotationsList-filter-text" id="Ldt-AnnotationsList-keywordsFilter" type="text" value=""></input>{{/keyword_filter}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
170 |
+ '{{#user_filter}}<select class="Ldt-AnnotationsList-filter-dropdown" id="Ldt-AnnotationsList-userFilter"><option selected value="">{{l10n.everyone}}</option></select>{{/user_filter}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
171 |
+ '{{#date_filter}}<label class="Ldt-AnnotationsList-filter-date">Date: <input id="Ldt-AnnotationsList-dateFilter" type="text"></input></label>{{/date_filter}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
172 |
+ '{{#segment_filter}}<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox" id="Ldt-AnnotationsList-ignoreSegmentsFilter">{{l10n.segment_filter}}</label>{{/segment_filter}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
173 |
+ '{{#latest_contributions_filter}}<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox" id="Ldt-AnnotationsList-latestContributionsFilter">{{l10n.latest_contributions}}</label>{{/latest_contributions_filter}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
174 |
+ '</div>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
175 |
+ '{{/show_filters}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
176 |
+ '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
177 |
+ '<ul class="Ldt-AnnotationsList-ul">' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
178 |
+ '</ul>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
179 |
+ '</div>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
180 |
+ '{{#allow_annotations_deletion}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
181 |
+ '<div id="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenDelete">' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
182 |
+ '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
183 |
+ '<ul class="Ldt-AnnotationsList-ul-ToDelete"></ul>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
184 |
+ '{{l10n.annotation_deletion_delete}} <a class="Ldt-AnnotationsList-ConfirmDelete">{{l10n.confirm}}</a> <a class="Ldt-AnnotationsList-CancelDelete">{{l10n.cancel}}</a>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
185 |
+ '</div>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
186 |
+ '<div id="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenSending">' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
187 |
+ '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
188 |
+ '{{l10n.annotation_deletion_sending}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
189 |
+ '</div>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
190 |
+ '<div id="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenSuccess">' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
191 |
+ '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
192 |
+ '{{l10n.annotation_deletion_success}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
193 |
+ '</div>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
194 |
+ '<div id="{{id}}" class="Ldt-AnnotationsList-Screen Ldt-AnnotationsList-ScreenError">' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
195 |
+ '<a title="{{l10n.close_widget}}" class="Ldt-AnnotationsList-Close" href="#"></a>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
196 |
+ '{{l10n.annotation_deletion_error}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
197 |
+ '</div>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
198 |
+ '{{/allow_annotations_deletion}}' |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
199 |
+ '</div>'; |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
200 |
|
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
201 |
IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
202 |
'<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">' |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
203 |
+ '<div id="{{id}}" class="Ldt-AnnotationsList-ThumbContainer Ldt-AnnotationsList-Annotation-Screen Ldt-AnnotationsList-Annotation-ScreenMain">' |
| 993 | 204 |
+ '<a href="{{url}}" draggable="true">' |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
205 |
+ '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />' |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
206 |
+ '</a>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
207 |
+ '</div>' |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
208 |
+ '{{#allow_annotations_deletion}}' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
209 |
+ '<div id={{id}} class="Ldt-AnnotationsList-DeleteButton">✖</div>' |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
210 |
+ '{{/allow_annotations_deletion}}' |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
211 |
+ '{{#show_timecode}}<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>{{/show_timecode}}' |
| 993 | 212 |
+ '<h3 class="Ldt-AnnotationsList-Title" draggable="true">' |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
213 |
+ '<a {{#url}} href="{{url}}" {{/url}}>{{{htitle}}}</a>' |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
214 |
+ '</h3>' |
| 993 | 215 |
+ '<p class="Ldt-AnnotationsList-Description">{{{hdescription}}}</p>' |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
216 |
+ '{{#created}}' |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
217 |
+ '<div class="Ldt-AnnotationsList-CreationDate">{{{created}}}</div>' |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
218 |
+ '{{/created}}' |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
219 |
+ '{{#tags.length}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
220 |
+ '<ul class="Ldt-AnnotationsList-Tags">' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
221 |
+ '{{#tags}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
222 |
+ '{{#.}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
223 |
+ '<li class="Ldt-AnnotationsList-Tag-Li">' |
| 902 | 224 |
+ '<span>{{.}}</span>' |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
225 |
+ '</li>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
226 |
+ '{{/.}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
227 |
+ '{{/tags}}' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
228 |
+ '</ul>' |
|
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
229 |
+ '{{/tags.length}}' |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
230 |
+ '{{#audio}}<div class="Ldt-AnnotationsList-Play" data-annotation-id="{{id}}">{{l10n.voice_annotation}}</div>{{/audio}}' |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
231 |
+ '</li>'; |
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
232 |
|
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
233 |
// obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
234 |
// + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id; |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
235 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
236 |
IriSP.Widgets.AnnotationsList.prototype.ajaxSource = function() { |
| 957 | 237 |
var _currentTime = this.media.getCurrentTime(), |
238 |
_duration = this.media.duration; |
|
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
239 |
this.lastAjaxQuery = _currentTime; |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
240 |
var _url = Mustache.to_html(this.ajax_url, { |
| 916 | 241 |
media : this.source.currentMedia.id, |
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
242 |
begin : Math.max(0, _currentTime - this.ajax_granularity), |
|
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
243 |
end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity) |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
244 |
}); |
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
245 |
this.currentSource = this.player.loadMetadata(IriSP._.defaults({ |
|
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
246 |
"url" : _url |
|
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
247 |
}, this.metadata)); |
| 1013 | 248 |
}; |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
249 |
|
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
250 |
IriSP.Widgets.AnnotationsList.prototype.showScreen = function(_screenName) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
251 |
this.$.find('.Ldt-AnnotationsList-Screen' + _screenName).show() |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
252 |
.siblings().hide(); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
253 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
254 |
|
| 903 | 255 |
IriSP.Widgets.AnnotationsList.prototype.ajaxMashup = function() { |
| 957 | 256 |
var _currentTime = this.media.getCurrentTime(); |
257 |
var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime); |
|
| 916 | 258 |
if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) { |
259 |
this.lastMashupAnnotation = _currentAnnotation.id; |
|
| 903 | 260 |
var _currentMedia = _currentAnnotation.getMedia(), |
261 |
_url = Mustache.to_html(this.ajax_url, { |
|
| 916 | 262 |
media : _currentMedia.id, |
| 903 | 263 |
begin : Math.max(0, _currentAnnotation.annotation.begin.milliseconds - this.ajax_granularity), |
264 |
end : Math.min(_currentMedia.duration.milliseconds, _currentAnnotation.annotation.end.milliseconds + this.ajax_granularity) |
|
265 |
}); |
|
266 |
this.currentSource = this.player.loadMetadata(IriSP._.defaults({ |
|
267 |
"url" : _url |
|
268 |
}, this.metadata)); |
|
269 |
} |
|
| 1013 | 270 |
}; |
| 903 | 271 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
272 |
IriSP.Widgets.AnnotationsList.prototype.refresh = function(_forceRedraw) { |
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
273 |
_forceRedraw = (typeof _forceRedraw !== "undefined" && _forceRedraw); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
274 |
if (this.currentSource.status !== IriSP.Model._SOURCE_STATUS_READY) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
275 |
return 0; |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
276 |
} |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
277 |
var _this = this, |
| 957 | 278 |
_currentTime = this.media.getCurrentTime(); |
| 903 | 279 |
var _list = this.annotation_type ? this.currentSource.getAnnotationsByTypeTitle(this.annotation_type) : this.currentSource.getAnnotations(); |
280 |
if (this.mashupMode) { |
|
| 957 | 281 |
var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime); |
| 903 | 282 |
if (typeof _currentAnnotation !== "undefined") { |
| 965 | 283 |
_currentTime = _currentTime - _currentAnnotation.begin + _currentAnnotation.annotation.begin; |
| 916 | 284 |
var _mediaId = _currentAnnotation.getMedia().id; |
| 903 | 285 |
_list = _list.filter(function(_annotation) { |
| 916 | 286 |
return _annotation.getMedia().id === _mediaId; |
| 903 | 287 |
}); |
288 |
} |
|
289 |
} |
|
| 983 | 290 |
_list = _list.filter(function(_annotation) { |
291 |
return _annotation.found !== false; |
|
292 |
}); |
|
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
293 |
|
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
294 |
if ((this.filter_by_segments)&&(!(this.show_filters && this.segment_filter && this.ignoresegmentcheckbox_$[0].checked))) { |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
295 |
/* |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
296 |
* A given annotation is considered "in" segment if the middle of it is between the segment beginning and the segment end. |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
297 |
* Note this is meant to be used for "markings" annotations (not segments) |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
298 |
*/ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
299 |
_segmentsAnnotation = this.currentSource.getAnnotationsByTypeTitle(this.segments_annotation_type) |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
300 |
if (this.media.getTimeRange()){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
301 |
_currentSegments = _segmentsAnnotation.filter(function(_segment){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
302 |
return (_this.media.getTimeRange()[0] == _segment.begin && _this.media.getTimeRange()[1] == _segment.end) |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
303 |
}); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
304 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
305 |
else { |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
306 |
_currentSegments = _segmentsAnnotation.filter(function(_segment){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
307 |
return (_currentTime >= _segment.begin && _currentTime <= _segment.end) |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
308 |
}); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
309 |
} |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
310 |
if (_currentSegments.length == 0) { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
311 |
_list = _list.filter(function(_annotation){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
312 |
return false; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
313 |
}); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
314 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
315 |
else { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
316 |
_list = _list.filter(function(_annotation){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
317 |
_annotation_time = (_annotation.begin+_annotation.end)/2; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
318 |
return (_currentSegments[0].begin <= _annotation_time && _currentSegments[0].end >= _annotation_time) |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
319 |
}); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
320 |
} |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
321 |
if(this.annotations_count_header && this.annotations_count != _list.length){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
322 |
this.annotations_count = _list.length; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
323 |
this.refreshHeader(); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
324 |
} |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
325 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
326 |
if (this.show_only_annotation_from_user){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
327 |
_list = _list.filter(function(_annotation){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
328 |
return _annotation.creator == _this.show_only_annotation_from_user; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
329 |
}); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
330 |
} |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
331 |
if (this.limit_count) { |
| 965 | 332 |
/* Get the n annotations closest to current timecode */ |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
333 |
_list = _list.sortBy(function(_annotation) { |
| 965 | 334 |
return Math.abs((_annotation.begin + _annotation.end) / 2 - _currentTime); |
| 1013 | 335 |
}).slice(0, this.limit_count); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
336 |
} |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
337 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
338 |
if (this.newest_first) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
339 |
_list = _list.sortBy(function(_annotation) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
340 |
return -_annotation.created.valueOf(); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
341 |
}); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
342 |
} else { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
343 |
_list = _list.sortBy(function(_annotation) { |
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
344 |
return _annotation.begin; |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
345 |
}); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
346 |
} |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
347 |
|
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
348 |
if (this.show_filters){ |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
349 |
if (this.user_filter){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
350 |
_username = this.userselect_$[0].options[this.userselect_$[0].selectedIndex].value; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
351 |
if (_username != "false") |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
352 |
{ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
353 |
_list = _list.filter(function(_annotation){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
354 |
return _annotation.creator == _username |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
355 |
}) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
356 |
} |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
357 |
} |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
358 |
if (this.keyword_filter){ |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
359 |
_keyword = this.keywordinput_$[0].value; |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
360 |
if (_keyword != ""){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
361 |
_list = _list.filter(function(_annotation){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
362 |
return _annotation.description.toLowerCase().match(_keyword.toLowerCase()); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
363 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
364 |
} |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
365 |
} |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
366 |
if (this.date_filter){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
367 |
if(this.datefilterinput_$[0].value != ""){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
368 |
_date = this.datefilterinput_$.datepicker("getDate"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
369 |
_list = _list.filter(function(_annotation){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
370 |
return ((_annotation.created.getDate() == _date.getDate())&&(_annotation.created.getMonth() == _date.getMonth())&&(_annotation.created.getFullYear() == _date.getFullYear())); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
371 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
372 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
373 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
374 |
if (this.latest_contributions_filter && this.latestcontributionscheckbox_$[0].checked){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
375 |
_list = _list.sortBy(function(_annotation) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
376 |
return -_annotation.created.valueOf(); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
377 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
378 |
this.usernames.forEach(function(_user){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
379 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
380 |
latest_ann = _list.filter(function(_annotation){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
381 |
return _annotation.creator == _user; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
382 |
})[0]; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
383 |
_list = _list.filter(function(_annotation){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
384 |
return _annotation.id == (latest_ann ? latest_ann.id : false) || _annotation.creator != _user; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
385 |
}); |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
386 |
}); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
387 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
388 |
|
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
389 |
} |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
390 |
|
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
391 |
var _ids = _list.idIndex; |
|
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
392 |
|
| 983 | 393 |
if (_forceRedraw || !IriSP._.isEqual(_ids, this.lastIds) || this.searchString !== this.lastSearch) { |
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
394 |
/* This part only gets executed if the list needs updating */ |
| 983 | 395 |
this.lastSearch = this.searchString; |
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
396 |
this.lastIds = _ids; |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
397 |
this.list_$.html(""); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
398 |
_list.forEach(function(_annotation) { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
399 |
var _url = ( |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
400 |
( typeof _annotation.url !== "undefined" && _annotation.url) |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
401 |
? _annotation.url |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
402 |
: ( |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
403 |
( typeof _this.source.projectId !== "undefined" && typeof _annotation.project !== "undefined" && _annotation.project && _this.source.projectId !== _annotation.project ) |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
404 |
? Mustache.to_html( |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
405 |
_this.foreign_url, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
406 |
{ |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
407 |
project : _annotation.project, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
408 |
media : _annotation.media.id, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
409 |
annotation : _annotation.id, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
410 |
annotationType : _annotation.annotationType.id |
| 924 | 411 |
} |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
412 |
) |
| 993 | 413 |
: document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
414 |
) |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
415 |
); |
|
1021
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
416 |
var _title = "", |
| 993 | 417 |
_description = _annotation.description, |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
418 |
_thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail) |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
419 |
|
|
1021
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
420 |
// Update : display creator |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
421 |
if (_annotation.creator) { |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
422 |
var _users = _this.source.users_data.filter(function(_user_data){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
423 |
return _user_data.username == _annotation.creator |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
424 |
}), |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
425 |
_user = {}; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
426 |
if (_users.length == 0){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
427 |
_user.username = _annotation.creator |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
428 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
429 |
else{ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
430 |
_user = _users[0] |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
431 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
432 |
_title = _this.make_name_string_function(_user); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
433 |
} |
|
1021
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
434 |
if (_annotation.title) { |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
435 |
var tempTitle = _annotation.title; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
436 |
if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
437 |
_title = ""; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
438 |
} |
|
1021
7253d4d06f0d
update widgets after enhance in annotation platform.
cavaliet
parents:
1013
diff
changeset
|
439 |
_title = _title + ( (_title=="") ? "" : ": ") + _annotation.title; |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
440 |
} |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
441 |
var _bgcolor; |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
442 |
IriSP._(_this.polemics).each(function(_polemic) { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
443 |
var _rgxp = IriSP.Model.regexpFromTextOrArray(_polemic.keyword, true); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
444 |
if (_rgxp.test(_title + " " + _description)) { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
445 |
_bgcolor = _polemic.background_color; |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
446 |
} |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
447 |
}); |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
448 |
var _created = false; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
449 |
if (_this.show_creation_date) { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
450 |
_created = _annotation.created.toLocaleDateString()+", "+_annotation.created.toLocaleTimeString(); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
451 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
452 |
if(this.tags == true){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
453 |
var _tags = _annotation.getTagTexts(); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
454 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
455 |
else { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
456 |
var _tags = false; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
457 |
} |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
458 |
var _data = { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
459 |
id : _annotation.id, |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
460 |
media_id : _annotation.getMedia().id, |
| 993 | 461 |
htitle : IriSP.textFieldHtml(_title), |
462 |
hdescription : IriSP.textFieldHtml(_description), |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
463 |
begin : _annotation.begin.toString(), |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
464 |
end : _annotation.end.toString(), |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
465 |
created : _created, |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
466 |
show_timecode : _this.show_timecode, |
| 993 | 467 |
thumbnail : _thumbnail, |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
468 |
url : _url, |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
469 |
tags : _tags, |
| 966 | 470 |
specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""), |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
471 |
l10n: _this.l10n, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
472 |
allow_annotations_deletion: _this.allow_annotations_deletion |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
473 |
}; |
| 1010 | 474 |
if (_this.show_audio && _annotation.audio && _annotation.audio.href && _annotation.audio.href != "null") { |
475 |
_data.audio = true; |
|
476 |
if (!_this.jwplayers[_annotation.id]) { |
|
477 |
var _audiofile = _annotation.audio.href; |
|
478 |
if (_this.audio_url_transform) { |
|
479 |
_audiofile = _this.audio_url_transform(_annotation.audio.href); |
|
480 |
} |
|
481 |
var _tmpId = "jwplayer-" + IriSP.Model.getUID(); |
|
482 |
_this.jwplayers[_annotation.id] = _tmpId; |
|
| 1011 | 483 |
_this.$.find(".Ldt-AnnotationsList-Audio").append(IriSP.jQuery("<div>").attr("id", _tmpId)); |
| 1010 | 484 |
jwplayer(_tmpId).setup({ |
485 |
flashplayer: IriSP.getLib("jwPlayerSWF"), |
|
486 |
file: _audiofile, |
|
487 |
fallback: false, |
|
488 |
primary: "flash", |
|
489 |
controls: false, |
|
490 |
width: 1, |
|
491 |
height: 1, |
|
492 |
events: { |
|
493 |
onPause: function() { |
|
| 1013 | 494 |
_this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.voice_annotation); |
| 1010 | 495 |
}, |
496 |
onPlay: function() { |
|
| 1013 | 497 |
_this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.now_playing); |
| 1011 | 498 |
} |
| 1010 | 499 |
} |
500 |
}); |
|
501 |
} |
|
502 |
} |
|
|
969
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
503 |
var _html = Mustache.to_html(_this.annotationTemplate, _data), |
|
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
504 |
_el = IriSP.jQuery(_html), |
|
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
505 |
_onselect = function() { |
| 1011 | 506 |
_this.$.find('.Ldt-AnnotationsList-li').removeClass("selected"); |
|
969
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
507 |
_el.addClass("selected"); |
|
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
508 |
}, |
|
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
509 |
_onunselect = function() { |
| 1011 | 510 |
_this.$.find('.Ldt-AnnotationsList-li').removeClass("selected"); |
|
969
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
511 |
}; |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
512 |
_el.mouseover(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
513 |
_annotation.trigger("select"); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
514 |
}) |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
515 |
.mouseout(function() { |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
516 |
_annotation.trigger("unselect"); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
517 |
}) |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
518 |
.click(function() { |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
519 |
_annotation.trigger("click"); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
520 |
}) |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
521 |
.appendTo(_this.list_$); |
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
522 |
IriSP.attachDndData(_el.find("[draggable]"), { |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
523 |
title: _title, |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
524 |
description: _description, |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
525 |
uri: _url, |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
526 |
image: _annotation.thumbnail |
|
996
c472984db275
refactored drag-and-drop interface (IE Compatibility)
veltr
parents:
994
diff
changeset
|
527 |
}); |
|
969
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
528 |
_el.on("remove", function() { |
|
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
529 |
_annotation.off("select", _onselect); |
|
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
530 |
_annotation.off("unselect", _onunselect); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
531 |
}); |
|
969
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
532 |
_annotation.on("select", _onselect); |
|
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
533 |
_annotation.on("unselect", _onunselect); |
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
534 |
}); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
535 |
|
| 903 | 536 |
/* Correct the empty tag bug */ |
537 |
this.$.find('.Ldt-AnnotationsList-Tag-Li').each(function() { |
|
538 |
var _el = IriSP.jQuery(this); |
|
539 |
if (!_el.text().replace(/(^\s+|\s+$)/g,'')) { |
|
|
969
353b0881a0b9
Added On-the-fly (file-less) metadata generation test
veltr
parents:
967
diff
changeset
|
540 |
_el.remove(); |
| 903 | 541 |
} |
542 |
}); |
|
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
543 |
|
|
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
544 |
this.$.find('.Ldt-AnnotationsList-Tag-Li').click(function() { |
| 983 | 545 |
_this.source.getAnnotations().search(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); |
| 966 | 546 |
}); |
547 |
|
|
548 |
this.$.find(".Ldt-AnnotationsList-Play").click(function() { |
|
549 |
var _el = IriSP.jQuery(this), |
|
| 1010 | 550 |
_annid = _el.attr("data-annotation-id"); |
551 |
if (_this.jwplayers[_annid]) { |
|
552 |
jwplayer(_this.jwplayers[_annid]).play(); |
|
553 |
} |
|
| 966 | 554 |
_this.media.pause(); |
555 |
}); |
|
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
556 |
|
| 983 | 557 |
if (this.source.getAnnotations().searching) { |
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
983
diff
changeset
|
558 |
var rx = _this.source.getAnnotations().regexp || false; |
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
559 |
this.$.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description").each(function() { |
|
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
560 |
var _$ = IriSP.jQuery(this); |
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
983
diff
changeset
|
561 |
_$.html(IriSP.textFieldHtml(_$.text(), rx)); |
|
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
983
diff
changeset
|
562 |
}); |
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
563 |
} |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
564 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
565 |
this.$.find(".Ldt-AnnotationsList-DeleteButton").click(_this.functionWrapper("onDeleteClick")) |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
566 |
} |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
567 |
|
| 903 | 568 |
if (this.ajax_url) { |
569 |
if (this.mashupMode) { |
|
570 |
this.ajaxMashup(); |
|
571 |
} else { |
|
| 963 | 572 |
if (Math.abs(_currentTime - this.lastAjaxQuery) > (this.ajax_granularity)) { |
| 903 | 573 |
this.ajaxSource(); |
574 |
} |
|
|
872
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
575 |
} |
|
d777d05a16e4
finished AnnotationsList and started New PolemicWidget
veltr
parents:
870
diff
changeset
|
576 |
} |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
577 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
578 |
return _list.length; |
| 1013 | 579 |
}; |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
580 |
|
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
581 |
IriSP.Widgets.AnnotationsList.prototype.onDeleteClick = function(event){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
582 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
583 |
ann_id = event.target.id; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
584 |
delete_preview_$ = this.$.find(".Ldt-AnnotationsList-ul-ToDelete"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
585 |
delete_preview_$.html(""); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
586 |
_list = this.getWidgetAnnotations() |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
587 |
_list = _list.filter(function(_annotation){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
588 |
return _annotation.id == ann_id |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
589 |
}) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
590 |
var _annotation = _list[0], |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
591 |
_title = "", |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
592 |
_this = this; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
593 |
if (_annotation.creator) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
594 |
var _users = _this.source.users_data.filter(function(_user_data){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
595 |
return _user_data.username == _annotation.creator |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
596 |
}), |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
597 |
_user = {}; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
598 |
if (_users.length == 0){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
599 |
_user.username = _annotation.creator |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
600 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
601 |
else{ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
602 |
_user = _users[0] |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
603 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
604 |
_title = _this.make_name_string_function(_user); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
605 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
606 |
if (_annotation.title) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
607 |
var tempTitle = _annotation.title; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
608 |
if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
609 |
_title = ""; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
610 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
611 |
_title = _title + ( (_title=="") ? "" : ": ") + _annotation.title; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
612 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
613 |
var _created = false; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
614 |
if (this.show_creation_date) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
615 |
_created = _annotation.created.toLocaleDateString()+", "+_annotation.created.toLocaleTimeString(); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
616 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
617 |
var _data = { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
618 |
id : _annotation.id, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
619 |
media_id : _annotation.getMedia().id, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
620 |
htitle : IriSP.textFieldHtml(_title), |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
621 |
hdescription : IriSP.textFieldHtml(_annotation.description), |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
622 |
begin : _annotation.begin.toString(), |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
623 |
end : _annotation.end.toString(), |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
624 |
created : _created, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
625 |
show_timecode : this.show_timecode, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
626 |
tags : false, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
627 |
l10n: this.l10n, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
628 |
allow_annotations_deletion: false |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
629 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
630 |
_html = Mustache.to_html(this.annotationTemplate, _data) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
631 |
delete_preview_$.html(_html) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
632 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
633 |
this.$.find(".Ldt-AnnotationsList-ConfirmDelete").click(function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
634 |
_this.sendDelete(ann_id); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
635 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
636 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
637 |
this.showScreen("Delete"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
638 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
639 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
640 |
IriSP.Widgets.AnnotationsList.prototype.refreshHeader = function() { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
641 |
var annotation_count_string = " (" + this.annotations_count +" annotations)"; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
642 |
this.$.find('.Ldt-AnnotationsList-header').html(""); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
643 |
this.$.find('.Ldt-AnnotationsList-header').html( |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
644 |
this.custom_header && typeof this.custom_header == "string"? this.custom_header + annotation_count_string : this.l10n.header + annotation_count_string |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
645 |
); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
646 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
647 |
|
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
648 |
IriSP.Widgets.AnnotationsList.prototype.hide = function() { |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
649 |
var _this = this; |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
650 |
if (this.visible){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
651 |
this.visible = false; |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
652 |
this.widget_$.slideUp(function(){ |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
653 |
_this.$.find('.Ldt-AnnotationsList-header').hide(); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
654 |
}); |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
655 |
this.showScreen("Main") |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
656 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
657 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
658 |
|
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
659 |
IriSP.Widgets.AnnotationsList.prototype.show = function() { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
660 |
if(!this.visible){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
661 |
this.visible = true; |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
662 |
this.$.find('.Ldt-AnnotationsList-header').show(); |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
663 |
this.widget_$.slideDown(); |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
664 |
this.showScreen("Main") |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
665 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
666 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
667 |
|
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
668 |
|
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
669 |
IriSP.Widgets.AnnotationsList.prototype.toggle = function() { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
670 |
if (!this.always_visible) { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
671 |
if (this.visible) { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
672 |
this.hide(); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
673 |
} else { |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
674 |
this.show(); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
675 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
676 |
} |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
677 |
}; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
678 |
|
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
679 |
IriSP.Widgets.AnnotationsList.prototype.revertToMainScreen = function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
680 |
if (this.$.find(".Ldt-AnnotationsList-ScreenMain").is(":hidden")){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
681 |
this.showScreen("Main"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
682 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
683 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
684 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
685 |
IriSP.Widgets.AnnotationsList.prototype.sendDelete = function(id){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
686 |
var _this = this, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
687 |
_url = Mustache.to_html(this.api_delete_endpoint, {annotation_id: id}) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
688 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
689 |
IriSP.jQuery.ajax({ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
690 |
url: _url, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
691 |
type: this.api_delete_method, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
692 |
contentType: 'application/json', |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
693 |
success: function(_data) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
694 |
_this.showScreen('Success'); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
695 |
window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 2000)); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
696 |
_this.currentSource.getAnnotations().removeId(id); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
697 |
_this.player.trigger("AnnotationsList.refresh"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
698 |
}, |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
699 |
error: function(_xhr, _error, _thrown) { |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
700 |
IriSP.log("Error when sending annotation", _thrown); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
701 |
_this.showScreen('Error'); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
702 |
window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 2000)); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
703 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
704 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
705 |
this.showScreen('Sending'); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
706 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
707 |
|
|
875
43629caa77bc
Big refactoring of widget files + started migration of segmentwidget
veltr
parents:
874
diff
changeset
|
708 |
IriSP.Widgets.AnnotationsList.prototype.draw = function() { |
| 1010 | 709 |
this.jwplayers = {}; |
| 959 | 710 |
this.mashupMode = (this.media.elementType === "mashup"); |
711 |
|
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
712 |
this.renderTemplate(); |
|
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
713 |
|
| 966 | 714 |
var _this = this; |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
715 |
|
|
937
eb3c442cec50
Added events on annotation for inter widget communication
veltr
parents:
930
diff
changeset
|
716 |
this.list_$ = this.$.find(".Ldt-AnnotationsList-ul"); |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
717 |
this.widget_$ = this.$.find(".Ldt-AnnotationsListWidget"); |
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
718 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
719 |
if (this.show_filters){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
720 |
if (this.user_filter){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
721 |
this.userselect_$ = this.$.find("#Ldt-AnnotationsList-userFilter"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
722 |
this.userselect_$.change(function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
723 |
_this.player.trigger("AnnotationsList.refresh"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
724 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
725 |
this.userselect_$.html("<option selected value='false'>"+this.l10n.everyone+"</option>"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
726 |
this.usernames.forEach(function(_user){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
727 |
_this.userselect_$.append("<option value='"+_user+"'>"+_user+"</option>"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
728 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
729 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
730 |
if (this.keyword_filter){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
731 |
this.keywordinput_$ = this.$.find("#Ldt-AnnotationsList-keywordsFilter"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
732 |
this.keywordinput_$.keyup(function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
733 |
_this.player.trigger("AnnotationsList.refresh"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
734 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
735 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
736 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
737 |
if (this.segment_filter){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
738 |
this.ignoresegmentcheckbox_$ = this.$.find("#Ldt-AnnotationsList-ignoreSegmentsFilter"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
739 |
this.ignoresegmentcheckbox_$.click(function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
740 |
_this.player.trigger("AnnotationsList.refresh"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
741 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
742 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
743 |
if(this.date_filter){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
744 |
this.datefilterinput_$ = this.$.find("#Ldt-AnnotationsList-dateFilter"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
745 |
this.datefilterinput_$.datepicker({ dateFormat: 'dd/mm/yy' }); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
746 |
this.datefilterinput_$.change(function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
747 |
_this.player.trigger("AnnotationsList.refresh") |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
748 |
}) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
749 |
if (this.current_day_filter){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
750 |
currentDate = new Date(); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
751 |
this.datefilterinput_$.datepicker("setDate",currentDate); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
752 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
753 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
754 |
if(this.latest_contributions_filter){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
755 |
this.latestcontributionscheckbox_$ = this.$.find("#Ldt-AnnotationsList-latestContributionsFilter"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
756 |
this.latestcontributionscheckbox_$.click(function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
757 |
_this.player.trigger("AnnotationsList.refresh"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
758 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
759 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
760 |
} |
| 966 | 761 |
|
| 983 | 762 |
this.source.getAnnotations().on("search", function(_text) { |
763 |
_this.searchString = _text; |
|
764 |
if (_this.source !== _this.currentSource) { |
|
765 |
_this.currentSource.getAnnotations().search(_text); |
|
766 |
_this.throttledRefresh(); |
|
767 |
} |
|
768 |
}); |
|
769 |
this.source.getAnnotations().on("found", function() { |
|
770 |
_this.throttledRefresh(); |
|
771 |
}); |
|
772 |
this.source.getAnnotations().on("not-found", function() { |
|
773 |
_this.throttledRefresh(); |
|
774 |
}); |
|
775 |
this.source.getAnnotations().on("clear-search", function() { |
|
776 |
_this.searchString = false; |
|
777 |
if (_this.source !== _this.currentSource) { |
|
778 |
_this.currentSource.getAnnotations().trigger("clear-search"); |
|
779 |
} |
|
780 |
}); |
|
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
781 |
|
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
782 |
this.$.find(".Ldt-AnnotationsList-Close").click(function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
783 |
_this.showScreen("Main"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
784 |
}) |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
785 |
|
| 983 | 786 |
this.source.getAnnotations().on("search-cleared", function() { |
787 |
_this.throttledRefresh(); |
|
788 |
}); |
|
789 |
|
|
| 966 | 790 |
this.onMdpEvent("AnnotationsList.refresh", function() { |
791 |
if (_this.ajax_url) { |
|
792 |
if (_this.mashupMode) { |
|
793 |
_this.ajaxMashup(); |
|
794 |
} else { |
|
795 |
_this.ajaxSource(); |
|
796 |
} |
|
797 |
} |
|
798 |
_this.throttledRefresh(); |
|
799 |
}); |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
800 |
|
| 903 | 801 |
if (this.ajax_url) { |
802 |
if (this.mashupMode) { |
|
803 |
this.ajaxMashup(); |
|
804 |
} else { |
|
805 |
this.ajaxSource(); |
|
806 |
} |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
807 |
} else { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
808 |
this.currentSource = this.source; |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
809 |
} |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
810 |
|
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
811 |
if (this.refresh_interval) { |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
812 |
window.setInterval(function() { |
| 1013 | 813 |
_this.currentSource.get(); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
814 |
}, this.refresh_interval); |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
815 |
} |
| 674 | 816 |
|
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
817 |
if (this.annotations_count_header){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
818 |
this.annotations_count = false; |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
819 |
} |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
820 |
|
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
821 |
this.onMdpEvent("AnnotationsList.toggle","toggle"); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
822 |
this.onMdpEvent("AnnotationsList.hide", "hide"); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
823 |
this.onMdpEvent("AnnotationsList.show", "show"); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
824 |
|
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
825 |
this.onMdpEvent("createAnnotationWidget.addedAnnotation", this.throttledRefresh); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
826 |
var _events = [ |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
827 |
"timeupdate", |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
828 |
"seeked", |
|
1046
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
829 |
"loadedmetadata", |
|
eb77616c245f
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents:
1037
diff
changeset
|
830 |
"settimerange" |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
831 |
]; |
|
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
832 |
for (var _i = 0; _i < _events.length; _i++) { |
| 957 | 833 |
this.onMediaEvent(_events[_i], this.throttledRefresh); |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
834 |
} |
|
730
357fc047503b
redraw the widget after that an annotation has been added.
hamidouk
parents:
729
diff
changeset
|
835 |
|
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
836 |
this.throttledRefresh(); |
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
837 |
|
|
1053
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
838 |
this.showScreen("Main"); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
839 |
this.$.find(".Ldt-AnnotationsList-CancelDelete").click(function(){ |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
840 |
_this.showScreen("Main") |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
841 |
}); |
|
149a4ea20ea7
Added support for deleting annotations + Added support for displaying user names under another format
durandn
parents:
1046
diff
changeset
|
842 |
|
|
1037
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
843 |
this.visible = true; |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
844 |
if (!this.start_visible){ |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
845 |
this.hide(); |
|
5c0416e8bba1
AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents:
1033
diff
changeset
|
846 |
} |
|
870
2c025db10a10
Migrated playerWidget and started annotationsListWidget
veltr
parents:
852
diff
changeset
|
847 |
}; |