Commit graph

5073 commits

Author SHA1 Message Date
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
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