# HG changeset patch # User durandn # Date 1443185138 -7200 # Node ID 539c9bee537268e1bbfb5a05ee496536fd7c9557 # Parent 5ef7182907c5f5e7282bf7e00987f6744e55ca35 Translating comments into English diff -r 5ef7182907c5 -r 539c9bee5372 src/widgets/CreateAnnotation.js --- a/src/widgets/CreateAnnotation.js Fri Sep 25 10:44:54 2015 +0200 +++ b/src/widgets/CreateAnnotation.js Fri Sep 25 14:45:38 2015 +0200 @@ -396,9 +396,8 @@ return !!_contents; }; -/* Fonction effectuant l'envoi des annotations */ IriSP.Widgets.CreateAnnotation.prototype.onSubmit = function() { - /* Si les champs obligatoires sont vides, on annule l'envoi */ + /* If mandatory fields are empty, we cancel the sending */ if (!this.onDescriptionChange() || (this.show_title_field && !this.onTitleChange()) || (this.show_creator_field && !this.onCreatorChange())) { return false; } @@ -408,26 +407,26 @@ } var _this = this, - _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */ - _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* Création d'un objet source utilisant un sérialiseur spécifique pour l'export */ - _annotation = new IriSP.Model.Annotation(false, _export), /* Création d'une annotation dans cette source avec un ID généré à la volée (param. false) */ - _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* Récupération du type d'annotation dans lequel l'annotation doit être ajoutée */ - _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* Si le Type d'Annotation n'existe pas, il est créé à la volée */ - _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); /* Génération de l'URL à laquelle l'annotation doit être envoyée, qui doit inclure l'ID du projet */ + _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create a List to send to the server that will contains the annotation */ + _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* We create a source object using a specific serializer for export */ + _annotation = new IriSP.Model.Annotation(false, _export), /* We create an annotation in the source with a generated ID (param. false) */ + _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* We get the AnnotationType in which the annotation will be added */ + _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* If it doesn't already exists, we create it */ + _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 */ - /* Si nous avons dû générer un ID d'annotationType à la volée... */ + /* If we created an AnnotationType on the spot ... */ if (!_annotationTypes.length) { - /* Il ne faudra pas envoyer l'ID généré au serveur */ + /* ... We must not send its id to the server ... */ _annotationType.dont_send_id = true; - /* Il faut inclure le titre dans le type d'annotation */ + /* ... And we must include its title. */ _annotationType.title = this.annotation_type; } /* - * Nous remplissons les données de l'annotation générée à la volée - * ATTENTION: Si nous sommes sur un MASHUP, ces éléments doivent se référer AU MEDIA D'ORIGINE + * Will fill the generated annotation object's data + * WARNING: If we're on a MASHUP, these datas must refer the ORIGINAL MEDIA * */ - _annotation.setMedia(this.source.currentMedia.id); /* Id du média annoté */ + _annotation.setMedia(this.source.currentMedia.id); /* Annotated media ID */ if (this.post_at_segment_time){ var _currentTime = this.media.getCurrentTime() @@ -436,28 +435,28 @@ return (_currentTime >= _segment.begin && _currentTime <= _segment.end) }); if (_currentSegments.length == 0){ - _annotation.setBegin(this.begin); /* Timecode de début du widget */ - _annotation.setEnd(this.end); /* Timecode de fin du widget */ + _annotation.setBegin(this.begin); /* Widget starting timecode */ + _annotation.setEnd(this.end); /* Widget end timecode */ } else { - _annotation.setBegin(_currentSegments[0].begin); /* Timecode de début du segment */ - _annotation.setEnd(_currentSegments[0].end); /* Timecode de fin du segment */ + _annotation.setBegin(_currentSegments[0].begin); /* Segment starting timecode */ + _annotation.setEnd(_currentSegments[0].end); /* Segment end timecode */ } } else { - _annotation.setBegin(this.begin); /*Timecode de début du widget */ - _annotation.setEnd(this.end); /* Timecode de fin du widget */ + _annotation.setBegin(this.begin); /* Widget starting timecode */ + _annotation.setEnd(this.end); /* Widget end timecode */ } - _annotation.setAnnotationType(_annotationType.id); /* Id du type d'annotation */ + _annotation.setAnnotationType(_annotationType.id); /* Annotation type ID */ if (this.show_title_field) { - /* Champ titre, seulement s'il est visible */ + /* Title field, only if it's visible */ _annotation.title = this.$.find(".Ldt-CreateAnnotation-Title").val(); }if (this.project_id != ""){ - /* Champ id projet, seulement si on l'a renseigné dans la config */ + /* Project id, only if it's been specifiec in the config */ _annotation.project_id = this.project_id; } - _annotation.created = new Date(); /* Date de création de l'annotation */ - _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); /* Champ description */ + _annotation.created = new Date(); /* Annotation creation date */ + _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); /* Description field */ var tagIds = Array.prototype.map.call( this.$.find(".Ldt-CreateAnnotation-TagLi.selected"), @@ -481,7 +480,7 @@ }) - _annotation.setTags(IriSP._(tagIds).uniq()); /*Liste des ids de tags */ + _annotation.setTags(IriSP._(tagIds).uniq()); /* Tag ids list */ if (this.audio_url) { _annotation.audio = { src: "mic", @@ -494,18 +493,18 @@ } else { _annotation.creator = this.creator_name; } - _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */ - _export.addList("annotation",_exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */ + _exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */ + _export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */ var _this = this; - /* Envoi de l'annotation via AJAX au serveur ! */ + /* We send the AJAX request to the server ! */ IriSP.jQuery.ajax({ url: _url, type: this.api_method, contentType: 'application/json', - data: _export.serialize(), /* L'objet Source est sérialisé */ + data: _export.serialize(), /* Source is serialized */ success: function(_data) { - _this.showScreen('Saved'); /* Si l'appel a fonctionné, on affiche l'écran "Annotation enregistrée" */ - if (_this.after_send_timeout) { /* Selon les options de configuration, on revient à l'écran principal ou on ferme le widget, ou rien */ + _this.showScreen('Saved'); + if (_this.after_send_timeout) { window.setTimeout( function() { _this.close_after_send @@ -515,13 +514,13 @@ _this.after_send_timeout ); } - _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */ - _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */ - _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */ + _export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */ + _export.deSerialize(_data); /* Data deserialization */ + _this.source.merge(_export); /* We merge the deserialized data with the current source data */ if (_this.pause_on_write && _this.media.getPaused()) { _this.media.play(); } - _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */ + _this.player.trigger("AnnotationsList.refresh"); }, error: function(_xhr, _error, _thrown) { IriSP.log("Error when sending annotation", _thrown); diff -r 5ef7182907c5 -r 539c9bee5372 src/widgets/CurrentSegmentInfobox.js --- a/src/widgets/CurrentSegmentInfobox.js Fri Sep 25 10:44:54 2015 +0200 +++ b/src/widgets/CurrentSegmentInfobox.js Fri Sep 25 14:45:38 2015 +0200 @@ -218,9 +218,9 @@ new_description = this.$.find(".Ldt-CurrentSegmentInfobox-DescriptionInput").val() var _this = this, - _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */ - _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), - _annotation = new IriSP.Model.Annotation(this.currentSegment.id, _export); /* Création d'une annotation dans cette source avec un ID généré à la volée (param. false) */ + _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create an Annotations List to send to the server */ + _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* We create a source object using a specific serializer for export */ + _annotation = new IriSP.Model.Annotation(this.currentSegment.id, _export); /* We create an annotation in the source with a generated ID (param. false) */ _annotation.setAnnotationType(this.currentSegment.getAnnotationType().id); _annotation.setMedia(this.currentSegment.getMedia().id); @@ -228,8 +228,8 @@ _annotation.setEnd(this.currentSegment.end); _annotation.created = this.currentSegment.created; _annotation.creator = this.currentSegment.creator; - _annotation.title = new_title /* Champ titre */ - _annotation.description = new_description /* Champ description */ + _annotation.title = new_title /* Title field */ + _annotation.description = new_description /* Description field */ var _tagIds = IriSP._(new_tags_titles).map(function(_title) { var _tags = _this.source.getTags(true).searchByTitle(_title, true); if (_tags.length) { @@ -245,8 +245,8 @@ _annotation.setTags(_tagIds); _annotation.project_id = this.project_id; - _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */ - _export.addList("annotation",_exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */ + _exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */ + _export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */ _url = Mustache.to_html(this.api_endpoint_template, {annotation_id: this.currentSegment.id}); @@ -254,11 +254,11 @@ url: _url, type: this.api_method, contentType: 'application/json', - data: _export.serialize(), /* L'objet Source est sérialisé */ + data: _export.serialize(), /* Source is serialized */ success: function(_data) { - _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */ - _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */ - _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */ + _export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */ + _export.deSerialize(_data); /* Data deserialization */ + _this.source.merge(_export); /* We merge the deserialized data with the current source data */ _this.segments.forEach(function(_segment){ if (_segment.id == _annotation.id){ _this.segments.removeElement(_segment) diff -r 5ef7182907c5 -r 539c9bee5372 src/widgets/Markers.js --- a/src/widgets/Markers.js Fri Sep 25 10:44:54 2015 +0200 +++ b/src/widgets/Markers.js Fri Sep 25 14:45:38 2015 +0200 @@ -205,7 +205,7 @@ this.showScreen("ConfirmDelete"); } else { - // Clic sur - sans marqueur sélectionné = retour à l'état initial + // Click on "x" without a selected marker: back to initial state this.cancelEdit(); } } @@ -247,7 +247,7 @@ IriSP.Widgets.Markers.prototype.cancelEdit = function(){ if (this.selectedMarker){ - // Clic sur "cancel" pendant édition d'un marqueur = retour à l'état visualisation + // Click on "cancel" while editing a marker: back to visualization state _divHtml = Mustache.to_html(this.infoTemplate, { edit: false, marker_info: this.selectedMarker.description, @@ -258,7 +258,7 @@ } } else { - // Clic sur "cancel" pendant la création d'un marqueur = retour à l'état initial + // Click on "cancel" while editing a marker: back to initial state this.hidePlaceholder(); this.$.find(".Ldt-Markers-Info").html(""); this.$.find(".Ldt-Markers-RoundButton").hide() @@ -440,85 +440,78 @@ IriSP.Widgets.Markers.prototype.onSubmit = function(){ - /* Si les champs obligatoires sont vides, on annule l'envoi */ + /* If mandatory fields are empty, we cancel the sending */ if (!this.allow_empty_markers && !this.onDescriptionChange()){ return false; } - /* On pause la vidéo si elle est encore en train de tourner */ + /* We pause the video if it's still playing */ if (!this.media.getPaused()){ this.media.pause(); } var _this = this, - _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager); /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */ + _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* We create a List to send to the server that will contains the annotation */ + _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* We create a source object using a specific serializer for export */ + _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* We get the AnnotationType in which the annotation will be added */ + _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)); /* If it doesn't already exists, we create it */ if (this.selectedMarker){ - var _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}) - _annotation = this.selectedMarker, + var _annotation = this.selectedMarker, _url = Mustache.to_html(this.api_endpoint_template_edit, {annotation_id: this.selectedMarker ? this.selectedMarker.id : ""}); _annotation.source = _export - _annotation.description = this.$.find(".Ldt-Markers-MarkerTextArea").val(), /* Champ description */ - _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* Récupération du type d'annotation dans lequel l'annotation doit être ajoutée */ - _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)); /* Si le Type d'Annotation n'existe pas, il est créé à la volée */ + _annotation.description = this.$.find(".Ldt-Markers-MarkerTextArea").val(), /* Description field */ } else { - var _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* Création d'un objet source utilisant un sérialiseur spécifique pour l'export */ - _annotation = new IriSP.Model.Annotation(false, _export); /* Création d'une annotation dans cette source avec un ID généré à la volée (param. false) */ - _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type, true), /* Récupération du type d'annotation dans lequel l'annotation doit être ajoutée */ - _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* Si le Type d'Annotation n'existe pas, il est créé à la volée */ + var _annotation = new IriSP.Model.Annotation(false, _export), _url = Mustache.to_html(this.api_endpoint_template_create); - /* Si nous avons dû générer un ID d'annotationType à la volée... */ + + /* If we created an AnnotationType on the spot ... */ if (!_annotationTypes.length) { - /* Il ne faudra pas envoyer l'ID généré au serveur */ + /* ... We must not send its id to the server ... */ _annotationType.dont_send_id = true; - /* Il faut inclure le titre dans le type d'annotation */ + /* ... And we must include its title. */ _annotationType.title = this.annotation_type; } - _annotation.setMedia(this.source.currentMedia.id); /* Id du média annoté */ + _annotation.setMedia(this.source.currentMedia.id); /* Annotated media ID */ if (!this.selectedMarker){ _annotation.setBegin(this.newMarkerCurrentTime); _annotation.setEnd(this.newMarkerCurrentTime); } - _annotation.setAnnotationType(_annotationType.id); /* Id du type d'annotation */ + _annotation.setAnnotationType(_annotationType.id); /* AnnotationType ID */ if (this.project_id != ""){ - /* Champ id projet, seulement si on l'a renseigné dans la config */ + /* Project id, only if it's been specifiec in the config */ _annotation.project_id = this.project_id; } - _annotation.created = new Date(); /* Date de création de l'annotation */ - _annotation.description = this.$.find(".Ldt-Markers-MarkerTextArea").val(); /* Champ description */ + _annotation.created = new Date(); /* Creation date */ + _annotation.description = this.$.find(".Ldt-Markers-MarkerTextArea").val(); /* Description field */ _annotation.creator = this.creator_name; } _annotation.project_id = this.project_id; - /* - * Nous remplissons les données de l'annotation générée à la volée - * ATTENTION: Si nous sommes sur un MASHUP, ces éléments doivent se référer AU MEDIA D'ORIGINE - * */ + _exportedAnnotations.push(_annotation); /* We add the annotation in the list to export */ + _export.addList("annotation",_exportedAnnotations); /* We add the list to the source object */ - _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */ - _export.addList("annotation",_exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */ - - /* Envoi de l'annotation via AJAX au serveur ! */ + /* We send the AJAX request to the server ! */ IriSP.jQuery.ajax({ url: _url, type: this.selectedMarker ? this.api_method_edit : this.api_method_create, contentType: 'application/json', - data: _export.serialize(), /* L'objet Source est sérialisé */ + data: _export.serialize(), success: function(_data) { - _this.showScreen('Success'); /* Si l'appel a fonctionné, on affiche l'écran "Annotation enregistrée" */ + _this.showScreen('Success'); window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000)); - _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */ - _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */ + _export.getAnnotations().removeElement(_annotation, true); /* We delete the sent annotation to avoid redundancy */ + _export.deSerialize(_data); /* Data deserialization */ _annotation.id = _data.id; - _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */ + _this.source.merge(_export); /* We merge the deserialized data with the current source data */ if (_this.pause_on_write && _this.media.getPaused() && _this.play_on_submit) { _this.media.play(); } _this.markers.push(_annotation); _this.selectedMarker = _annotation; _this.drawMarkers(); - _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */ + _this.player.trigger("AnnotationsList.refresh"); _this.player.trigger("Markers.refresh"); }, error: function(_xhr, _error, _thrown) { @@ -541,14 +534,14 @@ type: this.api_method_delete, contentType: 'application/json', success: function(_data) { - _this.showScreen('DeleteSuccess'); /* Si l'appel a fonctionné, on affiche l'écran "Annotation enregistrée" */ + _this.showScreen('DeleteSuccess'); window.setTimeout(_this.functionWrapper("revertToMainScreen"),(_this.after_send_timeout || 5000)); if (_this.pause_on_write && _this.media.getPaused() && _this.play_on_submit) { _this.media.play(); } _this.markers.removeElement(_this.selectedMarker); _this.selectedMarker = false - _this.player.trigger("AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */ + _this.player.trigger("AnnotationsList.refresh"); _this.player.trigger("Markers.refresh"); }, error: function(_xhr, _error, _thrown) {