diff --git a/chrome/chromeFiles/content/scholar/data_access.js b/chrome/chromeFiles/content/scholar/data_access.js index 0b2db853a7..e59f28b44b 100644 --- a/chrome/chromeFiles/content/scholar/data_access.js +++ b/chrome/chromeFiles/content/scholar/data_access.js @@ -1212,6 +1212,22 @@ Scholar.Creators = new function(){ +Scholar.ItemTypes = new function(){ + this.getTypes = getTypes; + this.getTypeName = getTypeName; + + function getTypes(){ + return Scholar.DB.query('SELECT itemTypeID AS id, typeName AS name ' + + 'FROM itemTypes order BY typeName'); + } + + function getTypeName(itemTypeID){ + return Scholar.DB.valueQuery('SELECT typeName FROM itemTypes ' + + 'WHERE itemTypeID=' + itemTypeID); + } +} + + Scholar.ItemFields = new function(){ diff --git a/chrome/chromeFiles/content/scholar/db.js b/chrome/chromeFiles/content/scholar/db.js index 44fee2a9f1..b1f25b57ec 100644 --- a/chrome/chromeFiles/content/scholar/db.js +++ b/chrome/chromeFiles/content/scholar/db.js @@ -412,11 +412,11 @@ Scholar.DB = new function(){ for (var i=parseInt(fromVersion) + 1; i<=toVersion; i++){ // For now, just wipe and recreate - if (i==7){ + if (i==8){ _initializeSchema(); } - if (i==8){ + if (i==9){ // do stuff // _updateDBVersion(i); } diff --git a/chrome/chromeFiles/content/scholar/scholar.js b/chrome/chromeFiles/content/scholar/scholar.js index 99517f9f0b..8520c555a0 100644 --- a/chrome/chromeFiles/content/scholar/scholar.js +++ b/chrome/chromeFiles/content/scholar/scholar.js @@ -1,7 +1,7 @@ const SCHOLAR_CONFIG = { GUID: 'scholar@chnm', DB_FILE: 'scholar.sqlite', - DB_VERSION: 7, // must match version at top of schema.sql + DB_VERSION: 8, // must match version at top of schema.sql DB_REBUILD: false, // erase DB and recreate from schema DEBUG_LOGGING: true, DEBUG_TO_CONSOLE: true // dump debug messages to console rather than (much slower) Debug Logger diff --git a/schema.sql b/schema.sql index 036d71dc95..c79e0142f1 100644 --- a/schema.sql +++ b/schema.sql @@ -1,4 +1,4 @@ --- 7 +-- 8 DROP TABLE IF EXISTS version; CREATE TABLE version ( @@ -122,8 +122,8 @@ INSERT INTO treeStructure VALUES (0, 1, 0, NULL); -- Some sample data - INSERT INTO itemTypes VALUES (1,'Book'); - INSERT INTO itemTypes VALUES (2,'Journal Article'); + INSERT INTO itemTypes VALUES (1,'book'); + INSERT INTO itemTypes VALUES (2,'journalArticle'); INSERT INTO "fieldFormats" VALUES(1, '.*', 0); INSERT INTO "fieldFormats" VALUES(2, '[0-9]*', 1);