Add access control to document model and view
The access checks are not yet written, but at least the model is
stable from now on.
Also converted the document view to dynaform while at it.
Patch by: Sverre Rabbelier
{% ifnotequal prev_start -1 %}<a href="{{ start_base_url }}&start={{ prev_start }}">‹ Previous</a>{% endifnotequal %}
{% for page in pages %}
<a {% ifequal page.number current_page %} class="ae-page-selected ae-page-number" {% endifequal %}
href="{{ start_base_url }}&start={{ page.start }}">{{ page.number }}</a>
{% endfor %}
{% ifnotequal next_start -1 %}<a href="{{ start_base_url }}&start={{ next_start }}">Next ›</a>{% endifnotequal %}