Commit graph

101 commits

Author SHA1 Message Date
Dan Stillman
ff7919553c Collections data layer cleanup
Get rid of data_access.js, at long last. Existing calls to
Zotero.getCollections() will need to be replaced with
Zotero.Collections.getByLibrary() or .getByParent().

Also removes Zotero.Collection::getCollections(), which is redundant
with Zotero.Collections.getByLibrary(), and Zotero.Collections.add().
The latter didn't didn't include a libraryID anyway, so code might as
well just use 'new Zotero.Collection' instead.
2015-05-24 04:37:34 -04:00
Dan Stillman
ef57b4e016 Relations fixes and cleanup
Relations need a complete overhaul, but this makes them generally work
again.
2015-05-24 03:08:22 -04:00
Dan Stillman
51c7ae6e5c Add -b option to skip translator/style installation in tests
'b' for *b*undled files

Translators and styles take a long time to install and initialize in
source installations, and they're unnecessary for many tests.

This shaves about 10 seconds off each test run for me on one system (and
that's with some help from filesystem caching).
2015-04-16 20:50:15 -04:00
Dan Stillman
fec43f1f62 Merge branch '4.0' into api_syncing 2015-04-13 02:01:43 -04:00
Aurimas Vinckevicius
164f4e4321 More informative error messages for failed file loads 2015-04-10 19:46:57 -05:00
Aurimas Vinckevicius
f6510419cb Skip test for "recognizePDF without DOI" on Travis-CI
Breaks due to CAPTCHA when tests are run frequently
2015-04-06 23:17:41 -05:00
Dan Stillman
827eb9b32e Change command-line debug flag to -ZoteroDebug for consistency
From -zoterodebug
2015-03-24 03:38:11 -04:00
Dan Stillman
bdd69d0a53 Merge branch '4.0' into api_syncing 2015-03-16 23:41:10 -04:00
Simon Kornblith
c7c58f8343 Add support function to reset the DB and a test that it works. 2015-03-09 14:25:49 -04:00
Aurimas Vinckevicius
68e7849fcf Add Zotero.Utilities.Internal.hyphenateISBN
Hyphenates ISBN-10 or ISBN-13 according to data from https://www.isbn-international.org
2015-02-24 22:42:29 -06:00
Dan Stillman
b478d8f204 Fix some errors if pane is opened during initialization 2015-02-24 22:07:30 -05:00
Dan Stillman
755ead2119 Update zotero:// extensions (report, timeline, etc.) for async DB, and more
- Protocol handler extensions can now handle promises and can also make
  data available as it's ready instead of all at once (e.g., reports now
  output one entry at a time)
- zotero:// URL syntaxes are now more consistent and closer to the web
  API (old URLs should work, but some may currently be broken)

Also:

- Code to generate server API, currently available for testing via
  zotero://data URLs but eventually moving to HTTP -- zotero://data URLs match
  web API URLs, with a different prefix for the personal library (/library vs.
  /users/12345)
- Miscellaneous fixes to data objects

Under the hood:

- Extensions now return an AsyncChannel, which is an nsIChannel implementation
  that takes a promise-yielding generator that returns a string,
  nsIAsyncInputStream, or file that will be used for the channel's data
- New function Zotero.Utilities.Internal.getAsyncInputStream() takes a
  generator that yields either promises or strings and returns an async input
  stream filled with the yielded strings
- Zotero.Router parsers URLs and extract parameters
- Zotero.Item.toResponseJSON()
2014-09-09 00:36:29 -04:00
Dan Stillman
c5ee3651fe Don't try to load uncommitted files 2014-09-09 00:35:35 -04:00
Dan Stillman
f5896dbb8d Remove synchronous database methods
This required doing additional caching at startup (e.g., item types and fields)
so that various methods can remain synchronous.

This lets us switch back to using the current Sqlite.jsm. Previously we were
bundling the Fx24 version, which avoided freezes with locking_mode=EXCLUSIVE
with both sync and async queries.

