A custom reports solution (for now)
I've often wished I could customize Zotero's "generate report" function. It's great for sharing notes and associated references, but three things bug me:
1. I don't want all those fields.
2. I want to alphabetize the results by author, not title.
3. I don't like having to include a separate stylesheet when I email the report.
Apparently, the ability to customize reports is coming, but it isn't here yet.
So, I've applied my rudimentary PHP skills to hack a holdover solution: a script that takes a report's html source, gives you some options for fields you like to exclude, and then spits back out the customized report. You can also choose whether to sort by title or author, and the report's stylesheet inserted as inline CSS, so the file stands by itself.
You can find this contraption at http://jasonpriem.com/projects/report_cleaner.php ; you can run it off my server or download the source code and run it on your own. Feel free to hack it up; I put it together quickly, and I'm sure it can be improved upon.
Happy Researching!
1. I don't want all those fields.
2. I want to alphabetize the results by author, not title.
3. I don't like having to include a separate stylesheet when I email the report.
Apparently, the ability to customize reports is coming, but it isn't here yet.
So, I've applied my rudimentary PHP skills to hack a holdover solution: a script that takes a report's html source, gives you some options for fields you like to exclude, and then spits back out the customized report. You can also choose whether to sort by title or author, and the report's stylesheet inserted as inline CSS, so the file stands by itself.
You can find this contraption at http://jasonpriem.com/projects/report_cleaner.php ; you can run it off my server or download the source code and run it on your own. Feel free to hack it up; I put it together quickly, and I'm sure it can be improved upon.
Happy Researching!
Jason: Nice work on this. A couple notes:
1) Report sorting is rather buggy in Zotero at the moment, but you can actually sort by creator in Zotero by sorting the items list in reverse alphabetical order on the Creator column and then generating the report from the context menu of the collection. (Alternatively, you can just append ?sort=firstCreator to the end of the report URL.)
2) The reports are XHTML, which has the benefit of being valid XML. So for a tool like this, it's probably cleaner, less error-prone, and more forward-compatible to use PHP's XML functions rather than treating everything as a string and doing lots of regexes. Doesn't matter for this, of course, but something to keep in mind.
1. Thanks for the tip on sorting; works like a charm, although the first way (reverse alpha by creator) only works if you want a report from a whole collection, as opposed to a group of selected items. The append-to-url method works great regardless.
2. Yes, I considered going that route, but I just started doing PHP, and I don't know much about its XML functions; that's why I went the admittedly uglier regex method. I figure by the time the format of the reports changes enough to break the regexen, this thing won't be needed. But your comment makes me think maybe I'll redo it the Right Way now, as an excuse to learn more about parsing XML with PHP.
Thanks for you comments, and keep up the awesome work. I seriously want to marry Zotero, and then name all our first ten children after it. Best. App. Ever.