Commit graph

4239 commits

Author SHA1 Message Date
Dan Stillman
7fa931425a Rename Zotero.Item.prototype.getCreatorsAPIData() to getCreatorsJSON
And add Zotero.Item.prototype.setCreators()
2014-10-10 04:46:09 -04:00
Dan Stillman
3c81067961 Use DB libraryID for check in Zotero.Libraries.getType()
Before, 'user' wouldn't be returned if the real libraryID was given for
the personal library.
2014-10-10 04:44:16 -04:00
Dan Stillman
7541106641 Update Bluebird to 2.3.5
Our modifications no longer include a custom yield handler to
automatically call all() on yielded arrays (which maintained Bluebird
1.x behavior). It's now necessary to call all() or similar explicitly.

Also fixed a few incorrect yields hidden by that behavior.
2014-10-09 14:21:10 -04:00
Dan Stillman
27804bb47c Fix database backup on userdata upgrade
Also uncomment standard backup age tests
2014-09-30 23:15:34 -04:00
Dan Stillman
e2d3cc3f0d Update zotero://select to use new URLs and wait for items list load
Closes #541
2014-09-23 01:13:38 -04:00
Dan Stillman
c917d9e30e Use only keys for collections and saved searches in search conditions
Previously, 'collection' and 'savedSearch' conditions used
"[libraryID]_[key]" format. Now, the condition should contain only a
key, and the libraryID will be drawn from either the search itself or a
libraryID search condition. Old-style conditions are still parsed if
provided.
2014-09-09 02:50:56 -04:00
Dan Stillman
985a5db0da Throw error if NULL libraryID is passed to DataObjects.getByLibraryAndKey() 2014-09-09 02:31:17 -04: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
ff5007fdea Fix error fetching empty file via File.getContentsAsync() 2014-09-09 00:35:35 -04:00
Dan Stillman
490d24f43b Merge branch 'master' into async_db 2014-09-09 00:34:18 -04:00
Dan Stillman
3d7a35addc Merge branch '4.0'
Conflicts:
	chrome/content/zotero/xpcom/zotero.js
	install.rdf
	update.rdf
2014-09-08 20:24:44 -04:00
Simon Kornblith
431185cc3a Merge pull request #531 from aurimasv/high-contrast
Use Mozilla's colors for itembox and tagbox background
2014-09-01 23:30:35 -04:00
Simon Kornblith
57da88ac3d Fix == use 2014-09-01 23:19:12 -04:00
Simon Kornblith
9146fb03d9 Merge pull request #536 from adam3smith/coinsfix
test for presence of author's firstName before using it
2014-09-01 23:18:39 -04:00
adam3smith
17c0f44e66 fix indenting 2014-09-01 19:25:10 -05:00
Simon Kornblith
9c3ec6f0be Fix DataCite under Fx 32 2014-09-01 20:00:31 -04:00
Simon Kornblith
79ed7e503e Fix MODS under Fx 32 2014-09-01 19:29:45 -04:00
Simon Kornblith
a09ff9c9ec Don't unwrap objects passed to chrome
Unwrapping objects also waives the Xray wrappers for contained objects,
which we need.
2014-09-01 18:42:24 -04:00
adam3smith
f973897d76 test for presence of author's firstName before using it 2014-09-01 14:31:51 -05:00
Simon Kornblith
5857368131 Update citeproc-js to 1.0.539 2014-09-01 15:04:52 -04:00
Dan Stillman
14a5643f38 Update submodules, repotime, versions 2014-09-01 14:56:01 -04:00
Simon Kornblith
ee35f7df41 Small fix to copyObject 2014-09-01 12:26:36 -04:00
Aurimas Vinckevicius
dc5ccffe43 Use Mozilla's colors for itembox and tagbox background
This way, the colors play nicely with Windows themes (e.g. high contrast)
Re https://forums.zotero.org/discussion/38870/make-zotero-fully-recognize-windowsff-high-contrast-themes/ and https://twitter.com/stuffilike2know/status/504167872567189504
2014-08-26 03:11:24 -05:00
Dan Stillman
9db4927f78 Scroll to new collections, and stay on same row when deleting collections 2014-08-12 22:19:59 -04:00
Dan Stillman
6dbcdb95f4 Fix variable name 2014-08-12 22:16:53 -04:00
Dan Stillman
38531ab172 Fix "Copy as HTML" checkbox disabling in Quick Copy site editor window 2014-08-12 21:49:38 -04:00
Dan Stillman
c729dc8a54 Fixes #522, [Async DB] Quick Copy is broken
Export depends on #520 (but still with a synchronous interface, somehow)
2014-08-12 21:49:30 -04:00
Dan Stillman
a67521e9dd Closes #500, Remove DOM_VK_ENTER 2014-08-12 19:18:29 -04:00
Dan Stillman
df67de125e Remove (non-async-compatible) REGEXP UDF in Zotero.DB.getNextName()
And remove UDF setup code

