Commit graph

4236 commits

Author SHA1 Message Date
Dan Stillman
9d353b4e25 Use Zotero.DB.MAX_BOUND_PARAMETERS instead of hard-coded number 2015-02-27 23:58:49 -05:00
Dan Stillman
b478d8f204 Fix some errors if pane is opened during initialization 2015-02-24 22:07:30 -05:00
Dan Stillman
3aaf9e341c Fix NO_INTERFACE error after entering tag in tags box 2015-02-03 15:36:01 -05:00
Aurimas Vinckevicius
ab7fc1614d Fix bug in collectionTreeView that caused tree row loss
...when collapsing/expanding group libraries
2015-01-29 19:31:55 -06:00
Aurimas Vinckevicius
d98a79c33f Fix typo in item field caching code 2015-01-29 19:31:54 -06:00
Aurimas Vinckevicius
9574e56ad6 Convert itemType to itemTypeID in itemTreeView.js, not items.js
itemType comes from the column name in the tree view, so it makes most sense to do it there. Otherwise, Zotero was complaining about invalid field somewhere
2015-01-29 19:31:54 -06:00
Dan Stillman
276cd82fe4 Fix NO_INTERFACE error tabbing between fields
Not sure why this is throwing, but I'm also not sure why it was
necessary in the first place
2015-01-28 18:28:44 -05:00
Dan Stillman
8499ec6211 Allow extra data for single-object notifications to be passed directly
Previous it had to be keyed by id (and still can be, but if there's only
a single id the notifier will now key it automatically)
2015-01-28 17:25:17 -05:00
Dan Stillman
b785a3bfce Dynamically populate charsets table
Instead of limiting charsets to a fixed list, dynamically populate it
with any charset name of less than 50 ASCII characters. Previously,
unknown charsets were discarded.

Zotero.Item.prototype.attachmentCharset now always returns a charset
name. It can be set with either a name or a charsetID.

Also:

- Remove the unused 'originalPath' column in itemAttachments
2015-01-28 17:15:16 -05:00
Dan Stillman
b670084925 Use 'version' for groups instead of 'etag'
APIv3 uses 'version'
2015-01-28 17:05:25 -05:00
Dan Stillman
58c062dd06 Add per-library lastsync times and synced flags for sync delete logs 2015-01-28 15:56:46 -05:00
Dan Stillman
6199742986 Make attempt to read from an invalid DB column a fatal error 2015-01-28 15:56:46 -05:00
Aurimas Vinckevicius
5db52ac1c3 Add 'year' as a gettable field for Zotero.Item 2015-01-26 15:46:56 -06:00
Aurimas Vinckevicius
a0a656eac0 Allow setting a specific dateModified on item
To be used in feed items to set the last _remote_ modification date
2015-01-26 15:46:49 -06:00
Aurimas Vinckevicius
7f5555aab6 Inheritance-based Zotero.DataObjects 2015-01-26 15:46:49 -06:00
Aurimas Vinckevicius
707a65c63e Remove deprecated Zotero.Items.add 2015-01-26 15:46:49 -06:00
Aurimas Vinckevicius
20444eceb7 Sanitize primary fields in setField before comparing to current value 2015-01-19 11:16:17 -06:00
Aurimas Vinckevicius
f0aae549c5 Allow bypassing library edit check when saving data objects
Pass {skipEditCheck: true} option to .save()
2015-01-19 11:16:17 -06:00
Aurimas Vinckevicius
efdc6f1230 Add loadAllData to Zotero.dataObject
Useful when trying to duplicate items, which requires access to all data
2015-01-19 11:16:17 -06:00
Aurimas Vinckevicius
84d8c17d6e Move erase to DataObject and make it modular 2015-01-19 11:16:16 -06:00
Aurimas Vinckevicius
cb56b9607d Move loadPrimaryData to Zotero.DataObject 2015-01-19 11:16:16 -06:00
Aurimas Vinckevicius
b83bc40426 Various fixes for Zotero.Item 2015-01-19 11:16:16 -06:00
Aurimas Vinckevicius
83187eaa35 Validate numeric field IDs 2015-01-19 11:16:16 -06:00
Aurimas Vinckevicius
adab8e45a7 Additional tweaks to DataObject & descendents to support inheritance 2015-01-19 11:16:15 -06:00
Aurimas Vinckevicius
442388304b Add Zotero.Libraries.isGroupLibrary 2015-01-19 10:37:22 -06:00
Aurimas Vinckevicius
9f535e0e91 Use Zotero.extendClass for inheritance 2015-01-19 10:37:22 -06:00
Aurimas Vinckevicius
a56e800d7c Add Zotero.localeCompare
Can be used directly in Array.sort() as the sorting function.
Uses LocaleCollateion.compareString internally
2015-01-19 10:37:21 -06:00
Aurimas Vinckevicius
9700cdde38 Add Zotero.extendClass 2015-01-19 10:37:21 -06:00
Aurimas Vinckevicius
f7220378dd Pass fixGaps to Zotero.Search.save() in an options object 2015-01-19 10:36:42 -06:00
Aurimas Vinckevicius
e02945b591 Add a centralized, modular .save() method to DataObject
.save calls ._initSave(), _saveData(), _finalizeSave() internally passing `env` object to each to act as an environment for passing around variables
* _initSave should determine if the save is possible and return a promise for either `true` or `false`. It should also set up the environment, e.g. determine if this `isNew`
* _saveData performs the actual saving to the database, but should not do any terminal steps in the save process so that any extending classes could extend this method to write additional data to the database
* _finalizeSave should perform any finalization before the data is committed to the database.

