Make threads generic

Detach conversation thread from ticket to make it more generic. Any object
can now have its own thread complete with entry type and attachments.
Add centralized object model registry
Fix attachment fetching to be object based
Bug: attachments

Auto-detect inline attachments
Attached keepers to canned reply
Use generic attachment table

Use generic attachment table for all attachments system-wide.
Drop thread entry attachment table
Use criteria lookup to get thread entries
Make threads generic

Detach conversation thread from ticket to make it more generic. Any object
can now have its own thread complete with entry type and attachments.
Add centralized object model registry
Fix attachment fetching to be object based
Use generic attachment table

Use generic attachment table for all attachments system-wide.
Drop thread entry attachment table
Use criteria lookup to get thread entries
tabs: Make tabs more generic and dynamic
bug: Validate thread entry

Validate all fields with data even if it's for presentation only
forms: pass options to field render

Add support for complex options to support complex field rendering.
dialog: Support auto-resizing popup dialog

The size of the dialog can be auto-adjusted based on the options
tooltip: Add generic preview tool tip util

Generalize how we show object/data preview. The url to get the preview is
now based on data-preview attribute on the element in question.
tooltip: Show tooltip only on visible elements

Auto-close toop tip box when element goes away
thread: Add generic ObjectThread class

Thread-able objects (e.g Ticket) can extend the class to add object specific
util routines.
forms: Add flags field to form field.

This is necessary so we can consolidate various settings and permissions
into one bit mask field.
Rename ticket number sequence