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')
This commit is contained in:
parent
605510a635
commit
fec3bc0129
4 changed files with 22 additions and 6 deletions
|
@ -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(){
|
Scholar.ItemFields = new function(){
|
||||||
|
|
|
@ -412,11 +412,11 @@ Scholar.DB = new function(){
|
||||||
for (var i=parseInt(fromVersion) + 1; i<=toVersion; i++){
|
for (var i=parseInt(fromVersion) + 1; i<=toVersion; i++){
|
||||||
|
|
||||||
// For now, just wipe and recreate
|
// For now, just wipe and recreate
|
||||||
if (i==7){
|
if (i==8){
|
||||||
_initializeSchema();
|
_initializeSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i==8){
|
if (i==9){
|
||||||
// do stuff
|
// do stuff
|
||||||
// _updateDBVersion(i);
|
// _updateDBVersion(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const SCHOLAR_CONFIG = {
|
const SCHOLAR_CONFIG = {
|
||||||
GUID: 'scholar@chnm',
|
GUID: 'scholar@chnm',
|
||||||
DB_FILE: 'scholar.sqlite',
|
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
|
DB_REBUILD: false, // erase DB and recreate from schema
|
||||||
DEBUG_LOGGING: true,
|
DEBUG_LOGGING: true,
|
||||||
DEBUG_TO_CONSOLE: true // dump debug messages to console rather than (much slower) Debug Logger
|
DEBUG_TO_CONSOLE: true // dump debug messages to console rather than (much slower) Debug Logger
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- 7
|
-- 8
|
||||||
|
|
||||||
DROP TABLE IF EXISTS version;
|
DROP TABLE IF EXISTS version;
|
||||||
CREATE TABLE version (
|
CREATE TABLE version (
|
||||||
|
@ -122,8 +122,8 @@
|
||||||
INSERT INTO treeStructure VALUES (0, 1, 0, NULL);
|
INSERT INTO treeStructure VALUES (0, 1, 0, NULL);
|
||||||
|
|
||||||
-- Some sample data
|
-- Some sample data
|
||||||
INSERT INTO itemTypes VALUES (1,'Book');
|
INSERT INTO itemTypes VALUES (1,'book');
|
||||||
INSERT INTO itemTypes VALUES (2,'Journal Article');
|
INSERT INTO itemTypes VALUES (2,'journalArticle');
|
||||||
|
|
||||||
INSERT INTO "fieldFormats" VALUES(1, '.*', 0);
|
INSERT INTO "fieldFormats" VALUES(1, '.*', 0);
|
||||||
INSERT INTO "fieldFormats" VALUES(2, '[0-9]*', 1);
|
INSERT INTO "fieldFormats" VALUES(2, '[0-9]*', 1);
|
||||||
|
|
Loading…
Reference in a new issue