1.4. Metadata

Interchange's foundation demonstration catalog and UI rely on a table named mv_metadata, which contains the definitions for table and field appearance. This table is supported with a table definition editor (pages/admin/db_metaconfig) and a field definition editor (pages/admin/meta_editor).

The mv_metadata table has the following fields:

code

The key for the table. Normally, it takes the form

    table::column

where table is the table the field is contained in, and column is the table column name. It can also take the forms:

    view::table::column::key
    view::table::column
    table::column::key

Each is checked in turn to see if it exists, then applied. If none of the above is found, then the field is displayed with a default widget (a text box with size 50).

type

The widget type. The following, at least, are supported:

Type Name Description
text Text entry The normal HTML text entry field.
textarea Textarea The normal HTML textarea entry for putting in multiple lines of data.
select Select box Also known as as a dropdown menu. Interchange has many ways to populate the options via automatic database lookup, and you can specify options to add or replace a lookup.
yesno Yes/No (Yes=1) A dropdown/select looking for a Yes (1) or No (0) answer.
noyes No/Yes (No=1) A dropdown/select looking for a Yes (0) or No (1) answer.
yesno radio Yes/No (radio) Same as the yesno widget except implmented with a radio box.
noyes radio No/Yes (radio) Same as the noyes widget except implmented with a radio box.
multiple Multiple Select A dropdown/select with SIZE greater than 1.
combo Combo Select A dropdown/select with a preceding text entry field that can add a new entry. Needs the nullselect filter; usually combined with a lookup.
reverse_combo Reverse Combo A dropdown/select with a following text entry field that can add a new entry. Needs the last_non_null filter; usually combined with a lookup.
move_combo Combo move A dropdown select that sends clicked items to a textarea.
display Text of option Displays the label (only) for a select/radio choice.
hidden_text Hidden (show text) Shows the value of a field and includes a hidden field to put the value in the form. Usually used when you want to display a key for a record but not give the opportunity to change it (and create a new record).
radio Radio box Select one of many options with a check box. Usually can be used instead of a select; can be grouped in matrices.
radio_nbsp Radio (nbsp) Select one of many options with a check box. Usually can be used instead of a select; can be grouped in matrices. This version puts no spaces in the outputted HTML, guaranteeing no wrap. (You can use the newer nowrap styles in CSS instead, often.)
checkbox Checkbox Select one or more options with a checkbox. Usually can be used instead of a multiple select.
check_nbsp Checkbox (nbsp) Select one or more options with a checkbox. Usually can be used instead of a multiple select. This version puts no spaces in the outputted HTML, guaranteeing no wrap. (You can use the newer nowrap styles in CSS instead, often.)
imagedir Image listing Shows a list of already existing images in a directory, with a link to a dialog to upload a new one.
imagehelper Image upload Combines input of an image name along with upload of the image.
date Date selector Selects a date, with optional time. Used in combination with the date_change filter.
value Value Simply shows the value of the field, with no widget to set it.
option_format Option formatter  
show Show all options Shows all options for a select/radio/checbox type input, without a widget to set the value.
uploadhelper File Uppload Puts the contents of a file upload in the named variable. Can be used as filter.widget="upload"

These widgets are implemented with the Vend::Form module, and are discussed in more detail later in this document.

width

The width of the widget. Meaningful in some way for most types.

height

In the field metadata, it is meaningful for textarea, multiple select types (including the combo widgets), and for groups of radio and checkboxes.

In the table metadata context, defines the number of rows that will be shown on the record select page before a "more" list will be built.

field

The fields for an options lookup query if more than one. Default is none -- the field in "lookup" is used.

db

The table to do the lookup query in. Default is the same table as the column is in.

name

The name of the generated HTML form element. Default is the same name as the column for the widget.

outboard

Catchall field used in several ways by different widgets. Normally used to specify a foreign key, it can also contain a directory name or other information needed for a widget.

options

Hard-coded options for the select, checkbox, and radio box widget types.

attribute

Not normally used for table editor. Used in Interchange in the context of an [item-list ...] for generating option names.

label

The label associated with the field for display in the table editor. In the below example, "Foo" is the label:

    Foo: <input type=text value="bar" size=30>

help

Inline help to be displayed in the table editor.

lookup

A field name to look up options in. Normally this would be the same field as the widget, to generate a list of unique values. The equivalent to the query:

  SELECT DISTINCT foo FROM table ORDER BY foo

is done.

filter

A filter which should be applied to the data coming from a widget before saving in the database. A few examples of the dozens of standard filters are:

There are many more filters, and it is easy to specify custom filters. See Interchange's filters documentation.

help_url

A URL for extended help on a field.

pre_filter

For advanced use only. Specifies a filter that is run on the data before it is used to set the widget value. Not normally used.

lookup_exclude

A regular expression that can exclude certain values from a lookup list.

prepend

append

Valuse that are prepended and appended to the widget HTML, perhaps to call an external formatter or tool.

display_filter

Not normally used.

default

The default value that should be given to a column when it is of length zero.

extended

The repository for the serialized extended values set in metadata.