CSV export, refactored text export

Both CSV and Text exports are now sent as files for download rather
than being displayed in the browser.