commit fec3bc0129718f48e6f009cd4bef4c4f4fb1ad4d
parent 605510a63510a2370930b1f76f35bf74bf5c142a
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 18 May 2006 20:39:38 +0000
New functions:
Scholar.ItemTypes.getTypes() -- returns associative array of all itemTypes, with 'id' and 'name'
Scholar.ItemTypes.getTypeName(itemTypeID) -- returns pre-l10n type name (e.g. 'book', 'journalArticle')
Diffstat:
4 files changed, 22 insertions(+), 6 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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);