_recoverFromSaveError is called with `env` and an error that occurred. This method should perform any recovery steps, e.g. discarding the save and reloading the item from the database into the cache.
2015-01-19 10:36:42 -06:00
Aurimas Vinckevicius
56f244a4bb Add id and libraryID getters for all data objects 2015-01-19 10:36:42 -06:00
Aurimas Vinckevicius
4657c46d4b getClassForObjectType => getObjectsClassForObjectType 2015-01-19 10:36:41 -06:00
Aurimas Vinckevicius
c222a3248a Transition __defineGetter/Setter__ to Zotero.defineProperty 2015-01-19 10:36:41 -06:00
Aurimas Vinckevicius
f7d5ebc357 Default to "configurable: true" in defineProperty 2015-01-19 10:36:41 -06:00
Aurimas Vinckevicius
29e9946123 Allow to define properties for late initialization via defineProperty 2015-01-19 10:35:33 -06:00
Aurimas Vinckevicius
d4bd0ee811 Move defineProperty from ZU.Internal to Zotero 2015-01-19 10:31:39 -06:00
Aurimas Vinckevicius
aca15c0d2d Fix deleting saved searches 2014-11-14 01:50:02 -06:00
Aurimas Vinckevicius
0e31e7ca01 Wait for the item pane to initialize before focusing first field 2014-11-14 01:50:02 -06:00
Dan Stillman
e4451d9002 Merge pull request #575 from aurimasv/async_db-av
Async DB tweaks (attempt 2)
2014-10-30 01:47:49 -04:00
Dan Stillman
efa8346d37 Create user library row in libraries table when initializing DB 2014-10-30 01:22:58 -04:00
Aurimas Vinckevicius
3f85ee73b3 Don't count on 0 being the user libraryID in Zotero.Libraries
Some other minor tweaks
2014-10-29 23:52:21 -05:00
Aurimas Vinckevicius
bc8a340c30 Virtualize data objects 2014-10-29 23:51:43 -05:00
Aurimas Vinckevicius
5ee40f6601 Add ZU.dom2text and Zotero.Utilities.Internal.getDOMDocument
* getDomDocument: returns a detached DOMDocument object
* dom2text (TODO): Currently just returns Node.textContent, but is intended to return Zotero-formatted string based on text formatting in the DOM and the Zotero.Item field that the text is meant for
2014-10-29 22:16:21 -05:00
Dan Stillman
f635d82ea6 Merge pull request #553 from aurimasv/async_db_if_exists
To be safe, DROP things only IF EXISTS for database upgrade.
2014-10-23 19:38:35 -04:00
Aurimas Vinckevicius
20564dd13a To be safe, DROP INDEX only _IF EXISTS_ for database upgrade.
Triggered by DROP INDEX fulltextItems_version, which apparently doesn't always exist.
2014-10-23 13:18:00 -05:00
Dan Stillman
5c94119c70 Fixes duplicates view for async DB
It's way too slow, though, since the whole list is regenerated after
merging.

Fixes #519

Also:

- The arguments to Zotero.Item.prototype.clone() have changed, and it no
  longer takes an existing item or copies primary data. To create an
  in-memory copy of an item, use the new Zotero.Item.prototype.copy().

- Zotero.Item.prototype.getUsedFields() now gets in-memory fields rather
  than the fields in the database
2014-10-10 04:49:39 -04:00
Dan Stillman
15d28014ed Fix creator type assignment in item box 2014-10-10 04:46:10 -04:00
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