5 }; |
5 }; |
6 |
6 |
7 IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget(); |
7 IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget(); |
8 |
8 |
9 IriSP.Widgets.CreateAnnotation.prototype.defaults = { |
9 IriSP.Widgets.CreateAnnotation.prototype.defaults = { |
10 show_title_field : false, /* For the moment, titles can't be sent to ldtplatform */ |
10 show_title_field : true, |
11 show_creator_field : true, |
11 show_creator_field : true, |
12 start_visible : true, |
12 start_visible : true, |
13 always_visible : false, |
13 always_visible : false, |
14 show_slice : true, |
14 show_slice : true, |
15 show_arrow : true, |
15 show_arrow : true, |
104 IriSP.Widgets.CreateAnnotation.prototype.template = |
104 IriSP.Widgets.CreateAnnotation.prototype.template = |
105 '{{#show_slice}}<div class="Ldt-CreateAnnotation-Slice"></div>{{/show_slice}}' |
105 '{{#show_slice}}<div class="Ldt-CreateAnnotation-Slice"></div>{{/show_slice}}' |
106 + '{{^show_slice}}{{#show_arrow}}<div class="Ldt-CreateAnnotation-Arrow"></div>{{/show_arrow}}{{/show_slice}}' |
106 + '{{^show_slice}}{{#show_arrow}}<div class="Ldt-CreateAnnotation-Arrow"></div>{{/show_arrow}}{{/show_slice}}' |
107 + '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
107 + '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
108 + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
108 + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
109 + '<h3><span class="Ldt-CreateAnnotation-h3Left">{{#show_title_field}}<input class="Ldt-CreateAnnotation-Title" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
109 + '<h3><span class="Ldt-CreateAnnotation-h3Left">{{#show_title_field}}<input class="Ldt-CreateAnnotation-Title empty" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
110 + '{{^show_title_field}}<span class="Ldt-CreateAnnotation-NoTitle">{{l10n.no_title}} </span>{{/show_title_field}}' |
110 + '{{^show_title_field}}<span class="Ldt-CreateAnnotation-NoTitle">{{l10n.no_title}} </span>{{/show_title_field}}' |
111 + ' <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>' |
111 + '<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>' |
112 + '{{#show_slice}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">{{end}}</span>{{/show_slice}}</span></span>' |
112 + '{{#show_slice}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">{{end}}</span>{{/show_slice}}</span></span>' |
113 + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator" value="{{creator_name}}" /></h3>{{/show_creator_field}}' |
113 + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator empty" value="{{creator_name}}" /></h3>{{/show_creator_field}}' |
114 + '<textarea class="Ldt-CreateAnnotation-Description" placeholder="{{l10n.type_description}}"></textarea>' |
114 + '<textarea class="Ldt-CreateAnnotation-Description empty" placeholder="{{l10n.type_description}}"></textarea>' |
115 + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>' |
115 + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>' |
116 + '<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{l10n.submit}}" />' |
116 + '<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{l10n.submit}}" />' |
117 + '{{#show_mic_record}}<div class="Ldt-CreateAnnotation-RecBlock"><div class="Ldt-CreateAnnotation-RecLabel">Add voice annotation</div>' |
117 + '{{#show_mic_record}}<div class="Ldt-CreateAnnotation-RecBlock"><div class="Ldt-CreateAnnotation-RecLabel">Add voice annotation</div>' |
118 + ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="220" height="160">' |
118 + ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="220" height="160">' |
119 + ' <param name="movie" value="{{record_swf}}" />' |
119 + ' <param name="movie" value="{{record_swf}}" />' |
259 } |
259 } |
260 |
260 |
261 IriSP.Widgets.CreateAnnotation.prototype.show = function() { |
261 IriSP.Widgets.CreateAnnotation.prototype.show = function() { |
262 this.visible = true; |
262 this.visible = true; |
263 this.showScreen('Main'); |
263 this.showScreen('Main'); |
264 this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666"); |
264 this.$.find(".Ldt-CreateAnnotation-Description").val("").css("border-color", "#666666").addClass("empty"); |
265 if (this.show_title_field) { |
265 if (this.show_title_field) { |
266 this.$.find(".Ldt-CreateAnnotation-Title").val("").css("border-color", "#666666"); |
266 this.$.find(".Ldt-CreateAnnotation-Title").val("").css("border-color", "#666666").addClass("empty"); |
267 } |
267 } |
268 if (this.show_creator_field) { |
268 if (this.show_creator_field) { |
269 this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666"); |
269 this.$.find(".Ldt-CreateAnnotation-Creator").val(this.creator_name).css("border-color", "#666666"); |
|
270 if (!this.creator_name) { |
|
271 this.$.find(".Ldt-CreateAnnotation-Creator").addClass("empty"); |
|
272 } |
270 } |
273 } |
271 this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected"); |
274 this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").removeClass("selected"); |
272 this.$.slideDown(); |
275 this.$.slideDown(); |
273 if (this.minimize_annotation_widget) { |
276 if (this.minimize_annotation_widget) { |
274 this.player.trigger("Annotation.minimize"); |
277 this.player.trigger("Annotation.minimize"); |
318 |
321 |
319 IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function() { |
322 IriSP.Widgets.CreateAnnotation.prototype.onDescriptionChange = function() { |
320 var _field = this.$.find(".Ldt-CreateAnnotation-Description"), |
323 var _field = this.$.find(".Ldt-CreateAnnotation-Description"), |
321 _contents = _field.val(); |
324 _contents = _field.val(); |
322 _field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
325 _field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
|
326 if (!!_contents) { |
|
327 _field.removeClass("empty"); |
|
328 } else { |
|
329 _field.addClass("empty"); |
|
330 } |
323 this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").each(function() { |
331 this.$.find(".Ldt-CreateAnnotation-TagLi, .Ldt-CreateAnnotation-PolemicLi").each(function() { |
324 var _rx = IriSP.Model.regexpFromTextOrArray(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); |
332 var _rx = IriSP.Model.regexpFromTextOrArray(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); |
325 if (_contents.match(_rx)) { |
333 if (_contents.match(_rx)) { |
326 IriSP.jQuery(this).addClass("selected"); |
334 IriSP.jQuery(this).addClass("selected"); |
327 } else { |
335 } else { |
334 |
342 |
335 IriSP.Widgets.CreateAnnotation.prototype.onTitleChange = function() { |
343 IriSP.Widgets.CreateAnnotation.prototype.onTitleChange = function() { |
336 var _field = this.$.find(".Ldt-CreateAnnotation-Title"), |
344 var _field = this.$.find(".Ldt-CreateAnnotation-Title"), |
337 _contents = _field.val(); |
345 _contents = _field.val(); |
338 _field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
346 _field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
|
347 if (!!_contents) { |
|
348 _field.removeClass("empty"); |
|
349 } else { |
|
350 _field.addClass("empty"); |
|
351 } |
339 this.pauseOnWrite(); |
352 this.pauseOnWrite(); |
340 return !!_contents; |
353 return !!_contents; |
341 } |
354 } |
342 |
355 |
343 |
356 |
344 IriSP.Widgets.CreateAnnotation.prototype.onCreatorChange = function() { |
357 IriSP.Widgets.CreateAnnotation.prototype.onCreatorChange = function() { |
345 var _field = this.$.find(".Ldt-CreateAnnotation-Creator"), |
358 var _field = this.$.find(".Ldt-CreateAnnotation-Creator"), |
346 _contents = _field.val(); |
359 _contents = _field.val(); |
347 _field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
360 _field.css("border-color", !!_contents ? "#666666" : "#ff0000"); |
|
361 if (!!_contents) { |
|
362 _field.removeClass("empty"); |
|
363 } else { |
|
364 _field.addClass("empty"); |
|
365 } |
348 this.pauseOnWrite(); |
366 this.pauseOnWrite(); |
349 return !!_contents; |
367 return !!_contents; |
350 } |
368 } |
351 |
369 |
352 /* Fonction effectuant l'envoi des annotations */ |
370 /* Fonction effectuant l'envoi des annotations */ |
419 if (_this.after_send_timeout) { /* Selon les options de configuration, on revient à l'écran principal ou on ferme le widget, ou rien */ |
437 if (_this.after_send_timeout) { /* Selon les options de configuration, on revient à l'écran principal ou on ferme le widget, ou rien */ |
420 window.setTimeout( |
438 window.setTimeout( |
421 function() { |
439 function() { |
422 _this.close_after_send |
440 _this.close_after_send |
423 ? _this.hide() |
441 ? _this.hide() |
424 : _this.showScreen("Main"); |
442 : _this.show(); |
425 }, |
443 }, |
426 _this.after_send_timeout |
444 _this.after_send_timeout |
427 ); |
445 ); |
428 } |
446 } |
429 _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */ |
447 _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */ |