src/js/model.js
branchnew-model
changeset 916 ec6849bbbdcc
parent 915 ba7aab923d08
child 917 eb8677d3a663
--- a/src/js/model.js	Fri Jun 08 19:03:03 2012 +0200
+++ b/src/js/model.js	Tue Jun 12 19:44:20 2012 +0200
@@ -336,14 +336,11 @@
 
 IriSP.Model.Reference = function(_source, _idRef) {
     this.source = _source;
+    this.id = _idRef;
     if (typeof _idRef === "object") {
         this.isList = true;
-        this.id = IriSP._(_idRef).map(function(_id) {
-            return _source.getNamespaced(_id).fullname;
-        });
     } else {
         this.isList = false;
-        this.id = _source.getNamespaced(_idRef).fullname;
     }
     this.refresh();
 }
@@ -384,8 +381,7 @@
         _id = IriSP.Model.getUID();
     }
     this.source = _source;
-    this.namespacedId = _source.getNamespaced(_id)
-    this.id = this.namespacedId.fullname;
+    this.id = _id;
     this.title = "";
     this.description = "";
     this.source.directory.addElement(this);
@@ -525,7 +521,7 @@
 /* */
 
 IriSP.Model.MashedAnnotation = function(_mashup, _annotation) {
-    IriSP.Model.Element.call(this, _mashup.namespacedId.name + "_" + _annotation.namespacedId.name, _annotation.source);
+    IriSP.Model.Element.call(this, _mashup.id + "_" + _annotation.id, _annotation.source);
     this.elementType = 'mashedAnnotation';
     this.annotation = _annotation;
     this.begin = new IriSP.Model.Time(_mashup.duration);
@@ -629,54 +625,10 @@
         })
         this.callbackQueue = [];
         this.contents = {};
-        if (typeof this.namespace === "undefined") {
-            this.namespace = "metadataplayer";
-        } else {
-            if (typeof this.namespaceUrl === "undefined" && typeof this.url !== "undefined") {
-                var _matches = this.url.match(/(^[^?&]+|[^?&][a-zA-Z0-9_%=?]+)/g),
-                    _url = _matches[0];
-                if (_matches.length > 1) {
-                    _matches = IriSP._(_matches.slice(1)).reject(function(_txt) {
-                        return /\?$/.test(_txt);
-                    });
-                }
-                if (_matches.length > 0) {
-                    _url += '?' + _matches.join('&');
-                }
-                this.namespaceUrl = _url;
-            }
-        }
-        if (typeof this.namespaceUrl === "undefined") {
-            this.namespaceUrl = "http://ldt.iri.centrepompidou.fr/";
-        }
-        this.directory.addNamespace(this.namespace, this.namespaceUrl);
         this.get();
     }
 }
 
-IriSP.Model.Source.prototype.getNamespaced = function(_id) {
-    var _tab = _id.split(':');
-    if (_tab.length > 1) {
-        return {
-            namespace : _tab[0],
-            name : _tab[1],
-            fullname : _id
-        }
-    } else {
-        return {
-            namespace : this.namespace,
-            name : _id,
-            fullname : this.namespace + ':' + _id
-        }
-    }
-}
-    
-IriSP.Model.Source.prototype.unNamespace = function(_id) {
-    if (typeof _id !== "undefined") {
-        return _id.replace(this.namespace + ':', '');
-    }
-}
-
 IriSP.Model.Source.prototype.addList = function(_listId, _contents) {
     if (typeof this.contents[_listId] === "undefined") {
         this.contents[_listId] = new IriSP.Model.List(this.directory);
@@ -703,7 +655,7 @@
 }
 
 IriSP.Model.Source.prototype.getElement = function(_elId) {
-    return this.directory.getElement(this.getNamespaced(_elId).fullname);
+    return this.directory.getElement(_elId);
 }
 
 IriSP.Model.Source.prototype.setCurrentMediaId = function(_idRef) {
@@ -718,21 +670,6 @@
     }
 }
 
-IriSP.Model.Source.prototype.listNamespaces = function(_excludeSelf) {
-    var _this = this,
-        _nsls = [],
-        _excludeSelf = (typeof _excludeSelf !== "undefined" && _excludeSelf);
-    this.forEach(function(_list) {
-        IriSP._(_list).forEach(function(_el) {
-            var _ns = _el.id.replace(/:.*$/,'');
-            if (IriSP._(_nsls).indexOf(_ns) === -1 && (!_excludeSelf || _ns !== _this.namespace)) {
-                _nsls.push(_ns);
-            }
-        })
-    });
-    return _nsls;
-}
-
 IriSP.Model.Source.prototype.get = function() {
     this.status = IriSP.Model._SOURCE_STATUS_WAITING;
     this.handleCallbacks();
@@ -839,11 +776,6 @@
 IriSP.Model.Directory = function() {
     this.remoteSources = {};
     this.elements = {};
-    this.namespaces = {};
-}
-
-IriSP.Model.Directory.prototype.addNamespace = function(_namespace, _url) {
-    this.namespaces[_namespace] = _url;
 }
 
 IriSP.Model.Directory.prototype.remoteSource = function(_properties) {