<% # options example... # # 'name' => # 'table' => # #? 'primary_key' => #required when the dbdef doesn't know...??? # 'labels' => { # 'column' => 'Label', # } # # listref - each item is a literal column name (or method) or hashref # or (notyet) coderef # if not specified all columns (except for the primary key) will be editable # 'fields' => [ # 'columname', # { 'field' => 'another_columname', # 'type' => 'text', #text, fixed, hidden, checkbox # #eventually more for <%= ( $opt{labels} && exists $opt{labels}->{$pkey} ) ? $opt{labels}->{$pkey} : $pkey %> #<%= $object->$pkey() || "(NEW)" %> <%= ntable("#cccccc",2) %> <% foreach my $f ( map { ref($_) ? $_ : {'field'=>$_} } @$fields ) { &{ $opt{'field_callback'} }( $f ) if $opt{'field_callback'}; my $field = $f->{'field'}; my $type = $f->{'type'} ||= 'text'; %> <%= ( $opt{labels} && exists $opt{labels}->{$field} ) ? $opt{labels}->{$field} : $field %> <% if ( $type eq 'fixed' ) { %> <%= $f->{'value'} %> <% } elsif ( $type eq 'checkbox' ) { %> $field() eq $f->{'value'} ? ' CHECKED' : '' %>> <% } else { %> <% } %> <% } %> <%= ref( $opt{'html_table_bottom'} ) ? &{ $opt{'html_table_bottom'} }( $object ) : $opt{'html_table_bottom'} %> <%= ref( $opt{'html_bottom'} ) ? &{ $opt{'html_bottom'} }( $object ) : $opt{'html_bottom'} %>
"> <%= include("/elements/footer.html") %>