X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_export.cgi;h=a2fad56a3cf0fbf2bcc1554983a8581fee8fc0ee;hb=03870c8fda3909d8aeb9d7120bc1debc3935f1c3;hp=d57979751c3242ab99cd149a96c2c0518cb9b7c2;hpb=0930d22ffc440f80c1b222b2e750cadbabd9e8f6;p=freeside.git diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index d57979751..a2fad56a3 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -77,15 +77,39 @@ my $widget = new HTML::Widgets::SelectLayers( ? $optinfo->{default} : '' ); - $html .= qq!$label!; + # 'freeform': disables table formatting of options. Instead, each + # option can define "before" and "after" strings which are inserted + # around the selector. + my $freeform = $optinfo->{freeform}; + if ( $freeform ) { + $html .= $optinfo->{before} || ''; + } + else { + $html .= qq!$label!; + } if ( $type eq 'select' ) { - $html .= qq!!; + my @values = split '\s+', $value if $multi; + my @options; + if (defined($optinfo->{option_values})) { + my $valsub = $optinfo->{option_values}; + @options = &$valsub(); + } elsif (defined($optinfo->{options})) { + @options = @{$optinfo->{options}}; + } + foreach my $select_option ( @options ) { #if ( ref($select_option) ) { #} else { - my $selected = $select_option eq $value ? ' SELECTED' : ''; + my $selected = ($multi ? grep {$_ eq $select_option} @values : $select_option eq $value ) ? ' SELECTED' : ''; + my $label = $select_option; + if (defined($optinfo->{option_label})) { + my $labelsub = $optinfo->{option_label}; + $label = &$labelsub($select_option); + } $html .= qq!!; + qq!$label!; #} } $html .= ''; @@ -93,7 +117,7 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= qq!'; } elsif ( $type eq 'text' ) { - $html .= qq!'; } elsif ( $type eq 'checkbox' ) { $html .= qq!{after} || ''; + } + else { + $html .= ''; + } } $html .= '';