Duplicates view also used REGEXP, so we'll need to figure out another approach
for the async rewrite of that (#519). There are no other current UDF consumers,
so this closes #528.
2014-08-12 03:13:00 -04:00
Dan Stillman
2856b71f0b Remove some remaining synchronous queries in data objects
Fixes collection and search saving
2014-08-12 03:11:49 -04:00
Dan Stillman
78a8e6b622 Fix breakage from 278e06e58 - Zotero.DataObject signature changed 2014-08-12 02:09:45 -04:00
Aurimas Vinckevicius
278e06e588 Document Zotero.DataObject. Minor tweaks. 2014-08-12 00:26:27 -05:00
Aurimas Vinckevicius
dcd65d087c Add object key/ID validation. Centralize key generation/checking. 2014-08-12 00:26:26 -05:00
Aurimas Vinckevicius
e1f59482c4 Add Zotero.Utilities.defineProperty convenience method
Use this to create enumerable properties in object prototypes.
2014-08-12 00:24:02 -05:00
Aurimas Vinckevicius
c5a532c789 Add option to print stack with debug messages 2014-08-12 00:24:01 -05:00
Dan Stillman
15d10d18a7 Use async DB queries for schema integrity check
Addresses #521
2014-08-11 02:23:00 -04:00
Dan Stillman
ae8f871f20 Fix flash of "No items in this view" when switching collections 2014-08-11 00:40:43 -04:00
Dan Stillman
40f111832c Fix error double-clicking on unopened regular items 2014-08-11 00:40:35 -04:00
Dan Stillman
f358975153 Closes #526, Asyncify database backup
When a database backup is in progress, all other DB operations are paused until
it's done.
2014-08-10 20:21:40 -04:00
Dan Stillman
f1ed5f1f03 Remove obsolete file (Zotero.Tag no longer exists) 2014-08-10 15:00:08 -04:00
Dan Stillman
9441627e74 Allow StopIteration in queryAsync() to cancel query
And catch other errors and throw StopIteration so that they stop the
search. (Non-StopIteration errors in onRow don't stop Sqlite.jsm
queries. We were logging them but then re-throwing them, which didn't do
anything.)
2014-08-10 14:15:46 -04:00
Dan Stillman
31502de08f Zotero.DB updates
- Fix ES5 generator in executeFile()
- Remove deferred in executeAsyncStatement()
- Remove obsolete properties and wait level check
2014-08-10 02:10:03 -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
86bc20c4e9 Remove unnecessary conditionals in Zotero.DataObject constructor 2014-08-08 17:44:19 -04:00
Dan Stillman
380668cc60 Changes to item and file retrieval methods
- Zotero.Item.prototype.getFilePath() is now synchronous, with a separate async getFilePathAsync()

- getFile() no longer takes a skipExistsCheck parameter, since that shouldn't happen synchronously

- Zotero.Items.getByLibraryAndKey() is now synchronous again, with a
  separate Zotero.Items.getByLibraryAndKeyAsync() - I haven't fully
  tested this, so I'm not sure if there will need to be any async
  calls.

- Some of the full-text indexing functions now take file paths instead of nsIFile objects

- Zotero.File.getContentsAsync() can now take a string path as well
2014-08-08 17:43:26 -04:00
Dan Stillman
e33dc815a0 Log the error for file launch() failure, in case it's relevant 2014-08-07 18:29:32 -04:00
Dan Stillman
cb6fae694c Fix attachment file mtime in right pane 2014-08-07 16:03:17 -04:00
Dan Stillman
ab36dda6e7 Restore loading of renamed styles
Didn't end up on this branch somehow
2014-08-07 15:01:59 -04:00
Dan Stillman
1ca2100cf0 Add timing to tag selector 2014-08-07 15:01: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
368e568fe1 Don't load saved search list for every collection row 2014-08-06 22:14:59 -04:00
Dan Stillman
7c958f4bd3 Show "Loading items list..." in middle pane on window load
Otherwise with async loading the pane appears blank before the message appears
2014-08-06 22:14:58 -04:00
Dan Stillman
b20a2e153b Fix Services.wm call 2014-08-06 22:14:58 -04:00
Dan Stillman
84882c8ecf Include actual error in "There was an error starting Zotero." dialog
And use a proper title
2014-08-06 22:14:58 -04:00
Dan Stillman
fe83d4db72 Document options.headers property for Zotero.HTTP.promise() 2014-08-06 22:14:58 -04:00
Dan Stillman
16e4aa0516 Remove Zotero.join() 2014-08-06 22:14:58 -04:00
Dan Stillman
3a7042e527 Zotero.Utilities.forEachChunk(arr, chunkSize, func)
Run a function on chunks of a given size of an array's elements and
return an array with the return values from the successive runs.
2014-08-06 22:14:58 -04:00
Dan Stillman
feb47caa6b Merge branch '4.0'
Conflicts:
	chrome/content/zotero/xpcom/translation/translate.js
2014-08-06 22:13:05 -04:00
Simon Kornblith
9219100901 Another Fx 32 translation fix 2014-07-23 18:05:56 -04:00
Aurimas Vinckevicius
638d29972c Don't ignore initial punctuation when sorting
Also, change sorting sensitivity to "base"
Closes #514
2014-07-23 00:18:48 -05:00
Dan Stillman
15108eea3f Fix intermittent source file deletion when dragging files in on Windows
(at least, if this is caused by what I think it was caused by)

https://forums.zotero.org/discussion/38486/
2014-07-20 15:56:55 -04:00
Dan Stillman
3b5bd45433 Further Windows drag-and-drop comment rewriting 2014-07-20 13:16:56 -04:00
Dan Stillman
717a440156 Clarify comment for Windows drag-and-drop mess 2014-07-20 02:50:00 -04:00
Dan Stillman
b8f69d6281 Fix Quick Copy drag to Chrome textareas on Windows
Possibly to other places as well (but not Notepad, which doesn't work
from Firefox or Chrome either)

Unfortunately this requires going back to 'copy' cursor feedback when
dragging, even when Shift is used. We can only choose one on Windows (as
far as I can tell), and we were previously using the unadorned 'move'.
2014-07-20 02:16:25 -04:00
Dan Stillman
7d74344b7d Restore highlighting of collection row during drag on Windows 2014-07-20 02:16:20 -04:00
Dan Stillman
36c5dceff4 Merge branch '4.0'
Conflicts:
	chrome/content/zotero/browser.js
	chrome/content/zotero/longTagFixer.js
	chrome/content/zotero/xpcom/schema.js
	chrome/content/zotero/xpcom/utilities.js
	chrome/content/zotero/xpcom/zotero.js
	install.rdf
	update.rdf
2014-07-15 22:17:27 -04:00
Dan Stillman
813f55d024 Natural sorting of numbers ("1" < "2" < "10")
This needs testing to see if it has any other unwanted effects.

Closes Trac ticket 1031
2014-07-08 09:47:03 -04:00
Simon Kornblith
87a0df43d8 Fix some more Fx 32 issues
Ref https://forums.zotero.org/discussion/37885/
2014-07-06 14:07:00 -04:00
Simon Kornblith
d9720f18a9 Update to citeproc-js 1.0.536 2014-07-06 08:50:13 -04:00
Dan Stillman
532ebc5239 Fix for startup error w/weird locale language tags ("de-CH@currency=EUR")
https://forums.zotero.org/discussion/37901

And just return a noop sorter on failure instead of breaking
2014-06-27 09:36:11 -04:00
Dan Stillman
4a677240d3 Don't use Intl until Fx30, since it's missing in Iceweasel 29
And nsICollation isn't broken on OS X until 30
2014-06-27 01:12:25 -04:00
Dan Stillman
d66a6f6680 Ignore punctuation when sorting
This sorts "St. A" before "St B". I don't know if we want this.
2014-06-25 12:24:31 -04:00
Dan Stillman
979e62714c Fix startup errors in some non-English locales in Fx30 on OS X
nsICollation broke for some locales. (Testing requires changing the
language setting in Language & Region and then restarting the computer.
The change seems to not fully go into effect until then, even though the
UI changes.) This is fixed in Nightly, but we can work around it by
using the new Intl.Collator.
2014-06-25 12:22:04 -04:00
Dan Stillman
be49010783 Use 11 instead of 6 on invalid note font size
Also don't validate font size until after pref field is blurred, to allow
numbers to be typed in properly
2014-06-23 23:36:36 -04:00
Simon Kornblith
bcc7a4ae86 Missing word in comment from 8cb081a4e1 2014-06-23 22:56:08 -04:00
Simon Kornblith
8cb081a4e1 Disable argument unwrapping on Fx < 32
This apparently breaks on Fx 24
2014-06-23 22:55:02 -04:00
Simon Kornblith
dd5160cc73 Partially revert 76e8ea835f
Apparently this doesn't work on Firefox 24. Sigh.
2014-06-23 22:29:32 -04:00
Dan Stillman
f45b219792 Fix inline collection editing when clicking to another collection
https://forums.zotero.org/discussion/37739
2014-06-21 13:37:55 -04:00
Simon Kornblith
41e50ef669 Fix check from fc91deb69e 2014-06-21 13:27:49 -04:00
Simon Kornblith
fc91deb69e Fix more Firefox 32 issues 2014-06-21 13:25:33 -04:00
Simon Kornblith
76e8ea835f Slightly cleaner fix for #504 2014-06-21 13:16:39 -04:00
Simon Kornblith
a71f3bbdd8 Fix #504
Determine whether to copy objects by their constructor names, since the
prototypes do not necessarily match
2014-06-21 12:51:41 -04:00
Dan Stillman
4812ab6f93 Fixes (cosmetic) "Q.async(...)(...) is undefined" sync error
Yield immediately so that a generator is always passed to Q.async()
2014-06-20 03:47:04 -04:00
Dan Stillman
09e53d85d5 Revert "Revert "Use Q instead of Task.spawn to run processUpdatedXML()""
This reverts commit 4334260865.
2014-06-20 03:47:01 -04:00
Dan Stillman
4334260865 Revert "Use Q instead of Task.spawn to run processUpdatedXML()"
Fixes "Q.async(...)(...) is undefined" sync error

This reverts commit ad8b81f4c7 (which
tried to fix Fx32+ compatibility).
2014-06-20 03:17:03 -04:00
Simon Kornblith
3a8c77e983 Fix search translation bug from 7950d3a7e2 2014-06-19 21:31:17 -04:00
Simon Kornblith
37f4e61ef2 Remove debug line 2014-06-19 20:11:46 -04:00
Simon Kornblith
7950d3a7e2 Attempt to fix #502, translation broken on Firefox 32 2014-06-19 20:07:31 -04:00
Simon Kornblith
f6dfeee210 Remove more uses of charsetDTD 2014-06-19 19:03:58 -04:00
Simon Kornblith
014c7b5b46 Fix tab mode in Aurora
Ref https://forums.zotero.org/discussion/37608/
2014-06-19 19:02:52 -04:00
Dan Stillman
75bdf08131 Fix event handling (e.g., Undo) in notes in Fx32
Addresses #503
2014-06-19 17:54:21 -04:00
Dan Stillman
c32144ddfd Fixes #503, Notes broken on Firefox 32
Unwrap the editor object if it's wrapped
2014-06-19 17:47:56 -04:00
Simon Kornblith
954f8bd001 Fix #496, Remove uses of nsICharsetConverterManager
We should confirm that the manually added charsets still work on
Firefox 32 once we #502
2014-06-19 17:31:27 -04:00
Simon Kornblith
e576416831 Remove old isFxN constants 2014-06-19 16:36:37 -04:00
Dan Stillman
b441e2cf9e Update submodules and repotime 2014-06-18 21:12:25 -04:00
Dan Stillman
ad8b81f4c7 Use Q instead of Task.spawn to run processUpdatedXML()
With Task.spawn, regular expressions in Zotero.DB were causing "too much
recursion" errors on Windows with JIT enabled.

This requires a change to Q to allow async() to take a generator instead
of a generator-maker (which is the reason it was using Task.spawn to
begin with).
2014-06-18 05:03:06 -04:00
Dan Stillman
fad6174e39 Fix download retrying
Follow-up from 238a972a
2014-06-10 03:50:41 -04:00
Dan Stillman
238a972ace Retry failed ZFS uploads and downloads automatically
S3 upload timeouts were retried already with an exponential backoff, but
this adds retrying for other kinds of upload failures as well as failed
downloads.  If 5 consecutive failures occur a file sync error is
thrown.

Failed file sync requests to the Zotero API are not currently retried,
but S3 accounts for the majority.

The download portion of this still needs further testing.
2014-06-09 06:47:07 -04:00
Dan Stillman
1b6dc5d681 Restore minimize/maximize buttons in note windows on Windows
From db6ec2b160
2014-06-05 00:54:22 -04:00