[GSOC2013] server view refactor

1. render the HTML element at once
2. fix HTML and PHP mixture
3. fix code indention
4. enhance the code Readability