Known broken things:

  - Autocomplete
  - Database backup
  - UDFs (e.g., REGEXP function used in Zotero.DB.getNextName())
2014-08-09 18:10:32 -04:00
Dan Stillman
db0fa3c33e Async DB megacommit
Promise-based rewrite of most of the codebase, with asynchronous database and file access -- see https://github.com/zotero/zotero/issues/518 for details.

WARNING: This includes backwards-incompatible schema changes.

An incomplete list of other changes:

- Schema overhaul
  - Replace main tables with new versions with updated schema
  - Enable real foreign key support and remove previous triggers
  - Don't use NULLs for local libraryID, which broke the UNIQUE index
    preventing object key duplication. All code (Zotero and third-party)
    using NULL for the local library will need to be updated to use 0
    instead (already done for Zotero code)
  - Add 'compatibility' DB version that can be incremented manually to break DB
    compatibility with previous versions. 'userdata' upgrades will no longer
    automatically break compatibility.
  - Demote creators and tags from first-class objects to item properties
- New API syncing properties
  - 'synced'/'version' properties to data objects
  - 'etag' to groups
  - 'version' to libraries
- Create Zotero.DataObject that other objects inherit from
- Consolidate data object loading into Zotero.DataObjects
- Change object reloading so that only the loaded and changed parts of objects are reloaded, instead of reloading all data from the database (with some exceptions, including item primary data)
- Items and collections now have .parentItem and .parentKey properties, replacing item.getSource() and item.getSourceKey()
- New function Zotero.serial(fn), to wrap an async function such that all calls are run serially
- New function Zotero.Utilities.Internal.forEachChunkAsync(arr, chunkSize, func)
- Add tag selector loading message
- Various API and name changes, since everything was breaking anyway

Known broken things:

- Syncing (will be completely rewritten for API syncing)
- Translation architecture (needs promise-based rewrite)
- Duplicates view
- DB integrity check (from schema changes)
- Dragging (may be difficult to fix)

Lots of other big and little things are certainly broken, particularly with the UI, which can be affected by async code in all sorts of subtle ways.
2014-08-06 22:59:37 -04:00
Dan Stillman
4ea5e2d426 Update code to use 0 instead of NULL for libraryID 2014-08-06 22:14:59 -04:00
Dan Stillman
156f4eb160 Allow items to be moved (not copied) between collections w/modifier key
Cmd on OS X, Shift on Windows/Linux

How do I not get to close a ticket for this?

Unfortunately on Windows it doesn't seem possible to set the cursor
effect to arbitrary states (see note in libraryTreeView.js::
_setDropEffect() for the gory details), so this just uses the default
cursor there. On OS X and Linux the cursor reflects the requested
action.
2014-05-03 11:52:38 -04:00
Dan Stillman
60e5ab8124 Merge branch '4.0'
Conflicts:
	chrome/content/zotero/xpcom/db.js
	chrome/content/zotero/xpcom/fulltext.js
	chrome/content/zotero/xpcom/zotero.js
	chrome/content/zotero/zoteroPane.js
	components/zotero-service.js
	install.rdf
	update.rdf
2014-04-08 18:47:32 -04:00
Simon Kornblith
1ee015317f Don't restart in connector mode on Zotero.init() failure
I broke this in a723c85999
2013-12-11 14:50:48 -05:00
Dan Stillman
6ff0ea6d18 Add -zoterodebug command-line flag to force debug output
This should make it much easier to debug startup errors, particularly in
Standalone.

This also adds a general mechanism to set Zotero initialization options via
command-line flags.
2013-11-30 01:55:48 -05:00
Dan Stillman
5d32fb90ea Merge branch '4.0'
Conflicts:
	chrome/content/zotero/fileInterface.js
	chrome/content/zotero/overlay.js
	chrome/content/zotero/xpcom/schema.js
	chrome/content/zotero/xpcom/zotero.js
	chrome/content/zotero/zoteroPane.js
	install.rdf
	update.rdf
