# HG changeset patch # User cavaliet # Date 1370612472 -7200 # Node ID f0d132d6beedcf7567057e7f8897df37a9878a69 # Parent 7cbaa8d0a7a6a0232d524462fdc0c29db3e437cb debug and update from integration diff -r 7cbaa8d0a7a6 -r f0d132d6beed src/metadatacomposer/static/metadatacomposer/css/style.css --- a/src/metadatacomposer/static/metadatacomposer/css/style.css Fri Jun 07 13:02:19 2013 +0200 +++ b/src/metadatacomposer/static/metadatacomposer/css/style.css Fri Jun 07 15:41:12 2013 +0200 @@ -10,6 +10,7 @@ h1 img{margin-right: 8px;} h1 a span{font-size: 16px; line-height: 20px; color: #FFF;} h1 span{font-size: 24px;} +.btn-ok-chapter{margin-right: 10px;} .nav-bar{margin-top: 10px; } .nav-bar a:hover{text-decoration: none; color: #34495e;} section{padding-top: 20px;} @@ -43,9 +44,9 @@ .project-title-editor-form{margin: 0;} .project-action a:last-child{margin-right: 20px;} .chapter-widget-info{margin-bottom: 20px;} -.chapter-widget form{ margin: 0;} +.chapter-widget form{ margin: 0; padding-bottom: 10px;} #list-annotations{ background-color: #fff;} -.form-info-general-annotation{ border-bottom: 1px solid #bdc3c7;} +.form-info-general-annotation{ } .chapter-widget input, .form-info-general-annotation input, .form-info-general-annotation textarea{width: 196px; max-width: 196px; } .chapter-widget textarea{width: 426px; max-width: 426px; min-width: 426px; height: 20px;-webkit-transition: height .3s ease;-moz-transition: height .3s ease;transition: height .3s ease;} .form-chapter-edit{} @@ -92,7 +93,11 @@ .timeline-annotations-wrap{position: relative;background-color: #202020;} .timeline-annotations{width: 460px;height: auto; position: relative; margin: 0; padding-top: 4px;} .timeline-annotations li{display: block; width: 460px;height: 12px; position: relative; padding-bottom: 4px;} -.timeline-annotations .annotation{ color:#000; text-align:center; font-size : 10px; overflow: hidden; line-height: 12px; width: 10px; height: 12px; background-color: #c0392b; position: absolute; top:0px;} +.timeline-annotations .annotation{cursor: pointer; display:block; text-decoration:none; color:#000; text-align:center; font-size : 10px; overflow: hidden; line-height: 12px; width: 10px; height: 12px; background-color: #c0392b; position: absolute; top:0px;} +.timeline-annotations .annotation span, .timeline-annotations .annotation i{display: none;} +.timeline-annotations .annotation:hover span, +.annotation.editing span, +.annotation.editing i{display: inline;} ul.tagit{margin-left: 10px;-webkit-border-radius: 0px; -moz-border-radius: 0px; border-radius: 0px;} @@ -120,6 +125,7 @@ .description-slideshow-row{word-wrap: break-word; width: 180px; } .description-slideshow-row span{max-height: 100px; display: inline-block; overflow: auto;} .description-slideshow-row textarea{width: 164px; max-width: 164px; height: 100px;} +.label-modify-video, .label-add-video{display: none;} /* Tangle */ .time-tangle { color: #2c3e50; cursor: w-resize; position: relative; diff -r 7cbaa8d0a7a6 -r f0d132d6beed src/metadatacomposer/static/metadatacomposer/js/edition.js --- a/src/metadatacomposer/static/metadatacomposer/js/edition.js Fri Jun 07 13:02:19 2013 +0200 +++ b/src/metadatacomposer/static/metadatacomposer/js/edition.js Fri Jun 07 15:41:12 2013 +0200 @@ -24,12 +24,20 @@ } }); -$('.timeline-annotations').bind('click', function(e){ - var x = e.pageX - $(this).offset().left; - myMedia.setCurrentTime(myMedia.duration * x / $(this).width()); +$('.timeline-annotations').on('click', '.annotation', function(e){ + e.preventDefault(); + var idAnnotation = $(this).attr('data-id'), + annotation = _.find(annotations, function(c){ return c.id == idAnnotation; }); + myMedia.setCurrentTime(annotation.begin); + if($('#tab-annotation-'+idAnnotation).length){ + $('a[href=#tab-annotation-'+idAnnotation+']').tab('show'); + }else{ + openTab(annotation.type, annotation); + } }); myProject.onLoad(function() { + myProject.regenerateTags = true; $(".project-title").text(myProject.title); $('.project-title-nav').text(myProject.title); @@ -121,19 +129,8 @@ if(v.begin <= t && v.end >= t){ currentAnnotationsDisplay.push(v.id); if(!$('#item-current-annotation-'+v.id).length){ - var itemAnnotation = - $('
  • ') - .attr('id', 'item-current-annotation-'+v.id) - .attr('data-id', v.id) - .append( - $('') - .css('backgroundColor', v.color) - .attr('data-id', v.id) - .attr('href', '#') - .append( - $('').addClass('icon-'+getIcon(v.type)) - ) - ); + var itemAnnotation = getTemplate('#tpl-item-annotation-display'); + itemAnnotation = Mustache.render(itemAnnotation, v); $('.list-current-annotations').append(itemAnnotation) } } @@ -154,8 +151,8 @@ } function showCurrentAnnotationInTimeline(idAnnotation){ - $('.timeline-annotations .annotation').empty(); - $('#annotation-timeline-'+idAnnotation).html(' '+textCurrentAnnotationEditT); + $('.annotation').removeClass('editing'); + $('#annotation-timeline-'+idAnnotation).addClass('editing'); } //display annotation view $('.list-current-annotations').on('click', 'a', function(e){ @@ -245,6 +242,7 @@ var idChapter = $(this).parents('form').attr('data-chapter-id'); $('.chapter-segments').find('#'+idChapter).text(value); $('#row-list-chapter-'+idChapter).find('td:first').text(value); + $(this).parents('form').find('.btn-delete-chapter').attr('data-title', value); } }); @@ -276,7 +274,7 @@ return $('#templates').find(idTpl).html(); } //supprimer -$('.list-chapter-wrap').on('click', '.btn-delete-chapter', function(e){ +$(document).on('click', '.btn-delete-chapter', function(e){ e.preventDefault(); if(chapters.length == 1){alert('Le projet doit contenir au moins un chapitre.'); return;} @@ -286,6 +284,10 @@ btnDeleteModal.attr('data-id', idChapter); }); +$(document).on('click', '.btn-ok-chapter', function(e){ + e.preventDefault(); + $('.form-chapter-edit').remove(); +}) function deleteChapter(idChapter){ disabledPreview(); @@ -301,7 +303,8 @@ //var newEnd = new IriSP.Model.Time(chapter.end) chapterModify.setEnd(chapter.end); } - chapters = _(chapters).reject(function(c) { return c.id == idChapter; }); + chapters.removeId(idChapter); + myProject.getAnnotations().removeId(idChapter, true); renderChapter(); //si le formulaire est visible if($('#form-chapter-edit-'+idChapter).length){ @@ -325,6 +328,7 @@ chapter.color = getRandomColor(); chapters.push(chapter); + myProject.getAnnotations().push(chapter); renderChapter(); loadFormChapter(chapter.id); } @@ -333,12 +337,12 @@ e.preventDefault(); var dataChapter = { - title : 'New', - begin : myMedia.currentTime, - end : organizeNewChapter(myMedia.currentTime), - description : 'description', - keywords : ['tag1','tag2'] - }; + title : 'New', + begin : myMedia.currentTime, + end : organizeNewChapter(myMedia.currentTime), + description : 'description', + keywords : ['tag1','tag2'] + }; newChapter(dataChapter, true); @@ -366,7 +370,7 @@ wChapterSegmentWrap = chapterSegmentWrap.width(), chapterList = $('.list-chapter-rows-wrap'); - chapters = _.sortBy(chapters, function(c){ + chapters = chapters.sortBy(function(c){ return c.begin; }); @@ -412,6 +416,7 @@ annotation.keywords = dataAnnotation.keywords; annotation.content = getContentAnnotationByType(dataAnnotation.type); + myProject.getAnnotations().push(annotation); annotations.push(annotation); return annotation; @@ -424,7 +429,7 @@ wTimeline = timeline.width(), annotationList = $('#list-annotations-rows'); - annotations = _.sortBy(annotations, function(c){ + annotations = annotations.sortBy(function(c){ return c.begin; }); @@ -436,11 +441,16 @@ //timeline var width = Math.floor(v.getDuration() * wTimeline / myMedia.duration), left = Math.floor(v.begin * wTimeline / myMedia.duration), - segment = $('
    ').css({ + dataAnntim = { left : left, width : width, - backgroundColor : v.color - }).addClass('annotation').attr('id', 'annotation-timeline-'+v.id); + color : v.color, + id : v.id, + title : v.title + }, + segment = getTemplate('#tpl-annotation-in-timeline'); + segment = Mustache.render(segment, dataAnntim); + var isInTimeline = false; $.each(timeline.find('li'), function(a, b){ @@ -505,6 +515,8 @@ if(name == 'title'){ var idAnnotation = $(this).parents('form').attr('data-id'); $('#onglet-title-'+idAnnotation).text(value); + $(this).parents('form').find('.btn-delete-annotation').attr('data-title', value); + $('#annotation-timeline-'+ idAnnotation+' span').text(value); } }); @@ -521,7 +533,8 @@ function deleteAnnotation(idAnnotation){ disabledPreview(); $("#modal-confirm").modal('hide'); - annotations = _(annotations).reject(function(c) { return c.id == idAnnotation; }); + annotations.removeId(idAnnotation); + myProject.getAnnotations().removeId(idAnnotation, true); closeTab(idAnnotation); renderAnnotation(); } @@ -543,6 +556,7 @@ var dataView; if(_.isUndefined(data)){//nouveau + var currentTimePlusUnMin = 60 * 1000 + myMedia.currentTime, endAnnotation = (currentTimePlusUnMin"], ["Header 1", "

    "], ["Header 2", "

    "], + styles: [["Paragraph", "

    "], ["Header 2", "

    "], ["Header 3", "

    "], ["Header 4","

    "], ["Header 5","

    "], ["Header 6","
    "]], docType: '', @@ -1026,7 +1051,7 @@ content = { mimetype : "application/x-ldt-text", markup : "html", - text : "azerty" + text : "" }; break; case 'links': diff -r 7cbaa8d0a7a6 -r f0d132d6beed src/metadatacomposer/static/metadatacomposer/js/ldt-serializer.js --- a/src/metadatacomposer/static/metadatacomposer/js/ldt-serializer.js Fri Jun 07 13:02:19 2013 +0200 +++ b/src/metadatacomposer/static/metadatacomposer/js/ldt-serializer.js Fri Jun 07 15:41:12 2013 +0200 @@ -58,7 +58,22 @@ "id-ref": _data.id }, items: _source.getAnnotationTypes().filter(function(_at) { - return _at.media === _data; + switch (typeof _at.media) { + case "object": + return (_at.media === _data); + case "string": + return (_at.media === _data.id); + default: + var _ann = _at.getAnnotations(); + if (_ann) { + for (var i = 0; i < _ann.length; i++) { + if (_ann[i].getMedia() === _data) { + return true; + } + } + } + } + return false; }).map(function(_at) { return { "id-ref": _at.id @@ -78,6 +93,9 @@ return _res; }, serializer : function(_data, _source, _dest) { + if (_source.regenerateTags && !_data.regenerated) { + return; + } var _res = { id : _data.id, meta : { @@ -179,12 +197,20 @@ "dc:creator" : _data.creator || _source.creator, "dc:contributor" : _data.contributor || _source.contributor || _data.creator || _source.creator, // project : _source.projectId - }, - tags : IriSP._(_data.tag.id).map(function(_id) { + } + } + if (_source.regenerateTags) { + _res.tags = IriSP._(_data.keywords).map(function(_kw) { + return { + "id-ref": _source.__keywords[_kw.toLowerCase()].id + } + }); + } else { + _res.tags = IriSP._(_data.tag.id).map(function(_id) { return { "id-ref" : _id } - }) + }); } _res.content.title = _data.title || _res.content.title || ""; _dest.annotations.push(_res); @@ -248,6 +274,24 @@ annotations: [] }, _this = this; + if (_source.regenerateTags) { + _source.__keywords = {}; + _source.getAnnotations().forEach(function(a) { + IriSP._(a.keywords).each(function(kw) { + var lkw = kw.toLowerCase(); + if (typeof _source.__keywords[lkw] === "undefined") { + _source.__keywords[lkw] = { + id: IriSP.Model.getUID(), + title: kw, + regenerated: true + } + } + }); + }); + IriSP._(_source.__keywords).each(function(kw) { + _this.types.tag.serializer(kw, _source, _res); + }) + } _source.forEach(function(_list, _typename) { if (typeof _this.types[_typename] !== "undefined") { _list.forEach(function(_el) { @@ -287,6 +331,9 @@ _source.projectId = _data.meta.id; _source.title = _data.meta["dc:title"] || _data.meta.title || ""; _source.description = _data.meta["dc:description"] || _data.meta.description || ""; + _source.creator = _data.meta["dc:creator"] || _data.meta.creator || ""; + _source.contributor = _data.meta["dc:contributor"] || _data.meta.contributor || _source.creator; + _source.created = IriSP.Model.isoToDate(_data.meta["dc:created"] || _data.meta.created); } if (typeof _data.meta !== "undefined" && typeof _data.meta.main_media !== "undefined" && typeof _data.meta.main_media["id-ref"] !== "undefined") { diff -r 7cbaa8d0a7a6 -r f0d132d6beed src/metadatacomposer/static/metadatacomposer/js/metadataplayer-core.js --- a/src/metadatacomposer/static/metadatacomposer/js/metadataplayer-core.js Fri Jun 07 13:02:19 2013 +0200 +++ b/src/metadatacomposer/static/metadatacomposer/js/metadataplayer-core.js Fri Jun 07 15:41:12 2013 +0200 @@ -1180,7 +1180,10 @@ return (_e.elementType === _listId); }); } else { - return this.contents[_listId] || new IriSP.List(this.directory); + if (typeof this.contents[_listId] === "undefined") { + this.contents[_listId] = new IriSP.List(this.directory); + } + return this.contents[_listId]; } }; diff -r 7cbaa8d0a7a6 -r f0d132d6beed src/metadatacomposer/templates/metadatacomposer_edit.html --- a/src/metadatacomposer/templates/metadatacomposer_edit.html Fri Jun 07 13:02:19 2013 +0200 +++ b/src/metadatacomposer/templates/metadatacomposer_edit.html Fri Jun 07 15:41:12 2013 +0200 @@ -85,42 +85,6 @@
    -

    Liste des chapitres

    @@ -136,27 +100,6 @@ -
    @@ -197,36 +140,6 @@ - @@ -338,7 +251,7 @@ Ajouter une vidéo
    + href="{% url 'composer_modal_content_library' branding=branding %}?mode=library">
    @@ -522,7 +435,7 @@
    - + Delete @@ -571,8 +484,9 @@

    Vidéo

    - Ajouter une vidéo -
    + Ajouter une vidéo + Modifier la vidéo +
    @@ -808,8 +722,29 @@
    + + + + + +