GSoC Template Engine back-end for User Generated Documents (from Andreas) - all commits squashed into one

same as on https://github.com/openMF/mifosx/pull/566, but on this commit all squashed into one.