5 include( '/elements/checkboxes-table-name.html',
10 'link_table' => 'table_name',
12 'name_col' => 'name_column',
14 #not yet '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 <% include('checkboxes.html',
45 'names_list' => $opt{'names_list'},
46 'checked_callback' => $checked_callback,
47 'element_name_prefix' => $opt{'link_table'}. '.',
48 'disable_links' => $opt{'disable_links'},
56 my @pset = ( 'a'..'z', 'A'..'Z', '0'..'9' );
58 my $prefix = $opt{prefix}
59 || join('', map $pset[ int(rand $#pset) ], (0..20) );
61 my( $source_pkey, $sourcenum, $source_obj );
62 if ( $opt{'source_obj'} ) {
64 $source_obj = $opt{'source_obj'};
65 #$source_table = $source_obj->dbdef_table->table;
66 $source_pkey = $source_obj->dbdef_table->primary_key;
67 $sourcenum = $source_obj->$source_pkey();
72 $source_pkey = $opt{'source_table'}
73 ? dbdef->table($opt{'source_table'})->primary_key
75 $sourcenum = $opt{'sourcenum'};
78 $source_pkey = $opt{'num_col'} || $source_pkey;
80 my $link_static = $opt{'link_static'} || {};
82 my $checked_callback = sub {
83 my( $cgi, $name ) = @_;
84 qsearchs( $opt{'link_table'}, {
85 $source_pkey => $sourcenum,
86 $opt{'name_col'} => $name,