integration/js/editor.js
changeset 69 e56b4456668f
parent 65 60a1e58b0a08
child 73 475e5fb0ea2b
equal deleted inserted replaced
65:60a1e58b0a08 69:e56b4456668f
   398             if (currentMedia.loaded) {
   398             if (currentMedia.loaded) {
   399                 currentMedia.setCurrentTime(currentSegment.begin);
   399                 currentMedia.setCurrentTime(currentSegment.begin);
   400             }
   400             }
   401             $(".add-segment").val(IriSP.translate(addMode ? "Add segment to hashcut" : "Save segment"));
   401             $(".add-segment").val(IriSP.translate(addMode ? "Add segment to hashcut" : "Save segment"));
   402             $(".create-or-edit").text(IriSP.translate(addMode ? "Create new segment" : "Edit existing segment"));
   402             $(".create-or-edit").text(IriSP.translate(addMode ? "Create new segment" : "Edit existing segment"));
   403             media.show();
       
   404             $("#segment-title").val(currentSegment.title);
   403             $("#segment-title").val(currentSegment.title);
   405             $("#segment-description").val(currentSegment.description);
   404             $("#segment-description").val(currentSegment.description);
   406             var segment_tags = $("#segment-tags");
   405             var segment_tags = $("#segment-tags");
   407             segment_tags.tagit("option","onTagRemoved",function(){});
   406             segment_tags.tagit("option","onTagRemoved",function(){});
   408             segment_tags.tagit("option","onTagAdded",function(){});
   407             segment_tags.tagit("option","onTagAdded",function(){});
   617     })
   616     })
   618     .on("mouseout", ".item-video", function() {
   617     .on("mouseout", ".item-video", function() {
   619         project.trigger("mouseout-annotation");
   618         project.trigger("mouseout-annotation");
   620     })
   619     })
   621     .on("click", ".item-video", function() {
   620     .on("click", ".item-video", function() {
   622         project.trigger("click-annotation", project.getElement($(this).attr("data-segment-id")));
   621         var segment = project.getElement($(this).attr("data-segment-id"));
       
   622         if (currentMedia === mashup) {
       
   623             project.trigger("click-annotation", segment);
       
   624         } else {
       
   625             currentSegment = segment;
       
   626             setMedia(segment.getMedia());
       
   627         }
   623     })
   628     })
   624     .on("click", ".edit", function(e) {
   629     .on("click", ".edit", function(e) {
   625         var currentItem = $(this).parents(".item-video"),
   630         var currentItem = $(this).parents(".item-video"),
   626             media = project.getElement(currentItem.attr("data-media-id")),
   631             media = project.getElement(currentItem.attr("data-media-id")),
   627             segment = project.getElement(currentItem.attr("data-segment-id"));
   632             segment = project.getElement(currentItem.attr("data-segment-id"));
   846             _a.setTags(tagids);
   851             _a.setTags(tagids);
   847         });
   852         });
   848         postproject.addList("annotation",annotations);
   853         postproject.addList("annotation",annotations);
   849         postproject.addList("media",medias);
   854         postproject.addList("media",medias);
   850         postproject.addList("mashup",[mashup]);
   855         postproject.addList("mashup",[mashup]);
   851         postproject.creator = "admin";
   856         postproject.creator = options.creator;
   852         postproject.created = new Date();
   857         postproject.created = new Date();
   853         postproject.modified = new Date();
   858         postproject.modified = new Date();
   854         postproject.title = mashup.title;
   859         postproject.title = mashup.title;
   855         postproject.description = mashup.description;
   860         postproject.description = mashup.description;
   856         $.ajax({
   861         $.ajax({
   857             type: "POST",
   862             type: "POST",
   858             url: IriSP.endpoints.project,
   863             url: IriSP.endpoints.project,
   859             data: IriSP.serializers.ldt.serialize(postproject),
   864             data: IriSP.serializers.ldt.serialize(postproject),
   860             contentType: "application/cinelab",
   865             contentType: "application/cinelab",
   861 //            headers: {"X-CSRFToken": "{{csrf_token}}"},
   866             headers: {
       
   867                 "X-CSRFToken": options.csrf_token
       
   868             },
   862             success: function(data, status, request){
   869             success: function(data, status, request){
   863                 var location = request.getResponseHeader("Location"),
   870                 var location = request.getResponseHeader("Location"),
   864                     projid = location.match(/([^/]+)\/?$/)[1],
   871                     projid = location.match(/([^/]+)\/?$/)[1],
   865                     destination = IriSP.endpoints.hashcut_page + projid;
   872                     destination = IriSP.endpoints.hashcut_page + projid;
   866                 $(window).off("beforeunload", onLeave);
   873                 $(window).off("beforeunload", onLeave);