Renamed 'objects' to 'items' in DB and code -- all remaining uses refer to actual JS objects (with the exception of sidebar.js, in which only the calls to data access methods were changed)
This commit is contained in:
parent
2ed6651b52
commit
c8b0d3daed
5 changed files with 285 additions and 284 deletions
|
@ -1,56 +1,56 @@
|
||||||
/*
|
/*
|
||||||
* Constructor for Object object
|
* Constructor for Item object
|
||||||
*
|
*
|
||||||
* Generally should be called through Scholar.Objects rather than directly
|
* Generally should be called through Scholar.Items rather than directly
|
||||||
*/
|
*/
|
||||||
Scholar.Object = function(){
|
Scholar.Item = function(){
|
||||||
this._init();
|
this._init();
|
||||||
|
|
||||||
// Accept objectTypeID, folderID and orderIndex in constructor
|
// Accept itemTypeID, folderID and orderIndex in constructor
|
||||||
if (arguments.length){
|
if (arguments.length){
|
||||||
this.setType(arguments[0]);
|
this.setType(arguments[0]);
|
||||||
this.setPosition(arguments[1],arguments[2]);
|
this.setPosition(arguments[1],arguments[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scholar.Object.prototype._init = function(){
|
Scholar.Item.prototype._init = function(){
|
||||||
//
|
//
|
||||||
// Public members for access by public methods -- do not access directly
|
// Public members for access by public methods -- do not access directly
|
||||||
//
|
//
|
||||||
this._data = new Array();
|
this._data = new Array();
|
||||||
this._creators = new Scholar.Hash();
|
this._creators = new Scholar.Hash();
|
||||||
this._objectData = new Array();
|
this._itemData = new Array();
|
||||||
|
|
||||||
this._creatorsLoaded = false;
|
this._creatorsLoaded = false;
|
||||||
this._objectDataLoaded = false;
|
this._itemDataLoaded = false;
|
||||||
|
|
||||||
this._changed = new Scholar.Hash();
|
this._changed = new Scholar.Hash();
|
||||||
this._changedCreators = new Scholar.Hash();
|
this._changedCreators = new Scholar.Hash();
|
||||||
this._changedObjectData = new Scholar.Hash();
|
this._changedItemData = new Scholar.Hash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Public Scholar.Object methods
|
// Public Scholar.Item methods
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the specified field is a primary field from the objects table
|
* Check if the specified field is a primary field from the items table
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.isPrimaryField = function(field){
|
Scholar.Item.prototype.isPrimaryField = function(field){
|
||||||
if (!Scholar.Object.primaryFields){
|
if (!Scholar.Item.primaryFields){
|
||||||
Scholar.Object.primaryFields = Scholar.DB.getColumnHash('objects');
|
Scholar.Item.primaryFields = Scholar.DB.getColumnHash('items');
|
||||||
Scholar.Object.primaryFields['firstCreator'] = true;
|
Scholar.Item.primaryFields['firstCreator'] = true;
|
||||||
Scholar.Object.primaryFields['parentFolderID'] = true;
|
Scholar.Item.primaryFields['parentFolderID'] = true;
|
||||||
Scholar.Object.primaryFields['orderIndex'] = true;
|
Scholar.Item.primaryFields['orderIndex'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!Scholar.Object.primaryFields[field];
|
return !!Scholar.Item.primaryFields[field];
|
||||||
}
|
}
|
||||||
|
|
||||||
Scholar.Object.editableFields = {
|
Scholar.Item.editableFields = {
|
||||||
title: true,
|
title: true,
|
||||||
source: true,
|
source: true,
|
||||||
rights: true
|
rights: true
|
||||||
|
@ -59,31 +59,31 @@ Scholar.Object.editableFields = {
|
||||||
/*
|
/*
|
||||||
* Check if the specified primary field can be changed with setField()
|
* Check if the specified primary field can be changed with setField()
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.isEditableField = function(field){
|
Scholar.Item.prototype.isEditableField = function(field){
|
||||||
return !!Scholar.Object.editableFields[field];
|
return !!Scholar.Item.editableFields[field];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build object from database
|
* Build object from database
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.loadFromID = function(id){
|
Scholar.Item.prototype.loadFromID = function(id){
|
||||||
var sql = 'SELECT O.*, lastName AS firstCreator, TS.parentFolderID, '
|
var sql = 'SELECT I.*, lastName AS firstCreator, TS.parentFolderID, '
|
||||||
+ 'TS.orderIndex '
|
+ 'TS.orderIndex '
|
||||||
+ 'FROM objects O '
|
+ 'FROM items I '
|
||||||
+ 'LEFT JOIN treeStructure TS ON (O.objectID=TS.id AND isFolder=0) '
|
+ 'LEFT JOIN treeStructure TS ON (I.itemID=TS.id AND isFolder=0) '
|
||||||
+ 'LEFT JOIN objectCreators OC ON (O.objectID=OC.objectID) '
|
+ 'LEFT JOIN itemCreators IC ON (I.itemID=IC.itemID) '
|
||||||
+ 'LEFT JOIN creators C ON (OC.creatorID=C.creatorID) '
|
+ 'LEFT JOIN creators C ON (IC.creatorID=C.creatorID) '
|
||||||
+ 'WHERE objectID=' + id + ' AND OC.orderIndex=0';
|
+ 'WHERE itemID=' + id + ' AND IC.orderIndex=0';
|
||||||
var row = Scholar.DB.rowQuery(sql);
|
var row = Scholar.DB.rowQuery(sql);
|
||||||
this.loadFromRow(row);
|
this.loadFromRow(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Populate basic object data from a database row
|
* Populate basic item data from a database row
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.loadFromRow = function(row){
|
Scholar.Item.prototype.loadFromRow = function(row){
|
||||||
this._init();
|
this._init();
|
||||||
for (col in row){
|
for (col in row){
|
||||||
if (this.isPrimaryField(col) || col=='firstCreator'){
|
if (this.isPrimaryField(col) || col=='firstCreator'){
|
||||||
|
@ -97,41 +97,41 @@ Scholar.Object.prototype.loadFromRow = function(row){
|
||||||
/*
|
/*
|
||||||
* Check if any data fields have changed since last save
|
* Check if any data fields have changed since last save
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.hasChanged = function(){
|
Scholar.Item.prototype.hasChanged = function(){
|
||||||
return (this._changed.length || this._changedCreators.length ||
|
return (this._changed.length || this._changedCreators.length ||
|
||||||
this._changedObjectData.length);
|
this._changedItemData.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Scholar.Object.prototype.getID = function(){
|
Scholar.Item.prototype.getID = function(){
|
||||||
return this._data['objectID'] ? this._data['objectID'] : false;
|
return this._data['itemID'] ? this._data['itemID'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Scholar.Object.prototype.getType = function(){
|
Scholar.Item.prototype.getType = function(){
|
||||||
return this._data['objectTypeID'] ? this._data['objectTypeID'] : false;
|
return this._data['itemTypeID'] ? this._data['itemTypeID'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Scholar.Object.prototype.getParent = function(){
|
Scholar.Item.prototype.getParent = function(){
|
||||||
return this._data['parentFolderID'] ? this._data['parentFolderID'] : false;
|
return this._data['parentFolderID'] ? this._data['parentFolderID'] : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set or change the object's type
|
* Set or change the item's type
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.setType = function(objectTypeID){
|
Scholar.Item.prototype.setType = function(itemTypeID){
|
||||||
if (objectTypeID==this.getType()){
|
if (itemTypeID==this.getType()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If existing type, clear fields from old type that aren't in new one
|
// If existing type, clear fields from old type that aren't in new one
|
||||||
if (this.getType()){
|
if (this.getType()){
|
||||||
var sql = 'SELECT fieldID FROM objectTypeFields '
|
var sql = 'SELECT fieldID FROM itemTypeFields '
|
||||||
+ 'WHERE objectTypeID=' + this.getType() + ' AND fieldID NOT IN '
|
+ 'WHERE itemTypeID=' + this.getType() + ' AND fieldID NOT IN '
|
||||||
+ '(SELECT fieldID FROM objectTypeFields WHERE objectTypeID='
|
+ '(SELECT fieldID FROM itemTypeFields WHERE itemTypeID='
|
||||||
+ objectTypeID + ')';
|
+ itemTypeID + ')';
|
||||||
var obsoleteFields = Scholar.DB.columnQuery(sql);
|
var obsoleteFields = Scholar.DB.columnQuery(sql);
|
||||||
|
|
||||||
if (obsoleteFields){
|
if (obsoleteFields){
|
||||||
|
@ -141,16 +141,16 @@ Scholar.Object.prototype.setType = function(objectTypeID){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this._data['objectTypeID'] = objectTypeID;
|
this._data['itemTypeID'] = itemTypeID;
|
||||||
this._changed.set('objectTypeID');
|
this._changed.set('itemTypeID');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the number of creators for this object
|
* Returns the number of creators for this item
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.numCreators = function(){
|
Scholar.Item.prototype.numCreators = function(){
|
||||||
if (this.getID() && !this._creatorsLoaded){
|
if (this.getID() && !this._creatorsLoaded){
|
||||||
this._loadCreators();
|
this._loadCreators();
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ Scholar.Object.prototype.numCreators = function(){
|
||||||
/*
|
/*
|
||||||
* Returns an array of the creator data at the given position, or false if none
|
* Returns an array of the creator data at the given position, or false if none
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.getCreator = function(pos){
|
Scholar.Item.prototype.getCreator = function(pos){
|
||||||
if (this.getID() && !this._creatorsLoaded){
|
if (this.getID() && !this._creatorsLoaded){
|
||||||
this._loadCreators();
|
this._loadCreators();
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ Scholar.Object.prototype.getCreator = function(pos){
|
||||||
/*
|
/*
|
||||||
* Set or update the creator at the specified position
|
* Set or update the creator at the specified position
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.setCreator = function(orderIndex, firstName, lastName, creatorTypeID){
|
Scholar.Item.prototype.setCreator = function(orderIndex, firstName, lastName, creatorTypeID){
|
||||||
if (this.getID() && !this._creatorsLoaded){
|
if (this.getID() && !this._creatorsLoaded){
|
||||||
this._loadCreators();
|
this._loadCreators();
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ Scholar.Object.prototype.setCreator = function(orderIndex, firstName, lastName,
|
||||||
/*
|
/*
|
||||||
* Remove a creator and shift others down
|
* Remove a creator and shift others down
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.removeCreator = function(orderIndex){
|
Scholar.Item.prototype.removeCreator = function(orderIndex){
|
||||||
if (this.getID() && !this._creatorsLoaded){
|
if (this.getID() && !this._creatorsLoaded){
|
||||||
this._loadCreators();
|
this._loadCreators();
|
||||||
}
|
}
|
||||||
|
@ -230,33 +230,33 @@ Scholar.Object.prototype.removeCreator = function(orderIndex){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieves (and loads from DB, if necessary) an objectData field value
|
* Retrieves (and loads from DB, if necessary) an itemData field value
|
||||||
*
|
*
|
||||||
* Field can be passed as fieldID or fieldName
|
* Field can be passed as fieldID or fieldName
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.getField = function(field){
|
Scholar.Item.prototype.getField = function(field){
|
||||||
//Scholar.debug('Requesting field ' + field + ' for object ' + this.getID(), 4);
|
//Scholar.debug('Requesting field ' + field + ' for item ' + this.getID(), 4);
|
||||||
if (this.isPrimaryField(field)){
|
if (this.isPrimaryField(field)){
|
||||||
return this._data[field] ? this._data[field] : '';
|
return this._data[field] ? this._data[field] : '';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.getID() && !this._objectDataLoaded){
|
if (this.getID() && !this._itemDataLoaded){
|
||||||
this._loadObjectData();
|
this._loadItemData();
|
||||||
}
|
}
|
||||||
|
|
||||||
var fieldID = Scholar.ObjectFields.getID(field);
|
var fieldID = Scholar.ItemFields.getID(field);
|
||||||
|
|
||||||
return this._objectData[fieldID] ? this._objectData[fieldID] : '';
|
return this._itemData[fieldID] ? this._itemData[fieldID] : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set a field value, loading existing objectData first if necessary
|
* Set a field value, loading existing itemData first if necessary
|
||||||
*
|
*
|
||||||
* Field can be passed as fieldID or fieldName
|
* Field can be passed as fieldID or fieldName
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.setField = function(field, value, loadIn){
|
Scholar.Item.prototype.setField = function(field, value, loadIn){
|
||||||
// Primary field
|
// Primary field
|
||||||
if (this.isPrimaryField(field)){
|
if (this.isPrimaryField(field)){
|
||||||
if (!this.isEditableField(field)){
|
if (!this.isEditableField(field)){
|
||||||
|
@ -274,32 +274,32 @@ Scholar.Object.prototype.setField = function(field, value, loadIn){
|
||||||
// Type-specific field
|
// Type-specific field
|
||||||
else {
|
else {
|
||||||
if (!this.getType()){
|
if (!this.getType()){
|
||||||
throw ('Object type must be set before setting field data.');
|
throw ('Item type must be set before setting field data.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If existing object, load field data first unless we're already in
|
// If existing item, load field data first unless we're already in
|
||||||
// the middle of a load
|
// the middle of a load
|
||||||
if (this.getID() && !loadIn && !this._objectDataLoaded){
|
if (this.getID() && !loadIn && !this._itemDataLoaded){
|
||||||
this._loadObjectData();
|
this._loadItemData();
|
||||||
}
|
}
|
||||||
|
|
||||||
var fieldID = Scholar.ObjectFields.getID(field);
|
var fieldID = Scholar.ItemFields.getID(field);
|
||||||
|
|
||||||
if (!fieldID){
|
if (!fieldID){
|
||||||
throw (field + ' is not a valid objectData field.');
|
throw (field + ' is not a valid itemData field.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Scholar.ObjectFields.isValidForType(fieldID, this.getType())){
|
if (!Scholar.ItemFields.isValidForType(fieldID, this.getType())){
|
||||||
throw (field + ' is not a valid field for this type.');
|
throw (field + ' is not a valid field for this type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If existing value, make sure it's actually changing
|
// If existing value, make sure it's actually changing
|
||||||
if (this._objectData[fieldID] && this._objectData[fieldID]==value){
|
if (this._itemData[fieldID] && this._itemData[fieldID]==value){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this._objectData[fieldID] = value;
|
this._itemData[fieldID] = value;
|
||||||
if (!loadIn){
|
if (!loadIn){
|
||||||
this._changedObjectData.set(fieldID);
|
this._changedItemData.set(fieldID);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -307,15 +307,15 @@ Scholar.Object.prototype.setField = function(field, value, loadIn){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move object to new position and shift surrounding objects
|
* Move item to new position and shift surrounding items
|
||||||
*
|
*
|
||||||
* N.B. Unless isNew is set, this function updates the DB immediately and
|
* N.B. Unless isNew is set, this function updates the DB immediately and
|
||||||
* reloads all cached objects -- a save() is not required
|
* reloads all cached items -- a save() is not required
|
||||||
*
|
*
|
||||||
* If isNew is true, a transaction is not started or committed, so it
|
* If isNew is true, a transaction is not started or committed, so it
|
||||||
* should only be run from an existing transaction within save()
|
* should only be run from an existing transaction within save()
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.setPosition = function(newFolder, newPos, isNew){
|
Scholar.Item.prototype.setPosition = function(newFolder, newPos, isNew){
|
||||||
var oldFolder = this.getField('parentFolderID');
|
var oldFolder = this.getField('parentFolderID');
|
||||||
var oldPos = this.getField('orderIndex');
|
var oldPos = this.getField('orderIndex');
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ Scholar.Object.prototype.setPosition = function(newFolder, newPos, isNew){
|
||||||
Scholar.DB.query(sql);
|
Scholar.DB.query(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a new object, insert
|
// If a new item, insert
|
||||||
if (isNew){
|
if (isNew){
|
||||||
sql = 'INSERT INTO treeStructure SET id=' + this.getID() + ', ' +
|
sql = 'INSERT INTO treeStructure SET id=' + this.getID() + ', ' +
|
||||||
'isFolder=0, orderIndex=' + newPos + ', ' +
|
'isFolder=0, orderIndex=' + newPos + ', ' +
|
||||||
|
@ -370,7 +370,7 @@ Scholar.Object.prototype.setPosition = function(newFolder, newPos, isNew){
|
||||||
this._data['orderIndex'] = newPos;
|
this._data['orderIndex'] = newPos;
|
||||||
|
|
||||||
if (!isNew){
|
if (!isNew){
|
||||||
Scholar.Objects.reloadAll();
|
Scholar.Items.reloadAll();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -379,19 +379,19 @@ Scholar.Object.prototype.setPosition = function(newFolder, newPos, isNew){
|
||||||
/*
|
/*
|
||||||
* Save changes back to database
|
* Save changes back to database
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype.save = function(){
|
Scholar.Item.prototype.save = function(){
|
||||||
if (!this.hasChanged()){
|
if (!this.hasChanged()){
|
||||||
Scholar.debug('Object ' + this.getID() + ' has not changed', 4);
|
Scholar.debug('Item ' + this.getID() + ' has not changed', 4);
|
||||||
return !!this.getID();
|
return !!this.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Existing object, update
|
// Existing item, update
|
||||||
//
|
//
|
||||||
if (this.getID()){
|
if (this.getID()){
|
||||||
Scholar.debug('Updating database with new object data', 4);
|
Scholar.debug('Updating database with new item data', 4);
|
||||||
|
|
||||||
var objectID = this.getID();
|
var itemID = this.getID();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Scholar.DB.beginTransaction();
|
Scholar.DB.beginTransaction();
|
||||||
|
@ -399,11 +399,11 @@ Scholar.Object.prototype.save = function(){
|
||||||
//
|
//
|
||||||
// Primary fields
|
// Primary fields
|
||||||
//
|
//
|
||||||
var sql = "UPDATE objects SET ";
|
var sql = "UPDATE items SET ";
|
||||||
var sql2;
|
var sql2;
|
||||||
|
|
||||||
if (this._changed.has('objectTypeID')){
|
if (this._changed.has('itemTypeID')){
|
||||||
sql += "objectTypeID='" + this.getField('objectTypeID') + "', ";
|
sql += "itemTypeID='" + this.getField('itemTypeID') + "', ";
|
||||||
}
|
}
|
||||||
if (this._changed.has('title')){
|
if (this._changed.has('title')){
|
||||||
sql += "title='" + this.getField('title') + "', ";
|
sql += "title='" + this.getField('title') + "', ";
|
||||||
|
@ -417,7 +417,7 @@ Scholar.Object.prototype.save = function(){
|
||||||
|
|
||||||
// Always update modified time
|
// Always update modified time
|
||||||
sql += "dateModified=CURRENT_TIMESTAMP ";
|
sql += "dateModified=CURRENT_TIMESTAMP ";
|
||||||
sql += "WHERE objectID=" + this.getID() + ";\n";
|
sql += "WHERE itemID=" + this.getID() + ";\n";
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -434,8 +434,8 @@ Scholar.Object.prototype.save = function(){
|
||||||
// We have to do this immediately so old entries are
|
// We have to do this immediately so old entries are
|
||||||
// cleared before other ones are shifted down
|
// cleared before other ones are shifted down
|
||||||
if (!creator['firstName'] && !creator['lastName']){
|
if (!creator['firstName'] && !creator['lastName']){
|
||||||
sql2 = 'DELETE FROM objectCreators '
|
sql2 = 'DELETE FROM itemCreators '
|
||||||
+ ' WHERE objectID=' + this.getID()
|
+ ' WHERE itemID=' + this.getID()
|
||||||
+ ' AND orderIndex=' + orderIndex;
|
+ ' AND orderIndex=' + orderIndex;
|
||||||
Scholar.DB.query(sql2);
|
Scholar.DB.query(sql2);
|
||||||
continue;
|
continue;
|
||||||
|
@ -458,18 +458,18 @@ Scholar.Object.prototype.save = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sql2 = 'SELECT COUNT(*) FROM objectCreators'
|
sql2 = 'SELECT COUNT(*) FROM itemCreators'
|
||||||
+ ' WHERE objectID=' + this.getID()
|
+ ' WHERE itemID=' + this.getID()
|
||||||
+ ' AND orderIndex=' + orderIndex;
|
+ ' AND orderIndex=' + orderIndex;
|
||||||
|
|
||||||
if (Scholar.DB.valueQuery(sql2)){
|
if (Scholar.DB.valueQuery(sql2)){
|
||||||
sql += 'UPDATE objectCreators SET creatorID='
|
sql += 'UPDATE itemCreators SET creatorID='
|
||||||
+ creatorID + ' WHERE objectID=' + this.getID()
|
+ creatorID + ' WHERE itemID=' + this.getID()
|
||||||
+ ' AND orderIndex=' + orderIndex + ";\n";
|
+ ' AND orderIndex=' + orderIndex + ";\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sql += 'INSERT INTO objectCreators VALUES ('
|
sql += 'INSERT INTO itemCreators VALUES ('
|
||||||
+ creatorID + ',' + objectID + ',' + orderIndex
|
+ creatorID + ',' + itemID + ',' + orderIndex
|
||||||
+ ");\n";
|
+ ");\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,34 +480,34 @@ Scholar.Object.prototype.save = function(){
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ObjectData
|
// ItemData
|
||||||
//
|
//
|
||||||
if (this._changedObjectData.length){
|
if (this._changedItemData.length){
|
||||||
var del = new Array();
|
var del = new Array();
|
||||||
for (fieldID in this._changedObjectData.items){
|
for (fieldID in this._changedItemData.items){
|
||||||
if (this.getField(fieldID)){
|
if (this.getField(fieldID)){
|
||||||
// Oh, for an INSERT...ON DUPLICATE KEY UPDATE
|
// Oh, for an INSERT...ON DUPLICATE KEY UPDATE
|
||||||
sql2 = 'SELECT COUNT(*) FROM objectData '
|
sql2 = 'SELECT COUNT(*) FROM itemData '
|
||||||
+ 'WHERE objectID=' + this.getID()
|
+ 'WHERE itemID=' + this.getID()
|
||||||
+ ' AND fieldID=' + fieldID;
|
+ ' AND fieldID=' + fieldID;
|
||||||
|
|
||||||
if (Scholar.DB.valueQuery(sql2)){
|
if (Scholar.DB.valueQuery(sql2)){
|
||||||
sql += "UPDATE objectData SET value=";
|
sql += "UPDATE itemData SET value=";
|
||||||
// Take advantage of SQLite's manifest typing
|
// Take advantage of SQLite's manifest typing
|
||||||
if (Scholar.ObjectFields.isInteger(fieldID)){
|
if (Scholar.ItemFields.isInteger(fieldID)){
|
||||||
sql += this.getField(fieldID);
|
sql += this.getField(fieldID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sql += "'" + this.getField(fieldID) + "'";
|
sql += "'" + this.getField(fieldID) + "'";
|
||||||
}
|
}
|
||||||
sql += " WHERE objectID=" + this.getID()
|
sql += " WHERE itemID=" + this.getID()
|
||||||
+ ' AND fieldID=' + fieldID + ";\n";
|
+ ' AND fieldID=' + fieldID + ";\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sql += 'INSERT INTO objectData VALUES ('
|
sql += 'INSERT INTO itemData VALUES ('
|
||||||
+ this.getID() + ',' + fieldID + ',';
|
+ this.getID() + ',' + fieldID + ',';
|
||||||
|
|
||||||
if (Scholar.ObjectFields.isInteger(fieldID)){
|
if (Scholar.ItemFields.isInteger(fieldID)){
|
||||||
sql += this.getField(fieldID);
|
sql += this.getField(fieldID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -524,8 +524,8 @@ Scholar.Object.prototype.save = function(){
|
||||||
|
|
||||||
// Delete blank fields
|
// Delete blank fields
|
||||||
if (del.length){
|
if (del.length){
|
||||||
sql += 'DELETE from objectData '
|
sql += 'DELETE from itemData '
|
||||||
+ 'WHERE objectID=' + this.getID() + ' '
|
+ 'WHERE itemID=' + this.getID() + ' '
|
||||||
+ 'AND fieldID IN (' + del.join() + ");\n";
|
+ 'AND fieldID IN (' + del.join() + ");\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,10 +541,10 @@ Scholar.Object.prototype.save = function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// New object, insert and return id
|
// New item, insert and return id
|
||||||
//
|
//
|
||||||
else {
|
else {
|
||||||
Scholar.debug('Saving data for new object to database');
|
Scholar.debug('Saving data for new item to database');
|
||||||
|
|
||||||
var isNew = true;
|
var isNew = true;
|
||||||
var sqlColumns = new Array();
|
var sqlColumns = new Array();
|
||||||
|
@ -553,8 +553,8 @@ Scholar.Object.prototype.save = function(){
|
||||||
//
|
//
|
||||||
// Primary fields
|
// Primary fields
|
||||||
//
|
//
|
||||||
sqlColumns.push('objectTypeID');
|
sqlColumns.push('itemTypeID');
|
||||||
sqlValues.push({'int':this.getField('objectTypeID')});
|
sqlValues.push({'int':this.getField('itemTypeID')});
|
||||||
|
|
||||||
if (this._changed.has('title')){
|
if (this._changed.has('title')){
|
||||||
sqlColumns.push('title');
|
sqlColumns.push('title');
|
||||||
|
@ -601,17 +601,17 @@ Scholar.Object.prototype.save = function(){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sql += 'INSERT INTO objectCreators VALUES ('
|
sql += 'INSERT INTO itemCreators VALUES ('
|
||||||
+ creatorID + ',' + objectID + ',' + orderIndex
|
+ creatorID + ',' + itemID + ',' + orderIndex
|
||||||
+ ");\n";
|
+ ");\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// objectData fields
|
// itemData fields
|
||||||
//
|
//
|
||||||
var sql = "INSERT INTO objects (" + sqlColumns.join() + ')'
|
var sql = "INSERT INTO items (" + sqlColumns.join() + ')'
|
||||||
+ ' VALUES (';
|
+ ' VALUES (';
|
||||||
// Insert placeholders for bind parameters
|
// Insert placeholders for bind parameters
|
||||||
for (var i=0; i<sqlValues.length; i++){
|
for (var i=0; i<sqlValues.length; i++){
|
||||||
|
@ -619,14 +619,14 @@ Scholar.Object.prototype.save = function(){
|
||||||
}
|
}
|
||||||
sql = sql.substring(0,sql.length-1) + ");\n";
|
sql = sql.substring(0,sql.length-1) + ");\n";
|
||||||
|
|
||||||
var objectID = Scholar.DB.query(sql,sqlValues);
|
var itemID = Scholar.DB.query(sql,sqlValues);
|
||||||
|
|
||||||
if (this._changedObjectData.length){
|
if (this._changedItemData.length){
|
||||||
sql = '';
|
sql = '';
|
||||||
for (fieldID in this._changedObjectData.items){
|
for (fieldID in this._changedItemData.items){
|
||||||
sql += 'INSERT INTO objectData VALUES (' +
|
sql += 'INSERT INTO itemData VALUES (' +
|
||||||
objectID + ',' + fieldID + ',';
|
itemID + ',' + fieldID + ',';
|
||||||
if (Scholar.ObjectFields.isInteger(fieldID)){
|
if (Scholar.ItemFields.isInteger(fieldID)){
|
||||||
sql += this.getField(fieldID);
|
sql += this.getField(fieldID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -641,7 +641,7 @@ Scholar.Object.prototype.save = function(){
|
||||||
Scholar.DB.query(sql);
|
Scholar.DB.query(sql);
|
||||||
|
|
||||||
|
|
||||||
// Set the position of the new object
|
// Set the position of the new item
|
||||||
var newFolder = this._changed.has('parentFolderID')
|
var newFolder = this._changed.has('parentFolderID')
|
||||||
? this.getField('parentFolderID') : 0;
|
? this.getField('parentFolderID') : 0;
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ Scholar.Object.prototype.save = function(){
|
||||||
this.setPosition(newFolder, newPos, true);
|
this.setPosition(newFolder, newPos, true);
|
||||||
|
|
||||||
// TODO: reload Folder or set the empty flag to false manually
|
// TODO: reload Folder or set the empty flag to false manually
|
||||||
// in case this was the first object in a folder
|
// in case this was the first item in a folder
|
||||||
|
|
||||||
Scholar.DB.commitTransaction();
|
Scholar.DB.commitTransaction();
|
||||||
}
|
}
|
||||||
|
@ -661,39 +661,39 @@ Scholar.Object.prototype.save = function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scholar.Objects.reload(this.getID());
|
Scholar.Items.reload(this.getID());
|
||||||
|
|
||||||
return isNew ? this.getID() : true;
|
return isNew ? this.getID() : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Scholar.Object.prototype.toString = function(){
|
Scholar.Item.prototype.toString = function(){
|
||||||
return this.getTitle();
|
return this.getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Scholar.Object.prototype.isFolder = function(){
|
Scholar.Item.prototype.isFolder = function(){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Private Scholar.Object methods
|
// Private Scholar.Item methods
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load in the creators from the database
|
* Load in the creators from the database
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype._loadCreators = function(){
|
Scholar.Item.prototype._loadCreators = function(){
|
||||||
if (!this.getID()){
|
if (!this.getID()){
|
||||||
throw ('ObjectID not set for object before attempting to load creators');
|
throw ('ItemID not set for item before attempting to load creators');
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = 'SELECT C.creatorID, C.*, orderIndex FROM objectCreators OC '
|
var sql = 'SELECT C.creatorID, C.*, orderIndex FROM itemCreators IC '
|
||||||
+ 'LEFT JOIN creators C USING (creatorID) '
|
+ 'LEFT JOIN creators C USING (creatorID) '
|
||||||
+ 'WHERE objectID=' + this.getID() + ' ORDER BY orderIndex';
|
+ 'WHERE itemID=' + this.getID() + ' ORDER BY orderIndex';
|
||||||
var creators = Scholar.DB.query(sql);
|
var creators = Scholar.DB.query(sql);
|
||||||
|
|
||||||
this._creatorsLoaded = true;
|
this._creatorsLoaded = true;
|
||||||
|
@ -718,19 +718,19 @@ Scholar.Object.prototype._loadCreators = function(){
|
||||||
/*
|
/*
|
||||||
* Load in the field data from the database
|
* Load in the field data from the database
|
||||||
*/
|
*/
|
||||||
Scholar.Object.prototype._loadObjectData = function(){
|
Scholar.Item.prototype._loadItemData = function(){
|
||||||
if (!this.getID()){
|
if (!this.getID()){
|
||||||
throw ('ObjectID not set for object before attempting to load data');
|
throw ('ItemID not set for object before attempting to load data');
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = 'SELECT OD.fieldID, value FROM objectData OD JOIN '
|
var sql = 'SELECT ID.fieldID, value FROM itemData ID JOIN '
|
||||||
+ 'objectTypeFields OTF ON (OTF.objectTypeID=(SELECT objectTypeID FROM '
|
+ 'itemTypeFields ITF ON (ITF.itemTypeID=(SELECT itemTypeID FROM '
|
||||||
+ 'objects WHERE objectID=?1) AND OTF.fieldID=OD.fieldID) '
|
+ 'items WHERE itemID=?1) AND ITF.fieldID=ID.fieldID) '
|
||||||
+ 'WHERE objectID=?1 ORDER BY orderIndex';
|
+ 'WHERE itemID=?1 ORDER BY orderIndex';
|
||||||
|
|
||||||
var result = Scholar.DB.query(sql,[{'int':this._data['objectID']}]);
|
var result = Scholar.DB.query(sql,[{'int':this._data['itemID']}]);
|
||||||
|
|
||||||
this._objectDataLoaded = true;
|
this._itemDataLoaded = true;
|
||||||
|
|
||||||
if (result){
|
if (result){
|
||||||
for (var i=0,len=result.length; i<len; i++){
|
for (var i=0,len=result.length; i<len; i++){
|
||||||
|
@ -748,11 +748,11 @@ Scholar.Object.prototype._loadObjectData = function(){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Primary interface for accessing Scholar objects
|
* Primary interface for accessing Scholar items
|
||||||
*/
|
*/
|
||||||
Scholar.Objects = new function(){
|
Scholar.Items = new function(){
|
||||||
// Private members
|
// Private members
|
||||||
var _objects = new Array();
|
var _items = new Array();
|
||||||
|
|
||||||
// Privileged methods
|
// Privileged methods
|
||||||
this.get = get;
|
this.get = get;
|
||||||
|
@ -762,12 +762,12 @@ Scholar.Objects = new function(){
|
||||||
this.reloadAll = reloadAll;
|
this.reloadAll = reloadAll;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Retrieves (and loads, if necessary) an arbitrary number of objects
|
* Retrieves (and loads, if necessary) an arbitrary number of items
|
||||||
*
|
*
|
||||||
* Can be passed ids as individual parameters or as an array of ids, or both
|
* Can be passed ids as individual parameters or as an array of ids, or both
|
||||||
*
|
*
|
||||||
* If only one argument and it's an id, return object directly;
|
* If only one argument and it's an id, return object directly;
|
||||||
* otherwise, return array indexed by objectID
|
* otherwise, return array indexed by itemID
|
||||||
*/
|
*/
|
||||||
function get(){
|
function get(){
|
||||||
var toLoad = new Array();
|
var toLoad = new Array();
|
||||||
|
@ -781,12 +781,12 @@ Scholar.Objects = new function(){
|
||||||
|
|
||||||
for (var i=0; i<ids.length; i++){
|
for (var i=0; i<ids.length; i++){
|
||||||
// Check if already loaded
|
// Check if already loaded
|
||||||
if (!_objects[ids[i]]){
|
if (!_items[ids[i]]){
|
||||||
toLoad.push(ids[i]);
|
toLoad.push(ids[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// New objects to load
|
// New items to load
|
||||||
if (toLoad.length){
|
if (toLoad.length){
|
||||||
_load(toLoad);
|
_load(toLoad);
|
||||||
}
|
}
|
||||||
|
@ -794,12 +794,12 @@ Scholar.Objects = new function(){
|
||||||
// If single id, return the object directly
|
// If single id, return the object directly
|
||||||
if (arguments[0] && typeof arguments[0]!='Object'
|
if (arguments[0] && typeof arguments[0]!='Object'
|
||||||
&& typeof arguments[1]=='undefined'){
|
&& typeof arguments[1]=='undefined'){
|
||||||
return _objects[arguments[0]];
|
return _items[arguments[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, build return array
|
// Otherwise, build return array
|
||||||
for (i=0; i<ids.length; i++){
|
for (i=0; i<ids.length; i++){
|
||||||
loaded[ids[i]] = _objects[ids[i]];
|
loaded[ids[i]] = _items[ids[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return loaded;
|
return loaded;
|
||||||
|
@ -807,11 +807,11 @@ Scholar.Objects = new function(){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns all objects in the database
|
* Returns all items in the database
|
||||||
*/
|
*/
|
||||||
function getAll(){
|
function getAll(){
|
||||||
var sql = 'SELECT O.objectID FROM objects O '
|
var sql = 'SELECT I.itemID FROM items I '
|
||||||
+ 'LEFT JOIN treeStructure TS ON (O.objectID=TS.id AND isFolder=0) '
|
+ 'LEFT JOIN treeStructure TS ON (I.itemID=TS.id AND isFolder=0) '
|
||||||
+ 'ORDER BY orderIndex';
|
+ 'ORDER BY orderIndex';
|
||||||
|
|
||||||
var ids = Scholar.DB.columnQuery(sql);
|
var ids = Scholar.DB.columnQuery(sql);
|
||||||
|
@ -820,8 +820,8 @@ Scholar.Objects = new function(){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns an array of all folders and objects that are children of a folder
|
* Returns an array of all folders and items that are children of a folder
|
||||||
* as Scholar.Folder and Scholar.Object instances
|
* as Scholar.Folder and Scholar.Item instances
|
||||||
*
|
*
|
||||||
* Takes parent folderID as optional parameter; by default, returns root items
|
* Takes parent folderID as optional parameter; by default, returns root items
|
||||||
*
|
*
|
||||||
|
@ -859,9 +859,9 @@ Scholar.Objects = new function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var obj = Scholar.Objects.get(tree[i]['id']);
|
var obj = Scholar.Items.get(tree[i]['id']);
|
||||||
if (!obj){
|
if (!obj){
|
||||||
throw ('Object ' + tree[i]['id'] + ' not found');
|
throw ('Item ' + tree[i]['id'] + ' not found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,7 +873,7 @@ Scholar.Objects = new function(){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reloads data for specified objects into internal array
|
* Reloads data for specified items into internal array
|
||||||
*
|
*
|
||||||
* Can be passed ids as individual parameters or as an array of ids, or both
|
* Can be passed ids as individual parameters or as an array of ids, or both
|
||||||
*/
|
*/
|
||||||
|
@ -891,22 +891,22 @@ Scholar.Objects = new function(){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reloads all currently cached objects
|
* Reloads all currently cached items
|
||||||
*/
|
*/
|
||||||
function reloadAll(){
|
function reloadAll(){
|
||||||
var ids = new Array();
|
var ids = new Array();
|
||||||
for (objectID in _objects){
|
for (itemID in _items){
|
||||||
ids.push(objectID);
|
ids.push(itemID);
|
||||||
}
|
}
|
||||||
_load(ids);
|
_load(ids);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function add(data, objectTypeID, folderID, orderIndex){
|
function add(data, itemTypeID, folderID, orderIndex){
|
||||||
var insert = new Array();
|
var insert = new Array();
|
||||||
|
|
||||||
var obj = new Scholar.Object(objectTypeID, folderID, orderIndex);
|
var obj = new Scholar.Item(itemTypeID, folderID, orderIndex);
|
||||||
|
|
||||||
for (field in data){
|
for (field in data){
|
||||||
obj.setField(data[field]);
|
obj.setField(data[field]);
|
||||||
|
@ -923,27 +923,27 @@ Scholar.Objects = new function(){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should be the same as query in Scholar.Object.loadFromID, just
|
// Should be the same as query in Scholar.Item.loadFromID, just
|
||||||
// without objectID clause
|
// without itemID clause
|
||||||
var sql = 'SELECT O.*, lastName AS firstCreator, TS.parentFolderID, '
|
var sql = 'SELECT I.*, lastName AS firstCreator, TS.parentFolderID, '
|
||||||
+ 'TS.orderIndex '
|
+ 'TS.orderIndex '
|
||||||
+ 'FROM objects O '
|
+ 'FROM items I '
|
||||||
+ 'LEFT JOIN treeStructure TS ON (O.objectID=TS.id AND isFolder=0) '
|
+ 'LEFT JOIN treeStructure TS ON (I.itemID=TS.id AND isFolder=0) '
|
||||||
+ 'LEFT JOIN objectCreators OC ON (O.objectID=OC.objectID) '
|
+ 'LEFT JOIN itemCreators IC ON (I.itemID=IC.itemID) '
|
||||||
+ 'LEFT JOIN creators C ON (OC.creatorID=C.creatorID) '
|
+ 'LEFT JOIN creators C ON (IC.creatorID=C.creatorID) '
|
||||||
+ 'WHERE OC.orderIndex=0';
|
+ 'WHERE IC.orderIndex=0';
|
||||||
|
|
||||||
if (arguments[0]!='all'){
|
if (arguments[0]!='all'){
|
||||||
sql += ' AND O.objectID IN (' + Scholar.join(arguments,',') + ')';
|
sql += ' AND I.itemID IN (' + Scholar.join(arguments,',') + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = Scholar.DB.query(sql);
|
var result = Scholar.DB.query(sql);
|
||||||
|
|
||||||
if (result){
|
if (result){
|
||||||
for (var i=0,len=result.length; i<len; i++){
|
for (var i=0,len=result.length; i<len; i++){
|
||||||
var obj = new Scholar.Object();
|
var obj = new Scholar.Item();
|
||||||
obj.loadFromRow(result[i]);
|
obj.loadFromRow(result[i]);
|
||||||
_objects[result[i]['objectID']] = obj;
|
_items[result[i]['itemID']] = obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1154,7 +1154,7 @@ Scholar.Creators = new function(){
|
||||||
*/
|
*/
|
||||||
function purge(returnSQL){
|
function purge(returnSQL){
|
||||||
var sql = 'SELECT creatorID FROM creators WHERE creatorID NOT IN '
|
var sql = 'SELECT creatorID FROM creators WHERE creatorID NOT IN '
|
||||||
+ '(SELECT creatorID FROM objectCreators);';
|
+ '(SELECT creatorID FROM itemCreators);';
|
||||||
var toDelete = Scholar.DB.columnQuery(sql);
|
var toDelete = Scholar.DB.columnQuery(sql);
|
||||||
|
|
||||||
if (!toDelete){
|
if (!toDelete){
|
||||||
|
@ -1162,7 +1162,7 @@ Scholar.Creators = new function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
sql = 'DELETE FROM creators WHERE creatorID NOT IN '
|
sql = 'DELETE FROM creators WHERE creatorID NOT IN '
|
||||||
+ '(SELECT creatorID FROM objectCreators);';
|
+ '(SELECT creatorID FROM itemCreators);';
|
||||||
|
|
||||||
if (!returnSQL){
|
if (!returnSQL){
|
||||||
var result = Scholar.DB.query(sql);
|
var result = Scholar.DB.query(sql);
|
||||||
|
@ -1194,18 +1194,18 @@ Scholar.Creators = new function(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Scholar.ObjectFields = new function(){
|
Scholar.ItemFields = new function(){
|
||||||
// Private members
|
// Private members
|
||||||
var _fields = new Array();
|
var _fields = new Array();
|
||||||
var _fieldFormats = new Array();
|
var _fieldFormats = new Array();
|
||||||
var _objectTypeFields = new Array();
|
var _itemTypeFields = new Array();
|
||||||
|
|
||||||
// Privileged methods
|
// Privileged methods
|
||||||
this.getName = getName;
|
this.getName = getName;
|
||||||
this.getID = getID;
|
this.getID = getID;
|
||||||
this.isValidForType = isValidForType;
|
this.isValidForType = isValidForType;
|
||||||
this.isInteger = isInteger;
|
this.isInteger = isInteger;
|
||||||
this.getObjectTypeFields = getObjectTypeFields;
|
this.getItemTypeFields = getItemTypeFields;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the fieldName for a passed fieldID or fieldName
|
* Return the fieldName for a passed fieldID or fieldName
|
||||||
|
@ -1229,11 +1229,11 @@ Scholar.ObjectFields = new function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function isValidForType(fieldID, objectTypeID){
|
function isValidForType(fieldID, itemTypeID){
|
||||||
if (!_fields.length){
|
if (!_fields.length){
|
||||||
_loadFields();
|
_loadFields();
|
||||||
}
|
}
|
||||||
return !!_fields[fieldID]['objectTypes'][objectTypeID];
|
return !!_fields[fieldID]['itemTypes'][itemTypeID];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1247,38 +1247,38 @@ Scholar.ObjectFields = new function(){
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns an array of fieldIDs for a given object type
|
* Returns an array of fieldIDs for a given item type
|
||||||
*/
|
*/
|
||||||
function getObjectTypeFields(objectTypeID){
|
function getItemTypeFields(itemTypeID){
|
||||||
if (_objectTypeFields[objectTypeID]){
|
if (_itemTypeFields[itemTypeID]){
|
||||||
return _objectTypeFields[objectTypeID];
|
return _itemTypeFields[itemTypeID];
|
||||||
}
|
}
|
||||||
|
|
||||||
var sql = 'SELECT fieldID FROM objectTypeFields '
|
var sql = 'SELECT fieldID FROM itemTypeFields '
|
||||||
+ 'WHERE objectTypeID=' + objectTypeID + ' ORDER BY orderIndex';
|
+ 'WHERE itemTypeID=' + itemTypeID + ' ORDER BY orderIndex';
|
||||||
|
|
||||||
_objectTypeFields[objectTypeID] = Scholar.DB.columnQuery(sql);
|
_itemTypeFields[itemTypeID] = Scholar.DB.columnQuery(sql);
|
||||||
return _objectTypeFields[objectTypeID];
|
return _itemTypeFields[itemTypeID];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns hash array of objectTypeIDs for which a given field is valid
|
* Returns hash array of itemTypeIDs for which a given field is valid
|
||||||
*/
|
*/
|
||||||
function _getFieldObjectTypes(){
|
function _getFieldItemTypes(){
|
||||||
var sql = 'SELECT fieldID,objectTypeID FROM objectTypeFields';
|
var sql = 'SELECT fieldID, itemTypeID FROM itemTypeFields';
|
||||||
|
|
||||||
var results = Scholar.DB.query(sql);
|
var results = Scholar.DB.query(sql);
|
||||||
|
|
||||||
if (!results){
|
if (!results){
|
||||||
throw ('No fields in objectTypeFields!');
|
throw ('No fields in itemTypeFields!');
|
||||||
}
|
}
|
||||||
var fields = new Array();
|
var fields = new Array();
|
||||||
for (var i=0; i<results.length; i++){
|
for (var i=0; i<results.length; i++){
|
||||||
if (!fields[results[i]['fieldID']]){
|
if (!fields[results[i]['fieldID']]){
|
||||||
fields[results[i]['fieldID']] = new Array();
|
fields[results[i]['fieldID']] = new Array();
|
||||||
}
|
}
|
||||||
fields[results[i]['fieldID']][results[i]['objectTypeID']] = true;
|
fields[results[i]['fieldID']][results[i]['itemTypeID']] = true;
|
||||||
}
|
}
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
@ -1305,14 +1305,14 @@ Scholar.ObjectFields = new function(){
|
||||||
throw ('No fields in database!');
|
throw ('No fields in database!');
|
||||||
}
|
}
|
||||||
|
|
||||||
var fieldObjectTypes = _getFieldObjectTypes();
|
var fieldItemTypes = _getFieldItemTypes();
|
||||||
|
|
||||||
for (i=0,len=result.length; i<len; i++){
|
for (i=0,len=result.length; i<len; i++){
|
||||||
_fields[result[i]['fieldID']] = {
|
_fields[result[i]['fieldID']] = {
|
||||||
id: result[i]['fieldID'],
|
id: result[i]['fieldID'],
|
||||||
name: result[i]['fieldName'],
|
name: result[i]['fieldName'],
|
||||||
formatID: result[i]['fieldFormatID'],
|
formatID: result[i]['fieldFormatID'],
|
||||||
objectTypes: fieldObjectTypes[result[i]['fieldID']]
|
itemTypes: fieldItemTypes[result[i]['fieldID']]
|
||||||
};
|
};
|
||||||
// Store by name as well as id
|
// Store by name as well as id
|
||||||
_fields[result[i]['fieldName']] = _fields[result[i]['fieldID']];
|
_fields[result[i]['fieldName']] = _fields[result[i]['fieldID']];
|
||||||
|
@ -1321,9 +1321,9 @@ Scholar.ObjectFields = new function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var objects = Scholar.Objects.getAll();
|
var items = Scholar.Items.getAll();
|
||||||
|
|
||||||
var obj = objects[9];
|
var obj = items[9];
|
||||||
for (var i=0,len=obj.numCreators(); i<len; i++){
|
for (var i=0,len=obj.numCreators(); i<len; i++){
|
||||||
Scholar.debug(Scholar.varDump(obj.getCreator(i)));
|
Scholar.debug(Scholar.varDump(obj.getCreator(i)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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==6){
|
if (i==7){
|
||||||
_initializeSchema();
|
_initializeSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i==7){
|
if (i==8){
|
||||||
// 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: 6, // must match version at top of schema.sql
|
DB_VERSION: 7, // 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: false // dump debug messages to console rather than (much slower) Debug Logger
|
DEBUG_TO_CONSOLE: false // dump debug messages to console rather than (much slower) Debug Logger
|
||||||
|
|
|
@ -15,7 +15,7 @@ Scholar.TreeView.prototype.setTree = function(treebox)
|
||||||
return;
|
return;
|
||||||
this._treebox = treebox;
|
this._treebox = treebox;
|
||||||
|
|
||||||
var newRows = Scholar.Objects.getTreeRows();
|
var newRows = Scholar.Items.getTreeRows();
|
||||||
for(var i = 0; i < newRows.length; i++)
|
for(var i = 0; i < newRows.length; i++)
|
||||||
this._insertItem(newRows[i], 0, i+1); //object ref, isContainerOpen, level
|
this._insertItem(newRows[i], 0, i+1); //object ref, isContainerOpen, level
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ Scholar.TreeView.prototype.toggleOpenState = function(row)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var newRows = Scholar.Objects.getTreeRows(this._getObjectAtRow(row).getID()); //Get children
|
var newRows = Scholar.Items.getTreeRows(this._getObjectAtRow(row).getID()); //Get children
|
||||||
|
|
||||||
for(var i = 0; i < newRows.length; i++)
|
for(var i = 0; i < newRows.length; i++)
|
||||||
{
|
{
|
||||||
|
@ -245,10 +245,10 @@ function removeDynamicRows()
|
||||||
|
|
||||||
function getFullFieldList(item)
|
function getFullFieldList(item)
|
||||||
{
|
{
|
||||||
var fields = Scholar.ObjectFields.getObjectTypeFields(item.getField("objectTypeID"));
|
var fields = Scholar.ItemFields.getItemTypeFields(item.getField("itemTypeID"));
|
||||||
var fieldNames = new Array("title","dateAdded","dateModified","source","rights");
|
var fieldNames = new Array("title","dateAdded","dateModified","source","rights");
|
||||||
for(var i = 0; i<fields.length; i++)
|
for(var i = 0; i<fields.length; i++)
|
||||||
fieldNames.push(Scholar.ObjectFields.getName(fields[i]));
|
fieldNames.push(Scholar.ItemFields.getName(fields[i]));
|
||||||
return fieldNames;
|
return fieldNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
171
schema.sql
171
schema.sql
|
@ -1,14 +1,14 @@
|
||||||
-- 6
|
-- 7
|
||||||
|
|
||||||
DROP TABLE IF EXISTS version;
|
DROP TABLE IF EXISTS version;
|
||||||
CREATE TABLE version (
|
CREATE TABLE version (
|
||||||
version INTEGER PRIMARY KEY
|
version INTEGER PRIMARY KEY
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS objects;
|
DROP TABLE IF EXISTS items;
|
||||||
CREATE TABLE objects (
|
CREATE TABLE items (
|
||||||
objectID INTEGER PRIMARY KEY,
|
itemID INTEGER PRIMARY KEY,
|
||||||
objectTypeID INT,
|
itemTypeID INT,
|
||||||
title TEXT,
|
title TEXT,
|
||||||
dateAdded DATETIME DEFAULT CURRENT_TIMESTAMP,
|
dateAdded DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
dateModified DATETIME DEFAULT CURRENT_TIMESTAMP,
|
dateModified DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
@ -16,9 +16,9 @@
|
||||||
rights TEXT
|
rights TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS objectTypes;
|
DROP TABLE IF EXISTS itemTypes;
|
||||||
CREATE TABLE objectTypes (
|
CREATE TABLE itemTypes (
|
||||||
objectTypeID INTEGER PRIMARY KEY,
|
itemTypeID INTEGER PRIMARY KEY,
|
||||||
typeName TEXT
|
typeName TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -37,26 +37,27 @@
|
||||||
FOREIGN KEY (fieldFormatID) REFERENCES fieldFormat(fieldFormatID)
|
FOREIGN KEY (fieldFormatID) REFERENCES fieldFormat(fieldFormatID)
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS objectTypeFields;
|
DROP TABLE IF EXISTS itemTypeFields;
|
||||||
CREATE TABLE objectTypeFields (
|
CREATE TABLE itemTypeFields (
|
||||||
objectTypeID INT,
|
itemTypeID INT,
|
||||||
fieldID INT,
|
fieldID INT,
|
||||||
orderIndex INT,
|
orderIndex INT,
|
||||||
PRIMARY KEY (objectTypeID, fieldID),
|
PRIMARY KEY (itemTypeID, fieldID),
|
||||||
FOREIGN KEY (objectTypeID) REFERENCES objectTypes(objectTypeID),
|
FOREIGN KEY (itemTypeID) REFERENCES itemTypes(itemTypeID),
|
||||||
FOREIGN KEY (fieldID) REFERENCES objectTypes(objectTypeID)
|
FOREIGN KEY (fieldID) REFERENCES itemTypes(itemTypeID)
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS objectData;
|
DROP TABLE IF EXISTS itemData;
|
||||||
CREATE TABLE objectData (
|
CREATE TABLE itemData (
|
||||||
objectID INT,
|
itemID INT,
|
||||||
fieldID INT,
|
fieldID INT,
|
||||||
value NONE,
|
value NONE,
|
||||||
PRIMARY KEY (objectID, fieldID),
|
PRIMARY KEY (itemID, fieldID),
|
||||||
FOREIGN KEY (objectID) REFERENCES objects(objectID),
|
FOREIGN KEY (itemID) REFERENCES items(itemID),
|
||||||
FOREIGN KEY (fieldID) REFERENCES fields(fieldID)
|
FOREIGN KEY (fieldID) REFERENCES fields(fieldID)
|
||||||
);
|
);
|
||||||
CREATE INDEX value ON objectData (value);
|
DROP INDEX IF EXISTS value;
|
||||||
|
CREATE INDEX value ON itemData (value);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS keywords;
|
DROP TABLE IF EXISTS keywords;
|
||||||
CREATE TABLE keywords (
|
CREATE TABLE keywords (
|
||||||
|
@ -64,12 +65,12 @@
|
||||||
keyword TEXT
|
keyword TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS objectKeywords;
|
DROP TABLE IF EXISTS itemKeywords;
|
||||||
CREATE TABLE objectKeywords (
|
CREATE TABLE itemKeywords (
|
||||||
objectID INT,
|
itemID INT,
|
||||||
keywordID INT,
|
keywordID INT,
|
||||||
PRIMARY KEY (objectID, keywordID),
|
PRIMARY KEY (itemID, keywordID),
|
||||||
FOREIGN KEY (objectID) REFERENCES objects(objectID),
|
FOREIGN KEY (itemID) REFERENCES items(itemID),
|
||||||
FOREIGN KEY (keywordID) REFERENCES keywords(keywordID)
|
FOREIGN KEY (keywordID) REFERENCES keywords(keywordID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -89,13 +90,13 @@
|
||||||
creatorType TEXT
|
creatorType TEXT
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS objectCreators;
|
DROP TABLE IF EXISTS itemCreators;
|
||||||
CREATE TABLE objectCreators (
|
CREATE TABLE itemCreators (
|
||||||
objectID INT,
|
itemID INT,
|
||||||
creatorID INT,
|
creatorID INT,
|
||||||
orderIndex INT DEFAULT 0,
|
orderIndex INT DEFAULT 0,
|
||||||
PRIMARY KEY (objectID, creatorID),
|
PRIMARY KEY (itemID, creatorID),
|
||||||
FOREIGN KEY (objectID) REFERENCES objects(objectID),
|
FOREIGN KEY (itemID) REFERENCES items(itemID),
|
||||||
FOREIGN KEY (creatorID) REFERENCES creators(creatorID)
|
FOREIGN KEY (creatorID) REFERENCES creators(creatorID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -121,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 objectTypes VALUES (1,'Book');
|
INSERT INTO itemTypes VALUES (1,'Book');
|
||||||
INSERT INTO objectTypes VALUES (2,'Journal Article');
|
INSERT INTO itemTypes VALUES (2,'Journal Article');
|
||||||
|
|
||||||
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);
|
||||||
|
@ -140,43 +141,43 @@
|
||||||
INSERT INTO fields VALUES (10,'publication',NULL);
|
INSERT INTO fields VALUES (10,'publication',NULL);
|
||||||
INSERT INTO fields VALUES (11,'ISSN',NULL);
|
INSERT INTO fields VALUES (11,'ISSN',NULL);
|
||||||
|
|
||||||
INSERT INTO objectTypeFields VALUES (1,1,1);
|
INSERT INTO itemTypeFields VALUES (1,1,1);
|
||||||
INSERT INTO objectTypeFields VALUES (1,2,2);
|
INSERT INTO itemTypeFields VALUES (1,2,2);
|
||||||
INSERT INTO objectTypeFields VALUES (1,3,3);
|
INSERT INTO itemTypeFields VALUES (1,3,3);
|
||||||
INSERT INTO objectTypeFields VALUES (1,4,4);
|
INSERT INTO itemTypeFields VALUES (1,4,4);
|
||||||
INSERT INTO objectTypeFields VALUES (1,5,5);
|
INSERT INTO itemTypeFields VALUES (1,5,5);
|
||||||
INSERT INTO objectTypeFields VALUES (1,6,6);
|
INSERT INTO itemTypeFields VALUES (1,6,6);
|
||||||
INSERT INTO objectTypeFields VALUES (1,7,7);
|
INSERT INTO itemTypeFields VALUES (1,7,7);
|
||||||
INSERT INTO objectTypeFields VALUES (1,8,8);
|
INSERT INTO itemTypeFields VALUES (1,8,8);
|
||||||
INSERT INTO objectTypeFields VALUES (1,9,9);
|
INSERT INTO itemTypeFields VALUES (1,9,9);
|
||||||
INSERT INTO objectTypeFields VALUES (2,10,1);
|
INSERT INTO itemTypeFields VALUES (2,10,1);
|
||||||
INSERT INTO objectTypeFields VALUES (2,2,2);
|
INSERT INTO itemTypeFields VALUES (2,2,2);
|
||||||
INSERT INTO objectTypeFields VALUES (2,3,3);
|
INSERT INTO itemTypeFields VALUES (2,3,3);
|
||||||
INSERT INTO objectTypeFields VALUES (2,8,4);
|
INSERT INTO itemTypeFields VALUES (2,8,4);
|
||||||
|
|
||||||
INSERT INTO "objects" VALUES(1, 1, 'Online connections: Internet interpersonal relationships', '2006-03-12 05:24:40', '2006-03-12 05:24:40', NULL, NULL);
|
INSERT INTO "items" VALUES(1, 1, 'Online connections: Internet interpersonal relationships', '2006-03-12 05:24:40', '2006-03-12 05:24:40', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(2, 1, 'Computer-Mediated Communication: Human-to-Human Communication Across the Internet', '2006-03-12 05:25:50', '2006-03-12 05:25:50', NULL, NULL);
|
INSERT INTO "items" VALUES(2, 1, 'Computer-Mediated Communication: Human-to-Human Communication Across the Internet', '2006-03-12 05:25:50', '2006-03-12 05:25:50', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(3, 2, 'Residential propinquity as a factor in marriage selection', '2006-03-12 05:26:37', '2006-03-12 05:26:37', NULL, NULL);
|
INSERT INTO "items" VALUES(3, 2, 'Residential propinquity as a factor in marriage selection', '2006-03-12 05:26:37', '2006-03-12 05:26:37', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(4, 1, 'Connecting: how we form social bonds and communities in the Internet age', '2006-03-12 05:27:15', '2006-03-12 05:27:15', NULL, NULL);
|
INSERT INTO "items" VALUES(4, 1, 'Connecting: how we form social bonds and communities in the Internet age', '2006-03-12 05:27:15', '2006-03-12 05:27:15', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(5, 1, 'Male, Female, Email: The Struggle for Relatedness in a Paranoid Society', '2006-03-12 05:27:36', '2006-03-12 05:27:36', NULL, NULL);
|
INSERT INTO "items" VALUES(5, 1, 'Male, Female, Email: The Struggle for Relatedness in a Paranoid Society', '2006-03-12 05:27:36', '2006-03-12 05:27:36', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(6, 2, 'Social Implications of Sociology', '2006-03-12 05:27:53', '2006-03-12 05:27:53', NULL, NULL);
|
INSERT INTO "items" VALUES(6, 2, 'Social Implications of Sociology', '2006-03-12 05:27:53', '2006-03-12 05:27:53', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(7, 1, 'Social Pressures in Informal Groups: A Study of Human Factors in Housing', '2006-03-12 05:28:05', '2006-03-12 05:28:05', NULL, NULL);
|
INSERT INTO "items" VALUES(7, 1, 'Social Pressures in Informal Groups: A Study of Human Factors in Housing', '2006-03-12 05:28:05', '2006-03-12 05:28:05', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(8, 1, 'Cybersociety 2.0: Revisiting Computer-Mediated Community and Technology', '2006-03-12 05:28:37', '2006-03-12 05:28:37', NULL, NULL);
|
INSERT INTO "items" VALUES(8, 1, 'Cybersociety 2.0: Revisiting Computer-Mediated Community and Technology', '2006-03-12 05:28:37', '2006-03-12 05:28:37', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(9, 2, 'The Computer as a Communication Device', '2006-03-12 05:29:03', '2006-03-12 05:29:03', NULL, NULL);
|
INSERT INTO "items" VALUES(9, 2, 'The Computer as a Communication Device', '2006-03-12 05:29:03', '2006-03-12 05:29:03', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(10, 2, 'What Does Research Say about the Nature of Computer-mediated Communication: Task-Oriented, Social-Emotion-Oriented, or Both?', '2006-03-12 05:29:12', '2006-03-12 05:29:12', NULL, NULL);
|
INSERT INTO "items" VALUES(10, 2, 'What Does Research Say about the Nature of Computer-mediated Communication: Task-Oriented, Social-Emotion-Oriented, or Both?', '2006-03-12 05:29:12', '2006-03-12 05:29:12', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(11, 1, 'The second self: computers and the human spirit', '2006-03-12 05:30:38', '2006-03-12 05:30:38', NULL, NULL);
|
INSERT INTO "items" VALUES(11, 1, 'The second self: computers and the human spirit', '2006-03-12 05:30:38', '2006-03-12 05:30:38', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(12, 1, 'Life on the screen: identity in the age of the Internet', '2006-03-12 05:30:49', '2006-03-12 05:30:49', NULL, NULL);
|
INSERT INTO "items" VALUES(12, 1, 'Life on the screen: identity in the age of the Internet', '2006-03-12 05:30:49', '2006-03-12 05:30:49', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(13, 2, 'The computer conference: An altered state of communication', '2006-03-12 05:31:00', '2006-03-12 05:31:00', NULL, NULL);
|
INSERT INTO "items" VALUES(13, 2, 'The computer conference: An altered state of communication', '2006-03-12 05:31:00', '2006-03-12 05:31:00', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(14, 2, 'Computer Networks as Social Networks: Collaborative Work, Telework, and Community', '2006-03-12 05:31:17', '2006-03-12 05:31:17', NULL, NULL);
|
INSERT INTO "items" VALUES(14, 2, 'Computer Networks as Social Networks: Collaborative Work, Telework, and Community', '2006-03-12 05:31:17', '2006-03-12 05:31:17', NULL, NULL);
|
||||||
INSERT INTO "objects" VALUES(15, 1, 'The Internet in everyday life', '2006-03-12 05:31:41', '2006-03-12 05:31:41', NULL, NULL);
|
INSERT INTO "items" VALUES(15, 1, 'The Internet in everyday life', '2006-03-12 05:31:41', '2006-03-12 05:31:41', NULL, NULL);
|
||||||
|
|
||||||
INSERT INTO "objectData" VALUES(1, 7, 2001);
|
INSERT INTO "itemData" VALUES(1, 7, 2001);
|
||||||
INSERT INTO "objectData" VALUES(1, 5, 'Cresskill, N.J.');
|
INSERT INTO "itemData" VALUES(1, 5, 'Cresskill, N.J.');
|
||||||
INSERT INTO "objectData" VALUES(1, 6, 'Hampton Press');
|
INSERT INTO "itemData" VALUES(1, 6, 'Hampton Press');
|
||||||
INSERT INTO "objectData" VALUES(2, 7, 2002);
|
INSERT INTO "itemData" VALUES(2, 7, 2002);
|
||||||
INSERT INTO "objectData" VALUES(2, 6, 'Allyn & Bacon Publishers');
|
INSERT INTO "itemData" VALUES(2, 6, 'Allyn & Bacon Publishers');
|
||||||
INSERT INTO "objectData" VALUES(2, 8, 347);
|
INSERT INTO "itemData" VALUES(2, 8, 347);
|
||||||
INSERT INTO "objectData" VALUES(2, 9, '0-205-32145-3');
|
INSERT INTO "itemData" VALUES(2, 9, '0-205-32145-3');
|
||||||
|
|
||||||
INSERT INTO "creators" VALUES(1, 1, 'Susan B.', 'Barnes');
|
INSERT INTO "creators" VALUES(1, 1, 'Susan B.', 'Barnes');
|
||||||
INSERT INTO "creators" VALUES(2, 1, 'J.S.', 'Bassard');
|
INSERT INTO "creators" VALUES(2, 1, 'J.S.', 'Bassard');
|
||||||
|
@ -194,24 +195,24 @@
|
||||||
INSERT INTO "creators" VALUES(14, 1, 'J.', 'Vallee');
|
INSERT INTO "creators" VALUES(14, 1, 'J.', 'Vallee');
|
||||||
INSERT INTO "creators" VALUES(15, 1, 'Barry', 'Wellman');
|
INSERT INTO "creators" VALUES(15, 1, 'Barry', 'Wellman');
|
||||||
|
|
||||||
INSERT INTO "objectCreators" VALUES(1, 1, 0);
|
INSERT INTO "itemCreators" VALUES(1, 1, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(2, 1, 0);
|
INSERT INTO "itemCreators" VALUES(2, 1, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(3, 2, 0);
|
INSERT INTO "itemCreators" VALUES(3, 2, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(4, 3, 0);
|
INSERT INTO "itemCreators" VALUES(4, 3, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(5, 4, 0);
|
INSERT INTO "itemCreators" VALUES(5, 4, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(6, 5, 0);
|
INSERT INTO "itemCreators" VALUES(6, 5, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(7, 6, 0);
|
INSERT INTO "itemCreators" VALUES(7, 6, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(8, 9, 0);
|
INSERT INTO "itemCreators" VALUES(8, 9, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(9, 10, 0);
|
INSERT INTO "itemCreators" VALUES(9, 10, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(10, 12, 0);
|
INSERT INTO "itemCreators" VALUES(10, 12, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(11, 13, 0);
|
INSERT INTO "itemCreators" VALUES(11, 13, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(12, 13, 0);
|
INSERT INTO "itemCreators" VALUES(12, 13, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(13, 14, 0);
|
INSERT INTO "itemCreators" VALUES(13, 14, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(14, 15, 0);
|
INSERT INTO "itemCreators" VALUES(14, 15, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(15, 15, 0);
|
INSERT INTO "itemCreators" VALUES(15, 15, 0);
|
||||||
INSERT INTO "objectCreators" VALUES(7, 7, 1);
|
INSERT INTO "itemCreators" VALUES(7, 7, 1);
|
||||||
INSERT INTO "objectCreators" VALUES(7, 8, 2);
|
INSERT INTO "itemCreators" VALUES(7, 8, 2);
|
||||||
INSERT INTO "objectCreators" VALUES(9, 11, 1);
|
INSERT INTO "itemCreators" VALUES(9, 11, 1);
|
||||||
|
|
||||||
INSERT INTO folders VALUES (1241, 'Test Folder');
|
INSERT INTO folders VALUES (1241, 'Test Folder');
|
||||||
INSERT INTO folders VALUES (3262, 'Another Test Folder');
|
INSERT INTO folders VALUES (3262, 'Another Test Folder');
|
||||||
|
|
Loading…
Reference in a new issue