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.
This is an introspection API. It returns a list of all hazard or risk calculations. It filters the calculations on the database. If we remove it and we want to retrieve the calculations we will have to filter them (by hazard or risk) on the platform. Even if now we do not have a summary page with all the computations run by a user (or a set of users) we may have it in the future, so I do not want to remove the API.