equal
deleted
inserted
replaced
68 time = (Number(date) + (offset * 60 * 1000)); |
68 time = (Number(date) + (offset * 60 * 1000)); |
69 var _res = new Date(); |
69 var _res = new Date(); |
70 _res.setTime(Number(time)); |
70 _res.setTime(Number(time)); |
71 return _res; |
71 return _res; |
72 }, |
72 }, |
73 dateToIso : function(d) { |
73 dateToIso : function(_d) { |
|
74 var d = _d ? new Date(_d) : new Date(); |
74 return d.getUTCFullYear()+'-' |
75 return d.getUTCFullYear()+'-' |
75 + pad(2, d.getUTCMonth()+1)+'-' |
76 + pad(2, d.getUTCMonth()+1)+'-' |
76 + pad(2, d.getUTCDate())+'T' |
77 + pad(2, d.getUTCDate())+'T' |
77 + pad(2, d.getUTCHours())+':' |
78 + pad(2, d.getUTCHours())+':' |
78 + pad(2, d.getUTCMinutes())+':' |
79 + pad(2, d.getUTCMinutes())+':' |
404 return; |
405 return; |
405 } |
406 } |
406 if (typeof _id === "undefined" || !_id) { |
407 if (typeof _id === "undefined" || !_id) { |
407 _id = Model.getUID(); |
408 _id = Model.getUID(); |
408 } |
409 } |
|
410 this.id = _id; |
409 this.source = _source; |
411 this.source = _source; |
410 this.id = _id; |
412 if (_source !== this) { |
411 this.source.directory.addElement(this); |
413 this.source.directory.addElement(this); |
|
414 } |
412 } |
415 } |
413 |
416 |
414 Model.Element.prototype.toString = function() { |
417 Model.Element.prototype.toString = function() { |
415 return this.elementType + (this.elementType !== 'element' ? ', id=' + this.id + ', title="' + this.title + '"' : ''); |
418 return this.elementType + (this.elementType !== 'element' ? ', id=' + this.id + ', title="' + this.title + '"' : ''); |
416 } |
419 } |
846 |
849 |
847 Model.Mashup.prototype.getAnnotations = function() { |
850 Model.Mashup.prototype.getAnnotations = function() { |
848 return this.segments; |
851 return this.segments; |
849 } |
852 } |
850 |
853 |
|
854 Model.Mashup.prototype.getOriginalAnnotations = function() { |
|
855 var annotations = new Model.List(this.source.directory); |
|
856 this.segments.forEach(function(_s) { |
|
857 annotations.push(_s.annotation); |
|
858 }); |
|
859 return annotations; |
|
860 } |
|
861 |
851 Model.Mashup.prototype.getMedias = function() { |
862 Model.Mashup.prototype.getMedias = function() { |
852 var medias = new Model.List(this.source.directory); |
863 var medias = new Model.List(this.source.directory); |
853 this.segments.forEach(function(_annotation) { |
864 this.segments.forEach(function(_annotation) { |
854 medias.push(_annotation.getMedia()) |
865 medias.push(_annotation.getMedia()) |
855 }) |
866 }) |
888 } |
899 } |
889 |
900 |
890 /* */ |
901 /* */ |
891 |
902 |
892 Model.Source = function(_config) { |
903 Model.Source = function(_config) { |
|
904 Model.Element.call(this, false, this); |
893 this.status = Model._SOURCE_STATUS_EMPTY; |
905 this.status = Model._SOURCE_STATUS_EMPTY; |
894 this.elementType = "source"; |
906 this.elementType = "source"; |
895 if (typeof _config !== "undefined") { |
907 if (typeof _config !== "undefined") { |
896 var _this = this; |
908 var _this = this; |
897 ns._(_config).forEach(function(_v, _k) { |
909 ns._(_config).forEach(function(_v, _k) { |