Commit graph

20 commits

Author SHA1 Message Date
Dan Stillman
05d1fba368 Fixed SQL error in creator update query in Item.save() 2006-05-23 13:08:19 +00:00
Dan Stillman
deea149235 Moved creatorTypeID into itemCreators and changed code accordingly; updated sample data
Added Scholar.CreatorTypes with methods getTypes() (multi-dim array with 'id' and 'name') and getTypeName(creatorTypeID)

Fixed bug in Scholar.Creators.purge() causing SQL error when deleting a non-existent creator

Fixed incorrect field order for itemCreators INSERT queries in save()

Changed setCreator() to take empty creator names (causing DELETE in itemCreators but without shifting up creators below it (or down and above, depending on your perspective) like removeCreators())
2006-05-20 15:18:36 +00:00
Dan Stillman
c726b3ba77 Added Scholar.Items.erase(id) and Scholar.Item.erase() -- can be used externally with the former or internally with the latter
Fixed bug in Scholar.Creators._getHash()
2006-05-19 11:31:45 +00:00
Dan Stillman
7800f7a39b Fix saving of new items
Added Scholar.Folders.reloadAll(), used after saving a new item or moving one to refresh isEmpty

Fixed bug where items without creators wouldn't show
2006-05-18 21:55:43 +00:00
Dan Stillman
fec3bc0129 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')
2006-05-18 20:39:38 +00:00
Dan Stillman
605510a635 New function Scholar.Items.getNewItemByType(itemTypeID [, parentFolderID] [, orderIndex]) to get empty Item object -- parentFolderID and orderIndex are optional 2006-05-18 20:09:01 +00:00
Dan Stillman
c8b0d3daed 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) 2006-05-18 11:25:10 +00:00
Dan Stillman
19d268e198 No need to throw error on empty folder 2006-05-16 21:56:49 +00:00
Dan Stillman
bfdcbd831b Moved folderID and parentFolderID out of objects/folders into treeStructure and removed level column; updated sample data and SQL calls
Removed getLevel()

Updated Object.setPosition() to handle setting the position of new objects without committing, so it can be used within save(). May or may not actually work--my money's on no.

Added Folder.isEmpty()

No Folder.setPosition() yet, but, then, no editing or saving of folders at all--coming soon
2006-05-16 21:51:09 +00:00
Dan Stillman
fdfd1e5116 Changed Scholar.Objects.getTreeRows() to return children of a specified folder instead of all objects -- defaults to root folder 2006-05-16 07:58:02 +00:00
Dan Stillman
3f398783d1 Fixed object level calculation (containing folder's level+1, not folder's level itself); updated schema to match 2006-05-16 07:21:31 +00:00
Dan Stillman
8b516fa6d2 Added isFolder() and getParent() for both Scholar.Folder and Scholar.Object instances 2006-05-15 19:30:18 +00:00
Dan Stillman
e14470db5a Added level column in folders table to track hierarchical level needed by treeView
Added getLevel() functions to Scholar.Object and Scholar.Folder -- save() and setPosition() not yet updated

Updated sample data to include levels

Added orderIndex (from treeOrder table, now) back into Scholar.Object data
2006-03-23 20:03:21 +00:00
Dan Stillman
d21638c465 Added in basic folder support to data access framework (no editing folders, no level information)
New Scholar.Objects method for treeView: getTreeRows() -- returns mixed array of all Folder and Object objects in the proper order, type testable with instanceof (e.g. if (obj instanceof Scholar.Folder))

Scholar.Objects.get() and getAll() return arrays hashed by objectID again, since they're no longer used directly by treeView

Scholar.Objects.get() now returns the object directly if only one argument and scalar (i.e. one id)

Updated schema and sample data to handle folder ordering
2006-03-23 08:51:05 +00:00
Dan Stillman
f9b4aab08d Missing argument in setField() prevented changing primary fields 2006-03-22 18:16:29 +00:00
Dan Stillman
c8f10f4b6d Missed some 2006-03-21 15:19:11 +00:00
Dan Stillman
9abad678fe Changed core, DB, and data access methods to create everything under a global Scholar object that can be shared across windows
Added include.js for use in non-browser.xul windows to bring in the SCHOLAR_CONFIG and Scholar objects

Adjusted sidebar to use shared object

Added test line (displayable by clicking "Hello, World" before and after sidebar load to demonstrate cross-window access
2006-03-20 21:47:22 +00:00
Dan Stillman
dc4f276297 Scholar_Object._loadObjectData() and _loadCreators() weren't setting the _objectDataLoaded and _creatorsLoaded flags if there were no rows, causing incessant trips to the DB 2006-03-18 23:46:50 +00:00
Dan Stillman
3711023d9a Added firstCreator to primary field list
Fixed object retrieval queries to use orderIndex is 0 rather than 1, since that's the default now

Scholar_Objects.getAll() now uses loaded.push() rather than loaded[objectID], since _for (objectID in objects)_ isn't an option with treeview

Scholar_Object.getField() now returns an empty string rather than false for empty values
2006-03-17 05:11:03 +00:00
Dan Stillman
d211159d74 Initial version of data access methods -- documentation will be provided on Basecamp
Surely buggy and incomplete, but a good start
2006-03-14 11:48:36 +00:00