X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Felements%2Fedit.html;h=c80586a4caf90de15f16d7d4da432069b08c09e1;hb=6626dc2a13c809092aa539c5a72bc72a0c56afdc;hp=d7d55a257aa9d76d32aab7a4e66880920ef70c56;hpb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd;p=freeside.git diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index d7d55a257..c80586a4c 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -10,21 +10,25 @@ Example: '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 + #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 + #password #money + #percentage #checkbox #select - #selectlayers + #selectlayers (can't use after a tablebreak-tr-title yet... grep "OneTrueTable") #title + #tablebreak-tr-title #hidden - hidden value from object - #fixed - display fixed value from here - #fixedhidden - hidden value from here + #fixed - display fixed value from object or here + #fixed-country + #fixed-state 'value' => 'Y', #for checkbox, title, fixed, fixedhidden 'disabled' => 0, 'onchange' => 'javascript_function', @@ -93,9 +97,12 @@ Example: #run when adding 'new_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; }, + #run before display to return a different value + 'value_callback' => sub { my( $columname, $value } ) = @_; }, + #XXX describe 'field_callback' => sub { }, - + #string or coderef of additional HTML to add before 'html_table_bottom' => '', @@ -110,19 +117,21 @@ Example: # overrides default popurl(1)."process/$table.html" 'post_url' => popurl(1).'process/something', + + #we're in a popup (no title/menu/searchboxes) + 'popup' => 1, + ); -<% include("/elements/header.html", $title, +<% include('/elements/header'. ( $opt{popup} ? '-popup' : '' ). '.html', + $title, include( '/elements/menubar.html', @menubar ) ) %> -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } +<% include('/elements/error.html') %> % my $url = $opt{'post_url'} || popurl(1)."process/$table.html"; @@ -131,10 +140,12 @@ Example: + <% ( $opt{labels} && exists $opt{labels}->{$pkey} ) ? $opt{labels}->{$pkey} : $pkey %> + #<% $object->$pkey() || "(NEW)" %> %# <% ntable("#cccccc",0) %> @@ -165,7 +176,11 @@ Example: % if $opt{'debug'}; % % my %include_common = ( -% #checkbox, title +% +% #text and derivitives +% 'size' => $f->{'size'}, +% +% #checkbox, title, fixed, fixedhidden % #& deprecated weird value hashref used only by reason.html % 'value' => $f->{'value'}, % @@ -191,8 +206,8 @@ Example: % my $fieldnum = delete $opt{'fieldnum'}; % % my $include = $type; -% $include = "input-$include" if $include =~ /^(text|money)$/; -% $include = "tr-$include" unless $include eq 'hidden'; +% $include = "input-$include" if $include =~ /^(text|money|percentage)$/; +% $include = "tr-$include" unless $include =~ /^(hidden|tablebreak)/; % % $include_common{'layer_prefix'} = "$field$fieldnum." % if $layer_prefix_on; @@ -261,13 +276,17 @@ Example: % #$field .= $fieldnum; % $onchange .= "\nspawn_$field(what);"; % } else { -% $curr_value = $object->$field(); +% $curr_value = +% ($opt{'value_callback'} && $mode ne 'error') +% ? &{ $opt{'value_callback'} }( $f->{'field'}, $object->$field() ) +% : $object->$field(); % } % % my @include = &{ $include_sub }( % 'label' => $label, % 'fieldnum' => $fieldnum, % 'curr_value' => $curr_value, +% 'object' => $object, % 'onchange' => $onchange, % 'cell_style' => ( $fieldnum ? 'border-top:1px solid black' : '' ), % ); @@ -332,6 +351,7 @@ Example: // add new row + //hmm, can't use selectlayers after a tablebreak-title for now var table = document.getElementById('OneTrueTable'); var row = table.insertRow(rownum++);