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/855
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.
I tried to use it without success, that's why I added the comment: http://engine/v1/calc/[hazard | risk] returns 404.