Commit graph

10469 commits

Author SHA1 Message Date
Dan Stillman
6918757b8b Accept singular or plural ('item'/'items' or 'folder'/'folders') for type parameter in getTreeRows() 2006-05-23 21:39:23 +00:00
Dan Stillman
e5b25a966b Items.getTreeRows() now takes an optional second param, type, which can (for the moment) be 'folders' or 'items' to limit the results
New methods: Folder.hasChildFolders() and Folder.hasChildItems()
2006-05-23 20:53:09 +00:00
David Norton
edb653cad4 completed move to overlay.xul. Main interface will now be in scholar.xul. Next move: move functionality from sidebar.xul, editpane.xul to scholar.xul 2006-05-23 19:12:53 +00:00
David Norton
139fc8ca99 step 2 of moving scholar.xul to overlay.xul 2006-05-23 19:10:03 +00:00
David Norton
bfcd391da6 2006-05-23 19:06:11 +00:00
David Norton
22d6e93478 Edit pane is now at the top of the window.
Hash map is created to keep track of rows by item ID.
2006-05-23 15:04:25 +00:00
Dan Stillman
74e2d5a842 New methods:
Scholar.Folder.erase() -- deletes a folder and all descendent folders and items

Scholar.Folder._getDescendents() - returns an array of descendent folders and items (rows of 'id' and 'isFolder') ("private" for now--could be useful as public later)

Scholar.Folders.unload() - clear folder from internal cache (used by Scholar.Folder.erase())
2006-05-23 14:54:10 +00:00
Dan Stillman
b56dcf5fbe Added more helpful error messages in DB class
DB transactions are now automatically nested if beginTransaction() is called when one is already in progress -- the queries aren't committed until the outermost commitTransaction() is called, which is handy for calling methods with their own transactions inside others when the entire process should be a transaction (e.g. Folder.erase() calling Item.erase() for the folder's descendents). Rollbacks are a little trickier -- currently, a rollback in a nested transaction flags the entire transaction for rollback when the outermost commit is reached, which for our purposes will probably be fine.
2006-05-23 14:50:58 +00:00
Dan Stillman
05d1fba368 Fixed SQL error in creator update query in Item.save() 2006-05-23 13:08:19 +00:00
David Norton
6c62115669 Creator editing and deleting should be fully working from the interface side (exceptions thrown on data access side, usually with deletes) 2006-05-23 12:53:06 +00:00
David Norton
3ad618f6df New editing pane. Lots of smaller bugs.
ScholarLocalizedStrings moved out of sidebar.js and into Scholar.LocalizedStrings

Rudimentary creator adding/editing. lots of things to work on, because it doesn't work.
2006-05-22 18:51:22 +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
David Norton
a75fb2ddb6 Added items show without refreshing.
The title column is by default the only one visible.
2006-05-19 18:21:27 +00:00
David Norton
72a2dd9216 Folders deletion logic added (needs Folder.erase() which should recursively delete children as well) 2006-05-19 15:26:54 +00:00
David Norton
0fa7c008aa fixed delete functionality -- for now (still need to work out folders) 2006-05-19 14:59:36 +00:00
David Norton
782d049dcd The properties file is now better realigned.
The selection no longer lost or moved on folder opening/closing.
The erase functionality works, on Mac (Windows) use the delete (backspace) or forward delete (delete) keys.
	unfortunately there are sometimes exceptions so I am not calling erase() on each item until we figure out what the problem is.
view._deleteItem() and view._insertItem() are now view._hideItem() and view._showItem() to better reflect functionality.
2006-05-19 13:53:37 +00:00
Dan Stillman
be6c2f2862 Once will be enough 2006-05-19 12:21:13 +00:00
Dan Stillman
c8b3863b9c Delete old tables 2006-05-19 11:37:33 +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
David Norton
d398339997 New... button menu loads from DB, localizes.
I think the functionality for adding a new item works on the interface end, Dan do you want to take a look?
2006-05-18 21:15:02 +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
David Norton
7aecfd5190 Added basic preferences support.
Removed all trace of 'object' from sidebar.js.

