
[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] What Does it Take to Create Wizards
Quoting Zack Johnson (zack@office.standardprinting.net):
> > The main part of the wizard is the [table-editor ...] tag with
> > the wizard option selected. I have never gotten to documenting
> > the table-editor UserTag, but it is what the UI uses for editing
> > DB stuff.
>
> I would say [table-editor] is perhaps the best IC's best feature, from a
> customization POV. I can't tell you enough how much of a boon the it is.
> While I have little idea what I'm doing with it, it's speeding my catalogue
> development significantly. I hate to keep pestering, but the tool is
> unbelievably powerful.
>
Flattery will get you everywhere. 8-}
> I've created a new table in mysql. Call it 'foo'. I have already created a
> page to input records to foo. I'm now trying to use mv_metadata to control
> the display of the [table-editor].
>
> For example, I have a table containing all airport codes called (ahem!):
> airport_codes. There are two fields, airport_code and name. I would like
> to setup mv_metadata::foo::airport_code to create a select box with
> value=label pairs from 'airport_codes'. That way, when I use table-editor
> on foo, I get a nice display with filters, etc.
That should be easy. Ed LaFrance asked about this last week but Ht::Dig may
not have indexed them yet. To review:
mv_metadata.asc (in Jon's te editor style):
code:foo::airport_code
type:select
db:airport_codes
lookup:airport_code,name
Also, a little trick is that you really only need one field in
mv_metadata -- extended. (Besides code, of course). That entry would be:
code:foo::airport_code
extended:{ type => 'select', db => 'airport_codes', lookup => 'airport_code,name' }
At one point, I started putting together a document about mv_metadata, but
it gave me the idea for the [table-editor] tag and I got distracted. 8-\
I attached where I was to this message.
--
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH 45013
phone +1.513.523.7621 <mheins@redhat.com>
Nature, to be commanded, must be obeyed. -- Francis Bacon
=head1 NAME
mv_metadata - Display formatting for the Interchange UI
=head2 VERSION
0.01
=head1 SYNOPSIS
[display table=tablename column=fieldname key=key arbitrary=tag filter=op ...]
=head1 DESCRIPTION
The Interchange UI uses the mv_metadata table to discover formatting
information for field, table, and view display. The information is kept
in fields in the mv_metadata table, and is used to select the display,
the HTML input type, the size (height and width where appropriate), label,
help text, additional help URL, and default value display.
It works in conjunction with the [display ...] tag defined in the Interchange
UI as well as in specific pages in the UI.
In the simplest use, the formatting information for a table form field
is called with:
[display table=products column=category key="os28007"]
The mv_metadata table is scanned for the following keys:
products::category::os28007
products::category
If a row is found with one of those keys, then the information in the
row is used to set the display widget. If no row is found, an INPUT TYPE=TEXT
widget is displayed. If the data is all digits, a size of 8 is used,
otherwise the size is 60.
If the following row were found (not all fields shown, would be tab-separated
in the actual data):
code type width height label options
products::category text 20 Category
Then an input C<<>C<INPUT TYPE=text SIZE=20 VALUE="*category*">> with a
field label of I<Category> would be output.
If the following row were found:
code type width height label options
products::category select Category =none, product=Hardware
Then the following would be output:
<SELECT NAME=category>
<OPTION VALUE="">none
<OPTION VALUE="product">Hardware
</SELECT>
The standard widget types are the same as the C<accessories> tag. Some
of the most important are:
=over 4
=item text
The default. Uses the fields:
width size of input box
=item textarea
Format a <TEXTAREA> </TEXTAREA> pair. Uses the fields:
width COLS for textarea
height ROWS for textarea
=item select
Format a <SELECT> </SELECT> pair with appropriate options. Uses the fields:
height SIZE for select
default Default for SELECTED
options Options for a fixed list (or prepended to a lookup)
lookup signals a lookup (used as field name if "field" empty)
field field to look up possible values in
db table to look up in if not current table
lookup_exclude regular expression to exclude certain values from lookup
=back
=head1 AUTHOR
Mike Heins, <heins@akopia.com>. Questions should be directed to the
Minivend user list, <minivend-users@minivend.com>.