Zotero Item History [plugin]

I am pleased to announce a Firefox add-on that extends the Zotero client user interface with per-collection browsing history.

(Edit: for use with Zotero 2.1.6 or above.)

As those who have seen my office (or indeed the code I have written) can attest, I do not have a flair for organization. Zotero provides at least four separate ways of ferreting meaning out of a library: search; tag filtering; related-items links; and free-form browsing within a library or collection. Now that, with the advice and assistance of many, I have at last gotten the citeproc-js processor into a stable condition, research beckons -- and I can see that the prospects for replicating my office inside my Zotero library are better than even.

I've tried to fend off disorder in advance with this plugin. Without any special action by the user, it tracks the items visited from the starting point of a particular collection. It works sort of like this:
  • Each collection or smart search and each top-level library or group has its own separate history list.
  • To keep things sparse and comprehensible, items are added to a given history list only once.
  • For the same reason, clicks on child items will only add their parents.
  • Items outside the "governing" collection (i.e. items removed from the collection after being first viewed there, or those added via a "Related" link, without explicitly selecting a separate collection in the left panel) are presented seamlessly as part of the navigable collection-based history list.
  • A "Select all" context menu option makes it easy to capture the items in a collection history and (say) drop them into a freshly minted collection if desired.
Apart from that there shouldn't be much need for explanations. The plugin provides three buttons in the toolbar, and a bit of clicking around should reveal what they do.

The plugin can be installed by clicking on the following link to the Zotero Item History XPI. Feel free to post a note here if you have difficulties; I can't guarantee full support, but it should work on all platforms.

I've put the source code under the AGPL, and I will put a copy online fairly soon. Quite a bit of work was needed to get this external tool to smoothly shadow the Zotero interface, [1] and it might provide a starting point for building similar extensions to support other workflows.

