Add more caching.

Note that Rails caching is a bit funny, so there is some custom code
here to make it work better for our needs. By default it works via
controller actions, but by registering Sweepers as Observers in
application.rb one can make it work via models. Some of the stuff in
CacheHelper helps with this:
- the sweeper, in order to call expire_fragment, needs to have a
controller attached, which ensure_controller can do
- the usual fragment naming (:action => X, :controller => Y) etc.
that the cache and expire_fragment methods use require not just a
controller but a request. Since working on the model side we don't
necessarily have this, CacheHelper provides methods for caching
and expiring that convert this kind of naming into a string for use
with the provided methods. With strings the url_for machinery doesn't
get called and so this isn't a problem. These methods also provide us
an opportunity to deal with locale automatically, which we take.

This is used to cache the index page for publications. Note that this
happens at two levels - the whole page and each row of the index table.
The sweeper expires these as appropriate when a Work, Publication, or
Publisher changes.

Obviously this could be used in more places, but I want to commit this as
an example of how one might go about doing it.
As if to demonstrate the inherent complexity in caching/sweeping,
fix bug - publication index table also depends on state of
contributorship(s) attached to a work. Take this into account.
Cache this.
Also cache the footer.
minor refactor
fix small potential bug - we need to cycle the row class outside of the row caching. This way if a publication is added or removed, causing a rebuild of the page cache, the rows will get rebuilt with the right class.
fix bug - when an object is destroyed then nothing about it will be marked as changed (i.e. obj.changed? = false), but we still want to act. So check also if it is destroyed. I'll refactor this presently.

fix bug - if a publication is destroyed then we need to make the list of related publications a bit differently, since we can no longer look them up from active record.
Some refactoring on determine expiration.
Refactored. We have a general method that can take the record
passed to the sweeper and call a lot of methods on it to determine
if something has happened that should require expiration. We then
have another method that uses that and a supplied block to figure
out what ids to expire and return as an array. This simplifies the
code in the actual sweeper.
fix another bug - if a publication's name changes then we potentially have to expire the cache corresponding to both its new _and_ old sort_name.

Doing this makes me wonder if it wouldn't be better to supply methods for each class of record that can come in, as there's more and more independent logic. Have these methods call common methods if they can, otherwise do the dirty work they need to do.
Another refactor, in a sense rotating how the expirations are done.  I
think this is clearer, because all the code specific to a particular
kind of observed object is now isolated.
update to reflect caching work
a bit of efficiency stuff. Actually get the most recently published work to display.
some simple caching. After implementing it's unclear if there is a lot of benefit here, though.
Enable file caching in production.
disable caching by default in development environment
don't require a user to be logged in to see saved works.
Fix bug around saved items
move methods to base class and slightly refactor
Fixed error with RIS import - add value translator to squish abstract
field.
There may be more fixes like this needed in the future, but this is good
for now.

Unfortunately the refworks-xml importer seems to be broken now (and may
have been for a while). So I need to find out what's going on there.