Few little bugs reported by Ingrid

Hi,

Just a few more little changes suggested by @ifinnane 

* Set file extension intelligently on download.
* Link to things using their PI form object id wherever possible.

Huw