diff --git a/chrome/chromeFiles/content/scholar/data_access.js b/chrome/chromeFiles/content/scholar/data_access.js index 1f3f20933..7235ea515 100644 --- a/chrome/chromeFiles/content/scholar/data_access.js +++ b/chrome/chromeFiles/content/scholar/data_access.js @@ -1,9 +1,9 @@ /* * Constructor for Object object * - * Generally should be called through Scholar_Objects rather than directly + * Generally should be called through Scholar.Objects rather than directly */ -function Scholar_Object(){ +Scholar.Object = function(){ this._init(); // Accept objectTypeID, folderID and orderIndex in constructor @@ -13,7 +13,7 @@ function Scholar_Object(){ } } -Scholar_Object.prototype._init = function(){ +Scholar.Object.prototype._init = function(){ // // Public members for access by public methods -- do not access directly // @@ -33,16 +33,16 @@ Scholar_Object.prototype._init = function(){ /* * Check if the specified field is a primary field from the objects table */ -Scholar_Object.prototype.isPrimaryField = function(field){ - if (!Scholar_Object.primaryFields){ - Scholar_Object.primaryFields = Scholar_DB.getColumnHash('objects'); - Scholar_Object.primaryFields['firstCreator'] = true; +Scholar.Object.prototype.isPrimaryField = function(field){ + if (!Scholar.Object.primaryFields){ + Scholar.Object.primaryFields = Scholar.DB.getColumnHash('objects'); + Scholar.Object.primaryFields['firstCreator'] = true; } - return !!Scholar_Object.primaryFields[field]; + return !!Scholar.Object.primaryFields[field]; } -Scholar_Object.editableFields = { +Scholar.Object.editableFields = { title: true, source: true, rights: true @@ -51,20 +51,20 @@ Scholar_Object.editableFields = { /* * Check if the specified primary field can be changed with setField() */ -Scholar_Object.prototype.isEditableField = function(field){ - return !!Scholar_Object.editableFields[field]; +Scholar.Object.prototype.isEditableField = function(field){ + return !!Scholar.Object.editableFields[field]; } /* * Build object from database */ -Scholar_Object.prototype.loadFromID = function(id){ +Scholar.Object.prototype.loadFromID = function(id){ var sql = 'SELECT O.*, lastName AS firstCreator FROM objects O ' + 'LEFT JOIN objectCreators OC USING (objectID) ' + 'LEFT JOIN creators USING (creatorID) ' + 'WHERE objectID=' + id + ' AND OC.orderIndex=0'; - var row = Scholar_DB.rowQuery(sql); + var row = Scholar.DB.rowQuery(sql); this.loadFromRow(row); } @@ -72,7 +72,7 @@ Scholar_Object.prototype.loadFromID = function(id){ /* * Populate basic object data from a database row */ -Scholar_Object.prototype.loadFromRow = function(row){ +Scholar.Object.prototype.loadFromRow = function(row){ this._init(); for (col in row){ if (this.isPrimaryField(col) || col=='firstCreator'){ @@ -86,18 +86,18 @@ Scholar_Object.prototype.loadFromRow = function(row){ /* * Check if any data fields have changed since last save */ -Scholar_Object.prototype.hasChanged = function(){ +Scholar.Object.prototype.hasChanged = function(){ return (this._changed.length || this._changedCreators.length || this._changedObjectData.length); } -Scholar_Object.prototype.getID = function(){ +Scholar.Object.prototype.getID = function(){ return this._data['objectID'] ? this._data['objectID'] : false; } -Scholar_Object.prototype.getType = function(){ +Scholar.Object.prototype.getType = function(){ return this._data['objectTypeID'] ? this._data['objectTypeID'] : false; } @@ -105,7 +105,7 @@ Scholar_Object.prototype.getType = function(){ /* * Set or change the object's type */ -Scholar_Object.prototype.setType = function(objectTypeID){ +Scholar.Object.prototype.setType = function(objectTypeID){ if (objectTypeID==this.getType()){ return true; } @@ -116,7 +116,7 @@ Scholar_Object.prototype.setType = function(objectTypeID){ + 'WHERE objectTypeID=' + this.getType() + ' AND fieldID NOT IN ' + '(SELECT fieldID FROM objectTypeFields WHERE objectTypeID=' + objectTypeID + ')'; - var obsoleteFields = Scholar_DB.columnQuery(sql); + var obsoleteFields = Scholar.DB.columnQuery(sql); if (obsoleteFields){ for (var i=0; i - + diff --git a/chrome/chromeFiles/content/scholar/sidebar.js b/chrome/chromeFiles/content/scholar/sidebar.js index bf3da6046..4f05bda8b 100644 --- a/chrome/chromeFiles/content/scholar/sidebar.js +++ b/chrome/chromeFiles/content/scholar/sidebar.js @@ -23,7 +23,7 @@ var treeView = { }, setTree: function(treebox){ this.treebox = treebox; - this.dataObjects = Scholar_Objects.getAll(); + this.dataObjects = Scholar.Objects.getAll(); }, isContainer: function(row){ return false; }, isSeparator: function(row){ return false; }, @@ -99,4 +99,6 @@ function setView() { ScholarLocalizedStrings = document.getElementById('scholar-strings'); document.getElementById('scholar-sidebar-items').view=treeView; -} \ No newline at end of file +} + +Scholar.testString = 'Sidebar is registered.'; \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/sidebar.xul b/chrome/chromeFiles/content/scholar/sidebar.xul index 8fe9fb922..c1ad29ba8 100644 --- a/chrome/chromeFiles/content/scholar/sidebar.xul +++ b/chrome/chromeFiles/content/scholar/sidebar.xul @@ -8,10 +8,9 @@ onload="setView()" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" > +