Merge with 45416f40602e45c606320f5447c9abfdef277eff
authorveltr
Wed, 28 Nov 2012 15:43:44 +0100
changeset 71 4360509f98e4
parent 70 f2686ce658fd (diff)
parent 68 45416f40602e (current diff)
child 72 aa85db611fb7
Merge with 45416f40602e45c606320f5447c9abfdef277eff
src/hashcut/static/hashcut/iri/css/home.css
--- a/integration/css/edition.css	Wed Nov 28 15:31:25 2012 +0100
+++ b/integration/css/edition.css	Wed Nov 28 15:43:44 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;
 }
 
--- a/integration/edition.html	Wed Nov 28 15:31:25 2012 +0100
+++ b/integration/edition.html	Wed Nov 28 15:43:44 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"
+            }
        });
     });
         </script>
--- a/integration/js/editor.js	Wed Nov 28 15:31:25 2012 +0100
+++ b/integration/js/editor.js	Wed Nov 28 15:43:44 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],
--- a/integration/js/mashupcore.js	Wed Nov 28 15:31:25 2012 +0100
+++ b/integration/js/mashupcore.js	Wed Nov 28 15:43:44 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();
             }
         });
--- a/src/hashcut/static/hashcut/iri/css/edition.css	Wed Nov 28 15:31:25 2012 +0100
+++ b/src/hashcut/static/hashcut/iri/css/edition.css	Wed Nov 28 15:43:44 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;
 }
 
--- a/src/hashcut/static/hashcut/js/hashcut.js	Wed Nov 28 15:31:25 2012 +0100
+++ b/src/hashcut/static/hashcut/js/hashcut.js	Wed Nov 28 15:43:44 2012 +0100
@@ -1850,7 +1850,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();
@@ -2058,7 +2057,7 @@
         });
         
         project.on("set-current", function(_m) {
-            if (_m !== media) {
+            if (_m !== media && (_m !== mashup || mashup.currentMedia !== media)) {
                 media.hide();
             }
         });
@@ -2641,7 +2640,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");
@@ -2860,7 +2858,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"),
@@ -3089,7 +3093,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;
@@ -3099,7 +3103,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],