src/js/model.js
author veltr
Thu, 12 Apr 2012 15:54:33 +0200
branchnew-model
changeset 858 ad1ffe0c0955
parent 856 41c574c807d1
child 860 7fd843e0dc4e
permissions -rw-r--r--
save before switch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
     1
/* model.js is where data is stored in a standard form, whatever the serializer */
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
     2
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
     3
IriSP.Model = {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
     4
    SOURCE_STATUS_EMPTY : 0,
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
     5
    SOURCE_STATUS_WAITING : 1,
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
     6
    SOURCE_STATUS_READY : 2,
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
     7
    ID_AUTO_INCREMENT : 0
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
     8
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
     9
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    10
/* */
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    11
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    12
IriSP.Model.List = function(_directory) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    13
    this.contents = [];
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    14
    this.directory = _directory;
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    15
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    16
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    17
IriSP.Model.List.prototype.toString = function() {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    18
    return 'List of Elements, length=' + this.length();
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    19
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    20
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    21
IriSP.Model.List.prototype.length = function() {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    22
    return this.contents.length;
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    23
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    24
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    25
IriSP.Model.List.prototype.getElement = function(_id) {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    26
    return this.directory.getElement(_id);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    27
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    28
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    29
IriSP.Model.List.prototype.getElementAt = function(_pos) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    30
    if (_pos >= 0 && _pos < this.length()) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    31
        return this.getElement(this.contents[_pos]);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    32
    }
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    33
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    34
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    35
IriSP.Model.List.prototype.each = function(_callback) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    36
    var _this = this;
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    37
    IriSP._(this.contents).each(function(_id) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    38
        _callback.call(_this, _this.getElement(_id), _id);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    39
    });
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    40
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    41
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    42
IriSP.Model.List.prototype.map = function(_callback) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    43
    var _this = this;
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    44
    return IriSP._(this.contents).map(function(_id) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    45
        return _callback.call(_this, _this.getElement(_id), _id);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    46
    });
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    47
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    48
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    49
IriSP.Model.List.prototype.filter = function(_callback) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    50
    var _this = this,
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    51
        _res = new IriSP.Model.List(this.directory);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    52
    _res.contents = IriSP._(this.contents).filter(function(_id) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    53
        return _callback.call(_this, _this.getElement(_id), _id);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    54
    });
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    55
    return _res;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    56
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    57
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    58
IriSP.Model.List.prototype.searchByTitle = function(_text) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    59
    var _rgxp = new RegExp('(' + _text.replace(/(\W)/gm,'\\$1') + ')','gim');
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    60
    return this.filter(function(_element) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    61
        return _rgxp.test(_element.text);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    62
    });
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    63
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    64
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    65
IriSP.Model.List.prototype.searchByDescription = function(_text) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    66
    var _rgxp = new RegExp('(' + _text.replace(/(\W)/gm,'\\$1') + ')','gim');
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    67
    return this.filter(function(_element) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    68
        return _rgxp.test(_element.description);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    69
    });
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    70
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    71
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    72
IriSP.Model.List.prototype.searchByTextFields = function(_text) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    73
    var _rgxp = new RegExp('(' + _text.replace(/(\W)/gm,'\\$1') + ')','gim');
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    74
    return this.filter(function(_element) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    75
        return _rgxp.test(_element.description);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    76
    });
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    77
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    78
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    79
IriSP.Model.List.prototype.addId = function(_id) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    80
    if (this.contents.indexOf(_id) === -1) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    81
        this.contents.push(_id);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    82
    }
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    83
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    84
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    85
IriSP.Model.List.prototype.addElement = function(_el) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    86
    this.addId(_el.id);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
    87
}
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    88
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    89
IriSP.Model.List.prototype.addIdsFromArray = function(_array) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    90
    var _l = _array.length;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    91
    for (var _i = 0; _i < _l; _i++) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    92
        this.addId(_array[_i]);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    93
    }
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    94
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    95
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    96
IriSP.Model.List.prototype.addIdsFromList = function(_list) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    97
    this.addIdsFromArray(_list.contents);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    98
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
    99
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   100
/* */
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   101
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   102
IriSP.Model.Time = function(_milliseconds) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   103
    this.milliseconds = parseInt(typeof _milliseconds !== "undefined" ? _milliseconds : 0);
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   104
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   105
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   106
IriSP.Model.Time.prototype.setSeconds = function(_seconds) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   107
    this.milliseconds = 1000 * _seconds;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   108
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   109
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   110
IriSP.Model.Time.prototype.getSeconds = function() {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   111
    return Math.floor(this.milliseconds / 1000);
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   112
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   113
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   114
IriSP.Model.Time.prototype.getHMS = function() {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   115
    var _totalSeconds = Math.abs(this.getSeconds());
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   116
    return {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   117
        hours : Math.floor(_totalSeconds / 3600),
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   118
        minutes : (Math.floor(_totalSeconds / 60) % 60),
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   119
        seconds : _totalSeconds % 60
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   120
    } 
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   121
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   122
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   123
IriSP.Model.Time.prototype.toString = function() {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   124
    function pad(_n) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   125
        var _res = _n.toString();
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   126
        while (_res.length < 2) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   127
            _res = '0' + _res;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   128
        }
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   129
        return _res;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   130
    }
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   131
    var _hms = this.getHMS(),
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   132
        _res = '';
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   133
    if (_hms.hours) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   134
        _res += pad(_hms.hours) + ':'
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   135
    }
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   136
    _res += pad(_hms.minutes) + ':' + pad(_hms.seconds);
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   137
    return _res;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   138
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   139
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   140
/* */
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   141
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   142
IriSP.Model.Reference = function(_directory, _idRef) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   143
    this.directory = _directory;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   144
    if (typeof _idRef === "object") {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   145
        this.isList = true;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   146
        this.contents = new IriSP.Model.List(this.directory);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   147
        this.contents.addIdsFromArray(_idRef);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   148
    } else {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   149
        this.isList = false;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   150
        this.contents = _idRef;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   151
    }
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   152
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   153
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   154
IriSP.Model.Reference.prototype.getContents = function() {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   155
    return (this.isList ? this.contents : this.directory.getElement(this.contents));
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   156
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   157
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   158
/* */
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   159
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   160
IriSP.Model.Element = function(_id, _source) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   161
    this.elementType = 'element';
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   162
    if (typeof _id !== "undefined" && typeof _source !== "undefined") {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   163
        this.source = _source;
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   164
        this.id = _id;
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   165
        this.title = "";
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   166
        this.description = "";
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   167
        this.source.directory.addElement(this);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   168
    }
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   169
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   170
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   171
IriSP.Model.Element.prototype.toString = function() {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   172
    return this.elementType + (this.elementType !== 'element' ? ', id=' + this.id + ', title="' + this.title + '"' : '');
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   173
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   174
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   175
IriSP.Model.Element.prototype.setReference = function(_elementType, _idRef) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   176
    this[_elementType] = new IriSP.Model.Reference(this.source.directory, _idRef);
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   177
}
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   178
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   179
IriSP.Model.Element.prototype.getReference = function(_elementType) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   180
    if (typeof this[_elementType] !== "undefined") {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   181
        return this[_elementType].getContents();
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   182
    }
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   183
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   184
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   185
/* */
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   186
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   187
IriSP.Model.Media = function(_id, _directory) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   188
    IriSP.Model.Element.call(this, _id, _directory);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   189
    this.elementType = 'media';
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   190
    this.duration = new IriSP.Model.Time();
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   191
    this.url = '';
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   192
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   193
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   194
IriSP.Model.Media.prototype = new IriSP.Model.Element();
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   195
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   196
IriSP.Model.Media.prototype.setDuration = function(_durationMs) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   197
    this.duration.milliseconds = _durationMs;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   198
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   199
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   200
/* */
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   201
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   202
IriSP.Model.Tag = function(_id, _directory) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   203
    IriSP.Model.Element.call(this, _id, _directory);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   204
    this.elementType = 'tag';
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   205
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   206
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   207
IriSP.Model.Tag.prototype = new IriSP.Model.Element();
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   208
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   209
/* */
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   210
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   211
IriSP.Model.AnnotationType = function(_id, _directory) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   212
    IriSP.Model.Element.call(this, _id, _directory);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   213
    this.elementType = 'annotationType';
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   214
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   215
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   216
IriSP.Model.AnnotationType.prototype = new IriSP.Model.Element();
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   217
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   218
/* Annotation
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   219
 * */
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   220
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   221
IriSP.Model.Annotation = function(_id, _directory) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   222
    IriSP.Model.Element.call(this, _id, _directory);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   223
    this.elementType = 'annotation';
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   224
    this.begin = new IriSP.Model.Time();
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   225
    this.end = new IriSP.Model.Time();
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   226
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   227
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   228
IriSP.Model.Annotation.prototype = new IriSP.Model.Element(null);
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   229
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   230
IriSP.Model.Annotation.prototype.setBegin = function(_beginMs) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   231
    this.begin.milliseconds = _beginMs;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   232
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   233
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   234
IriSP.Model.Annotation.prototype.setEnd = function(_beginMs) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   235
    this.end.milliseconds = _beginMs;
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   236
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   237
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   238
IriSP.Model.Annotation.prototype.setMedia = function(_idRef) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   239
    this.setReference("media", _idRef);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   240
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   241
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   242
IriSP.Model.Annotation.prototype.getMedia = function() {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   243
    return this.getReference("media");
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   244
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   245
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   246
IriSP.Model.Annotation.prototype.setAnnotationType = function(_idRef) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   247
    this.setReference("annotationType", _idRef);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   248
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   249
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   250
IriSP.Model.Annotation.prototype.getAnnotationType = function() {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   251
    return this.getReference("annotationType");
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   252
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   253
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   254
IriSP.Model.Annotation.prototype.setTags = function(_idRefs) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   255
    this.setReference("tag", _idRefs);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   256
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   257
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   258
IriSP.Model.Annotation.prototype.getTags = function() {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   259
    return this.getReference("tag");
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   260
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   261
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   262
/* */
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   263
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   264
IriSP.Model.Source = function(_properties) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   265
    this.status = IriSP.Model.SOURCE_STATUS_EMPTY;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   266
    this.config = _properties;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   267
    this.callbackQueue = [];
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   268
    this.contents = {};
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   269
    this.get();
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   270
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   271
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   272
IriSP.Model.Source.prototype.addList = function(_listId, _contents) {
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   273
    if (typeof this.contents[_listId] === "undefined") {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   274
        this.contents[_listId] = new IriSP.Model.List(this.config.directory);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   275
    }
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   276
    this.contents[_listId].addIdsFromList(_contents);
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   277
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   278
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   279
IriSP.Model.Source.prototype.getList = function(_listId) {
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   280
    if (typeof this.contents[_listId] === "undefined") {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   281
        return this.config.directory.getGlobalList.filter(function(_e) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   282
            return (_e.elType === _listId);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   283
        });
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   284
    } else {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   285
        return this.contents[_listId];
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   286
    }
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   287
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   288
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   289
IriSP.Model.Source.prototype.getElement = function(_listId, _elId) {
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   290
    var _list = this.getList(_listId);
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   291
    return (typeof _list !== "undefined" ? _list.getElement(_elId) : undefined);
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   292
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   293
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   294
IriSP.Model.Source.prototype.setCurrentMediaId = function(_idRef) {
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   295
    if (typeof _idRef !== "undefined") {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   296
        this.currentMedia = _idRef;
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   297
    }
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   298
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   299
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   300
IriSP.Model.Source.prototype.setDefaultCurrentMedia = function() {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   301
    if (typeof this.currentMedia === "undefined") {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   302
        this.currentMedia = this.getList("media")[0];
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   303
    }
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   304
}
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   305
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   306
IriSP.Model.Source.prototype.get = function() {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   307
    this.status = IriSP.Model.SOURCE_STATUS_WAITING;
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   308
    this.status = IriSP.Model.SOURCE_STATUS_READY;
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   309
    var _this = this;
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   310
    if (_this.callbackQueue.length) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   311
        IriSP._.each(_this.callbackQueue, function(_callback) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   312
            _callback.call(_this);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   313
        });
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   314
    }
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   315
    _this.callbackQueue = [];
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   316
}
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   317
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   318
IriSP.Model.Source.prototype.addCallback = function(_callback) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   319
    if (this.status === IriSP.Model.SOURCE_STATUS_READY) {
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   320
        callback.call(this);
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   321
    } else {
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   322
        this.callbackQueue.push(_callback);
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   323
    }
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   324
}
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   325
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   326
IriSP.Model.Source.prototype.getAnnotations = function() {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   327
    return this.getList("annotation");
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   328
}
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   329
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   330
IriSP.Model.Source.prototype.getMedias = function() {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   331
    return this.getList("media");
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   332
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   333
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   334
IriSP.Model.Source.prototype.getDuration = function() {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   335
    return this.currentMedia.duration;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   336
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   337
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   338
/* */
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   339
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   340
IriSP.Model.RemoteSource = function() {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   341
    IriSP.Model.Element.call(this, _id, _directory);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   342
    this.elementType = 'tag';
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   343
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   344
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   345
IriSP.Model.RemoteSource.prototype = new IriSP.Model.Source();
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   346
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   347
IriSP.Model.RemoteSource.prototype.get = function() {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   348
    this.status = IriSP.Model.SOURCE_STATUS_WAITING;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   349
    var _this = this;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   350
    IriSP.jQuery.getJSON(this.url, function(_result) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   351
        _this.serializer.deSerialize(_result, _this);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   352
        if (_this.callbackQueue.length) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   353
            IriSP._.each(_this.callbackQueue, function(_callback) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   354
                _callback.call(_this);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   355
            });
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   356
        }
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   357
        _this.callbackQueue = [];
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   358
        _this.status = IriSP.Model.SOURCE_STATUS_READY;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   359
    });
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   360
}
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   361
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   362
/* */
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   363
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   364
IriSP.Model.Directory = function() {
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   365
    this.remoteSources = {};
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   366
    this.localSource = [];
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   367
    this.elements = {};
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   368
    this.nameSpaces = {};
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   369
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   370
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   371
IriSP.Model.Directory.prototype.remoteSource = function(_properties) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   372
    if (typeof this.remoteSources[_properties.url] === "undefined") {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   373
        this.remoteSources[_properties.url] = new IriSP.Model.RemoteSource(_properties);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   374
    }
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   375
    return this.remoteSources[_properties.url];
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   376
}
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   377
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   378
IriSP.Model.Directory.prototype.getElement = function(_id) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   379
    return this.elements[_id];
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   380
}
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   381
858
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   382
IriSP.Model.Directory.prototype.addElement = function(_element) {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   383
    this.elements[_element.id] = _element;
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   384
}
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   385
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   386
IriSP.Model.Directory.prototype.getGlobalList = function() {
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   387
    var _res = new IriSP.Model.List(this);
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   388
    _res.addIdsFromArray(IriSP._(this.elements).keys());
ad1ffe0c0955 save before switch
veltr
parents: 856
diff changeset
   389
    return _res;
854
29f28a9f236f New Model first commit
veltr
parents:
diff changeset
   390
}
856
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   391
41c574c807d1 basic implementation of model: media, annotation type, annotation
veltr
parents: 854
diff changeset
   392
/* */