Commit graph

5898 commits

Author SHA1 Message Date
Dan Stillman
f8684cc9d8 Fix tag purging and Zotero.Tags.getName() 2015-06-09 16:47:04 -04:00
Dan Stillman
ac440b2b38 Don't reload collections list when sources are modified
Just update the row that changed, moving it if necessary.
2015-06-09 16:47:04 -04:00
Dan Stillman
1d45c6c882 Reselect the same row when an item is removed 2015-06-09 03:27:45 -04:00
Dan Stillman
33c19715a8 Avoid error when dragging over header row 2015-06-08 04:29:16 -04:00
Dan Stillman
9a45fa94bd Move transaction wait debug output to level 6, and strip Bluebird lines
This output is basically only useful when something hangs, so it can
stay off all other times.

For now, 6 can be the new only-use-when-something-is-actively-broken
level. At some point we may want to move DB activity to 4 and make this
sort of thing 5, because we don't have much that's 4 right now.
2015-06-08 04:14:47 -04:00
Dan Stillman
2d6143dce1 Clean up notifier debug output 2015-06-08 04:14:46 -04:00
Dan Stillman
f93e6706fa Don't refresh collections view when removing groups
Remove rows one by one
2015-06-08 04:14:46 -04:00
Dan Stillman
b43a735b93 Include libraryID in group.erase() notifier data 2015-06-08 04:05:47 -04:00
Dan Stillman
ec89a98f9d Add group.eraseTx() 2015-06-08 04:05:47 -04:00
Simon Kornblith
70f021f945 Use ISO 8601 accessDates everywhere
This uses ISO 8601 dates for generateAllTypesAndFieldsData (and
changes populateDBWithSampleData to use Item#fromJSON), and makes
translators expect ISO 8601 accessDates, although SQL accessDates are
still supported with a deprecation warning. Canonicalization happens in
Zotero.Translate, so I need to remember to update connectors as well.
2015-06-07 18:50:57 -04:00
Dan Stillman
8448203583 Expect ISO 8601 access dates in Zotero.Item::fromJSON()
This causes translator tests to fail, because the sample data currently
has SQL access dates instead.
2015-06-07 17:54:44 -04:00
Simon Kornblith
3fc38d750b Use Zotero.Item.fromJSON() for saving from translators
Also:
  - Move some canonicalization of items returned by translators to
    Zotero.Translate
  - Make Zotero.Translate#translate return a promise
  - Add tests
2015-06-07 17:30:41 -04:00
Simon Kornblith
ec5e20659b Improve error handling for attachment saving 2015-06-07 17:22:57 -04:00
Simon Kornblith
e27d907973 Throw an error if HTTP request yields non-OK in importFromURL() 2015-06-07 16:06:59 -04:00
Dan Stillman
6935310c75 Fix Zotero.Users.setCurrentUsername() 2015-06-07 15:50:07 -04:00
Dan Stillman
a22c4969e6 Move editable and filesEditable props to libraries table [DB reupgrade]
And add group.fromJSON(json, userID), which sets editable and
filesEditable properties based on the group JSON (libraryReading, role
lists, etc.) and the given user
2015-06-07 15:50:07 -04:00
Dan Stillman
53706d633a Make Zotero.HTTP exceptions instances of Error 2015-06-07 15:43:09 -04:00
Dan Stillman
16706ba481 Allow Zotero.HTTP.request() to be mocked
sinon.useFakeXMLHttpRequest() doesn't work in our case, but if
Zotero.HTTP.mock is set, Zotero.HTTP.request() will create new instances of
that object instead of the built-in XMLHttpRequest, so it can be set to
FakeXMLHttpRequest:

Zotero.HTTP.mock = sinon.FakeXMLHttpRequest;
var server = sinon.fakeServer.create();
server.autoRespond = true;
server.respondWith("GET", "/users/1",
  [200, {"Content-Type": "application/json"}, '{"userID": 1}']);
var userInfo = yield getUser();
Zotero.HTTP.mock = null;
server.restore(); // probably not necessary
2015-06-07 15:23:12 -04:00
Simon Kornblith
38eeab06a3 Some snapshot-related fixes 2015-06-07 14:02:20 -04:00
Aurimas Vinckevicius
3d4926923a Resolve relative URLs to absolute before trying to proxify them
Besides adding some debug logging, this currently makes no difference, but it will when we add support for de-proxifying URLs in #578.
2015-06-05 15:51:42 -05:00
Aurimas Vinckevicius
9450d0797f Don't double-proxy in properToProxy
Surfaced due to changes in 7f7fe90ad5
2015-06-05 15:51:42 -05:00
Dan Stillman
aa2e0a8582 Update Zotero.Relations.updateUser() for new relations schema
Also adds Zotero.DataObjects::getLoaded(), which returns an array of all
loaded objects of the given type. This is useful for selective
reloading, for example with item.reload(['relations'], true).
2015-06-04 20:38:49 -04:00
Dan Stillman
195a737049 Allow item.addRelatedItem() to work on unsaved item without libraryID
Production code should just assign a libraryID, but this is useful for
tests, and addCollection() does it.
2015-06-04 20:38:41 -04:00
Simon Kornblith
582799e428 Fix Zotero.Attachments.importSnapshotFromFile 2015-06-04 20:22:54 -04:00
Simon Kornblith
7253a2dd8c Map base fields to item-specific fields in Item#fromJSON() 2015-06-03 23:42:08 -04:00
Dan Stillman
20ca8edf87 Fix getContentsAsync() with invalid characters 2015-06-02 20:32:31 -04:00
Dan Stillman
424cae173b Fix getField/setField behavior/tests with regard to falsy values
In particular, 0 is kept as a value, and passing undefined to setField
now throws an error.

I'm not sure if we actually want to return an empty string in all cases
for missing/invalid fields, but that's what we do currently.
2015-06-02 19:09:58 -04:00
Dan Stillman
3ad15f7b59 Use Zotero.Utilities.Internal.exec() for PDF tool calls 2015-06-02 14:58:44 -04:00
Dan Stillman
77f12527aa Fix NS_BASE_STREAM_CLOSED error, for real
The input stream produced by asyncFetch is closed automatically at EOL,
so the available() call throws this for an empty file.
2015-06-02 14:58:43 -04:00
Dan Stillman
ef3bf8d596 Fix a few test failures/warnings
And simplify tree view load event handling, which may or may not have
been contributing to intermittent test failures, but is cleaner this way
regardless.
2015-06-02 03:51:09 -04:00
Dan Stillman
4f12c71e3e Fix intermittent NS_BASE_STREAM_CLOSED error? 2015-06-02 03:51:09 -04:00
Dan Stillman
dca29a06e3 Include params in DB error messages 2015-06-02 03:51:09 -04:00
Dan Stillman
1f643c1baa Fix skipNotifier option with DataObject::erase() 2015-06-02 03:51:09 -04:00
Dan Stillman
c5cfb6adfd Ignore 'synced' in Zotero.Item.fromJSON() 2015-06-01 22:45:13 -04:00
Dan Stillman
a740658452 Relations overhaul (requires new DB upgrade from 4.0)
Relations are now properties of collections and items rather than
first-class objects, stored in separate collectionRelations and
itemRelations tables with ids for subjects, with foreign keys to the
associated data objects.

Related items now use dc:relation relations rather than a separate table
(among other reasons, because API syncing won't necessarily sync both
items at the same time, so they can't be stored by id).

The UI assigns related-item relations bidirectionally, and checks for
related-item and linked-object relations are done unidirectionally by
default.

dc:isReplacedBy is now dc:replaces, so that the subject is an existing
object, and the predicate is now named
Zotero.Attachments.replacedItemPredicate.

Some additional work is still needed, notably around following
replaced-item relations, and migration needs to be tested more fully,
but this seems to mostly work.
2015-06-01 20:28:30 -04:00
Dan Stillman
b59fa1eed9 Store copy of changed object in _markFieldChange()
Otherwise a splice() on a stored array affects the calculation of what's
new.
2015-06-01 20:23:20 -04:00
Dan Stillman
5fc524bcb2 Generalize Zotero.CachedTypes.add(), and tweak item charset handling
.attachmentCharset on an item now requires a string, not a charsetID.
(It accepted a charset before but didn't quite work right.)
2015-06-01 20:23:20 -04:00
Dan Stillman
bf0d2a1bf4 Fix collectionTreeView::expandToCollection() 2015-06-01 15:31:57 -04:00
Simon Kornblith
9bb01d737c Merge branch '4.0' into sjk/659 2015-06-01 00:03:20 -04:00
Dan Stillman
5ba344516e Update PDF tool handling in tests
The test runner now downloads and caches the PDF tools for the current
platform within the test data directory and only redownloads them when
out of date, and it updates the download URL so that the full-text code
pulls from the cache directory via a file:// URL.

The installPDFTools() support function now installs the files directly
instead of going through the prefs, and a new uninstallPDFTools()
function removes the tools. Since the presence of the PDF tools can
affect other tests, tests that need the tools should install them in a
before() and uninstall them in an after(), leaving most tests to run
without PDF indexing.

This also adds a callback to the waitForWindow() support function. If a
modal dialog is opened, it blocks the next promise handler from running,
so a callback has to be used to interact with and close the dialog
immediately.
2015-05-31 23:50:26 -04:00
Dan Stillman
55d27273fb TextEncoder is no longer required for OS.File.writeAtomic() 2015-05-31 23:01:34 -04:00
Dan Stillman
4fd65fec4c Fix charset handling in Zotero.File.getContentsAsync()
Character sets are now populated on demand, so they can't be run through
Zotero.CharacterSets.getName() in getContentsAsync(), since they might
not exist. (I'm also not sure why this was being done anyway.)
2015-05-31 22:58:11 -04:00
Dan Stillman
1979efd8ce Fix Zotero.Fulltext.getTotalPagesFromFile() call 2015-05-31 22:57:34 -04:00
Simon Kornblith
e868c758b6 Fix library/locator engine lookup
Fixes #744, closes #747. Thanks to @zuphilip for tracking down the bug
2015-05-31 18:23:11 -04:00
Dan Stillman
b8d9504a4f Missed lines from 420985661 2015-05-31 17:07:59 -04:00
Simon Kornblith
673168ea7b Don't adjust accessDate for UTC and set version to 0 in Item#toJSON
Ref discussions:
https://github.com/zotero/zotero/pull/746/files#r31394225
https://github.com/zotero/zotero/pull/746#commitcomment-11445605
2015-05-31 17:02:20 -04:00
Dan Stillman
cc3d81da93 Add Zotero.DataObjectUtilities.generateKey()
For now, this just calls Zotero.Utilities.generateObjectKey(), but this
function makes more sense in DataObjectUtilities. It does need to be
accessible to the connectors, but if it's possible to add an alias in
Zotero.Utilities just for the connectors, it'd probably be better to do
that and use Zotero.DataObjectUtilities.generateKey() elsewhere.
2015-05-31 16:59:10 -04:00
Dan Stillman
420985661b Default to user library when assigning unsaved item to collection
And fix some issues setting the libraryID property on unsaved objects

Also return .deleted as false, not an empty string
2015-05-31 02:03:53 -04:00
Dan Stillman
ed1c0a4637 Fix updating of cached child collections/items, and make more efficient 2015-05-30 19:03:42 -04:00
Dan Stillman
807c40859f Missed lines from 2154673dd 2015-05-29 21:55:47 -04:00
Dan Stillman
2154673dd3 Return a Zotero.Item from all Zotero.Attachments methods
These previously returned an itemID, but now that new saved items can be edited
without a refetch, they should just return the new item.

(Possible I missed a few spots where these are called.)
2015-05-29 05:33:54 -04:00
Dan Stillman
5a2ec43de1 Add Notifier.queue()
Notifier.trigger() needs to be async, since if it actually runs it waits for
promises returned from observers. But the vast majority of trigger() calls are
in transactions where they just queue and can therefore be synchronous. This
replaces all such calls with Notifier.queue().

This should fix a race condition that was causing the emptyTrash() test to fail
intermittently.
2015-05-29 05:03:05 -04:00
Dan Stillman
15252623d7 Log the actual number of Notifier observers for a type 2015-05-29 03:37:29 -04:00
Dan Stillman
72e0124e4e Fix tag purging with stricter DB parameter checks
Should have failed without libraryID being passed
2015-05-29 01:15:04 -04:00
Dan Stillman
4e1dd6f5b6 Restore DB parameter checking and add tests
Some parameter situations also weren't being properly handled
2015-05-29 01:15:04 -04:00
Dan Stillman
1e7c822ab0 Fix linked file creation 2015-05-29 01:09:24 -04:00
Dan Stillman
a804efce67 Fix getAttachments()/getNotes() with no child items after save 2015-05-27 22:18:40 -04:00
Dan Stillman
7eaa57562f Fix Zotero.ItemFields.getBaseIDFromTypeAndField()
Closes #741
2015-05-27 05:01:48 -04:00
Dan Stillman
80d5b74cf3 Merge 4.0 up to 28301ea45f
Conflicts:
	chrome/content/zotero/preferences/preferences_export.js
	chrome/content/zotero/xpcom/proxy.js
2015-05-26 17:48:22 -04:00
Dan Stillman
8c64d8b410 Fixes #739, Item added to "My Publications" despite choosing cancel 2015-05-26 17:20:42 -04:00
Aurimas Vinckevicius
ec786bf15c For now, use Zotero item DB ids when passing items to citeproc
citeproc-js relies on this in several locations. Seems that Zotero passes these IDs to citeproc from the item picker. We also need to consider existing embedded items in Word/LO documents, but they do have embedded URIs, so it shouldn't be a problem.
CC @fbennett
2015-05-26 16:11:44 -05:00
Aurimas Vinckevicius
c84a16984b Map note excerpt to title in itemToCSLJSON
This way notes have some sort of user-friendly way of being traced from Word documents to Zotero items in the library
2015-05-26 16:11:44 -05:00
Aurimas Vinckevicius
de0b7ba181 ItemGetter shouldn't break with an empty DB 2015-05-26 16:11:42 -05:00
Aurimas Vinckevicius
9d5d8b525a Access date in Zotero.Item::toJSON should be in ISO-8601 format 2015-05-26 16:03:35 -05:00
Aurimas Vinckevicius
47bf9c38e9 Transition item Export Format to Zotero web API item JSON
* Enable legacy mode for export translators compatible with pre-4.0.27:
   * Add compatibility mappings, so that current translators don't break if they specify minVersion lower than 4.0.27. This does introduce non-compatible changes, specifically, "version" field in legacy mode is "versionNumber" in the new format. "version" in the new format corresponds to the "version" as specified for Zotero API JSON format. New translators should expect Zotero web API JSON format and should specify minVersion 4.0.27.
* Update CSL mappings to comply with new itemToExportFormat
* CSL JSON export translator needs to be updated to be compatible with 4.0.27 to export correct CSL JSON
* Use item URI for id in CSL JSON instead of item ID
* Fix note and attachment handling in itemToCSLJSON
2015-05-26 15:48:43 -05:00
Aurimas Vinckevicius
12db2e6c51 Don't throw if checking invalid field in ItemFields.isValidForType 2015-05-26 15:39:44 -05:00
Aurimas Vinckevicius
c6151f959d Fix relations serialization in Zotero.Item::toJSON() 2015-05-26 15:39:44 -05:00
Aurimas Vinckevicius
21cd15b068 Port Zotero.Item.toJSON from api_syncing branch
* Modified to use synchronous DB access
* Take patchBase argument as an option
* Update to conform to v3 API
2015-05-26 15:32:33 -05:00
Aurimas Vinckevicius
7445f81042 Port Zotero.Date.sqlToISO8601 from 755ead2119
Copy-pasted, no modifications
2015-05-26 15:32:33 -05:00
Dan Stillman
f71140da64 Remove Zotero.Item.prototype.addTags
Can use addTag() or setTags()

Addresses #735
2015-05-26 12:13:27 -04:00
Dan Stillman
8a0b4d92a6 Fix PDF tools installation on Linux 2015-05-26 04:44:02 -04:00
Dan Stillman
3d3b817724 Allow data to be set after save() on a new object without load() calls
After saving a new object and reloading primary data and any changed
data (which we can maybe reconsider at some point), mark all other data
types as loaded, since there's no other data we don't have. For example,
this allows for item.save() to be followed by item.setField() without
needing to call item.loadItemData() first.
2015-05-26 04:08:47 -04:00
Dan Stillman
5d530e4173 Don't load item data and collections for all items in the middle pane 2015-05-26 03:19:44 -04:00
Dan Stillman
41a68af1ae Remove debug line when loading collections 2015-05-26 03:19:44 -04:00
Dan Stillman
ea1573e1c3 Don't log warning when localized string for search condition not found
Falls back to item field strings, so not sure why I added logging for
this.
2015-05-26 03:19:30 -04:00
Dan Stillman
9f4b128c14 Remove header and footer from stack trace display 2015-05-26 03:15:04 -04:00
rmzelle
06e6168cb4 Implement locale drop-down menus 2015-05-26 00:12:04 -04:00
Dan Stillman
28301ea45f Center the site-specific Quick Copy and proxy editing windows
On OS X these show up as sheets, but on Windows without this flag they
appear in the top-left of the screen.
2015-05-25 23:36:24 -04:00
Dan Stillman
c152e81bed Merge pull request #732 from rmzelle/edit-button-quickcopy
Add Edit button for site-specific Quick Copy settings
2015-05-25 23:31:44 -04:00
rmzelle
5833d87169 Add Edit button for site-specific Quick Copy settings 2015-05-25 23:21:50 -04:00
Dan Stillman
ab3b0367ef Merge locales from Transifex 2015-05-25 22:26:50 -04:00
Dan Stillman
6e4eb61694 Merge pull request #673 from sendecomp/optional-proxy-redirect-notification
Add an option to not show the proxy redirection notification
2015-05-25 21:57:16 -04:00
Dan Stillman
96f5bab3a1 Cancel relatedbox loading if binding disappears 2015-05-25 21:48:47 -04:00
Dan Stillman
31af26af08 Fix selection of new items 2015-05-25 21:48:47 -04:00
Dan Stillman
2bd246e2ea Fixes #728, Tag selector refreshing 2015-05-25 21:48:46 -04:00
LinuxMercedes
34c0e746f5 Add an option to not show the proxy redirection notification 2015-05-25 17:38:24 -05:00
Dan Stillman
cbbdebc5b7 Fix hang in collectionsTreeView::selectWait() if row is already selected 2015-05-25 01:43:07 -04:00
Dan Stillman
43762248a4 Fix trash emptying, and do it in batches of 50 2015-05-25 00:14:49 -04:00
Dan Stillman
87fa51849f Accept promise-yielding generators directly in forEachChunkAsync() 2015-05-24 22:56:44 -04:00
Dan Stillman
6933f64616 Fix reselection of trash after restart 2015-05-24 22:04:40 -04:00
Dan Stillman
dd52206b37 Don't show "Loading item data" when data is cached 2015-05-24 21:34:11 -04:00
Dan Stillman
e35575e6fd If last viewed collection is set but not found, default to My Library 2015-05-24 20:00:10 -04:00
Dan Stillman
2ed04eca26 Speed up translator initialization in source installs
updateBundledStyles() already has the contents of a new/updated
translator when it copies it into the data dir, so there's no need for
Zotero.Translators.reinit() to read it again from the just-copied file.
This passes the metadata from updateBundledStyles() to reinit() to avoid
the extra file read.

(Alas, this appears to make essentially zero difference on an OS X
system with an SSD, but maybe it will help elsewhere.)
2015-05-24 20:00:10 -04:00
Dan Stillman
bd9c53b29c Fix tag selector loading (broken by 6b87c641) 2015-05-24 20:00:10 -04:00
Dan Stillman
8a93250ca1 Fix "comment.split is not a function" in item box 2015-05-24 04:56:19 -04:00
Dan Stillman
19b8db590f Fixes #727, Duplicated items lose their creators 2015-05-24 04:55:54 -04:00
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
b21e07d700 Fix group saving and copying attachments between libraries 2015-05-23 21:10:07 -04:00
Dan Stillman
5e1c25f4b5 Async Zotero.File.copyDirectory() 2015-05-23 21:08:11 -04:00
Dan Stillman
e1355cef2f Show only "Export Files..." in context menu for My Publications 2015-05-23 19:07:14 -04:00
Dan Stillman
0f519dc757 Post-merge cleanup in fileInterface.js
(Though not enough to actually get it working)
2015-05-23 18:35:28 -04:00
Dan Stillman
aa730bb3bd Merge branch '4.0'
Conflicts:
	chrome/content/zotero/fileInterface.js
	chrome/content/zotero/xpcom/translation/translate_item.js
	chrome/content/zotero/xpcom/utilities_internal.js
	chrome/content/zotero/zoteroPane.js
2015-05-23 18:26:32 -04:00
Dan Stillman
ebe41ac51a Fixes #724, PDF indexing binaries not downloading
And adds Zotero.File.download(uri, path)
2015-05-23 18:03:25 -04:00
Dan Stillman
6b87c641d9 Experimental approach to cancelling unnecessary promises
If a view or other resources are destroyed while a promise is being
resolved, subsequent code can fail. This is generally harmless, but it
results in unnecessary errors being logged to the console.

To address this, promises can use a new function,
Zotero.Promise.check(), to test whether a value is truthy or 0 and
automatically throw a specific error that's ignored by the unhandled
rejection handler if not.

Example usage:

getAsync().tap(() => Zotero.Promise.check(this.win));

If this.win is cleaned up while getAsync() is being resolved, subsequent
lines won't be run, and nothing will be logged to the console.
2015-05-23 04:43:37 -04:00
Dan Stillman
3fc09add3a Attachment fixes
Change all attachment functions to take parameter objects, including a
'collections' property to assign collections. (Previously, calling code
assigned collections separately, which required a nested transaction,
which is no longer possible.)

Fixes #723, Can't attach files by dragging
2015-05-23 04:43:37 -04:00
Simon Kornblith
6e2d1f683a Get translation at least partly working
I'm pretty sure I've only scratched the surface here, but at least
basic things work.
2015-05-22 22:24:46 -04:00
Dan Stillman
61cb01b7c2 Collection/item tree selection improvements
Wait for the pane's collectionSelected() to finish before returning from
collectionTreeView select methods (e.g., selectLibrary()), and wait for
previous items view to finish loading before creating a new one in
collectionSelected(). This ensures that the items view has been created (though
not loaded) before returning from a select. The tree can still get a bit
confused switching between collections, but I think we're getting closer to
fixing that.

Also switch the items tree to use the same pattern.

This also fixes dragging items to collections (#731).
2015-05-22 19:22:00 -04:00
Dan Stillman
23e4e54c29 Add extra newline between lines in error reports 2015-05-22 16:03:06 -04:00
Dan Stillman
f164fef3d2 Skip Quick Copy until #520 is done 2015-05-22 16:00:22 -04:00
Dan Stillman
22e0ba3a22 Fix hangs related to data object purging 2015-05-22 15:59:15 -04:00
Dan Stillman
cf010d7748 Fix collection collapse/expand issues
Fixes #722, Everything disappears
2015-05-22 14:43:09 -04:00
Dan Stillman
432d89af24 Group data layer fixes 2015-05-22 14:41:59 -04:00
Dan Stillman
32abbe7c25 Load groups at startup, and make Zotero.Groups functions synchronous
Groups were already being loaded for the collections list, so we might
as well just store them initially and let Zotero.Libraries.getName() be
a synchronous call.
2015-05-22 04:52:05 -04:00
Dan Stillman
f4446e268d Use more concise 1-line format for SQL logging
SELECT * FROM foo WHERE bar=? AND qux=? ['foo', 1]

Not sure why I didn't do this years ago...
2015-05-21 23:44:10 -04:00
Dan Stillman
ada657fcb8 Functions to modify 'version'/'synced' efficiently, plus some other fixes 2015-05-21 23:44:10 -04:00
Dan Stillman
a3f4fe181f More data layer changes
- Moved ::_get() and _set() from Collection/Search into DataObject, and
  disabled in Item
- Don't disable new items after save. We now put new objects into the
  DataObjects cache from save() so that changes made post-save are
  picked up by other code using .get().
- Added 'skipCache' save() option to avoid reloading data on new objects
  and adding them to the cache. (This will be used in syncing, where
  objects might be in another library where they're not needed right
  away.) Objects created with this option are instead disabled to
  prevent reuse.
- Modified some tests to try to make sure we're reloading everything properly
  after a save.
- Documented save() options
2015-05-21 23:39:00 -04:00
Dan Stillman
8352934009 Merge pull request #671 from gracile-fr/localize-locators-labels
Add localized locator labels
2015-05-21 02:19:16 -04:00
Dan Stillman
4792b7cd48 Data layer fixes
- Fixes some saving and erasing issues with collections and searches
- Adds Zotero.DataObject::eraseTx() to automatically start transaction,
  and have .erase() log a warning like .save()
- Adds createUnsavedDataObject() and createDataObject() helper functions
  for tests
2015-05-20 23:16:18 -04:00
Dan Stillman
e8a04dffd0 Relations support for Z.DataObjectUtilities.diff() and applyChanges() 2015-05-20 23:16:18 -04:00
Dan Stillman
c9aed60acd Rename error/warning icons 2015-05-19 22:42:43 -04:00
Dan Stillman
0e73b1cc61 Remove code to check for changes after note reselection
No longer necessary, since items aren't reselected on change, and the
dateModified check was insufficient
2015-05-19 22:34:49 -04:00
Dan Stillman
3ac22b6242 Merge locales from Transifex 2015-05-19 17:28:40 -04:00
Dan Stillman
8cfca53b48 Register itembox and noteeditor with notifier and refresh on update
Since selected items are no longer reselected, the boxes now need to
refresh themselves.
2015-05-19 17:08:45 -04:00
rmzelle
4bdef75074 Add DOI-field context-menu 2015-05-19 16:25:02 -04:00
Aurimas Vinckevicius
f7868be884 Consolidate _saveAttachment error and callback handling 2015-05-19 03:12:37 -05:00
Aurimas Vinckevicius
ed734bfdf3 Merge 849803473a into api_syncing
Fixes #677
2015-05-19 02:41:03 -05:00
Dan Stillman
eee0e22bf6 Add 'version' to sync cache primary key
The sync cache will have pristine copies of the existing versions of
local objects for better conflict resolution, but downloads will get
saved to the sync cache first before processing, so the cache needs to
be able to hold more than one version.
2015-05-19 01:25:31 -04:00
Dan Stillman
ab4320df07 Add Zotero.Libraries.getAll() 2015-05-19 01:20:12 -04:00
Dan Stillman
e0ea3ca99b Don't show "[object Object]" in varDump() output 2015-05-19 01:17:12 -04:00
Dan Stillman
3b0b2c59b7 Always show HTTP request resolution, even without debug flag 2015-05-19 01:17:12 -04:00
Dan Stillman
abaa4da5ab Much better data object change detection
Replace Z.DataObjects::diff() with Z.DataObjectUtilities.diff(). Instead
of just returning two objects with the differing fields, the new diff()
generates a changeset with operations to apply with applyChanges(),
including at the array member level for collections and tags. This,
combined with cached pristine copies of objects, will allow for vastly
better conflict resolution, with automatic merging of non-conflicting
changes.

Creators currently don't show granular changes, and ordering might make
it too tough to do so. Relations diffing isn't yet implemented.
2015-05-19 01:17:12 -04:00
Dan Stillman
f727b224e7 Fix tag diffing 2015-05-15 01:47:20 -04:00
Dan Stillman
7a93b132b3 Merge pull request #715 from rmzelle/proxylist-editbutton
Add Edit button to proxy list
2015-05-14 13:10:20 -04:00
rmzelle
bd8db988f3 Add Edit button to proxy list 2015-05-14 09:26:38 -04:00
Dan Stillman
3f4eebe51c Set 'synced' to false automatically on save, unless value is changed
And add 'skipSyncedUpdate' option to leave untouched

Also move some save logic into Zotero.DataObject.prototype._saveData(),
and call that first.
2015-05-13 19:32:53 -04:00
Dan Stillman
fa039971e6 Fixes #714, Zotero.defineProperty() lazy mode doesn't work
Patch from @aurimasv
2015-05-13 13:43:55 -04:00
Dan Stillman
f376db0705 Remove duplicate Zotero.defineProperty() function
Ended up in two places somehow
2015-05-13 12:35:26 -04:00
Dan Stillman
27ab9869be Fix DB upgrading (broken in 14d435b8d) 2015-05-13 11:20:12 -04:00
Dan Stillman
3eed76698c clearUserPref no longer throws on an invalid pref 2015-05-13 11:20:12 -04:00
Dan Stillman
1f8b6fad61 Don't include collections in child item JSON export
But handle it in Zotero.Items.diff() if it's there for one item
2015-05-13 11:20:11 -04:00
Dan Stillman
24022623a1 Move patchBase into options in Zotero.Item.prototype.toJSON()
Also:

- Make .mode == 'patch' optional if .patchBase is provided.
- Remove requirement for item to be unchanged, which hopefully wasn't there for
  a good reason
- Add a few tests, though more are needed
2015-05-12 20:12:10 -04:00
Dan Stillman
1578675ace Change 'finite' param to 'maxTime' in delayGenerator
Allows delaying up to a specified amount of time before yielding false
2015-05-12 20:12:05 -04:00
Dan Stillman
27899c85b5 Add setter and tests for dateAdded
Setting dateAdded is necessary for syncing
2015-05-12 19:55:14 -04:00
Dan Stillman
1558ed8a27 Update Zotero.DataObjects.prototype.diff() to handle API JSON 2015-05-12 19:51:02 -04:00
Dan Stillman
50f627c0cd Replace CollectionTreeView::getLastViewedRow() with selectByID() 2015-05-12 19:45:14 -04:00
retorquere
47ffa1188a export groups, unify library export 2015-05-12 17:52:35 +02:00
Dan Stillman
4d37b3d4c9 Temporary debugging of ItemTreeView::notify() yielding 2015-05-10 18:33:44 -04:00
Dan Stillman
c83bc1b01d Don't reload skipped data types 2015-05-10 18:32:11 -04:00
Dan Stillman
14d435b8d8 Closes #711, Remove support for nested transactions 2015-05-10 18:32:10 -04:00
Dan Stillman
e584dbf5dd Wait for items list to refresh before handling notifications
This fixes an error if New Item is used before the items list has
loaded.
2015-05-10 18:30:07 -04:00
Dan Stillman
6faa2caff8 Add queryTx() to a run a single query in a transaction
Otherwise a write statement could run in the middle of an unrelated open
transaction.
2015-05-10 18:30:06 -04:00
Dan Stillman
03da4a9d52 Restore unselecting of last row in tree if removed
If no other rows are selected, select the row before the removed row
2015-05-10 18:30:06 -04:00
Dan Stillman
af7da366c9 Get connection without yielding if available in executeTransaction 2015-05-10 18:30:05 -04:00
Dan Stillman
a39a42546f Add missing yield in restoreSelectedItems() 2015-05-10 18:30:05 -04:00
Dan Stillman
a64282118b Fix items-count updating in right-hand pane
And some other tweaks to ZoteroPane.itemSelected()
2015-05-10 18:30:05 -04:00
Dan Stillman
e2b62580d1 Fix errorHandler check in DataObject.save() 2015-05-08 13:35:04 -04:00
Dan Stillman
3349930483 Allow fromJSON to be called on unsaved items 2015-05-08 13:35:04 -04:00
Dan Stillman
5635fec4e3 Various creator-saving fixes 2015-05-08 13:35:01 -04:00
Dan Stillman
9f8510c821 Throw ZoteroUnknownTypeError on unknown item type in getItemTypeFields
This needs to be done in additional places as well.
2015-05-08 03:38:28 -04:00
Dan Stillman
3214e37d92 Ignore empty 'filename' property in Item.fromJSON() 2015-05-08 03:38:27 -04:00
Dan Stillman
e3da547c81 Avoid error if item tree disappeared during refresh 2015-05-08 03:38:27 -04:00
Dan Stillman
2a69885b11 Fix placement of saved searches in collections tree
And unify row add/remove handling between collections tree and items
tree
2015-05-07 18:20:26 -04:00
Dan Stillman
67abbc8c4a Add errorHandler option to DataObject.prototype.save()
This allows calling code to do something other than call Zotero.debug()
on errors (like, say, nothing, in order to avoid logging certain
expected errors) before throwing.
2015-05-07 18:20:26 -04:00
Dan Stillman
47f3c1efe6 Don't reselect items unnecessarily
Store and check the last selected items in ZoteroPane.itemSelected() to
see if it's necessary to refresh the item pane. This prevents loss of
textbox focus if another write occurs while editing a field.

Also optimize row adding/removing in itemTreeView.js
2015-05-07 15:09:41 -04:00
Dan Stillman
afface4fba Fix Zotero.Utilities.arrayEquals() for nested array comparisons 2015-05-07 15:09:41 -04:00
Dan Stillman
37f5669319 Fix making an item a child item if it's in any collections 2015-05-07 15:09:40 -04:00
Dan Stillman
2525f8e532 Fix dragging items to collections 2015-05-07 15:09:40 -04:00
Dan Stillman
45b3cd8a53 Replace non-breaking spaces in tested lines in recognizePDF
Fixes "PDF does not contain OCRed text" message for
http://pdfserver.amlaw.com/nlj/NSA_ca2_20150507.pdf
2015-05-07 13:41:13 -04:00
Dan Stillman
3587bb0f6b Fix error if a synced filename begins with a dot (".pdf") 2015-05-07 13:40:05 -04:00
Dan Stillman
3a995d64a4 Fix saving of tags 2015-05-06 04:23:31 -04:00
Dan Stillman
26e1372f46 Throw an error if item type isn't set when saving
And add a test for throwing from setField(), which already happens.
2015-05-06 04:20:47 -04:00
Dan Stillman
7879e5432a Fix new attachment charset saving, which I definitely didn't test before 2015-05-06 04:20:45 -04:00
Dan Stillman
33eaaffd83 Fix Date Modified handling when saving items 2015-05-06 04:19:20 -04:00
Dan Stillman
e5cbfb71a6 Throw ZoteroMissingObjectError for missing item errors
And don't log in DataObject.saveData() before rethrowing, since the
calling code will probably take care of it
2015-05-06 04:19:20 -04:00
Dan Stillman
d67fd9fda2 Don't send add notifications for collections if skipNotifier is passed 2015-05-05 15:57:37 -04:00
Dan Stillman
01f04802f0 Fix loadAllData() on regular items without notes
Set a flag when setting the item type that instructs loadAllData()
whether to attempt to call loadNote()
2015-05-05 15:57:37 -04:00
Dan Stillman
beb17436f8 Don't mark parentKey as changed when set to false for an unsaved item
And return undefined for search objects
2015-05-05 15:57:37 -04:00
Dan Stillman
b0f52a0f07 Allow attachmentLinkMode to be specified as a string ('linked_url') 2015-05-05 15:57:36 -04:00
Dan Stillman
93a6a4ffdb Don't mark an empty field set to an empty string as changed
And some tests
2015-05-05 15:57:36 -04:00
Dan Stillman
18714a4fcb Default to user library for saved searches
For consistency with collections and items
2015-05-05 03:17:51 -04:00
Dan Stillman
bb760707d4 Get id values directly in Zotero.DataObject.prototype.loadPrimaryData 2015-05-05 02:56:56 -04:00
Dan Stillman
02a36eab9b Fix various issues with rapid UI/data changes due to asyncification 2015-05-05 02:53:06 -04:00
Dan Stillman
fc428f8e1b Insert new saved search rows without refreshing collections list
And some other selection-related tweaks
2015-05-05 02:52:26 -04:00
Dan Stillman
2ca53677f8 Don't resave collection with no parent after .parentKey = false 2015-05-05 02:52:26 -04:00
Dan Stillman
aa512f0f8d Miscellaneous data layer fixes and tweaks 2015-05-04 03:19:58 -04:00
Dan Stillman
53e40bb0f4 Miscellaneous tweaks 2015-05-04 02:46:40 -04:00
Dan Stillman
ef91299951 Asyncify Zotero.CollectionTreeCache.clear() 2015-05-04 02:46:39 -04:00
Dan Stillman
8ec248f7ec Remove some unnecessary asyncness in tree views
E.g., closing a container doesn't need to yield
2015-05-04 02:46:39 -04:00
Dan Stillman
d22f762bb6 Add new collection rows without reloading the collections list 2015-05-04 02:46:34 -04:00
Dan Stillman
6328d1f39b CollectionTreeView::selectLibrary() doesn't need to be async 2015-05-04 02:45:56 -04:00
Dan Stillman
8fec5ace3a Fix post-save textbox focusing bugs in right-hand pane
Fix a couple cases of lost text field focus after an edit, including
focusing of the Title field after using New Item when a field is already
being edited and has a changed value.

Also, in tests, select My Library and wait for items to load when using
the loadZoteroPane() support function. We could add a parameter to skip
that or move it to a separate function, but the code to detect it is a
bit convoluted and it's a prerequisite for many tests, so it's handy to
have a function for it.
2015-05-04 02:45:55 -04:00
Dan Stillman
590649fd49 Ignore blur events from html:textarea
If a new item is created manually when a text field is already open, the
hideEditor is run first on the html:textarea before bubbling up to the
textbox. During a normal blur, the event only happens on the textbox,
though I haven't looked into the reason for the difference.
2015-05-04 02:45:55 -04:00
Dan Stillman
bdd44e9a44 DB isolation changes and item selection tweaks
- Add an 'exclusive' option to transactions that causes them to block other
  transactions and wait for other transactions to finish before starting,
  instead of nesting
- Resolve Zotero.DB.waitForTransaction() promise before returning from
  executeTransaction()
- A side effect of the above: wait for a newly created item to be selected in
  the middle pane and rendered in the right-hand pane before returning from
  executeTransaction()
- Don't save items multiple times when adding/removing a non-final creator in
  the Info pane
- Use a simpler, non-recursive method for focusing the next field in the Info
  pane; this prevents "too much recursion" errors if something causes the
  right-hand pane not to be rendered when expected
2015-05-04 02:45:55 -04:00
Dan Stillman
4a0018ec63 Fix transaction detection
This fixes an issue where two transactions started around the same time
could run separately instead of nesting, causing the statements from one
to end up running not within a transaction
2015-05-04 02:45:55 -04:00
Dan Stillman
43a2045aec Change computerProgram 'version' to 'versionNumber'
And use 'version' instead of 'itemVersion' for object version for items

Also add deferred foreign key checking to system.sql so that DROP TABLE
commands don't fail mid-transaction
2015-05-04 02:45:53 -04:00
Dan Stillman
5070c04af6 Ignore invalid fields in Zotero.ItemFields.isValidForType() 2015-05-04 02:45:28 -04:00
Dan Stillman
805df39869 Remove extra debugging in Zotero.ItemFields.getLocalizedString() 2015-05-04 02:45:28 -04:00
Dan Stillman
285995807d fromJSON() methods for data objects
Tests needed
2015-05-04 02:45:25 -04:00
Dan Stillman
afe0412c58 Collection/item tree view updates
- Pass .skipSelect option to data object .save() to prevent new objects
  from being selected
- Fix miscellaneous bugs
- Selection-related tests
2015-05-04 02:43:32 -04:00
Dan Stillman
322339876e Add Zotero.Date.isISODate() and Zotero.Date.isoToSQL() 2015-05-04 02:41:14 -04:00
Dan Stillman
e8d4b3e840 Add Zotero.Item.prototype.attachmentFilename 2015-05-04 02:41:14 -04:00
Dan Stillman
40e86147a4 Allow loadChildItems() to be called on note/attachment items
Otherwise loadAllData() doesn't work
2015-05-04 02:41:14 -04:00
Dan Stillman
453e7bd090 Fix size of 2x icons in progress window 2015-05-02 19:00:42 -04:00
Dan Stillman
fbef911cb7 Add wizard for My Publications
Show a wizard after items are dragged to My Publications choosing
whether to include files and notes and choosing sharing settings for the
items. Sharing options are Creative Commons licenses, CC0, "All rights
reserved", or keeping the existing Rights field if available.

Also blocks collections, searches, linked file attachments, and
top-level attachments/notes from My Publications at the data layer, but
not yet from the UI in all places (so it can crash if you try).

Todo:

- Block certain UI actions with nice messages
- Show a nice scrollable list of items in the wizard to allow selecting
  specific files/notes, instead of just having checkboxes for files and
  notes that apply to all dragged items
- Show an explanation of My Publications in the right-hand pane when no
  items are selected
- Maybe adjust handling when no attached files/notes, since it might be
  a bit alarming at the moment to see sharing options for metadata
  entries
2015-04-26 19:41:45 -04:00
Dan Stillman
944d298af7 Make retrieving transactionDate with no transaction fatal
I think the places where we retrieve it are always within transactions,
and this helps catch promises that aren't waited for.
2015-04-26 19:36:08 -04:00
Dan Stillman
0471a393eb Always return promise from Zotero.Attachments._postProcessFile() 2015-04-26 18:08:26 -04:00
Dan Stillman
1179d4c142 Fix Zotero.File.getBinaryContentsAsync() with no maxLength
And properly reject promise on failure
2015-04-26 18:08:25 -04:00
Dan Stillman
311ed7a71d Fix some old-style generators passed to executeTransaction()
And some missing yields
2015-04-26 18:08:25 -04:00
Dan Stillman
99dfc72a18 Fix collection saving 2015-04-26 18:08:25 -04:00
Dan Stillman
694896273a Properly detect group in Zotero.CollectionTreeRow::isWithinGroup()
More follow-up from 1c8abf384
2015-04-26 17:51:30 -04:00
Dan Stillman
1f00e99e71 Fix 'this' binding in ZoteroPane.selectItem(), but this time for real 2015-04-26 17:51:30 -04:00
Dan Stillman
a2b572665d Make libraryID optional for DataObjects, defaulting to user library 2015-04-26 17:51:29 -04:00
Dan Stillman
30535653a6 Fix error saving single attachment files from document 2015-04-26 17:51:29 -04:00
Dan Stillman
8ff258fe03 Don't require parent item to be loaded when setting item parent 2015-04-25 03:17:41 -04:00
Dan Stillman
6126a49fea Don't require non-identified items to have loaded data in getField()
This allows getField() on an unsaved item to work properly without a pointless
loadItemData() call.
2015-04-25 03:17:41 -04:00
Dan Stillman
5c8209da5c Fix 'this' binding in ZoteroPane.selectItem() 2015-04-25 03:17:41 -04:00
Dan Stillman
2f556d0da1 Adjust identifier registration on object save
Previously, object identifiers were registered in a commit callback, but that
meant that they wouldn't be available to getLibraryAndKeyFromID/
getIDFromLibraryAndKey within a transaction. Instead, register them before
saving and clear them in a tranasction rollback if necessary.

This changes Zotero.DataObject to call its own _finalizeSave() in addition to a
descendent one.
2015-04-25 03:17:41 -04:00
Dan Stillman
f8ac21d891 Return object instead of array from Zotero.DataObjects.getLibraryAndKeyFromID()
Object contains 'libraryID' and 'key' properties

This is due to changed array destructuring behavior in Firefox. Previously,
`var [foo, bar] = maybeArrayMaybeFalse()` always worked, leaving foo and bar
undefined if the function returned false. Now (with ES6, I assume), if the
function returns false it results in a "false[Symbol.iterator] is not a
function" error. But `var {libraryID, key} = false` works as expected, leaving
both values undefined, so instead we can just return an object with those
properties from getLibraryAndKeyFromID(). To assign to different variables, use
`var {libraryID, key: parentItemKey} = ...`.
2015-04-25 03:17:41 -04:00
Dan Stillman
9e3e680be8 Rework DB transaction handling
Rollback callbacks weren't being properly called, and some other things were in
the wrong place, particularly with nested transactions.
2015-04-25 03:17:41 -04:00
Dan Stillman
4cb5e7e4d5 Remove check for ES5 generators in Zotero.DB.executeTransaction()
This doesn't work properly in some contexts and can break things. There might
be a better test, but we probably don't need this anymore.
2015-04-25 03:17:40 -04:00
Dan Stillman
0e800f350c Throw errors instead of logging for some item load calls
Reverts a change in b83bc404, and changes one debug line introduced
there into an error
2015-04-25 03:17:40 -04:00
Dan Stillman
f68a595a2b Remove Zotero.DataObject._eraseRecoverFromFailure() 2015-04-25 03:17:40 -04:00
Dan Stillman
4b040c78a7 Fix various saved search bugs, and add tests
Search condition ids are now indexed from 0, and always saved
contiguously (no more 'fixGaps' option), since they're just in an array
in the API. (They're still returned as an object from
Zotero.Search.prototype.getConditions() because it's easier for the
advanced search window to not have to deal with shifting ids between
saves.)
2015-04-17 19:29:37 -04:00
Dan Stillman
d9c32a8e90 Fix search saving, and add some unit tests
Also:

- Return an object from `Zotero.Search.prototype.getConditions()`
  instead of an array.
- Add support function `getPromiseError(promise)` to return the error
  thrown from a chain of promises, or false if none. (We could make an
  `assert.throwsAsync()`, but this allows testing of various properties
  such as `.name`, which even the built-in `assert.throws()` can't
  test.)
- Clarify some search save errors
2015-04-17 00:25:09 -04:00
Dan Stillman
59773f3f6d Zotero.Search.getSearchCondition(s) -> getCondition(s) 2015-04-17 00:25:09 -04:00
Dan Stillman
1952fbccd4 Wait for Zotero.Searches initialization 2015-04-16 20:50:15 -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
0154e44c2f Mark all data as loaded when loading primary data for nonexistent object 2015-04-16 20:49:18 -04:00
Dan Stillman
293f7c6dd4 Zotero.Search.prototype.addCondition() doesn't need to be async 2015-04-16 20:48:59 -04:00
Dan Stillman
a2b6df1014 Include both DB version numbers in "newer than SQL file" dialog 2015-04-15 16:03:47 -04:00
Dan Stillman
384a547693 Merge branch '4.0' into api_syncing
Conflicts:
	chrome/content/zotero/lookup.js
2015-04-15 00:56:25 -04:00
Dan Stillman
a8d1080cd6 Unpromisify a couple Zotero.Translator.get() calls
More to be done to fix translation
2015-04-15 00:50:22 -04:00
Dan Stillman
e8b7b38290 Remove some obsolete synchronous DB code 2015-04-15 00:45:59 -04:00
Dan Stillman
4f9366749c Add Zotero.alert() method
This is just a wrapper around nsIPromptService.alert() that takes
Zotero.noUserInput into consideration, which avoids long timeouts during
testing (e.g., for lookup failures).
2015-04-14 16:09:55 -04:00
Dan Stillman
7b72d47070 Zotero.File.putContentsAsync() fixes
Breakage from e6ccca3230
2015-04-13 03:45:25 -04:00
Dan Stillman
915542e696 Throw Error, not Exception 2015-04-13 03:45:25 -04:00
Dan Stillman
2a3af13ddf Automatically return local user URI from Zotero.URI.getLibraryURI()
Previously, getItemURI and getCollectionURI had to check the libraryID
to determine whether to return a local URI, and were doing so using an
obsolete check.
2015-04-13 03:45:25 -04:00
Dan Stillman
a91151756b Fix test running after schema updates
Tests still need to be updated for Bluebird/promisification
2015-04-13 02:25:34 -04:00
Dan Stillman
fec43f1f62 Merge branch '4.0' into api_syncing 2015-04-13 02:01:43 -04:00
Dan Stillman
1c2b2575f7 Fix excessive file sync mtime updates/checks (probably?) 2015-04-09 03:47:43 -04:00
Dan Stillman
f5ce2d238e Fixes #546, Advanced search : match "any" is broken 2015-04-09 02:57:29 -04:00
Dan Stillman
c1a581168a Merge locales from Transifex 2015-04-09 00:26:12 -04:00
Dan Stillman
1e2346eba1 Revert to modified 3.02 binaries on Windows
To deal with issues running .vbs scripts on some systems. If the 3.02
binaries haven't been reinstalled since this version, reinstall them as
3.02a automatically or on manual upgrade to fix corrupted binaries from
previous gzip issue.

Other platforms unchanged
2015-04-09 00:22:32 -04:00
Dan Stillman
b2d5612526 Fix sync and debug output submission in Nightly
(sendAsBinary() removal)
2015-04-07 16:59:33 -04:00
Dan Stillman
2afebc79d0 Set tree image height to 16px everywhere
Windows maybe also doesn't handle HiDPI tree images correctly otherwise
2015-04-07 14:37:13 -04:00
Dan Stillman
c398353d5d Remove obsolete CSS include 2015-04-07 14:26:49 -04:00
Dan Stillman
fe79954b96 Fix HiDPI icons in trees on Linux 2015-04-07 14:25:24 -04:00
Dan Stillman
152b1c0d83 Merge pull request #692 from aurimasv/test-beta_build
Add Firefox Beta for Travis-CI testing
2015-04-07 03:13:19 -04:00
Dan Stillman
61e11f9afa Fix main toolbar icons in 2x mode on Win/Linux 2015-04-07 03:06:25 -04:00
Dan Stillman
adadc9e03a Accept a string path in Zotero.Utilities.Internal.exec() 2015-04-07 01:16:17 -04:00
Dan Stillman
31941c0798 Fix flashing console window for Retrieve Metadata on Windows 2015-04-07 01:14:18 -04: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
796a1a2898 Use firstCreator instead of creators[0] for QuickFormat sort
Previously, if an editor was entered before an author, it would sort by
the editor. Now, as long as there's an author, it will sort by that
first (and, with 2f3d865f, favor left-bound matches).

Addresses the second issue on
https://forums.zotero.org/discussion/48047/
2015-04-06 23:32:15 -04:00
Dan Stillman
2f3d865f11 Favor left-bound name matches in QuickFormat bar
https://forums.zotero.org/discussion/48047/
2015-04-06 23:14:32 -04:00
Dan Stillman
bfbf3d871c Fix display of sync error icon (2x and spacing) 2015-04-06 17:39:21 -04:00
Dan Stillman
af871a3fd5 Add 2x versions of many icons
Courtesy of Pastel SVG (2x famfamfam)

I didn't add 2x versions for any composite icons or any Fugue icons.

Also:

- Removed some unused/redundant images
- Switched to shadowless versions for a couple Fugue icons
2015-04-06 17:24:55 -04:00
Dan Stillman
58b56abbc7 Fix file sync errors with symlinked files/directories
nsIFile seems to have figured out symlinks since Firefox 3.0.1
2015-04-04 00:09:24 -04:00
Dan Stillman
788f92bc8b Fix sync error panel positioning (at least on OS X)
After 88be88661
2015-04-03 23:54:37 -04:00
Dan Stillman
4613f9593c Don't update pdfinfo unnecesarily 2015-04-01 16:43:37 -04:00
Dan Stillman
e567ad25aa More PDF tools tweaks
- If one tool is missing, reinstall it automatically during translator
  update check
- Account for pdfinfo 3.02pl1 on Linux
2015-04-01 16:35:13 -04:00
Dan Stillman
1a47d79716 Restore support for modified pdfinfo 3.02 2015-04-01 13:20:34 -04:00
Dan Stillman
a9ca6e0857 Support unmodified Xpdf binaries
Use stdout redirection scripts for pdfinfo and, on Windows, a script to
run pdftotext hidden, which together allow for all unmodified binaries
(including, probably, symlinked system ones, though I didn't test that).

On Windows, using a .vbs does cause a brief wait cursor. The stock
pdfinfo needs the redirection script anyway, so that's unavoidable, but
on the async branch I think we'll be able to switch to pdf.js for the
page count, at which point maybe I'll try to remember how I modified the
Windows binaries to be hidden and use a modified version of pdftotext to
avoid VBScript. (We use the stock pdftotext elsewhere already.)
2015-04-01 04:36:21 -04:00
Aurimas Vinckevicius
49a0b02b06 Log a list of translators that were found during detect* 2015-03-31 14:29:32 -05:00
Aurimas Vinckevicius
c05025f4b1 Log translatorID and lastUpdated timestamp when parsing translators 2015-03-31 14:29:32 -05:00
Dan Stillman
e1c1803ce2 Add DB version info to newer-DB-version error 2015-03-30 14:45:53 -04:00
Dan Stillman
aab21f68ad Blacklist "bad script XDR magic number" message 2015-03-29 15:22:07 -04:00
Dan Stillman
d6e19a9f25 Automatic PDF tool upgrading
If automatic translator/style updates are enabled, at least one of the
PDF tools is installed, and the repo returns a more recent version
number than what's installed, automatically upgrade the tools. (Version
3.02 counts as lower, since Poppler's version numbers are lower.)

If an error occurs, wait increasing amounts of time to try the downloads
again, up to one week.
2015-03-28 18:50:06 -04:00
Dan Stillman
40b349edca Handle gzip encoding via saveURI() 2015-03-27 18:43:39 -04:00
Dan Stillman
c9a787c7bd Maybe show some sync errors that weren't being shown
(This might end up showing some twice, but better than not at all.)
2015-03-26 20:34:31 -04:00
Dan Stillman
52e735b035 Merge locales from Transifex 2015-03-26 20:34:23 -04:00
Dan Stillman
4625b7081e Add checkbox to use one side for all remaining conflicts
This should be rewritten in a way that allows it to be unit tested, but
it seems to work.
2015-03-26 20:34:23 -04:00
Dan Stillman
21ad09112c Merge pull request #683 from aurimasv/setValue-base_fields
Allow setting item field value via base field
2015-03-26 20:33:54 -04:00
Aurimas Vinckevicius
48810f23e0 Tweak cleanISBN, cleanISSN, toISBN13 to match tests
Fixes regression from 37921b0910
cleanISBN/ISSN now return first valid ISBN/ISSN from a list of valid/invalid ISBNs/ISSNs, even if invalid ISBN/ISSN comes first
toISBN13 now corrects the check digit for ISBN13 input
2015-03-25 21:25:38 -05:00
Dan Stillman
d1ca5e2729 Restore use of dump() on Windows if debug pref is enabled
It turns out that the Cygwin console, unlike -console, is actually
usable, so developers on Windows can use that. Since we sometimes need
real-time debug output from end users (who won't have Cygwin installed),
keep logging to the Browser Console if only the -ZoteroDebug flag is
passed.
2015-03-24 03:44:16 -04:00
Aurimas Vinckevicius
e732d6350b Allow setting item field value via base field 2015-03-24 02:16:32 -05:00
Dan Stillman
b042973751 Merge branch '4.0' into api_syncing 2015-03-22 19:51:29 -04:00
Dan Stillman
b8fe15ed63 Properly reinitialize styles after repo update 2015-03-22 16:20:53 -04:00
Dan Stillman
a2d7dfd206 More bundled files fixes 2015-03-22 16:05:17 -04:00
Dan Stillman
e6ccca3230 Take either nsIFile or string path in Zotero.File.putContentsAsync()
And throw an OS.File.Error directly instead of catching it
2015-03-22 16:04:56 -04:00
Dan Stillman
d8f3be4bee updateBundledStyles() asyncification and related changes
- Use async DB and OS.File for bundled file updates
- Remove support for translator/style ZIP files -- the two options are
  now non-unpacked XPIs with subfolders or unpacked source installations
- Now that we have async file access, don't store translator code in
  database cache -- just store metadata so that it's available without
  reading each translator file
- Change the (previously partially asyncified) Zotero.Styles/Translators
  APIs a bit -- while the getAll/getVisible methods are asynchronous and
  will wait for loading, the get() methods are synchronous and require
  styles/translators to be initialized before they're called. Most
  places that end up calling get() probably call getAll/getVisible first
  and should therefore be async, but if there's any way to trigger a
  get() first, that will need to be adjusted.
- Asyncify various other style/translator-related code

XPI support is untested, as is style/translator usage, so there are
almost certainly bugs. The latter depends on updated export format
support (#659), since toArray() no longer exists on this branch.

Addresses #529 and #520
2015-03-22 04:27:25 -04:00
Dan Stillman
842082f818 Simplify options checking in Zotero.HTTP.request() 2015-03-22 02:49:19 -04:00
Dan Stillman
b437826bd0 Include HTTP headers in output in Zotero.HTTP.request() debug mode 2015-03-22 02:44:24 -04:00
Dan Stillman
32a4604481 Rename Zotero.HTTP.promise() to Zotero.HTTP.request() 2015-03-22 02:42:21 -04:00
Dan Stillman
9c0dc327e0 Fix library upgrade with trashed user library items (from 1c8abf384) 2015-03-21 22:56:31 -04:00
rmzelle
0df26d1d2d No prompt for remove if no top-level items are selected
As requested at
https://github.com/zotero/zotero/pull/668#issuecomment-84090670
2015-03-21 20:28:29 -04:00
Dan Stillman
ab25a306fd Add libraries table support to Zotero.ID.getNext() 2015-03-18 22:58:06 -04:00
Dan Stillman
304f46c8cc Update Zotero.Sync.Storage.QueueManager.start() for async item.clone()
Via _reconcileConflicts()
2015-03-18 22:58:06 -04:00
Dan Stillman
44a9b84891 Additional safety check when checking for persisted item pane state
I don't think there's any way for this to happen short of manual
preference editing, and the pane width would have to be exactly 250px,
and it's pretty harmless anyway, but might as well be safe.
2015-03-18 19:07:45 -04:00
Dan Stillman
935fb90bed Reopen collapsed item pane on restart, for now
Until we find a solution that confuses people less (#678), don't persist the
collapsed state across restarts.
2015-03-18 16:13:19 -04:00
Dan Stillman
68b0fb0368 Merge locales from Transifex 2015-03-17 18:35:21 -04:00
Dan Stillman
faed7cd7dd Replace some 'for each..in' instances
There are hundreds more, but these are all the ones that generate warnings in
the console at startup. XPCOM/XBL ones don't seem to do so, so we can ignore
those for now (and hopefully not bother with them on 4.0). Instances in
translators do generate warnings.

Addresses #656
2015-03-17 15:19:45 -04:00
Dan Stillman
4d8471afac Merge pull request #674 from gracile-fr/localize-wordproc-prefs
Localize Word Processors tab in Preferences
2015-03-17 01:12:27 -04:00
Dan Stillman
bb3496dfa8 Fix item duplication 2015-03-17 01:08:18 -04:00
Dan Stillman
828f3f5024 Fix report generation 2015-03-17 00:05:08 -04:00
Dan Stillman
417335baf2 Some libraryID follow-ups 2015-03-17 00:04:41 -04:00
Dan Stillman
d50b6667f0 Fix moving items to trash (from bf36a988e4) 2015-03-16 23:50:24 -04:00
Dan Stillman
bdd69d0a53 Merge branch '4.0' into api_syncing 2015-03-16 23:41:10 -04:00
Dan Stillman
a03772cae7 Merge branch 'master' into api_syncing
Note that this loses conflicting changes to translate_item.js from 849803473a,
so those will need to be reapplied if applicable. /cc @aurimasv, @mtd91429
2015-03-16 15:23:07 -04:00
Dan Stillman
bf36a988e4 Initial My Publications support
Adds a "My Publications" source after "My Library", implemented as a
separate library. Top-level items can be dragged in and removed.

(This doesn't currently work without disabling Quick Copy.)

Also:

- Make "Group Libraries" an unselectable header instead of a container,
  and don't indent group libraries
- Fix relation purging, which maybe never worked
- Pass only libraryID/key on deletes (which should speed them up)
- Fix async item cloning/copying
- Fix miscellaneous other bugs

To-do:

- Confirmation dialog on drag
- API support
2015-03-16 12:18:54 -04:00
Dan Stillman
a9f010d547 Update Quick Start Guide URL to HTTPS 2015-03-16 12:17:51 -04:00
Dan Stillman
94accba8a0 Fix error creating new item with tags 2015-03-16 12:17:50 -04:00
Dan Stillman
1c8abf3841 Change user library from 0 to 1
0 allowed for some accidental behavior due to old code expecting NULL,
and it prevented easy checks (``if (!libraryID)``) for a passed
libraryID. Code now uses Zotero.Libraries.userLibraryID instead of a
hard-coded value (except in schema.js). Functions can still make
libraryID optional, but they should then use
Zotero.Libraries.userLibraryID if that's to mean the user library.

There might be some code that still expects 0 that I missed.
2015-03-16 12:16:05 -04:00
Dan Stillman
072ced347c Merge locales from Transifex 2015-03-16 12:11:33 -04:00
Simon Kornblith
d881d4a647 Fix a bug saving attachments to items with notes via the server 2015-03-14 18:54:25 -04:00
Simon Kornblith
b4142342a5 Merge remote-tracking branch 'origin/connector' into 4.0 2015-03-14 18:32:54 -04:00
Simon Kornblith
48f6de7ad1 Move Safari items to root images directory, part 1 2015-03-14 18:28:05 -04:00
gracile-fr
5e9f6ff502 Localize Word Processors tab in Preferences
Fixes #426: this allows the localization of the Word Processors Add-in
button and messages displayed in the Prefs, under the "Word Processors"
tab. These strings were previously hardcoded in the integration plugins.
2015-03-12 21:25:50 +01:00
Dan Stillman
532c95e13e Fix placeholder in word processor document version message
Noted in #426
2015-03-12 15:31:45 -04:00
gracile-fr
7fb8f162c5 Add localized locator labels
Fixes #557
2015-03-12 15:30:05 +01:00
Simon Kornblith
3583793571 Wait for bundled file updates to complete before running tests 2015-03-11 13:32:25 -04:00
Simon Kornblith
608da632f3 E4X is gone 2015-03-11 12:04:54 -04:00
Dan Stillman
3672d2a895 Merge pull request #668 from rmzelle/confirm-remove-from-collection
Add prompt for Remove Item(s) from Collection
2015-03-09 22:27:12 -04:00
rmzelle
c5a40d503b Add prompt for Remove Item(s) from Collection 2015-03-09 21:45:39 -04:00
Simon Kornblith
d5f3e6d8f7 Merge pull request #580 from aurimasv/relative-urls
Resolve protocol-relative URLs outside of document context
2015-03-09 20:41:18 -04:00
Simon Kornblith
f2fb6e2e9c Merge pull request #640 from aurimasv/trans-tester-redundant-tags
Discard redundant tags in translator tester
2015-03-09 20:25:03 -04:00
Simon Kornblith
3415cefa71 Merge pull request #601 from aurimasv/defer
Allow meta redirects when running web translator tests
2015-03-09 20:10:19 -04:00
Simon Kornblith
181d852b72 Merge pull request #665 from zotero/unit-testing
Unit testing infrastructure
2015-03-09 19:13:25 -04:00
Dan Stillman
0aaa0540d9 Delete syncedSettings for deleted libraries on sync error
Not sure how this is possible, but fix it for now. It'll be prevented with a FK
check in 5.0.
2015-03-09 19:11:36 -04:00
Dan Stillman
cd358977f3 Update locales from Transifex
(Unfortunately this wipes out "Shortcuts" in all locales, but pushing
non-English locales to Transifex scares me too much. Sorry, localizers!
I think Transifex makes it easy to use previously used translations, at
least.)
2015-03-09 18:58:01 -04:00
Dan Stillman
2681a508b4 Merge pull request #664 from gracile-fr/prefs-pane
Move shortcut keys prefpane to tab of Advanced (#646)
2015-03-09 18:54:39 -04:00
Simon Kornblith
c2d32c2e27 Just give up on trying to automate the panel itself 2015-03-09 16:49:50 -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
gracile-fr
0a4fcc90ac Move shortcut keys prefpane to tab of Advanced
[and delete unused "#zotero-prefpane-keys checkbox" (there used to be a checkbox to "Try to override conflicting shortcuts", which has been definely removed by 5b34dce40f )]
2015-03-09 12:08:31 +01:00
gracile-fr
1ac54c4b13 Move "#styleManager-updated" under "Cite Pane" code
It was lost under "Shortcut Keys pane" code.
2015-03-09 12:06:55 +01:00
Dan Stillman
3194f4629f Fix size of separate Z toolbar icon on Windows and Linux
Fixes #667
2015-03-09 03:37:40 -04:00
Dan Stillman
98263fb485 Fix padding of single save button in palette
(At least on OS X. This might need to be added back for Windows/Linux.)
2015-03-08 01:43:12 -07:00
Dan Stillman
806259d187 When dropping combo buttons into panel, add two separate buttons instead
And move combo button to customization palette
2015-03-08 00:13:19 -07:00
Philipp Zumstein
e9e9527e60 Add stopPropagation to menuitem of new icon
This should solve 658
2015-03-03 00:00:36 +01:00
Aurimas Vinckevicius
efa269d382 Regression from f0bd1e77ff
Re https://forums.zotero.org/discussion/47176/beta-item-fields-mapping-to-weird-csl-variables/
2015-02-28 15:57:27 -06:00
Dan Stillman
9d353b4e25 Use Zotero.DB.MAX_BOUND_PARAMETERS instead of hard-coded number 2015-02-27 23:58:49 -05:00
Dan Stillman
126d55b3c3 Remove extra overlay.css import
(Though possibly we just want to merge zotero.css and overlay.css, since
the distinction has been mostly lost.)
2015-02-27 03:39:35 -05:00
Dan Stillman
a1bed8b5ad More icon tweaks
- New dedicated Zotero button, available in the Customize palette
- Remove "16px" Z SVG and just render "32px" one at the smaller size
  (there's a slight difference at the edges, but we should probably redo
  it anyway so that dark lines reach all the way to the bottom)
- Change "Open Zotero" back to just "Zotero", since 1) it's for closing
  too, 2) it can also just bring Standalone to the front, and 3) "Open
  Zotero" looks weird and inconsistent in the menu panel next to things
  like "Preferences"
- For now, show single large Z for combo buttons in customization
  palette with "Zotero (Combo)", though we can probably do something
  better.
- Fix some HiDPI bugs when moving items between areas

Still need a layout for the panel for the combo buttons
2015-02-27 03:35:18 -05:00
Klaus Flittner
1990240733 Restore settings to server
If the local data is to be resotres to the zotero server,
the settings like tag colors also need to be synced again.
2015-02-26 21:57:16 +01:00
Aurimas Vinckevicius
3918adf21a Hyphenate ISBN when writing to DB
Only hyphenate if we're very confident that it's a list of unhyphenated ISBNs
2015-02-24 22:42:41 -06: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
Aurimas Vinckevicius
37921b0910 Add dontValidate parameter to ZU.cleanISBN
Don't validate check digit
2015-02-24 22:40:40 -06:00
Aurimas Vinckevicius
c809dfcbc4 Use only the first ISBN for CSL JSON 2015-02-24 22:40:40 -06:00
Aurimas Vinckevicius
f0bd1e77ff Use Zotero.Utilities.itemToCSLJSON when sending items to citeproc 2015-02-24 22:40:39 -06:00
Aurimas Vinckevicius
7f52e00341 Cleanup ISBNs when importing from web/search translators
Validate, convert to ISBN-13, and list in a space-separated format
2015-02-24 22:40:39 -06:00
Dan Stillman
b478d8f204 Fix some errors if pane is opened during initialization 2015-02-24 22:07:30 -05:00
Dan Stillman
93e3f68be8 Center align and pad error paragraphs on center pane crash 2015-02-24 22:07:30 -05:00
Dan Stillman
395d596105 Don't try to add child items to collections dragging cross-library
Previously, if you dragged a standalone attachment to a collection in another
library where the item already existed as a child item, it would crash Zotero
on a collection-item constraint.
2015-02-24 15:54:34 -05:00
Dan Stillman
0ab38f1d43 Add borders to collapsed collections/items splitters
We can think about making them more wider, etc., but this makes them ever so
slightly more visible.
2015-02-23 19:48:28 -05:00
Dan Stillman
b80d4cd369 Update locales from Transifex 2015-02-23 03:43:35 -05:00
Dan Stillman
a61157f8e3 Change "Zotero" button tooltip to "Open Zotero" 2015-02-23 03:33:34 -05:00
Dan Stillman
8371749bd1 Add Zotero.clientName, set to "Zotero" by default
We should eventually replace all hard-coded uses of "Zotero" with this
for use by unofficial versions (which legally can't be called "Zotero").
2015-02-23 03:31:52 -05:00
Dan Stillman
003db7c894 Toolbar icon tweaks on OS X 2015-02-23 02:38:48 -05:00
Dan Stillman
46bed210a1 Toolbar icon tweaks on Windows 2015-02-22 19:30:16 -05:00
Dan Stillman
0f402295be Toolbar icon tweaks on Linux 2015-02-22 18:56:39 -05:00