Added isFolder() and getParent() for both Scholar.Folder and Scholar.Object instances

This commit is contained in:
Dan Stillman 2006-05-15 19:30:18 +00:00
parent e14470db5a
commit 8b516fa6d2

View File

@ -30,6 +30,12 @@ Scholar.Object.prototype._init = function(){
} }
//////////////////////////////////////////////////////////////////////////////
//
// Public Scholar.Object methods
//
//////////////////////////////////////////////////////////////////////////////
/* /*
* Check if the specified field is a primary field from the objects table * Check if the specified field is a primary field from the objects table
*/ */
@ -107,6 +113,11 @@ Scholar.Object.prototype.getType = function(){
} }
Scholar.Object.prototype.getParent = function(){
return this._data['folderID'] ? this._data['folderID'] : false;
}
/* /*
* Set or change the object's type * Set or change the object's type
*/ */
@ -650,6 +661,17 @@ Scholar.Object.prototype.toString = function(){
} }
Scholar.Object.prototype.isFolder = function(){
return false;
}
//////////////////////////////////////////////////////////////////////////////
//
// Private Scholar.Object methods
//
//////////////////////////////////////////////////////////////////////////////
/* /*
* Load in the creators from the database * Load in the creators from the database
*/ */
@ -713,6 +735,7 @@ Scholar.Object.prototype._loadObjectData = function(){
/* /*
* Primary interface for accessing Scholar objects * Primary interface for accessing Scholar objects
*/ */
@ -903,6 +926,8 @@ Scholar.Objects = new function(){
/* /*
* Constructor for Folder object * Constructor for Folder object
* *
@ -947,6 +972,13 @@ Scholar.Folder.prototype.getLevel = function(){
return this._level; return this._level;
} }
Scholar.Folder.prototype.isFolder = function(){
return true;
}
Scholar.Folder.prototype.getParent = function(){
return this._parent;
}
/* /*
@ -987,6 +1019,9 @@ Scholar.Folders = new function(){
} }
Scholar.Creators = new function(){ Scholar.Creators = new function(){
var _creators = new Array; // indexed by first%%%last%%%creatorTypeID hash var _creators = new Array; // indexed by first%%%last%%%creatorTypeID hash
var _creatorsByID = new Array; // indexed by creatorID var _creatorsByID = new Array; // indexed by creatorID
@ -1119,6 +1154,10 @@ Scholar.Creators = new function(){
} }
Scholar.ObjectFields = new function(){ Scholar.ObjectFields = new function(){
// Private members // Private members
var _fields = new Array(); var _fields = new Array();