extract attachments processing in REST into lib
extract form editor loop into a sub for error checks

Extracts form editor with loop into vi_form_while function
that takes text and a callback, so callback can check errors
and keep asking user to fix problems.

Use it in comment command and check files existance in the callback.
REST: make it possible to attach files on create

Now ticket create form has Attachment field and
it's possible to use set attachment=foo.txt from
command line.
Merge branch '4.0/rest-attachments-on-create' into 4.0-trunk