integration/js/model.js
changeset 42 40909e8d6855
parent 41 3ec2343f2b85
child 43 5a5024bc74e6
--- 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") {