Add loss-of-changes protection to the edition form

Now that we have moved the management of attachments to a separate
tab, the user has a way of leaving the edit form that does not make it
obvious that they will lose any changes they might have made. This
commit means that users with JavaScript will see a warning if they
attempt to leave the page with unsaved changes to the edition.