Commit Graph

58 Commits

Author SHA1 Message Date
Dan Stillman
3c60b98d69 Fix error when deleting non-attachment items caused by r1195 2007-02-21 19:53:04 +00:00
Dan Stillman
937072e875 Add Item.hasTags(tagIDs) -- returns true if the item has one or more of |tagIDs|
|tagIDs| can be an int or array of ints, so made Item.hasTag(tagID) just call hasTags()
2007-02-21 19:22:45 +00:00
Dan Stillman
baca59063d -- Basic support for indexing and scanning of PDF content --
This is still mostly proof-of-concept stage, but it seems to work on my Mac. It requires the pdftotext utility from the Xpdf project, which parses PDFs into plain text files. The Zotero fulltext indexer calls pdftotext on the PDF file and saves the plaintext version as .zotero-ft-cache in the attachment item's storage directory. It runs the fulltext word indexer on the plaintext file and also scans the plaintext file when doing a phrase search.

To try it out, install a copy of Xpdf (or just pdftotext) and either place pdftotext into the Zotero data directory or create a symlink. Either way, the file must be named pdftotext-{platform}[.exe], where {platform} is navigator.platform, with spaces replaced by hyphens (e.g. "Win32", "Linux-i686", "MacPPC", "MacIntel", etc.). On my Mac, with Xpdf installed via Darwin Ports, I create a symlink to /opt/local/bin/pdftotext named pdftotext-MacIntel. This setup will allow users to sync their Firefox profiles and still have Zotero use the appropriate platform-specific binary.

Assuming we go this pdftotext route, I think we'll instruct users to download and install Xpdf/pdftotext, possibly even providing binaries ourselves. The binaries are too big to include in the XPI. I'm going to look into creating a GUI to make linking Zotero to pdftotext easier. I also need to finish some of the other tickets related to indexer feedback and control.

There are also two new hidden prefs, fulltext.pdfMaxPages and fulltext.textMaxLength, currently set to 100 and 500K, respectively. The first determines how many pages of each PDF pdftotext processes, and the second determines how many characters and/or bytes of text files (the PDF cache files included) Zotero indexes and scans. These defaults may want to be adjusted higher or lower.

