equal
deleted
inserted
replaced
71 } |
71 } |
72 |
72 |
73 IriSP.Model.List.prototype = new Array(); |
73 IriSP.Model.List.prototype = new Array(); |
74 |
74 |
75 IriSP.Model.List.prototype.getElement = function(_id) { |
75 IriSP.Model.List.prototype.getElement = function(_id) { |
76 var _index = (IriSP._(this.idIndex).indexOf(this.source.getNamespaced(_id).fullName)); |
76 var _index = IriSP._(this.idIndex).indexOf(_id); |
77 if (_index !== -1) { |
77 if (_index !== -1) { |
78 return this[_index]; |
78 return this[_index]; |
|
79 } else { |
|
80 var _un = _id.replace(/.*:/); |
|
81 return IriSP._(this.idIndex).find(function(_i) { |
|
82 return _i.replace(/.*:/) === _un; |
|
83 }); |
79 } |
84 } |
80 } |
85 } |
81 |
86 |
82 IriSP.Model.List.prototype.hasId = function(_id) { |
87 IriSP.Model.List.prototype.hasId = function(_id) { |
83 return (IriSP._(this.idIndex).indexOf(_id) !== -1); |
88 return (IriSP._(this.idIndex).indexOf(_id) !== -1); |
536 _callback.call(_this, _value, _key); |
541 _callback.call(_this, _value, _key); |
537 }) |
542 }) |
538 } |
543 } |
539 |
544 |
540 IriSP.Model.Source.prototype.getElement = function(_elId) { |
545 IriSP.Model.Source.prototype.getElement = function(_elId) { |
541 return this.directory.getElement(_this.getNamespaced(_elId).fullname); |
546 return this.directory.getElement(this.getNamespaced(_elId).fullname); |
542 } |
547 } |
543 |
548 |
544 IriSP.Model.Source.prototype.setCurrentMediaId = function(_idRef) { |
549 IriSP.Model.Source.prototype.setCurrentMediaId = function(_idRef) { |
545 if (typeof _idRef !== "undefined") { |
550 if (typeof _idRef !== "undefined") { |
546 this.currentMedia = this.getMedias().getElement(this.getNamespaced(_idRef).fullname); |
551 this.currentMedia = this.getMedias().getElement(this.getNamespaced(_idRef).fullname); |
678 _res = new IriSP.Model.Source(_config); |
683 _res = new IriSP.Model.Source(_config); |
679 return _res; |
684 return _res; |
680 } |
685 } |
681 |
686 |
682 IriSP.Model.Directory.prototype.getElement = function(_id) { |
687 IriSP.Model.Directory.prototype.getElement = function(_id) { |
683 return this.elements[_id]; |
688 var _res = this.elements[_id]; |
|
689 if (typeof _res === "undefined") { |
|
690 var _un = _id.replace(/.*:/), |
|
691 _keys = IriSP._(this.elements).keys(); |
|
692 _key = IriSP._(_keys).find(function(_i) { |
|
693 return _i.replace(/.*:/) === _un; |
|
694 }); |
|
695 if (typeof _key !== "undefined") { |
|
696 _res = this.elements[_key]; |
|
697 } |
|
698 } |
|
699 return _res; |
684 } |
700 } |
685 |
701 |
686 IriSP.Model.Directory.prototype.addElement = function(_element) { |
702 IriSP.Model.Directory.prototype.addElement = function(_element) { |
687 this.elements[_element.id] = _element; |
703 this.elements[_element.id] = _element; |
688 } |
704 } |