From 8b516fa6d2a50fb2733e3f1a6f142f231a6142c6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 15 May 2006 19:30:18 +0000 Subject: [PATCH] Added isFolder() and getParent() for both Scholar.Folder and Scholar.Object instances --- .../content/scholar/data_access.js | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/chrome/chromeFiles/content/scholar/data_access.js b/chrome/chromeFiles/content/scholar/data_access.js index 7d66944616..63647cf15a 100644 --- a/chrome/chromeFiles/content/scholar/data_access.js +++ b/chrome/chromeFiles/content/scholar/data_access.js @@ -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 */ @@ -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 */ @@ -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 */ @@ -713,6 +735,7 @@ Scholar.Object.prototype._loadObjectData = function(){ + /* * Primary interface for accessing Scholar objects */ @@ -903,6 +926,8 @@ Scholar.Objects = new function(){ + + /* * Constructor for Folder object * @@ -947,6 +972,13 @@ Scholar.Folder.prototype.getLevel = function(){ 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(){ var _creators = new Array; // indexed by first%%%last%%%creatorTypeID hash var _creatorsByID = new Array; // indexed by creatorID @@ -1119,6 +1154,10 @@ Scholar.Creators = new function(){ } + + + + Scholar.ObjectFields = new function(){ // Private members var _fields = new Array();