# HG changeset patch # User veltr # Date 1354113736 -3600 # Node ID e56b4456668f3b2094909fe5f48f47db226a7ac7 # Parent 60a1e58b0a08fadfd5d1400603083c5419216142 Added CSRF Token and Username Option diff -r 60a1e58b0a08 -r e56b4456668f integration/css/edition.css --- a/integration/css/edition.css Wed Nov 28 12:19:21 2012 +0100 +++ b/integration/css/edition.css Wed Nov 28 15:42:16 2012 +0100 @@ -3,7 +3,9 @@ .empty-mode .bloc-pvw, .empty-mode .bloc-segmentation, .segment-mode .bloc-pvw, -.pvw-mode .bloc-segmentation { +.pvw-mode .bloc-segmentation, +.empty-mode .publier-button, +.segment-mode .publier-button { display: none; } diff -r 60a1e58b0a08 -r e56b4456668f integration/edition.html --- a/integration/edition.html Wed Nov 28 12:19:21 2012 +0100 +++ b/integration/edition.html Wed Nov 28 15:42:16 2012 +0100 @@ -368,11 +368,11 @@ $(function() { var hashcut = IriSP.editor({ - //url: "data/bpidata.json", - //url: "data/moon-local.json", - filter: { - tags__icontains: "Hashcut" - } + csrf_token: "{{csrf_token}}", + creator: "{{username}}", + filter: { + tags__icontains: "Hashcut" + } }); }); diff -r 60a1e58b0a08 -r e56b4456668f integration/js/editor.js --- a/integration/js/editor.js Wed Nov 28 12:19:21 2012 +0100 +++ b/integration/js/editor.js Wed Nov 28 15:42:16 2012 +0100 @@ -400,7 +400,6 @@ } $(".add-segment").val(IriSP.translate(addMode ? "Add segment to hashcut" : "Save segment")); $(".create-or-edit").text(IriSP.translate(addMode ? "Create new segment" : "Edit existing segment")); - media.show(); $("#segment-title").val(currentSegment.title); $("#segment-description").val(currentSegment.description); var segment_tags = $("#segment-tags"); @@ -619,7 +618,13 @@ project.trigger("mouseout-annotation"); }) .on("click", ".item-video", function() { - project.trigger("click-annotation", project.getElement($(this).attr("data-segment-id"))); + var segment = project.getElement($(this).attr("data-segment-id")); + if (currentMedia === mashup) { + project.trigger("click-annotation", segment); + } else { + currentSegment = segment; + setMedia(segment.getMedia()); + } }) .on("click", ".edit", function(e) { var currentItem = $(this).parents(".item-video"), @@ -848,7 +853,7 @@ postproject.addList("annotation",annotations); postproject.addList("media",medias); postproject.addList("mashup",[mashup]); - postproject.creator = "admin"; + postproject.creator = options.creator; postproject.created = new Date(); postproject.modified = new Date(); postproject.title = mashup.title; @@ -858,7 +863,9 @@ url: IriSP.endpoints.project, data: IriSP.serializers.ldt.serialize(postproject), contentType: "application/cinelab", -// headers: {"X-CSRFToken": "{{csrf_token}}"}, + headers: { + "X-CSRFToken": options.csrf_token + }, success: function(data, status, request){ var location = request.getResponseHeader("Location"), projid = location.match(/([^/]+)\/?$/)[1], diff -r 60a1e58b0a08 -r e56b4456668f integration/js/mashupcore.js --- a/integration/js/mashupcore.js Wed Nov 28 12:19:21 2012 +0100 +++ b/integration/js/mashupcore.js Wed Nov 28 15:42:16 2012 +0100 @@ -276,7 +276,6 @@ mashupSegmentEnd = mashup.currentAnnotation.annotation.end.milliseconds; mashupTimedelta = mashupSegmentBegin - mashup.currentAnnotation.begin.milliseconds; mashup.currentMedia = mashup.currentAnnotation.getMedia(); - project.getMedias().forEach(function(_media) { if (_media !== mashup.currentMedia) { _media.hide(); @@ -484,7 +483,7 @@ }); project.on("set-current", function(_m) { - if (_m !== media) { + if (_m !== media && (_m !== mashup || mashup.currentMedia !== media)) { media.hide(); } });