/** * Content category. * * @markdown Example: //create a content object var myContent = new econda.media.Content({ name: "MyMediaFile" }); // add a category myContent.setCategory(new econda.media.Category({ path: "/ProductViedeos" }); // you can use a shortcut syntax myContent.setCategory("/ProductVideos"); // or let's do it all in constructor of content object var myContent = new econda.media.Content({ name: "MyMediaFile", category: "/ProductVideos" }); * @class econda.media.Category * @extends econda.base.Object */ econda.media.Category = function(cfg) { cfg = cfg || {}; /** * Private properties collection * @property {Object} __p * @private */ var __p = { /** * @cfg {String} path * Name or path of category (use slash to separate parts) * A path must start with a slash, if you set a value that does not start * with a slash, a slash will be added automatically */ path: null }; /** * Handle non object cfg values as value for property "name" * @property {String} __defaultProperty * @private */ this.__defaultProperty = "path"; /** * Set path (name) of category. e.g. /productVideos/tv/myvideo * @method * @param {String} path Name/path of category */ this.setPath = function(path) { if(typeof path !== 'string') { econda.debug.error("Category expects a String as path. Got: " + path, path); } else { if(path.substr(0,1) != '/') { path = "/" + path; } __p["path"] = path; } return this; }; /** * Returns path (name) of category. e.g. /productVideos/tv/myvideo * @method * @return {String} */ this.getPath = function() { return __p["path"]; }; /** * Returns path of category as String * @method * @return {String} path of category */ this.toString = function() { return this.getPath(); } return this.setup(cfg, __p); }; econda.media.Category.prototype = new econda.base.Object();