[1] Let's hope that "was" in this sentence doesn't beg to be changed to "would have been".
«13
  • hmmm - downloaded fine, but then I get "Zotero Item History could not be installed because Firefox cannot modify the needed file".
    Ubuntu and Firefox 4.0.1
  • edited May 29, 2011
    Aha. I wondered about that. I've piggybacked on the Zotero database infrastructure, which wants to install the database in the Zotero data directory. It works fine here (Linux) but it could be that's where it's breaking for you. Is there a hint of the target filename in the log?

    (Edit: Oops. Ubuntu, you say. Hmm. Which version?)
  • Ubuntu 11.04
  • just tried Win XP - I get past the hurdle mentioned above - firefox then claims the plugin will be installed at restart, but when the restart is done, there is no sign of the plug-in.

    Not sure what information you need for this to be any help ? Let me know what I can provide and how.
  • I can't replicate the error in Ubuntu 10.x. Time to capitulate to the popup messages I've been receiving over the past weeks and upgrade, I guess. I'm not sure whether this is a security issue (which might require a significant amount of coding to work around the fault) or just a packaging thing. We'll see; I'll post again when I have something to show.
  • There's only one thing: do you see any suspicious errors in Firefox Tools -> Error Console? If not, I'll try to get access to a Windows machine tomorrow and see if I can make it fail there. This little app doesn't have the nice debugging infrastructure of Zotero, and under Windows I'm not exactly sure how to obtain error traces (and in any case, the code doesn't generate any chatter, so Error Console is probably all we'd see anyway).

    We'll get there, though.
  • On the Windows machine there is nothing of interest in the error console, neither before nor after the restart.

    More luck on the Ubuntu 11.04 machine :
    Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFileOutputStream.init]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/components/nsSessionStore.js :: sss_writeFile :: line 3975" data: no]
    Source File: resource://gre/components/nsSessionStore.js
    Line: 3975

    Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFileOutputStream.init]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/components/nsSessionStore.js :: sss_writeFile :: line 3975" data: no]
    Source File: resource://gre/components/nsSessionStore.js
    Line: 3975

    Hope that's relevant - it certainly appeared just after the error.

    Really looking forward to this plugin - thanks for the hard work!
  • edited May 29, 2011
    On the Linux machine, you might try grabbing the XPI file itself with something like this from the command line:wget http://gsl-nagoya-u.net/http/pub/zotero-item-history.xpi
    then, visiting the Firefox profile extension directory, adding a subdirectory "zotero-item-history@mystery-lab.com":mkdir ~/.firefox/mozilla/<funny_chars>/extensions/zotero-item-history@mystery-lab.com
    then putting the plugin there and unzipping it. If Firefox will run it from that point, we can narrow this down to a security issue, under Linux at least.

    (Edit: I haven't been able to find a reference on the Net that exactly reflects this error. The module failing can apparently be associated with local file permissions issues, encryption service denials, and antivirus protections. I suspect the latter, but don't really know. Before tackling the issue, I'll try to get better information on whether it is permissible, in the Firefox architecture, for one plugin to install software in a directory created by another. If that's okay, then maybe it's just a matter of trusted signing or something.)
  • As another low-cost poke in the dark, possibly some FF clients want to see the chrome directory zipped into a jar file. I've just refreshed the copy at the original link with a build in that form. Limited expectations, but if you click on the link again and it works this time, that would be wonderful luck.
  • tried installing from the link again - same error.

    Also tried the manual installation approach but keep coming up against the fact that the shell claims that extensions directory is read-only and no amount of sudo will sort it out. My rather limited skills in command-line wizardry probably don't help, but I can't create the directory to put the .xpi into it
  • Hmm. Looks like Ubuntu 11.04 is going to be an interesting experience. But if you don't have trouble installing other plugins, there must be a channel through which we can inject this. I'll need to learn more about Firefox package distribution, looks like.
  • I'm unable to install it with firefox 3.6.17 (and zotero 2.1.6, win 7).
  • edited May 29, 2011
    I managed to install on top of multilingual (Ubuntu 11.04; Firefox 4.01, no special magic required), but the buttons seem perpetually disabled / grayed-out. Am I missing something?

    Also, I think you should be able to tap into Zotero's debug logger if you want to-- if you have access to the Zotero object, then you have access to things like the debug function.
  • @clio_13, @ajlyon, @Gracile,

    I've pushed a fresh copy to the same URL that may work a bit better. I've borrowed some more install logic from Zotero, eased a restriction to Firefox 4 (it may work with 3.6, I'm not sure), and made the attachment of "listeners" to the Zotero UI a little more robust. The plugin will also try to issue debugging output via Zotero.debug, if it's available.
  • @ajlyon,

    Working on class prep this morning, I see that the buttons stay inactive under one combination of conditions: if Zotero is set to Tab mode and Firefox is restarted, and then Zotero is changed to Pane mode, the buttons stay inactive until a return to Tab mode.

    The other way around -- starting with default Pane mode, and then switching to Tab mode -- seems to work in both modes. The mode switch is a great mystery to me, but I'll keep an eye on this and see if I can work out what the deal is with that one combination.
  • Yay - it now installs on the linux machine (haven't tried Windows yet) - but I am having the same issue as Ajlion, the buttons stay inactive. And changing from the tab it started into to pane and back did not help.
  • Well, half a positive report is better than none -- and the install failure was surely the highest hurdle. Do you see any errors in either the Firefox Error Console or the debugging log? In the debugging log, you should be able to find them by searching for the word "ZoteroItemHistory".
  • Nothing in the Firefox error console, this is the debug log for me clicking on several items in a collection : http://pastebin.com/W2YZ5zCr
  • Meanwhile, I have a small further revision idea brewing. In nested subcollections, items browsed could be added to the parent collection lists as well. The highlighted item in the menu list at higher levels could then show which subcollections the item appears in, by calling the same function that Zotero ties to the ALT (under Linux) key. That would give us a bit of cross-collection awareness similar to the behavior with the recursiveCollections hidden option, but without the top-level clutter.
  • That set me wondering : I had recursive collections on for all the previous testing, but turning it off doesn't make it work either.
  • I've just put up a fresh copy with some changes that should improve things. This new copy will also dump a little more debugging output, to help us hone in on the source of the button activation failures.
  • I should have mentioned that recursiveCollections shouldn't make any difference either way. I had it turned on the whole time I was writing the code for this.
  • so close - reinstalling the newest version means the green down arrow and the house-icon turn green when I click on items in a collection. But clicking on the green arrow doesn't take me back and although clicking on the house opens up a list, clicking on an item in the list doesn't take me anywhere. Debug-logging for, successively, clicking on items, trying the arrow to go back and trying to get at an item in the logged history-menu : http://pastebin.com/GBfQqNPE
  • edited May 30, 2011
    It's failing to find a Zotero item. I can make it fail past that, but it should not happen; possibly an earlier attempt with a bad client pushed some bad data into the list. Try clearing the list (right-click on the house, select "Clear collection history"), and clicking on some items in the collection again.
  • Yay. In testing my fanciful collection-highlight extension, I'm getting the same error shown in your trace ("item.inCollection() is not a function"). We're near the end of this little journey.
  • I tried clearing the collection history - that didn't make a difference, still the same result of the arrow not doing anything (despite appearing in green) and the items in the list under the house not being called up upon a click
  • Try now. I found the source of the error in your log (and was suffering from it myself, it turns out). I've also implemented upward cascading (so items clicked upon in subordinate collections will be recorded on the lists of their parents as well). After playing with it, I decided there's no point in implementing automated highlighting when scrolling over items in the pulldown list -- it's easy enough to touch the key on items of interest, so the extra complexity is not really needed.

    See how it goes; I'm hopeful that this one will get you going.
  • Brilliant - well done! Works flawlessly now and is already proving incredibly useful (writing a big paper and trying to find all useful material in a v big collection...)
    Thanks again!
  • edited May 30, 2011
    Great! I too am finding this useful here, although my collections are still comparatively small.

    Enjoy!

    (And thanks all around for the patient feedback during debugging.)
  • For anyone interested, I've put the source code of the plugin online at BitBucket.
Sign In or Register to comment.