Move CreatorTypes constructor in code -- ignore

This commit is contained in:
Dan Stillman 2006-06-12 13:08:36 +00:00
parent c24c148e0b
commit 0b1765b549

View file

@ -1371,6 +1371,8 @@ Scholar.Collection.prototype._getDescendents = function(){
}
/*
* Primary interface for accessing Scholar collection
*/
@ -1497,6 +1499,8 @@ Scholar.Collections = new function(){
}
Scholar.Creators = new function(){
var _creators = new Array; // indexed by first%%%last hash
var _creatorsByID = new Array; // indexed by creatorID
@ -1623,6 +1627,45 @@ Scholar.Creators = new function(){
Scholar.CreatorTypes = new function(){
var _creatorTypes = new Array();
var _creatorTypesLoaded;
var self = this;
this.getTypes = getTypes;
this.getTypeName = getTypeName;
function getTypes(){
return Scholar.DB.query('SELECT creatorTypeID AS id, '
+ 'creatorType AS name FROM creatorTypes order BY creatorType');
}
function getTypeName(creatorTypeID){
if (!_creatorTypesLoaded){
_load();
}
if (!_creatorTypes[creatorTypeID]){
Scholar.debug('Invalid creator type ' + creatorTypeID, 1);
}
return _creatorTypes[creatorTypeID];
}
function _load(){
var types = self.getTypes();
for (i in types){
_creatorTypes[types[i]['id']] = types[i]['name'];
}
_creatorTypesLoaded = true;
}
}
Scholar.ItemTypes = new function(){
var _itemTypes = new Array();
var _itemTypesLoaded;
@ -1815,45 +1858,6 @@ Scholar.ItemFields = new function(){
Scholar.CreatorTypes = new function(){
var _creatorTypes = new Array();
var _creatorTypesLoaded;
var self = this;
this.getTypes = getTypes;
this.getTypeName = getTypeName;
function getTypes(){
return Scholar.DB.query('SELECT creatorTypeID AS id, '
+ 'creatorType AS name FROM creatorTypes order BY creatorType');
}
function getTypeName(creatorTypeID){
if (!_creatorTypesLoaded){
_load();
}
if (!_creatorTypes[creatorTypeID]){
Scholar.debug('Invalid creator type ' + creatorTypeID, 1);
}
return _creatorTypes[creatorTypeID];
}
function _load(){
var types = self.getTypes();
for (i in types){
_creatorTypes[types[i]['id']] = types[i]['name'];
}
_creatorTypesLoaded = true;
}
}
/*