2013-11-24 16:08:46 -05:00
Simon Kornblith
0b92ad0037 Modify behavior on Zotero Standalone launch to account for failure
- Close Zotero pane before database is closed prior to reload, instead
  of waiting until reload is complete
- Show an error message if Zotero Standalone is not accessible when it
  should be
2013-11-05 15:52:40 -05:00
Dan Stillman
d318bca7a4 Allow items to be moved (not copied) between collections w/modifier key
Cmd on OS X, Shift on Windows/Linux

How do I not get to close a ticket for this?

Unfortunately on Windows it doesn't seem possible to set the cursor
effect to arbitrary states (see note in libraryTreeView.js::
_setDropEffect() for the gory details), so this just uses the default
cursor there. On OS X and Linux the cursor reflects the requested
action.
2013-09-06 15:30:37 -04:00
Simon Kornblith
526441c3ca Make translator loading asynchronous
Other changes:
- Factored out Zotero.Translators from Zotero.Translator. The latter
  should be usable in the bookmarklet and connectors without changes.
- configOptions, displayOptions, and hiddenPrefs no longer copy on
  read. I don't think this actually affects any existing code.
- Zotero.Translate._loadTranslator() now returns a promise
2013-08-17 03:15:43 -04:00
Dan Stillman
5787b230f7 Use asynchronous DB and file access for schema checks/updates
This change should improve Firefox startup time. If the Zotero pane is
opened before Zotero has initialized, the pane will be blocked with a
progress bar until it's done. Standalone currently does the same, but it
should be changed to just delay opening the window if possible.

The upgrade wizard has been disabled for schema upgrades, in the hope
that upgrades can be done in a way that won't break compatibility with
earlier versions (or that can at least be done in a way such that we can
put out point releases of the last major version that provide
compatibility during beta/post-upgrade periods).

This patch likely breaks many things, and definitely breaks connector
mode.

This change also removes upgrade steps for databases from Zotero 2.1b2
and earlier. Users with such databases will need to upgrade via Zotero
4.0.x first or delete their data directories and start anew. This should
only affect users who haven't opened Zotero since Nov. 2010.
2013-08-11 21:53:41 -04:00
Simon Kornblith
a723c85999 Return a promise from Zotero.shutdown() 2013-08-09 11:11:01 -04:00
Simon Kornblith
2069b5b396 Fix switching in and out of connector mode
Broken by 9d3f55be51
2013-08-09 10:55:56 -04:00
Dan Stillman
10e9c5e0b7 Restore ZFS quota warning
Possible that this hasn't shown since 4.0?
2013-07-08 20:13:47 -04:00
Dan Stillman
d2f028d797 Tag colors, synced settings, and (stopgap) silent DB upgrades
- New tag colors support, with the ability to assign colors to up to 6
  tags per library. Tags with colors assigned will show up at the top of
  the tag selector and can be added to (and removed from) selected items
  by pressing the 1-6 keys on the keyboard. The tags will show up as
  color swatches before an item's title in the items list.
- Synced settings, with Notifier triggers when they change and
  accessible via the API (currently restricted on the server to
  'tagColors', but available for other things upon request)
- Silent DB upgrades for backwards-compatible changes. We'll do
  something fancier with async DB queries in 4.0, but this will work for
  changes that can be made without breaking compatibility with older
  clients, like the creation of new tables. The 'userdata' value is
  capped at 76, while further increments go to 'userdata2'.

TODO:

- Try to avoid jitter when redrawing swatches
- Optimize tag color images for retina displays
- Redo attachment dots in flat style?
- Clear all colors from an item with 0 (as in Thunderbird), but I don't
  think we can do this without undo
2013-03-03 06:23:25 -05:00
Simon Kornblith
dbf2bc265f Merge branch '3.0'
Conflicts:
	chrome/content/zotero/recognizePDF.js
	chrome/content/zotero/xpcom/utilities.js
