67 preview_submit: "You cannot submit annotations in preview mode", |
76 preview_submit: "You cannot submit annotations in preview mode", |
68 cancel: "Cancel", |
77 cancel: "Cancel", |
69 add_keywords_: "Add keywords:", |
78 add_keywords_: "Add keywords:", |
70 add_polemic_keywords_: "Add polemic attributes :", |
79 add_polemic_keywords_: "Add polemic attributes :", |
71 your_name_: "Your name:", |
80 your_name_: "Your name:", |
72 annotate_video: "Annotate this video", |
81 annotate_video: "New note", |
73 type_title: "Annotation title", |
82 type_title: "Annotation title", |
74 type_description: "Type the full contents of your annotation here.", |
83 type_description: "Enter a new note...", |
75 wait_while_processing: "Please wait while your annotation is being processed...", |
84 wait_while_processing: "Please wait while your annotation is being processed...", |
76 error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.", |
85 error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.", |
77 annotation_saved: "Thank you, your annotation has been saved.", |
86 annotation_saved: "Thank you, your annotation has been saved.", |
78 share_annotation: "Would you like to share it on social networks ?", |
87 share_annotation: "Would you like to share it on social networks ?", |
79 close_widget: "Hide the annotation form", |
88 close_widget: "Hide the annotation form", |
80 "polemic++": "Agree", |
89 "polemic++": "Agree", |
81 "polemic--": "Disagree", |
90 "polemic--": "Disagree", |
82 "polemic??": "Question", |
91 "polemic??": "Question", |
83 "polemic==": "Reference" |
92 "polemic==": "Reference", |
|
93 "in_tooltip": "Set begin time to current player time", |
|
94 "out_tooltip": "Set begin time to current player time", |
|
95 "play_tooltip": "Play the fragment" |
84 }, |
96 }, |
85 fr: { |
97 fr: { |
86 from_time: "de", |
98 from_time: "de", |
87 to_time: "à", |
99 to_time: "à", |
88 at_time: "à", |
100 at_time: "à", |
90 preview_submit: "Vous ne pouvez pas envoyer d'annotation en mode aperçu", |
102 preview_submit: "Vous ne pouvez pas envoyer d'annotation en mode aperçu", |
91 cancel: "Annuler", |
103 cancel: "Annuler", |
92 add_keywords_: "Ajouter des mots-clés\u00a0:", |
104 add_keywords_: "Ajouter des mots-clés\u00a0:", |
93 add_polemic_keywords_: "Ajouter des attributs polémiques\u00a0:", |
105 add_polemic_keywords_: "Ajouter des attributs polémiques\u00a0:", |
94 your_name_: "Votre nom\u00a0:", |
106 your_name_: "Votre nom\u00a0:", |
95 annotate_video: "Annoter cette vidéo", |
107 annotate_video: "Entrez une nouvelle note...", |
96 type_title: "Titre de l'annotation", |
108 type_title: "Titre de l'annotation", |
97 type_description: "Rédigez ici le contenu de votre annotation.", |
109 type_description: "Prenez vos notes...", |
98 wait_while_processing: "Veuillez patienter pendant le traitement de votre annotation...", |
110 wait_while_processing: "Veuillez patienter pendant le traitement de votre annotation...", |
99 error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée.", |
111 error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée.", |
100 annotation_saved: "Merci, votre annotation a été enregistrée.", |
112 annotation_saved: "Merci, votre annotation a été enregistrée.", |
101 share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?", |
113 share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?", |
102 close_widget: "Cacher le formulaire de création d'annotations", |
114 close_widget: "Cacher le formulaire de création d'annotations", |
103 "polemic++": "Accord", |
115 "polemic++": "Accord", |
104 "polemic--": "Désaccord", |
116 "polemic--": "Désaccord", |
105 "polemic??": "Question", |
117 "polemic??": "Question", |
106 "polemic==": "Référence" |
118 "polemic==": "Référence", |
|
119 "in_tooltip": "Utiliser le temps courant comme début", |
|
120 "out_tooltip": "Utiliser le temps courant comme fin", |
|
121 "play_tooltip": "Jouer le fragment" |
107 } |
122 } |
108 }; |
123 }; |
109 |
124 |
110 IriSP.Widgets.CreateAnnotation.prototype.template = |
125 IriSP.Widgets.CreateAnnotation.prototype.template = |
111 '{{#show_slice}}<div class="Ldt-CreateAnnotation-Slice"></div>{{/show_slice}}' |
126 '{{#show_slice}}<div class="Ldt-CreateAnnotation-Slice Ldt-TraceMe"></div>{{/show_slice}}' |
112 + '{{^show_slice}}{{#show_arrow}}<div class="Ldt-CreateAnnotation-Arrow"></div>{{/show_arrow}}{{/show_slice}}' |
127 + '{{^show_slice}}{{#show_arrow}}<div class="Ldt-CreateAnnotation-Arrow"></div>{{/show_arrow}}{{/show_slice}}' |
113 + '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
128 + '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
114 + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
129 + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
115 + '<h3><span class="Ldt-CreateAnnotation-h3Left">{{l10n.annotate_video}}{{#show_title_field}}</span></h3>' |
130 + '<h3><span class="Ldt-CreateAnnotation-h3Left">{{l10n.annotate_video}}{{#show_title_field}}</span></h3>' |
116 + '<h3><span class="Ldt-CreateAnnotation-h3Left"><input class="Ldt-CreateAnnotation-Title empty" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
131 + '<h3><span class="Ldt-CreateAnnotation-h3Left"><input class="Ldt-CreateAnnotation-Title empty" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
117 + '{{#show_time}}<span class="Ldt-CreateAnnotation-Times"> {{#show_slice}}{{l10n.from_time}} {{/show_slice}}{{^show_slice}}{{l10n.at_time}} {{/show_slice}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>{{/show_time}}' |
132 + '{{#show_time}}<span class="Ldt-CreateAnnotation-Times"> {{#show_slice}}{{l10n.from_time}} {{/show_slice}}{{^show_slice}}{{l10n.at_time}} {{/show_slice}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>{{/show_time}}' |
118 + '{{#show_slice}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">{{end}}</span>{{/show_slice}}</span></span>' |
133 + '{{#show_slice}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">{{end}}</span>{{/show_slice}}</span></span>' |
119 + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator empty" value="{{creator_name}}" {{#creator_field_readonly}}readonly{{/creator_field_readonly}}/>{{/show_creator_field}}</h3>' |
134 + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator empty" value="{{creator_name}}" {{#creator_field_readonly}}readonly{{/creator_field_readonly}}/>{{/show_creator_field}}</h3>' |
120 + '<textarea class="Ldt-CreateAnnotation-Description empty" placeholder="{{l10n.type_description}}"></textarea>' |
135 + '{{#show_controls}}<div class="Ldt-CreateAnnotation-Controls">' |
121 + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>' |
136 + '<span title="{{l10n.in_tooltip}}" class="Ldt-CreateAnnotation-Control-In">In</span>' |
|
137 + '<span title="{{l10n.out_tooltip}}" class="Ldt-CreateAnnotation-Control-Out">Out</span>' |
|
138 + '<span title="{{l10n.play_tooltip}}" class="Ldt-CreateAnnotation-Control-Play">Play</span>' |
|
139 + '</div>{{/show_controls}}' |
|
140 + '<textarea class="Ldt-CreateAnnotation-Description Ldt-TraceMe empty" placeholder="{{l10n.type_description}}"></textarea>' |
|
141 + '{{#show_creator_field}}<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>{{/show_creator_field}}' |
|
142 + '<div class="Ldt-CreateAnnotation-SubmitArea Ldt-TraceMe">' |
122 + '{{#preview_mode}}<input type="button" class="Ldt-CreateAnnotation-PreviewSubmit" title="{{l10n.preview_submit}}" value="{{#custom_send_button}}{{custom_send_button}}{{/custom_send_button}}{{^custom_send_button}}{{l10n.submit}}{{/custom_send_button}}" />{{/preview_mode}}' |
143 + '{{#preview_mode}}<input type="button" class="Ldt-CreateAnnotation-PreviewSubmit" title="{{l10n.preview_submit}}" value="{{#custom_send_button}}{{custom_send_button}}{{/custom_send_button}}{{^custom_send_button}}{{l10n.submit}}{{/custom_send_button}}" />{{/preview_mode}}' |
123 + '{{^preview_mode}}<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{#custom_send_button}}{{custom_send_button}}{{/custom_send_button}}{{^custom_send_button}}{{l10n.submit}}{{/custom_send_button}}" />{{/preview_mode}}' |
144 + '{{^preview_mode}}<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{#custom_send_button}}{{custom_send_button}}{{/custom_send_button}}{{^custom_send_button}}{{l10n.submit}}{{/custom_send_button}}" />{{/preview_mode}}' |
124 + '<input type="button" class="Ldt-CreateAnnotation-Cancel" value="{{#custom_cancel_button}}{{custom_cancel_button}}{{/custom_cancel_button}}{{^custom_cancel_button}}{{l10n.cancel}}{{/custom_cancel_button}}" />' |
145 + '<input type="button" class="Ldt-CreateAnnotation-Cancel" value="{{#custom_cancel_button}}{{custom_cancel_button}}{{/custom_cancel_button}}{{^custom_cancel_button}}{{l10n.cancel}}{{/custom_cancel_button}}" />' |
|
146 + '<div class="Ldt-CreateAnnotation-Begin Ldt-CreateAnnotation-Times">00:00</div>' |
|
147 + '</div>' |
125 + '{{#show_mic_record}}<div class="Ldt-CreateAnnotation-RecBlock"><div class="Ldt-CreateAnnotation-RecLabel">Add voice annotation</div>' |
148 + '{{#show_mic_record}}<div class="Ldt-CreateAnnotation-RecBlock"><div class="Ldt-CreateAnnotation-RecLabel">Add voice annotation</div>' |
126 + ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="220" height="160">' |
149 + ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="220" height="160">' |
127 + ' <param name="movie" value="{{record_swf}}" />' |
150 + ' <param name="movie" value="{{record_swf}}" />' |
128 + ' <param name="quality" value="high" />' |
151 + ' <param name="quality" value="high" />' |
129 + ' <param name="bgcolor" value="#ffffff" />' |
152 + ' <param name="bgcolor" value="#ffffff" />' |
210 { |
233 { |
211 type: "Slice", |
234 type: "Slice", |
212 show_arrow: this.show_arrow, |
235 show_arrow: this.show_arrow, |
213 annotation_type: this.slice_annotation_type, |
236 annotation_type: this.slice_annotation_type, |
214 onBoundsChanged: function(_from, _to) { |
237 onBoundsChanged: function(_from, _to) { |
215 _this.begin = new IriSP.Model.Time(_from || 0); |
238 this.setBeginEnd(_from, _to); |
216 _this.end = new IriSP.Model.Time(_to || 0); |
|
217 _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString()); |
|
218 _this.$.find(".Ldt-CreateAnnotation-End").html(_this.end.toString()); |
|
219 } |
239 } |
220 }, |
240 }, |
221 "slice" |
241 "slice" |
222 ); |
242 ); |
223 } else { |
243 } else { |
224 if (this.show_arrow) { |
244 if (this.show_arrow) { |
225 this.insertSubwidget(this.$.find(".Ldt-CreateAnnotation-Arrow"), {type: "Arrow"},"arrow"); |
245 this.insertSubwidget(this.$.find(".Ldt-CreateAnnotation-Arrow"), {type: "Arrow"},"arrow"); |
226 } |
246 } |
227 this.onMediaEvent("timeupdate", function(_time) { |
247 this.onMediaEvent("timeupdate", function(_time) { |
228 _this.begin = new IriSP.Model.Time(_time || 0); |
248 // Do not update timecode if description is not empty |
229 _this.end = new IriSP.Model.Time(_time || 0); |
249 if (_this.$.find(".Ldt-CreateAnnotation-Description").val().trim() == "") { |
230 _this.$.find(".Ldt-CreateAnnotation-Begin").html(_this.begin.toString()); |
250 _this.setBeginEnd(_time, _time); |
231 if (_this.arrow) { |
251 if (_this.arrow) { |
232 _this.arrow.moveToTime(_time); |
252 _this.arrow.moveToTime(_time); |
233 } |
253 } |
|
254 }; |
234 }); |
255 }); |
235 } |
256 } |
236 this.$.find(".Ldt-CreateAnnotation-Cancel").click(function() { |
257 this.$.find(".Ldt-CreateAnnotation-Cancel").click(function() { |
237 _this.player.trigger("CreateAnnotation.hide"); |
258 _this.player.trigger("CreateAnnotation.hide"); |
238 }); |
259 }); |
273 this.onMdpEvent("CreateAnnotation.hide", "hide"); |
312 this.onMdpEvent("CreateAnnotation.hide", "hide"); |
274 this.onMdpEvent("CreateAnnotation.show", "show"); |
313 this.onMdpEvent("CreateAnnotation.show", "show"); |
275 this.$.find("form").submit(this.functionWrapper("onSubmit")); |
314 this.$.find("form").submit(this.functionWrapper("onSubmit")); |
276 }; |
315 }; |
277 |
316 |
|
317 IriSP.Widgets.CreateAnnotation.prototype.setBegin = function (t) { |
|
318 this.begin = new IriSP.Model.Time(t || 0); |
|
319 this.$.find(".Ldt-CreateAnnotation-Begin").html(this.begin.toString()); |
|
320 }; |
|
321 |
|
322 IriSP.Widgets.CreateAnnotation.prototype.setEnd = function (t) { |
|
323 this.end = new IriSP.Model.Time(t || 0); |
|
324 this.$.find(".Ldt-CreateAnnotation-End").html(this.end.toString()); |
|
325 }; |
|
326 |
|
327 IriSP.Widgets.CreateAnnotation.prototype.setBeginEnd = function (begin, end) { |
|
328 this.setBegin(begin); |
|
329 this.setEnd(end); |
|
330 }; |
|
331 |
278 IriSP.Widgets.CreateAnnotation.prototype.showScreen = function(_screenName) { |
332 IriSP.Widgets.CreateAnnotation.prototype.showScreen = function(_screenName) { |
279 this.$.find('.Ldt-CreateAnnotation-' + _screenName).show() |
333 this.$.find('.Ldt-CreateAnnotation-' + _screenName).show() |
280 .siblings().hide(); |
334 .siblings().hide(); |
281 } |
335 }; |
282 |
336 |
283 IriSP.Widgets.CreateAnnotation.prototype.show = function() { |
337 IriSP.Widgets.CreateAnnotation.prototype.show = function() { |
284 if (!this.visible){ |
338 if (!this.visible){ |
285 this.visible = true; |
339 this.visible = true; |
286 if (this.pause_when_displaying){ |
340 if (this.pause_when_displaying){ |
407 } |
473 } |
408 |
474 |
409 var _this = this, |
475 var _this = this, |
410 _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create a List to send to the server that will contains the annotation */ |
476 _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create a List to send to the server that will contains the annotation */ |
411 _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* We create a source object using a specific serializer for export */ |
477 _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* We create a source object using a specific serializer for export */ |
|
478 _local_export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers['ldt_localstorage']}), /* Source object using a specific serializer for local export */ |
412 _annotation = new IriSP.Model.Annotation(false, _export), /* We create an annotation in the source with a generated ID (param. false) */ |
479 _annotation = new IriSP.Model.Annotation(false, _export), /* We create an annotation in the source with a generated ID (param. false) */ |
413 _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* We get the AnnotationType in which the annotation will be added */ |
480 _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* We get the AnnotationType in which the annotation will be added */ |
414 _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* If it doesn't already exists, we create it */ |
481 _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* If it doesn't already exists, we create it */ |
415 _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); /* We make the url to send the request to, must include project id */ |
482 _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); /* We make the url to send the request to, must include project id */ |
416 |
483 |
491 if (this.show_creator_field) { |
555 if (this.show_creator_field) { |
492 _annotation.creator = this.$.find(".Ldt-CreateAnnotation-Creator").val(); |
556 _annotation.creator = this.$.find(".Ldt-CreateAnnotation-Creator").val(); |
493 } else { |
557 } else { |
494 _annotation.creator = this.creator_name; |
558 _annotation.creator = this.creator_name; |
495 } |
559 } |
496 _exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */ |
560 _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */ |
497 _export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */ |
561 |
498 var _this = this; |
562 if (this.editable_storage != '') { |
499 /* We send the AJAX request to the server ! */ |
563 // Append to localStorage annotations |
500 IriSP.jQuery.ajax({ |
564 |
501 url: _url, |
565 // FIXME: handle movie ids |
502 type: this.api_method, |
566 _local_export.addList("annotation", _exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */ |
503 contentType: 'application/json', |
567 _this.source.merge(_local_export); /* On ajoute la nouvelle annotation au recueil original */ |
504 data: _export.serialize(), /* Source is serialized */ |
568 // Import previously saved local annotations |
505 success: function(_data) { |
569 if (window.localStorage[this.editable_storage]) { |
506 _this.showScreen('Saved'); |
570 _local_export.deSerialize(window.localStorage[this.editable_storage]); |
507 if (_this.after_send_timeout) { |
571 } |
508 window.setTimeout( |
572 // Save everything back |
509 function() { |
573 window.localStorage[_this.editable_storage] = _local_export.serialize(); |
510 _this.close_after_send |
574 _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */ |
511 ? _this.player.trigger("CreateAnnotation.hide") |
575 _this.player.trigger("Annotation.create", _annotation); |
512 : _this.player.trigger("CreateAnnotation.show"); |
576 _this.$.find(".Ldt-CreateAnnotation-Description").val(""); |
513 }, |
577 } |
514 _this.after_send_timeout |
578 |
515 ); |
579 if (_url !== "") { |
|
580 _exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */ |
|
581 _export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */ |
|
582 var _this = this; |
|
583 /* We send the AJAX request to the server ! */ |
|
584 IriSP.jQuery.ajax({ |
|
585 url: _url, |
|
586 type: this.api_method, |
|
587 contentType: 'application/json', |
|
588 data: _export.serialize(), /* Source is serialized */ |
|
589 success: function(_data) { |
|
590 _this.showScreen('Saved'); |
|
591 if (_this.after_send_timeout) { |
|
592 window.setTimeout( |
|
593 function() { |
|
594 _this.close_after_send |
|
595 ? _this.player.trigger("CreateAnnotation.hide") |
|
596 : _this.player.trigger("CreateAnnotation.show"); |
|
597 }, |
|
598 _this.after_send_timeout |
|
599 ); |
|
600 } |
|
601 _export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */ |
|
602 _export.deSerialize(_data); /* Data deserialization */ |
|
603 _this.source.merge(_export); /* We merge the deserialized data with the current source data */ |
|
604 if (_this.pause_on_write && _this.media.getPaused()) { |
|
605 _this.media.play(); |
|
606 } |
|
607 _this.player.trigger("AnnotationsList.refresh"); |
|
608 }, |
|
609 error: function(_xhr, _error, _thrown) { |
|
610 IriSP.log("Error when sending annotation", _thrown); |
|
611 _export.getAnnotations().removeElement(_annotation, true); |
|
612 _this.showScreen('Error'); |
|
613 window.setTimeout(function(){ |
|
614 _this.showScreen("Main") |
|
615 }, |
|
616 (_this.after_send_timeout || 5000)); |
516 } |
617 } |
517 _export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */ |
618 }); |
518 _export.deSerialize(_data); /* Data deserialization */ |
619 this.showScreen('Wait'); |
519 _this.source.merge(_export); /* We merge the deserialized data with the current source data */ |
620 }; |
520 if (_this.pause_on_write && _this.media.getPaused()) { |
|
521 _this.media.play(); |
|
522 } |
|
523 _this.player.trigger("AnnotationsList.refresh"); |
|
524 }, |
|
525 error: function(_xhr, _error, _thrown) { |
|
526 IriSP.log("Error when sending annotation", _thrown); |
|
527 _export.getAnnotations().removeElement(_annotation, true); |
|
528 _this.showScreen('Error'); |
|
529 window.setTimeout(function(){ |
|
530 _this.showScreen("Main") |
|
531 }, |
|
532 (_this.after_send_timeout || 5000)); |
|
533 } |
|
534 }); |
|
535 this.showScreen('Wait'); |
|
536 |
|
537 return false; |
621 return false; |
538 }; |
622 }; |
539 |
623 |