Move template code from lib/Data to template file

Fix #1729
Change license header to small version and replace echo with p()

Fix #1729
Correctly check whether previewImageLink is set

Fix #1729
Do not use echo for html in template/list.php
Remove more HTML echo
Merge pull request #1730 from owncloud/issue/1729

Move template code from lib/Data to template file