2013-01-21 02:01:08 -05:00
Simon Kornblith
94619403ca Tweak loading process 2013-01-21 01:58:01 -05:00
Dan Stillman
596c6da3ee Remove Commons code, which contains E4X
Some items pane code is still in place, since it's a decent example of
dynamic items pane loading.
2013-01-15 03:23:37 -05:00
aurimasv
b1cc6e260e Load XRegExp into Zotero.XRegExp and Zotero.Utilities.XRegExp and make it accessible from translators. 2012-12-19 06:36:08 -06:00
Dan Stillman
bb93f019dc File sync overhaul
- New promise-based architecture
- Library-specific file sync queues, allowing other libraries to
  continue if there's an error in one library
- Library-specific sync errors, with error icons next to each library
- Changed file uploading in on-demand download mode, which had been missing
- On-demand download progress indicator in middle pane
- More accurate progress indicator
- Various tweaks and bug fixes
- Various future tweaks and bug fixes
2012-12-11 15:16:40 -05:00
Dan Stillman
61c36b0523 Add ZoteroPaneOpen command line argument to open Zotero automatically 2012-11-10 19:38:22 -05:00
Simon Kornblith
57c3d190b4 Merge branch 'kill-e4x'
Conflicts:
	chrome/content/zotero/xpcom/integration.js
2012-06-25 00:42:32 -04:00
Simon Kornblith
66815c118f Kill E4X in Zotero.Style
Also kill enstyle.js, since it no longer works
2012-06-24 23:32:08 -04:00
Simon Kornblith
ac19b0490a Merge branch 'no-new-collection-on-import' 2012-06-10 22:39:41 -04:00
Simon Kornblith
68365e2297 Allow user to control whether files are imported into a new collection.
Adds three new preferences controlling whether a new collection is created upon import:
- extensions.zotero.import.createNewCollection.fromFile
	Controls whether a new collection is created by import from cog menu
- extensions.zotero.import.createNewCollection.fromClipboard
	Controls whether a new collection is created by import from clipboard
- extensions.zotero.import.createNewCollection.fromFileOpenHandler
	Controls whether a new collection is created when import is initiated by
	double-clicking a file or by dragging it over Zotero. This preference applies only to
	Zotero Standalone, and is configurable in the dialog that appears asking the user
	to confirm the import.

Closes #19, [papercuts] (26) Clipboard import into an open collection
2012-06-10 11:05:39 -04:00
Simon Kornblith
4e5d4281f1 Merge branch '3.0' 2012-05-26 18:24:52 -04:00
Simon Kornblith
5894a9511d Tweak RDF loading code 2012-05-05 16:53:00 -04:00
aurimasv
1942fb6762 Remove compatibility hack from rdf.js. Fix Zotero code instead. Move all setup to init.js 2012-04-29 20:30:37 -05:00
aurimasv
ea767e5647 Set up environment for RDF parser 2012-04-26 17:36:35 -05:00
Dan Stillman
f1aa68f82b Simplify the file sync code a bit
Just call Zotero.Sync.Storage.[ZFS/WebDAV] directly

This probably breaks some things.
2012-03-21 19:39:40 -04:00
Simon Kornblith
09813b145d Merge branch '3.0' 2012-02-14 15:00:07 -05:00
Simon Kornblith
a01fcd360f Remove redundant code 2012-02-12 23:35:39 -05:00
Simon Kornblith
703d18ecb9 Remove antiquated code 2012-02-11 00:39:58 -05:00
Simon Kornblith
ef9040c46d Revert "Remove antiquated code"
This reverts commit d5fc04485b.
2012-02-11 00:38:21 -05:00
Simon Kornblith
d5fc04485b Remove antiquated code 2012-02-11 00:34:05 -05:00
Dan Stillman
6c5e155ba7 Merge branch '3.0' 2012-02-09 02:18:15 -05:00