refactor detail.php to template.php

https://bugs.dokuwiki.org/index.php?do=details&task_id=2437

done:
- refactor back and mediamanager link creation
- refactor metadata listing

Note: added placeholder replacement in action captions

Question:
-Should the IPTC.Headline and the simple.title should also be coming from a function of their own? (as suggested by issue?) If yes, how?