Content Types are the fundamental building blocks of a repository. They define how content objects that share common fields and functionality are stored, organized and function.
A good way to become familiar with content types is to work with them in webCOMAND.
The remainder of this page details each Content Type feature organized into the following sections.
Each content type is given a unique name that is used to represent and identify its framework of fields and functionality in user interfaces, queries, scripts and programming code.
It is a good idea to initially select an identifier that will work well long-term. If an identifier is updated, all queries, scripts and programming code that reference it will also need to be updated.
Since a content type identifier is referenced in queries, scripts and programming code that follow traditional computer language naming conventions, identifiers must start with an upper- or lower-case letter and consist of only upper- and lower-case letters, numbers and underscores.
A title can be used to overcome the limitations of an identifier.
Each field that should store data (text, numbers, files, etc.) is assigned a Data Type. A Data Type determines the type of value that will be accepted and stored for this field, as well as basic validation rules and how the field is displayed and the input/controls provided for editing.
Data Fields (Data Types)
Fields that store numbers, text, files and other data values have a Data Type selected for their field type. The following Data Type field types are available.
- Checkbox - A simple checkbox that can be clicked to toggle the state. Click anywhere in the label or row to toggle the state.
- Number - An integer in the range of +/-2 billion (2,147,483,648 to 2,147,483,647, to be exact). The input field can be used like a calculator to perform math operations on the fly. Simply type numbers and the various math operations, or click the calculator icon to display a simple on-screen calculator.
- Decimal - A double-precision floating-point number. The input field can be used like a calculator to perform math operations on the fly, same as Number fields.
- Currency - A decimal number with up to 10 significant digits to the left of the decimal and two digits to the right. The input field can be used like a calculator to perform math operations on the fly, same as Number fields.
- Date - Date stored in YYYY-MM-DD format.
- Time - Time stored in HH:MM:SS format.
- Timestamp - Date and time stored in YYYY-MM-DD HH:MM:SS format for the current local time. The time will be adjusted to the local time of other computers when the content record is copied, if the destination computer is in a different time zone.
- Color - Color represented visually and in web color format, also known as hexidecimal format or hex RGB triplet (ie. #ff8800). Click the color box to display the color chooser.
- UUID - A universally unique identifier represented by 32 hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 (ie. 550e8400-e29b-41d4-a716-446655440000)
- Text Line - A single line of plain text, up to 64K (65,536 characters). Tab and enter characters are not supported.
- Rich Text Line - Same as Text Line, except a "clean" control is provided to convert special characters, such as smart quotes, to their standard equivelents.
- Text Box - Multiple lines of plain text, up to 4GB (4,294,977,295 characters). The TAB and ENTER characters are supported. To tab multiple lines at once, select multiple lines and press TAB or SHIFT+TAB. To focus the next field from a text box input, press CTRL+TAB.
- Text Box (Short) - Same as a Text Box, except the input will initially be shorter. This is useful for short descriptions or summaries.
- HTML Destined Text Box - Same as text box, except ENTER characters are translated to their HTML equivelent (
) when published.
- Rich Text Box - Similar to Text Box, except for formatted text. A set of formatted text controls are provided, similar to the formatting controls available in a word processor. Formatting is stored as HTML.
- cScript Text Line - Same as a Text Line, except the text is interpreted as cScript when processed.
- cScript Rich Text Line - Same as a Rich Text Line, except the text is interpreted as cScript when processed.
- cScript Text Box - Same as a Text Box, except the text is interpreted as cScript when processed.
- cScript Rich Text Box - Same as a Rich Text Box, except the text is interpreted as cScript when processed. Additional options are also available from the Insert menu, based on content type-specific rich text functionality.
- Password - Same as Text Line, except all characters are represented as bullets to hide the actual text from view. The text is still stored as plain text, and is not secured in any other way.
- File Data - Used to upload and store the contents of a file up to 4GB. The orginal filename is not stored, just the data. A control is provided to upload a file from your computer. Some servers and storage engines may limit the upload or storage of file sizes.
- Image Data - Same as File Data, except a thumbnail of the image is displayed. Click the thumbnail to display the full-size image in a new browser window or tab.
- Order Index - Unlike all other data type fields, Order Index fields are not displayed as a row. Instead, they enable the control to update the order of content records in the same folder or field.
Fields that represent a relationship have a Content Type for their field type.
The determines the type of content this field relates to. For example, an Address Book might contain Contacts, so the content type would be "Contacts".
D determines where the field content will be stored.
- Embedded content is stored within the content record and will not be available outside of the content record.
- Reference content is stored externally in another folder and referenced from within the content record.
- Back-reference content is stored externally in another folder that references this content through a reference content field of its own.
- Publication List content is limited to items in a publication list.
Determines if the relationship can have one or many items.
Together, the Location and List Type determine how the relationship field is displayed and the input/controls provided for editing. There are four combinations:
- Embedded - Location: "Embedded", List Type: "None"
- Embedded Lists - Location: "Embedded", List Type: "List" or "List (Expanded)"
- References - Location: "Reference", "Back-Reference" or "Publiction List", List Type: "None"
- Reference Lists - Location: "Reference", "Back-Reference" or "Publiction List", List Type: "List" or "List (Expanded)"
Embedded content fields display a summary of the embedded content record, similar to referenced content. However, the row is displayed like a field group and when the row (label and summary) is clicked, the embedded content record is expanded to reveal its fields. The embedded fields are bottom capped with a thin dark grey row. Hover over the top or bottom cap to highlight and identify the matching top and bottom.
A hierarchy of embedded fields can be expanded down to any depth. All expanded embedded content record fields will be displayed simultaneously.
Embedded list content fields combine features of Reference List and Embedded. When summarized, these fields look like a Reference List. When expanded, these fields look similar to a Reference List on the left column, but similar to Emedded on the right.
The > icon can be clicked from any state to display the list in Grid view.
Multiple embedded list fields can be navigated "in-place". Once drilled down past the first list, a row of breadcrumbs is displayed above the current list to make it easy to determine your place and get back.
A field that references another content record displays as a drop-down menu. The referenced content is displayed with an icon and summary in the single line drop-down. Click the drop-down to display all other content that may be referenced based on the field's scope. If the referenced content is not in the field's scope, "(out of scope)" will be appended to the summary text.
Same as a single reference, except the number of referenced content records is listed for the value (ie "5 items selected"). Click the drop-down to display all referenced content on the left and all other content in the field's scope on the right. Click an item on the left to remove the reference. Click an item on the right to add a reference. If the reference list can be ordered, the content on the left can be dragged to change the order. Click the search icon or just start typing to filter displayed content records on the right based on matching summary text. For a similar working example, see jQuery UI Multiselect.
Fields that determine layout are assigned a layout type. Layout types determine how fields are organized for display and input.
- Group Open
- Group Close
- Tabset Open
- Tabset Close
Content type functionality is defined as a set of actions, typically created by developers. Actions are typically used for two purposes.
- System Functionality - Actions triggered by the repository, webCOMAND and other applications to define or override events, such as when a content is created, submitted, deleted, validated or displayed in a list.
- User Functionality - Actions started by a user in webCOMAND. Authorized users see actions as buttons in webCOMAND panels, typically above the grid, form views.
For more information about content type functionality, see Content Action.
When provided, a content type title will override the identifier wherever the content type is referenced in a user interface. This is useful when the restrictions of an identifier produce a cryptic or out of date name because the title has fewer restrictions and can be changed without affecting queries, scritps or programming code.
Storage options determine how field data is stored, replicated and backed up for each content type.
These options should be moved to folder settings to enable per-folder/content type configuration.
Underlying a repository is one or more storage engines, which are used to store content field data and relationships. Indexed field data and relationships are always stored in the primary storage engine, which is typically a relational database. However, a content type can specify which type of storage engine to use for its other field data when possible.
- Relational Databases - MySQL, PostgreSQL, MS SQL, Oracle and other relational databases that process standard SQL queries and have a supported PHP PDO driver. Relational databases are most commonly used as the primary (and often only) storage engine for a COMAND repository because they are efficient, widely available, well understood and supported.
- Property-Value Store (Cloud Storage) - MongoDB, Amazon S3, etc.
- File System - A local, network, FTP, SFTP, webDAV (HTTP or HTTPS) file system can be used to store information. File system storage is well-suited for content that is not typically used in a query condition and contains large values, such as video. However, any content can be stored in the File System.
When a publish or other process that requires a repository snapshot is started, the repository content is temporarily replicated for the process. Process queries will use the static replicated copy to avoid conflicts with the main repository, which may dynamically change while the process works.
To fine-tune replication and query performance, three options are available.
- Disk - The default option is to replicate to disk. This is the slowest option, but utilizes a typically plentiful resource.
- Memory - Offers better replication and query performance, but consumes a more typically limited resource.
- None - Disables replication for content that is not needed by processes that replicate the database to improve replication performance.
Determines if content is included in repository backups. Content such as caches or other information that can be automatically repopulated if it is lost can be excluded from backups to reduce backup storage requirements.
An interesting feature of content types is that they are objects of the type content type. In other words, a content type object is an instance of Content Type. Therefore, every repository has a content type that defines the fields and methods of content types. The fields and methods of a content type can be accessed and inspected like any other object. This feature is called reflection.
One benefit of content type reflection is that the schema of a COMAND repository can be understood and changed by reviewing and updating its content types. In fact, a good way to understand how a repository stores its content is to review the foundation content types, which are prerequisite content types in every COMAND repository.