5 include( '/elements/checkboxes-table-name.html',
10 'link_table' => 'table_name',
12 'name_col' => 'name_column',
14 'name_callback' => sub { },
16 'names_list' => [ 'value',
18 [ 'complex value' => { 'desc' => "Add'l description",
25 # recommended (required?)
29 #'source_table' => 'table_name',
30 #'sourcenum' => '4', #current value of primary key in source_table
31 # # (none is okay, just pass it if you have it)
36 'num_col' => 'col_name' #if column name is different in link_table than
38 'link_static' => { 'column' => 'value' },
44 <TABLE CELLSPACING=0 CELLPADDING=0>
46 % foreach my $item ( @{ $opt{'names_list'} } ) {
48 % my $name = ref($item) ? $item->[0] : $item;
49 % ( my $display = $name ) =~ s/ / /g;
50 % $display .= $item->[1]{note} if ref($item) && $item->[1]{note};
51 % my $desc = ref($item) && $item->[1]{desc} ? $item->[1]{desc} : '';
54 % if ( $cgi->param('error') ) {
56 % $checked = $cgi->param($opt{'link_table'}. ".$name" )
63 % qsearchs( $opt{'link_table'}, {
64 % $source_pkey => $sourcenum,
65 % $opt{'name_col'} => $name,
75 <INPUT TYPE="checkbox" NAME="<% $opt{'link_table'}. ".$name" %>" <% $checked %> VALUE="ON">
79 <BR><FONT SIZE="-2"><% $desc %></FONT>
92 my( $source_pkey, $sourcenum, $source_obj );
93 if ( $opt{'source_obj'} ) {
95 $source_obj = $opt{'source_obj'};
96 #$source_table = $source_obj->dbdef_table->table;
97 $source_pkey = $source_obj->dbdef_table->primary_key;
98 $sourcenum = $source_obj->$source_pkey();
103 $source_pkey = $opt{'source_table'}
104 ? dbdef->table($opt{'source_table'})->primary_key
106 $sourcenum = $opt{'sourcenum'};
109 $source_pkey = $opt{'num_col'} || $source_pkey;
111 my $link_static = $opt{'link_static'} || {};