--- a/integration/css/common.css Thu Nov 08 18:24:47 2012 +0100
+++ b/integration/css/common.css Fri Nov 09 18:56:29 2012 +0100
@@ -1,54 +1,60 @@
/* fonts */
@font-face {
- font-family: 'OpenSans';
+ font-family: 'Open Sans';
font-weight: normal;
font-style: normal;
- src:url("fonts/OpenSans-Regular.eot") format("eot"),
+ src: local('Open Sans'), local('OpenSans'),
+ url("fonts/OpenSans-Regular.eot") format("eot"),
url("fonts/OpenSans-Regular.woff") format("woff"),
url("fonts/OpenSans-Regular.ttf") format("truetype"),
url("fonts/OpenSans-Regular.svg#OpenSans-Regular") format("svg");
}
@font-face {
- font-family: 'OpenSans';
+ font-family: 'Open Sans';
font-weight: normal;
font-style: italic;
- src:url("fonts/OpenSans-Italic.eot") format("eot"),
+ src: local('Open Sans Italic'), local('OpenSans-Italic'),
+ url("fonts/OpenSans-Italic.eot") format("eot"),
url("fonts/OpenSans-Italic.woff") format("woff"),
url("fonts/OpenSans-Italic.ttf") format("truetype"),
url("fonts/OpenSans-Italic.svg#OpenSans-Italic") format("svg");
}
@font-face {
- font-family: 'OpenSans';
+ font-family: 'Open Sans';
font-weight: 300;
font-style: normal;
- src:url("fonts/OpenSans-Light.eot") format("eot"),
+ src: local('Open Sans Light'), local('OpenSans-Light'),
+ url("fonts/OpenSans-Light.eot") format("eot"),
url("fonts/OpenSans-Light.woff") format("woff"),
url("fonts/OpenSans-Light.ttf") format("truetype"),
url("fonts/OpenSans-Light.svg#OpenSans-Regular") format("svg");
}
@font-face {
- font-family: 'OpenSans';
+ font-family: 'Open Sans';
font-weight: 600;
font-style: normal;
- src:url("fonts/OpenSans-Semibold.eot") format("eot"),
+ src: local('Open Sans Semibold'), local('OpenSans-Semibold'),
+ url("fonts/OpenSans-Semibold.eot") format("eot"),
url("fonts/OpenSans-Semibold.woff") format("woff"),
url("fonts/OpenSans-Semibold.ttf") format("truetype"),
url("fonts/OpenSans-Semibold.svg#OpenSans-Semibold") format("svg");
}
@font-face {
- font-family: 'OpenSans';
+ font-family: 'Open Sans';
font-weight: 600;
font-style: italic;
- src:url("fonts/OpenSans-SemiboldItalic.eot") format("eot"),
+ src: local('Open Sans Semibold Italic'), local('OpenSans-SemiboldItalic'),
+ url("fonts/OpenSans-SemiboldItalic.eot") format("eot"),
url("fonts/OpenSans-SemiboldItalic.woff") format("woff"),
url("fonts/OpenSans-SemiboldItalic.ttf") format("truetype"),
url("fonts/OpenSans-SemiboldItalic.svg#OpenSans-SemiboldItalic") format("svg");
}
@font-face {
- font-family: 'OpenSans';
+ font-family: 'Open Sans';
font-weight: bold;
font-style: normal;
- src:url("fonts/OpenSans-Bold.eot") format("eot"),
+ src: local('Open Sans Bold'), local('OpenSans-Bold'),
+ url("fonts/OpenSans-Bold.eot") format("eot"),
url("fonts/OpenSans-Bold.woff") format("woff"),
url("fonts/OpenSans-Bold.ttf") format("truetype"),
url("fonts/OpenSans-Bold.svg#OpenSans-Bold") format("svg");
@@ -65,13 +71,18 @@
textarea {
resize: none;
}
+
+input, textarea {
+ font-family: 'Open Sans';
+}
+
/* common */
.wrap{
min-height:100%;
background-color: #FFF;
width: 960px;
margin: 0 auto;
- font-family: 'OpenSans';
+ font-family: 'Open Sans';
font-weight: 400;
color:#333333;
font-size: 13px;
@@ -187,7 +198,6 @@
.popin-content input[type=password],
.popin-content textarea{
padding: 0 4px;
- font-family: 'OpenSans';
font-size: 12px;
border: 1px solid #867a97;
-webkit-border-radius: 4px;
--- a/integration/css/edition.css Thu Nov 08 18:24:47 2012 +0100
+++ b/integration/css/edition.css Fri Nov 09 18:56:29 2012 +0100
@@ -528,7 +528,7 @@
.tagit {
border: 1px solid #867A97;
padding: 0 4px; width: 200px;
- font-size: 12px; font-family: OpenSans;
+ font-size: 12px; font-family: 'Open Sans';
}
ul.tagit li.tagit-choice {
--- a/integration/edition.html Thu Nov 08 18:24:47 2012 +0100
+++ b/integration/edition.html Fri Nov 09 18:56:29 2012 +0100
@@ -229,6 +229,12 @@
<div class="media-segments-list">
</div>
</div>
+
+ <div class="media-segments other-media-segments">
+ <h2>Segments existants sur ce média :</h2>
+ <div class="media-segments-list">
+ </div>
+ </div>
</div><!-- bloc-segmentation -->
@@ -321,6 +327,7 @@
<script type="text/javascript" src="lib/underscore-min.js"></script>
<script type="text/javascript" src="lib/popcorn-complete.min.js"></script>
<script type="text/javascript" src="js/init.js"></script>
+ <script type="text/javascript" src="js/ldt-serializer.js"></script>
<script type="text/javascript" src="js/medialist-serializer.js"></script>
<script type="text/javascript" src="js/model.js"></script>
<script type="text/javascript" src="js/mashupcore.js"></script>
@@ -328,7 +335,11 @@
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
$(function() {
- var hashcut = IriSP.editor({url: "data/moon.json"});
+ var hashcut = IriSP.editor({
+ url: "data/moon.json",
+ segment_api_endpoint: "http://capsicum/pf/ldtplatform/api/ldt/1.0/segments/bytimecode/",
+ project_api_endpoint: "http://capsicum/pf/ldtplatform/api/ldt/1.0/projects/"
+ });
});
</script>
</body>
--- a/integration/js/editor.js Thu Nov 08 18:24:47 2012 +0100
+++ b/integration/js/editor.js Fri Nov 09 18:56:29 2012 +0100
@@ -18,6 +18,7 @@
/* Load Media List */
var directory = new IriSP.Model.Directory(),
+ apidirectory = new IriSP.Model.Directory(),
project = directory.remoteSource({
url: options.url,
serializer: IriSP.serializers.medialist
@@ -279,6 +280,8 @@
}
}
+ var mediasegmentscache = {};
+
function setMedia(media) {
if (currentMedia) {
currentMedia.pause();
@@ -298,6 +301,7 @@
currentSegment.setEnd(currentMedia.duration);
currentSegment.title = IriSP.hc_messages.segment_title_placeholder;
currentSegment.color = currentMedia.color;
+ currentSegment.created = new Date();
currentSegment.keywords = [];
currentSegment.description = "";
currentSegment.on("change-begin", function() {
@@ -334,11 +338,11 @@
var relatedSegments = mashup.segments.filter(function(_s) {
return _s.getMedia() === currentMedia && _s.annotation !== currentSegment;
});
- var html = "";
+ var html = "",
+ k = $(".Ldt-Slider").width() / currentSegment.getMedia().duration,
+ currentleft = k * currentSegment.begin,
+ currentwidth = k * currentSegment.getDuration();
if (relatedSegments.length) {
- var k = $(".Ldt-Slider").width() / currentSegment.getMedia().duration,
- currentleft = k * currentSegment.begin,
- currentwidth = k * currentSegment.getDuration();
relatedSegments.forEach(function(_s) {
var pos = k * (_s.annotation.begin + _s.annotation.end) / 2,
corrpos = Math.max(145, Math.min(305, pos));
@@ -357,11 +361,36 @@
} else {
$(".self-media-segments").hide();
}
-
- //TODO: Show Related Segments from http://capsicum/pf/ldtplatform/api/ldt/1.0/segments/bytimecode/f72aa2f4-29bb-11e2-a193-08002791f1b7/0/674000?format=json
+ $(".self-media-segments .media-segments-list").html(html);
+ $(".other-media-segments").hide();
+ apidirectory.remoteSource({
+ url: options.segment_api_endpoint + currentMedia.id + "/0/" + currentMedia.duration.milliseconds + "?format=json",
+ serializer: IriSP.serializers.ldt
+ }).onLoad(function() {
+ var medias = this.getMedias(),
+ annotations = this.getAnnotations();
+ if (medias && medias.length && medias[0].id === currentMedia.id && annotations && annotations.length ) {
+ var html = "";
+ annotations.forEach(function(_a) {
+ var pos = k * (_a.begin + _a.end) / 2,
+ corrpos = Math.max(145, Math.min(305, pos));
+ vizdata = {
+ annotation : _a,
+ currentleft : currentleft,
+ currentwidth : currentwidth,
+ popleft : corrpos,
+ left : k * _a.begin,
+ width : k * _a.getDuration(),
+ pointerpos : (pos - corrpos)
+ }
+ html += mediasegmenttemplate(vizdata);
+ });
+ $(".other-media-segments").show();
+ $(".other-media-segments .media-segments-list").html(html);
+ }
+ });
}
- $(".self-media-segments .media-segments-list").html(html);
if (currentMedia.elementType === "mashup") {
showPreview();
}
@@ -588,7 +617,8 @@
}).on("mouseout", ".media-segment", function() {
$(this).find(".media-segment-popin").hide();
}).on("click", ".reprendre-segment", function() {
- var s = project.getElement($(this).attr("data-segment-id"));
+ var sid = $(this).attr("data-segment-id"),
+ s = directory.getElement(sid) || apidirectory.getElement(sid);
currentSegment.title = s.title;
currentSegment.description = s.description;
$("#segment-title").val(s.title);
@@ -626,5 +656,39 @@
}, 0);
}
+ /* Publication */
+
+ $(".publier-button").click(function() {
+ var postproject = directory.newLocalSource(),
+ anntype = new IriSP.Model.AnnotationType(false, postproject),
+ annotations = mashup.getOriginalAnnotations();
+ anntype.title = "hashcut-segments";
+ annotations.forEach(function(_a) {
+ _a.setAnnotationType(anntype.id);
+ });
+ postproject.addList("media",mashup.getMedias());
+ postproject.addList("annotationType",[anntype]);
+ postproject.addList("annotation",annotations);
+ postproject.addList("mashup",[mashup]);
+ postproject.addList("tag");
+ postproject.creator = "IRI";
+ postproject.title = mashup.title;
+ postproject.description = mashup.description;
+ console.log(IriSP.serializers.ldt.serialize(postproject));
+ $.ajax({
+ type: "POST",
+ url: options.project_api_endpoint,
+ data: IriSP.serializers.ldt.serialize(postproject),
+ contentType: "application/cinelab",
+// headers: {"X-CSRFToken": "{{csrf_token}}"},
+ success: function(data, status, request){
+ alert("api post success");
+ },
+ error: function(jqXHR, textStatus, errorThrown){
+ alert(errorThrown);
+ }
+ });
+ });
+
mashup.trigger("change");
}
--- a/integration/js/ldt-serializer.js Thu Nov 08 18:24:47 2012 +0100
+++ b/integration/js/ldt-serializer.js Fri Nov 09 18:56:29 2012 +0100
@@ -121,7 +121,7 @@
},
media : _data.media.id,
meta : {
- "id-ref" : _data.annotationType.id,
+ "id-ref" : _data.getAnnotationType().id,
"dc:created" : IriSP.Model.dateToIso(_data.created),
"dc:creator" : _data.creator,
project : _source.projectId
@@ -155,7 +155,7 @@
listtype: "mashup"
},
items: _data.segments.map(function(_annotation) {
- return _id;
+ return _annotation.annotation.id;
}),
id: _data.id
}
@@ -163,7 +163,16 @@
}
},
serialize : function(_source) {
- var _res = {},
+ var _res = {
+ meta: {
+ "dc:creator": _source.creator,
+ "dc:created": IriSP.Model.dateToIso(_source.created),
+ "dc:title": _source.title,
+ "dc:description": _source.description,
+ "id": _source.projectId || _source.id
+ },
+ views: []
+ },
_this = this;
_source.forEach(function(_list, _typename) {
if (typeof _this.types[_typename] !== "undefined") {
--- a/integration/js/model.js Thu Nov 08 18:24:47 2012 +0100
+++ b/integration/js/model.js Fri Nov 09 18:56:29 2012 +0100
@@ -70,7 +70,8 @@
_res.setTime(Number(time));
return _res;
},
- dateToIso : function(d) {
+ dateToIso : function(_d) {
+ var d = _d ? new Date(_d) : new Date();
return d.getUTCFullYear()+'-'
+ pad(2, d.getUTCMonth()+1)+'-'
+ pad(2, d.getUTCDate())+'T'
@@ -406,9 +407,11 @@
if (typeof _id === "undefined" || !_id) {
_id = Model.getUID();
}
+ this.id = _id;
this.source = _source;
- this.id = _id;
- this.source.directory.addElement(this);
+ if (_source !== this) {
+ this.source.directory.addElement(this);
+ }
}
Model.Element.prototype.toString = function() {
@@ -848,6 +851,14 @@
return this.segments;
}
+Model.Mashup.prototype.getOriginalAnnotations = function() {
+ var annotations = new Model.List(this.source.directory);
+ this.segments.forEach(function(_s) {
+ annotations.push(_s.annotation);
+ });
+ return annotations;
+}
+
Model.Mashup.prototype.getMedias = function() {
var medias = new Model.List(this.source.directory);
this.segments.forEach(function(_annotation) {
@@ -890,6 +901,7 @@
/* */
Model.Source = function(_config) {
+ Model.Element.call(this, false, this);
this.status = Model._SOURCE_STATUS_EMPTY;
this.elementType = "source";
if (typeof _config !== "undefined") {