Unified the export framework for hazard and risk

See https://bugs.launchpad.net/oq-engine/+bug/1204955. 500+ lines of code duplication have been removed. The tests are running here: https://ci.openquake.org/job/zdevel_oq-engine/850
This has impact on the platform calculate tab, since the URLs have changed.
This also fixes https://bugs.launchpad.net/oq-engine/+bug/1363795 and https://bugs.launchpad.net/oq-engine/+bug/1221111.
Is this still needed?