Insert docstring, move view, insert JS into the agenda config page.

Problematic is still that the JS can not be moved to an extra file because of the template tags in the code.

Do also some small fixes.