Lots of improvements as a side-effed of getting image loading to work

Moved option processing down into fields from global field.  Improved
database form handling of autoAddFiels.  Allow reordering of
auto-added fields. Improve type mapping from database.  Fix handling
of optional file and image fields.