admin - new extension 'template editor'

Moved all the templating functions into a new extension and renamed
functions to be more generic. This is so that the code can be reused in
campaigns. started adding some campaign code as well.
admin template editor - more work on wizard