commit 0b1765b549291078cca7fe7dec61bd29e99d434b
parent c24c148e0b30552a52a15d73cf7e419dff2c0883
Author: Dan Stillman <dstillman@zotero.org>
Date: Mon, 12 Jun 2006 13:08:36 +0000
Move CreatorTypes constructor in code -- ignore
Diffstat:
1 file changed, 43 insertions(+), 39 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
@@ -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;
- }
-}
-
-
-
-
/*