Closes #315, Hidden pref to set maximum file size to index/scan
2007-02-20 15:55:24 +00:00
Dan Stillman
0eb970fc9c Closes #443, Duplicate record via context menu
Works for regular items and notes, not attachments (and doesn't clone child items when duplicating parent)

New method Item.clone()


Unrelated changes:

- Fix note/attachment dragging, broken by notifier changes (r1131) a while back
- Item.save() now triggers Notifier even if a transaction is in progress, which I hopefully no longer had a reason not to be doing
2007-02-19 11:05:51 +00:00
Dan Stillman
264778f72c 2007-02-19 01:35:30 +00:00
Dan Stillman
38416da753 Closes #367, Display dialog to locate missing attachment files
New "Locate..." button in file not found dialog.

Split file not found message into two parts and updated localizations accordingly
2007-02-18 10:15:44 +00:00
Dan Stillman
f7671f2a93 Add autocomplete on some more fields in the metadata pane, including all the type and medium fields (but not across each other, since they're distinct fields)
Add asNames option to Z.ItemFields.getTypeFieldsFromBase() to return field names instead of ids
2007-02-18 07:57:02 +00:00
Dan Stillman
a1485213e4 Remove Z.Items.search(), which is no longer used
Removed unnecessary debug output when a collection has no children
2007-02-18 04:46:22 +00:00
Dan Stillman
7c8b185b27 Fix accessDate for attachments showing up as "false" (caused by r1162) 2007-02-17 23:48:53 +00:00
Dan Stillman
97d1e0b844 Closes #346, mapping for new item types
Closes #227, Indent nested collections in search drop-down
Addresses #528, Make search condition drop-down menu less unwieldy

- Created new distinct fields for differently labeled fields
- Mapped lots of fields to base fields
- Made base field search conditions search type-specific fields as well
- Removed type-specific fields that are based on base fields not show up in search conditions drop-down
- Added a tooltip when hovering over a condition in the search conditions drop-down that shows the fields it searches (when there's more than one)
- Moved search dialog CSS to separate file
2007-02-17 09:39:51 +00:00
Dan Stillman
3e7ddd04d8 Removed abstract-as-note functionality in favor of a regular 'abstract' field
Abstract displays in metadata pane as a cropped one-line field by default; clicking the 'Abstract' label toggles between the cropped field and an expanded view

Some problems with import/export: https://www.zotero.org/trac/ticket/537

Refs #537
2007-02-15 20:33:14 +00:00
Dan Stillman
d9b4b121b8 Don't allow Zotero.Notes.add() to set sourceItemID to an attachment 2007-02-12 07:08:47 +00:00
Dan Stillman
0a3913d792 Add 'isAbstract' property to notes arrays in toArray() output; changed translate.js to use it (not that it matters). We might want to add abstractID and abstract to the parent too--should the abstract be included if the user doesn't check "Export Notes"?
Don't include empty 'firstCreator' in notes and attachments in toArray()
2007-02-12 07:06:06 +00:00
Dan Stillman
cc1517da90 Closes #220, Add a more friendly way to enter dates in search window and accessDate field
Addresss #352, Make sure data layer doesn't allow bad data via the API

Access date field is now human-friendly. Also enforcing SQL date form for the field in the DB and discarding bad data passed via setField().
2007-02-06 11:03:22 +00:00
Dan Stillman
51e2d36dd1 Closes #532, Highlight collections containing item(s) when pressing alt/option
Also:

- New method, Collections.getCollectionsContainingItems(itemIDs, asIDs)
- Convenience property Zotero.isWin
- ZoteroPane.onKeyUp()
2007-02-06 09:08:06 +00:00
Dan Stillman
4caa096a46 Addresses #346, mapping for new item types
Closes #453, Check if any fields will actually be discarded on item type change before giving warning
Refs #530, Add base field conversion to translation level

Added mechanism for linking item type fields via base fields, e.g. publisher => label in audioRecording

New methods:

Item.getFieldsNotInType(itemTypeID, allowBaseConversion)
ItemFields.getLocalizedString(itemTypeID, field)
ItemFields.isBaseField(fieldID)
ItemFields.getFieldIDFromTypeAndBase(itemType, baseField)
ItemFields.getBaseIDFromTypeAndField(itemType, typeField)
ItemFields.getTypeFieldsFromBase(baseField)

Currently only the publisher fields are mapped -- I need more feedback on #346 before I implement the others (specifically on whether or not all these sorts of fields should be done as distinct fields or whether some should just be localized strings (in which case they'll autocomplete but not show up separately as search conditions))

Also added 'university' as distinct publisher field for thesis

Values of equivalent fields are now preserved when switching between item types (e.g. the 'studio' value becomes the 'label' value when switching between videoRecording and audioRecording), and the pop-up is much smarter--it will only prompt you if fields will in fact be lost, and it will list the fields that would be deleted.

Not finished:

- Searching for base fields doesn't yet search the type-specific fields, as Elena requested
- import/export/bib should be updated to use the ItemFields base conversion methods where appropriate -- data coming from the 'publisher' field from translators, for example, should be put into the appropriate type-specific field.
2007-02-03 17:08:03 +00:00
Dan Stillman
2b1fbf5e9a Fixes #507, Twisty on collection is not removed after deleting last subcollection
Same thing happened on New Subcollection -- data layer wasn't updating hasChildCollections
2007-01-30 23:37:49 +00:00
Dan Stillman
5a25fa3e0c Updated Notifier trigger architecture and data layer to send a pre-modification copy from toArray() of items/collections/tags as part of 'modify'/'delete' notifications
Sent as a fourth parameter to notify() -- parameter is an array of objects (in the same order as the ids) that currently contain a single property, 'old', which holds the toArray() object

Copies are not sent with 'modify' when it's only meant to refresh the UI and there's another trigger that covers the data change (e.g. removing a tag from an item sends both an item modify and an item-tag add, but the modify doesn't get a pre-change copy of the item since any consumers that care should just monitor item-tag)

 Also:

 - Removed Notifier.enable()/disable()
 - Notifier no longer sends modify() if item already deleted
 - New methods: Collection.toArray(), Zotero.Tags.toArray(tagID)
 - Removed a few extraneous triggers
2007-01-30 10:21:01 +00:00
Dan Stillman
56a0863a9d Fixes #520, deleting items from smart collections/search fails under certain circumstances
Simon, reopen if this doesn't fix the problem you were referring to.

(Also removes Notifier.enable()/disable() from its use in Item.erase() while we're at it.)
2007-01-30 06:16:03 +00:00
Dan Stillman
a3126da160 Addresses #502, Special handling for automatic tags
- Automatic tags now appear in orange; tooltip says either "User-added tag" or "Automatically added tag"
- New menu in tag selector to toggle automatic tags
- User and automatic tags are combined in tag selector, so renaming/deleting a tag will affect both user and automatic, regardless of view mode
- Editing a tag makes it a user tag, as does adding an identical user tag to an item (rather than creating a second one)
- ingester/export will need to be adjusted to add automatic tags

Changed:

Item.addTag(tag) => addTag(tag, type)
Item.getTags() - now returns 'id', 'tag', 'type'
Item.toArray() - tags now include 'type' property (from Item.getTags())
Tags.getID(tag) => getID(tag, type)
Tags.getAll() => getAll([types]) - types is an optional array of tagTypes to fetch; now returns objects with 'tag' and 'type' properties
Tags.getAllWithinSearch(search) => Tags.getAllWithinSearch(search, [types]) - now returns object with 'tag'/'type'

Added:

Tags.get(tagID) - returns object with 'tag' and 'type' properties
Tags.getIDs(tag) - returns all tagIDs for this tag (of all types)
Tags.getType(tag) - returns array of tag types matching given tag

For type property, 0 == user, 1 == automatic
2007-01-22 22:32:52 +00:00
Dan Stillman
ebe4ec7446 Fixes #475, Quicksearch doesn't find child items in collections or saved searches
It ain't pretty, but (I think) it works.

Also:

- Fulltext content search should handle ANY/ALL modes better, but that needs some more testing.
- Tag selector now properly takes fulltext content search conditions into account when filtering to scope.
- Added Zotero.Search.hasPostSearchFilter(), since getSQL() isn't sufficient with post-search filters.
2007-01-17 11:51:11 +00:00
Dan Stillman
28a6b5f7cb Closes #494, Remember "Rename associated file" setting
Also:

- Clicking OK on rename dialog with "Rename associated file" checked but without changing the filename would delete the original file.
- Add "Show File" button for snapshots
2007-01-12 07:18:53 +00:00
Dan Stillman
c33cc7d0c9 Not sure how this bug made it this far, but don't return empty values in Items.get() when passed an array including nonexistent itemIDs 2007-01-09 05:49:31 +00:00
Dan Stillman
1bfa4425bd Merge r1036, r1037, r1039, r1040, r1041, r1042 back to the branch 2007-01-05 08:17:01 +00:00
Dan Stillman
55244b5cf7 Closes #418, Context menu option to rename attached files
New methods, Item.renameAttachmentFile(newName, force) -- _force_ forces overwrite of an existing file

For the moment, implemented in the UI via a checkbox in the attachment title rename dialog (accessible by clicking on the title in the right pane) to rename the associated file as well -- this might be replaced by the upcoming keep-filenames-in-sync-with-attachment-titles feature, but it's probably fine for Beta 3.

Also new:

- Zotero.Attachments.getPath(file, linkMode) to get a relative or persistent path as appropriate given the link mode
2007-01-03 11:16:36 +00:00
Dan Stillman
b9f036e5f1 Fix various things I broke (empty collections, auto-selection of new items, editing of inline attachment notes) 2007-01-03 07:45:32 +00:00
Dan Stillman
1b675ecc7e Fixes #447, Disable tags and related on abstracts
New methods:

Item.removeAllRelated()
Item.removeAllTags()

Also:

- Tag selector didn't initialize properly if it was closed when Firefox was started
- Items pane would lose open state of items and current scroll position when an item was edited while the tag selector was open -- added save/rememberOpenState() and save/rememberFirstRow() to fix this, and these could also fairly easily be used to remember the open state while switching between collections
2007-01-03 06:54:41 +00:00
Dan Stillman
b8321f13ea Fix ZoteroPane.selectItem() to rely on itemsView.selectItem() to find the item in the current view if it's there, regardless of mode -- this simplifies ZP.selectItem() and fixes problems adding items while viewing a saved search. If the new item(/attachment/note) matches the saved search, it'll now appear and become selected. Otherwise, Z will switch to the Library and the new item will be selected in there.
There might be some regressions from this, but it seems to work fine.

Also:

- Fixed JS strict warnings in popup note window
- Use Zotero.Notes.add() when using toolbar button instead of a two-stage save with ZP.newItem('note')
2007-01-02 10:50:38 +00:00
Dan Stillman
ecab0e5785 Closes #470, Add tag add/modification/delete targets to Notifier
Closes #471, Tag selector should update when tags are added/removed

Tag Selector overhaul:

- Right-click to rename/delete tags globally
- Filter tags to only those associated with currently visible items, with a Display All checkbox to show others in gray -- scope list set via new callback mechanism in the items tree
- Drag and drop items onto tags to batch assign
- Tag Notifier events, currently unused (tag selector currently just refreshes on all item events, since doing granular tag updates is considerably more complicated)
- Performance improvements, offset by the new features that make it slower

There should probably be an option to use either an ANY or an ALL search in the tag selector... (It's ALL by default now.)


New methods:

- Zotero.hasValues(obj) -- return true if an object (/associative array) has at least one value, false if not
- Zotero.Item.addTagByID()
- Zotero.Item.hasTag()
- Zotero.Tags.getAllWithinSearch(search)
- Zotero.Tags.rename(tagID, tag)
- Zotero.Tags.remove(tagID)
- ItemTreeView.addCallback()
- ItemTreeView.setFilter('search'|'tags', data) -- replaces searchText()
- CollectionTreeView.getSearchObject() -- search object used to generate the items list
- CollectionTreeView.getChildTags()
2006-12-25 07:06:46 +00:00
Dan Stillman
bd7d95a576 Prevent Item.save() from running when hitting Escape in an empty field (I don't know when this started, but Beta 2 didn't do it...) 2006-12-21 08:43:55 +00:00
Dan Stillman
3988bce5ac Closes #446, either add icons for new item types or implement a function to get the image src for a given item type
Adds Item.getImageSrc() and ItemTypes.getImageSrc(string itemType)
2006-12-15 23:06:36 +00:00
Dan Stillman
a9cb13710c Fix error changing item type when fields don't exist in new type 2006-12-11 01:49:49 +00:00
Dan Stillman
8520125d6e Taking advantage of the new Notifier queuing, group item deletes into a single Notifier event queue -- this makes multi-item deletes much, much faster
I'm doing this manually with Notifier.begin(true)/commit(unlock) instead of putting them all in a DB transaction since Item.erase() erases files too, so rolling back previous deletes would be bad

Notice the finally {...} block -- this ensures that the event queue is unlocked even if there's an error deleting (or else notifications would break until Firefox was restarted)

Other changes:

- Zotero.Items.erase() now supports multiple items and the recursive flag to erase children
- Fixed a few JS strict warnings in the items view
2006-12-08 19:50:44 +00:00
Dan Stillman
5876debd36 Closes #362, Support abstracts
N.B.: Some changes from plan on ticket

New methods:

Item.setAbstract(true|false) -- make a note an abstract (and clear existing abstract if there is one for source item) or clear abstract status
Item.isAbstract() -- returns true if note is an abstract, false if not
Item.getAbstract() - get itemID of child abstract note or false if none
ZoteroPane.toggleAbstractForSelectedItem()

Changed methods:

Item.updateNoteCache(text, isAbstract)
Notes.add(note, sourceItemID, isAbstract)
Item.setSource() -- moving abstract note to another source with an existing abstract or setting as an independent note will make note not abstract

Other changes:

- Context menu options in items pane: "Set note as abstract" and "Unset note as abstract"
- Child notes are now displayed before child attachments so that abstract will be first
2006-12-07 00:45:41 +00:00
Dan Stillman
f87d29a6b9 Zotero.MIME fixes:
- Don't try to get MIME type from extension if extension is blank
- Add text/css to native text types, even if snapshots add some html tags (why is that?)
- Get rid of extraneous "this." prefixes
2006-12-06 00:08:38 +00:00
Dan Stillman
d3e29108a8 Addresses #400, Report generation
A work in progress:

- Implemented zotero:// custom protocol handler, which will likely be useful for other things too
- First version of XHTML/CSS detail view -- definitely needs feedback, work, and refinement but is more or less functional
- Added XUL-side interface and context menu options for loading report URLs

Going forward:

- Other formats (RTF, CSV)
- Other views (list view, annotated bibliography, etc.)
- Report options window (let the user which fields to include (with saved templates?))
- Ability to specify custom CSS files?
- Extension of Zotero protocol handler to trigger Zotero events? This would allow more interactive reports with the ability to click to select items in the Z pane, run searches by clicking on tags, etc., but would have to be limited to idempotent actions.

Other changes:

- ZoteroPane.getSortField() and ZoteroPane.getSortDirection() 
- Zotero.Utilities.htmlSpecialChars(str)
- Fixed sort direction in items pane (triangle icon now goes the right direction, though the default direction on clicking a new column is incorrect)
- firstCreator now included in toArray(), though it's not particularly correct (#287, more or less)
- ZoteroPane.getSelectedCollection/SavedSearch/Items now take asIDs parameter to return ids instead of objects
2006-12-01 06:01:26 +00:00
Dan Stillman
3d6bfbe6d5 Fixes #386, Context menu option for creating a new subfolder
Fixes #226, Insert new collections and saved searches in the proper order

Also:

- Only display "New Collection..." and "New Saved Search..." in Library drop-down
- Sort collections and saved searches case-insensitively
2006-11-18 19:48:33 +00:00
Dan Stillman
54790c13d8 Purge tags on item delete 2006-11-10 09:23:33 +00:00
Dan Stillman
3f59f808e3 Tag Selector pane -- filter the current items view by one or many tags
Will be getting a lot more functionality (e.g. renaming, deleting, maybe assigning of tags from the pane), some UI changes, and possibly some modified behavior (e.g. should it only show the available tags for the items that you're viewing, show all and let you use the interface to assign tags (say, by batch drag and drop), or have a checkbox to toggle between the two modes)

Other notes:

- Implemented as XBL binding, so should be reusable elsewhere if necessary
- Needs a better icon and possibly different icon placement
- Doesn't handle live updating of modified tags yet -- will need a Notifier target
- New methods Tags.getAll() and Tags.search()
- I really wish I'd created a ticket for this so I could check it off
2006-11-09 13:33:49 +00:00
Dan Stillman
de5b998139 Closes #388, Use relative paths for imported attachments
Also fixes breakage of linked files since multiple attachments update
2006-11-05 09:13:01 +00:00
Dan Stillman
e73285ffc5 Improve date field handling
- Item.setField() stores dates in a multipart format beginning with an SQL date followed by the user's entry, so "November 3, 2006" becomes "2006-11-03 November 3, 2006" -- date field entries are parsed with Zotero.Date.strToDate() if not already in multipart format

- Item.getField() returns just the user part unless passed the new second parameter, _unformatted_, which returns the field directly from DB without processing (e.g. the full multipart string)

- Added SQLite triggers on the itemData table to enforce multipart format even if the table is modified outside the API

- Migration step to update existing dates

- Indicator next to date field to show what we've parsed and a tooltip over the date field to show the SQL date -- though I'm not sure how well the abbreviation part will localize (i.e. can you abbreviate 'month' in Chinese?)

One obvious problem is how to handle date ranges when sorting or searching, which may end up rendering this whole method fairly useless (though I guess the multipart format could begin with two SQL dates instead of just one, at the cost of some storage space...).


Other changes:

- Utilities.lpad() handling for undefined value parameter

- new Zotero.Date methods: strToMultipart(), isMultipart(), multipartToSQL(), multipartToStr(), isSQLDate(), sqlHasYear(), sqlHasMonth, sqlHasDay getLocaleDateOrder() (the last one unused for now)

- try/catch around manual itemData INSERT execute() statements in Item.save()
2006-11-03 09:23:24 +00:00
Dan Stillman
58558c37a3 Fix for error when creating new items or attachments with saved search selected
Item.getSource() no longer protests when called on a regular item (it just returns false)
2006-10-31 21:03:08 +00:00
Dan Stillman
99f7badf42 Fix for collections not refreshing on item delete (thanks Simon) and new snapshots not getting added to the active collection (since yesterday) 2006-10-24 08:04:41 +00:00
Dan Stillman
953a43064a Item.getCreators() didn't call _loadCreators(), apparently... 2006-10-24 05:57:00 +00:00
Dan Stillman
677b047172 Addresses #367, Handle missing attachment files
- Catch errors trying to display missing files and display message to user

- Switch to persistent descriptors rather than relative paths for attachment paths -- this will fix attachments on networked drives (which, at least on Windows, were not working and apparently in some cases breaking entire Zotero installs), but since WebBrowserPersist.saveDocument() is asynchronous and file.persistentDescriptor can't be set on Macs before the file exists, Attachments.importFromDocument() no longer returns the id of the new attachment, so translate.js had to be changed accordingly

- Try to convert relative descriptors to persistent ones with migration step (and later on access, if persistent fails)

- Added Zotero.WebProgressFinishListener(onDone)


Next step would be to throw up a file dialog to let the user locate the missing file
2006-10-22 10:11:29 +00:00
Dan Stillman
cf37ce6e82 Addresses #352, Make sure data layer doesn't allow bad data via the API
Don't allow a save() with noncontiguous creator order indexes
2006-10-21 06:04:30 +00:00
Dan Stillman
79efa85482 - Default to double-field mode in setCreator() if not specified
- Allow creator type to be specified as name rather than id in setCreator()

 - Use object rather than array in getCreator()
2006-10-19 20:35:28 +00:00
Dan Stillman
b7a261d3da Allow item types to be passed by name in Item constructor -- don't know why I never did this before, since they're cached
Feel free to remove redundant calls to ItemTypes.getID()

(I actually see a whole bunch of calls to the constructor using type names in scrapers, but presumably those are converted to itemTypeIDs in translate.js, since they seem to have been working just fine...)
2006-10-12 06:44:07 +00:00
Dan Stillman
081b544688 Change collection notifier event to 'delete' instead of 'remove' to be consistent with item deletions (as opposed to merely removing items from collections, which uses 'remove') 2006-10-11 04:20:05 +00:00
Dan Stillman
ba5b978afb Quick fix for note saving problem from Roy 2006-10-06 00:12:47 +00:00