X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Felements%2Fedit.html;h=3896f17129fc009569db33833af6bf976048a723;hb=ef0d8db38d1ee28a65a7ecdc6e11c7a82c0a741b;hp=4a62ba316664a10b642b2ae07d41e3f9bb5caac3;hpb=b286503a0445e77d67b323785a73d4339c1145a9;p=freeside.git diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 4a62ba316..3896f1712 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -3,8 +3,12 @@ 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', @@ -91,7 +95,7 @@ Example: '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 ) = @_; }, @@ -106,10 +110,10 @@ Example: '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' @@ -179,7 +183,7 @@ Example: % @$fields % ) { % -% &{ $opt{'field_callback'} }( $f ) +% my $trash = &{ $opt{'field_callback'} }( $cgi, $object, $f ) % if $opt{'field_callback'}; % % my $field = $f->{'field'}; @@ -212,6 +216,7 @@ Example: % #select(-*) % 'options' => $f->{'options'}, % 'labels' => $f->{'labels'}, +% 'empty_label' => $f->{'empty_label'}, % 'multiple' => $f->{'multiple'}, % 'disable_empty' => $f->{'disable_empty'}, % #select-reason @@ -226,10 +231,18 @@ Example: % '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++ % } @@ -548,7 +561,7 @@ if ( $cgi->param('error') ) { 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 @@ -607,9 +620,9 @@ my @menubar = (); 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, ); }