Example:
include( 'elements/edit.html',
- 'name' =>
- 'table' =>
+ 'name_singular' => #singular name for the record
+ # (preferred, will be pluralized automatically)
+ 'name' => #name for the record
+ # (deprecated, will be pluralized simplistically)
+ 'table' =>
+
#? 'primary_key' => #required when the dbdef doesn't know...???
'labels' => {
'column' => 'Label',
'agent_null_right' => 'Access Right Name',
#run when re-displaying with an error
- 'error_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; },
+ 'error_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; },
#run when editing
'edit_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; },
'new_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; },
#run before display to return a different value
- 'value_callback' => sub { my( $columname, $value } ) = @_; },
+ 'value_callback' => sub { my( $columname, $value ) = @_; },
- #XXX describe
- 'field_callback' => sub { },
+ #run before display to manipulate element of the 'fields' arrayref
+ 'field_callback' => sub { my( $cgi, $object, $field_hashref ) = @_; },
'viewall_dir' => '', #'search' or 'browse', defaults to 'search'
% @$fields
% ) {
%
-% &{ $opt{'field_callback'} }( $f )
+% my $trash = &{ $opt{'field_callback'} }( $cgi, $object, $f )
% if $opt{'field_callback'};
%
% my $field = $f->{'field'};
% #select(-*)
% 'options' => $f->{'options'},
% 'labels' => $f->{'labels'},
+% 'empty_label' => $f->{'empty_label'},
% 'multiple' => $f->{'multiple'},
% 'disable_empty' => $f->{'disable_empty'},
% #select-reason
% 'disabled' => $f->{'disabled'},
% );
%
-% #select-table
+% #select-table, checkboxes-table
% $include_common{$_} = $f->{$_}
% foreach grep exists($f->{$_}), qw( table name_col );
%
+% #checkboxes-table
+% $include_common{$_} = $f->{$_}
+% foreach grep exists($f->{$_}), qw( target_table link_table );
+%
+% #*-table
+% $include_common{$_} = $f->{$_}
+% foreach grep exists($f->{$_}), qw( hashref agent_virt agent_null_right );
+%
% if ( $type eq 'tablebreak-tr-title' ) {
% $include_common{'table_id'} = 'TableNumber'. $tablenum++
% }
map { $_ => scalar($cgi->param($_)) } fields($table)
});
- &{$opt{'error_callback'}}($cgi, $object, $fields)
+ &{$opt{'error_callback'}}($cgi, $object, $fields, \%opt )
if $opt{'error_callback'};
} elsif ( $cgi->keywords || $cgi->param($pkey) ) { #editing
if ( $opt{'menubar'} ) {
@menubar = @{ $opt{'menubar'} };
} else {
+ my $items = $opt{'name'} ? $opt{'name'}.'s' : PL($opt{'name_singular'});
@menubar = (
- #eventually use Lingua::bs to pluralize
- "View all $opt{'name'}s" => $viewall_url,
+ "View all $items" => $viewall_url,
);
}