More code renaming.
2006-05-18 18:39:55 +00:00
Dan Stillman
72ea24e2bb Change the default to console logging rather than DebugLogger 2006-05-18 18:24:02 +00:00
David Norton
dac4c6c9d0 Editing now works. Additionally, I cleaned up some function and variable names in sidebar.js 2006-05-18 17:13:06 +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
David Norton
2ed6651b52 (forgot to delete editDialog) 2006-05-17 18:49:27 +00:00
David Norton
6ee2459997 Edit tools are now in sidebar. alpha release. 2006-05-17 18:47:47 +00:00
David Norton
44d4c5dee8 2006-05-17 14:54:29 +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
David Norton
4b1545d38a You can view object metadata again. 2006-05-16 20:36:20 +00:00
David Norton
85458659d0 sidebar tree uses Dan's forthcoming isEmpty() function 2006-05-16 19:38:42 +00:00
David Norton
c51f612098 Hierarchical display works!! Need a way to check to see if a container is empty. 2006-05-16 19:33:44 +00:00
David Norton
5fb98853bc Hierarchical folders work, but do not display correctly. getLevel() function no being called? 2006-05-16 16:34:28 +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
6b5ba60acf More helpful comment in Scholar.DB._migrateSchema() 2006-05-16 07:24:37 +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
396cce8a0d Add comment to Scholar.debug() to explain console logging 2006-05-15 21:52:18 +00:00
David Norton
8f84eaad7a 2006-05-15 21:45:07 +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
cf7cf17d7e Add config flag to log to console rather than Debug Logger extension, which for some reason is excruciatingly slow with multiple lines
With flag on, start up FF from command-line (e.g. /Applications/Firefox.app/Contents/MacOS/firefox) to use console
2006-03-22 18:53:26 +00:00
Dan Stillman
f9b4aab08d Missing argument in setField() prevented changing primary fields 2006-03-22 18:16:29 +00:00
Dan Stillman
93c2b8c2ee DROP TABLE IF EXISTS now available in mozStorage 2006-03-22 16:42:22 +00:00
Dan Stillman
6cad409813 Update to work with Gecko 1.8 branch (2.0a1) and trunk (1.6a1) with native mozStorage support
Disabled on 1.5, as hacks.atrus.org binaries will no longer work (the mozStorage API changed a bit)
2006-03-22 05:47:10 +00:00
Dan Stillman
c8f10f4b6d Missed some 2006-03-21 15:19:11 +00:00
David Norton
7448c8ce5d Object pane now shows creators= 2006-03-21 14:58:40 +00:00
David Norton
b50afbef24 Fixed the object pane. 2006-03-21 14:27:19 +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
David Norton
749ef47bbd I got the basic object pane working, so that it displays all the metadata.
I also started implementing some of the localization. There is a lot to do still, and I am still learning a lot of the Firefox extension technologies (XUL, adv. Javascript, etc.) but things are going great.
2006-03-18 22:51:05 +00:00
David Norton
47d7525e80 There are now just two columns in the sidebar: creator and title. 2006-03-18 05:48:41 +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
David Norton
4a493e5953 2006-03-17 03:45:42 +00:00
David Norton
4d4b7cf47e 2006-03-17 03:45:30 +00:00
Dan Stillman
3dd8351478 Including the file would probably help 2006-03-14 11:52:59 +00:00
Dan Stillman
396631cb30 Removed some screwy characters in XML-stylesheet declarations 2006-03-14 11:49:31 +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
Dan Stillman
b88b767b0b Renamed DB to scholar.sqlite, since that seems to be the current fashion
Added some new core functions:

- Scholar.varDump(), after PHP's var_dump()

- Scholar.flattenArguments(), to flatten mixed array/literal argument lists into a single array

- Scholar.join() -- a version of join() that operates externally, for use on, for example, the arguments object (safer than extending Object)

- Scholar.Hash, a slightly smarter associative array -- not perfect, but brings a proper length property and a few convenience methods (and allows for other additions) -- should probably be limited to places where the length property or other additional additions are needed, since its use is a little non-standard (e.g. you have to remember to do _for (i in arr.items)_ rather than just _for (i in arr)_, to use set(), etc.)
2006-03-14 11:45:19 +00:00
Dan Stillman
50eddb05ee Lots of DB-related updates:
Moved schema file out of chrome and removed XML tags, since it will no longer be accessed by XMLHTTP

Changed schema updater to use XPCOM components rather than XMLHTTP

Converted DB class to a singleton named Scholar_DB

Scholar_DB.query() now returns associative array similar to mysql_fetch_assoc() for SELECT statements rather than a mozIStorageStatementWrapper -- the mozStorage executeDataSet() function doesn't work yet, so we do it this way

Added DB functions:

   - beginTransaction(), commitTransaction(), rollbackTransaction()
   - columnQuery() -- one column, multiple rows, returned as array indexed by row
   - getColumns() and getColumnHash

DB query functions can now handle bind parameters passed as an array of object literals: e.g. [{'int':2},{'string':'foobar'}]

valueQuery() now returns an int for COUNT(*) queries, so the result can be tested without a "0" being true

Changed _initializeSchema to drop existing tables before creating new ones, hacked with try/catch until DROP TABLE IF EXISTS works with the mozStorage extension (it's already in the latest SQLite release)

Added DB_REBUILD config flag to manually trigger schema regeneration

Added debug logging at level 5 for all SQL queries

Updated sample data
2006-03-14 11:34:17 +00:00
Dan Stillman
2a866fe3cd Added some sample data to the schema file and other assorted additions and tweaks 2006-03-14 10:57:01 +00:00
David Norton
89949042c3 Forgot to add the sidebar.js file before. :-) 2006-02-24 17:51:16 +00:00
David Norton
b0e5715c17 updated sidebar with treeView interface. 2006-02-24 17:50:24 +00:00
David Norton
686389ced5 Basic sidebar added. 2006-02-24 14:41:15 +00:00
David Norton
000378b5af 2006-02-24 14:28:04 +00:00
Dan Stillman
9f38337ec7 Initial import of repository structure, basic extension layout, and functions for DB abstraction and schema maintenance 2006-02-21 17:01:06 +00:00