list.mc - List of something as HTML table
This Mason component replaces absoleted ePortal::HTML::List package.
It is used to create HTML tables for iterable objects and arrays.
<&| /list.mc, id=>'list1', obj => $object OR list => [@array] &>
<&| /list.mc:row, parameters &> # this method is optional <& /list.mc:column, parameters &> <& /list.mc:column_image, src => ... &> </&> # end of row <&| /list.mc:extra_row &> ... </&>
# These method going after all "column" methods <&| /list.mc:before_title &> ... </&> <&| /list.mc:after_title &> ... </&> <&| /list.mc:before_footer &> ... </&> <&| /list.mc:after_footer &> ... </&>
<& /list.mc:row_span &> </&> # end of list
The typical list consists of the following:
<table> <form>
<before_title row> <title row> <after_title row>
<one or more rows> <extra_row for each row>
<before_footer row> <footer row> <action_bar row> <after_footer row>
</form> </table>
The content of <&| list.mc &> is responsible for HTML generation of each row.
The very first call to content is when row_number==0. This call is used to count all columns, create soring groups and discover column titles. ThePersistent object is not restored at this moment and $_ is undefined for array lists.
Use local variable $_
as iterator for array. $_ is the object for
ThePersistent lists.
All -xxx like parameters are passed directly to CGI::start_table. Others are
Generic method to make a row. Call once per list content. Use extra_row method if you need more than one row per iteration.
This is optionsl method. list.mc call it implicitly at least once if you don't.
<&| /list.mc:row &> <& /list.mc:column &> ... </&>
<&| /list.mc:extra_row &> this is additional row </&>
Produce ``extra'' row in the same style as main row. Used for description and memos
start_column
specifies starting column to make colspan
Make a space between rows.
<&| list.mc:row &> ... </&> <& list.mc:row_span &>
Action bar below footer consists of two cells. Left is your content and right is popup_menu with submit button. The name of popup_menu is list_action. You may get it with list_action method or as $ARGS{list_action}.
Array of ID of selected checkboxes available with checkboxes method.
Returns array ID of checked checkboxes or empty array.
Returns a value of list_action popup_menu or undef if form was not submitted. The fact of submit is request method eq 'POST'.
Generic method to make a column. Call it as many times as many columns you
have. Place the calls inside row
method.
A special parameter '#' => ... will be added as URL anchor
id
column
parameter is required if you use order_by
of order_by_desc
feature.
A column with image.
/images/icons/msg.gif
Produce delete button.
Produce ``edit object'' button.
Produce checkbox column
list_chboxLISTID
Row number counter
Returns HASH of arguments that represent current state of the list. Put these parameters to other forms on the page to save list apperance untouched.
Return self referencing URL without checkboxes selected.
Put list state as hidden fields into your form
This method used to insert a text before|after title|footer row. Place it AFTER all
column
methods. The content of method method is placed into one
wide TD cell. Arguments are:
<&| /list.mc:before_title &> this text goes before title row </&>
What to show when no data available in recordset?
These arguments are significant for list.mc when exists in request. See state method for convenient way to get hash of all of them.
Sergey Rusakov, <rusakov_sa@users.sourceforge.net>