<font color="#ff0000">no type</font>
+% } elsif ( $type eq 'image' ) {
+
+ <% $conf->exists($key, $agentnum)
+ ? 'Current image<br>'.
+ '<img src="config-image.cgi?key='. $key.
+ ';agentnum='. $agentnum. '"><br>'
+ : ''
+ %>
+
+ <BR>
+ New image filename <input type="file" name="<% "$key$n" %>">
+
% } elsif ( $type eq 'binary' ) {
Filename <input type="file" name="<% "$key$n" %>">
% } elsif ( $type eq 'textarea' ) {
- <textarea name="<% "$key$n" %>" rows=12 cols=78 wrap="off"><% join("\n", $conf->config($key, $agentnum)) %></textarea>
+ <textarea name="<% "$key$n" %>" rows=12 cols=78 wrap="off"><% join("\n", $conf->config($key, $agentnum)) |h %></textarea>
% } elsif ( $type eq 'checkbox' ) {
% '' => '', map { $_ => $_ } @{ $config_item->select_enum };
% } elsif ( $config_item->select_hash ) {
% if ( ref($config_item->select_hash) eq 'ARRAY' ) {
-% tie %hash, 'Tie::IxHash',
-% '' => '', @{ $config_item->select_hash };
+% tie %hash, 'Tie::IxHash', '' => '', @{ $config_item->select_hash };
% } else {
-% tie %hash, 'Tie::IxHash',
-% '' => '', %{ $config_item->select_hash };
+% tie %hash, 'Tie::IxHash', '' => '', %{ $config_item->select_hash };
% }
% } else {
% %hash = ( '' => 'WARNING: neither select_enum nor select_hash specified in Conf.pm for configuration option "'. $key. '"' );
% } elsif ( $type eq 'select-sub' ) {
- <select name="<% "$key$n" %>"><option value="">
+ <select name="<% "$key$n" %>" <% $config_item->multiple ? 'MULTIPLE' : '' %>>
+
+% unless ( $config_item->multiple ) {
+ <option value="">
+% }
% my %options = &{$config_item->options_sub};
% my @options = sort { $a <=> $b } keys %options;
% foreach my $value ( @options ) {
% local($^W)=0; next if $saw{$value}++;
- <option value="<% $value %>" <% $value eq $conf->config($key, $agentnum) ? 'SELECTED' : '' %>><% $value %>: <% $options{$value} %>
+ <option value="<% $value %>"
+
+% if ( $value eq $conf->config($key, $agentnum)
+% || ( $config_item->multiple
+% && grep { $_ eq $value } $conf->config($key, $agentnum) ) ){
+
+ SELECTED
+
+% }
+
+ ><% $value %>: <% $options{$value} %>
% }
% my $curvalue = $conf->config($key, $agentnum);
<td><input type="button" value="add" onClick="doadd<% "$key$n" %>(this.form)"></td>
</tr></table>
+% } elsif ( $element_types{$type} ) {
+%
+% my %opt = ( 'element_name' => "$key$n",
+% 'empty_label' => ' ',
+% 'showdisabled' => 1,
+% );
+% if ( $config_item->multiple ) {
+% $opt{'multiple'} = 1 if $config_item->multiple;
+% $opt{'curr_value'} = [ $conf->config($key, $agentnum) ];
+% } else {
+% $opt{'curr_value'} =
+% $conf->exists($key, $agentnum) ? $conf->config($key, $agentnum) : '';
+% }
+
+ <% include("/elements/$type.html", %opt ) %>
+
% } else {
- <font color="#ff0000">unknown type $type</font>
+ <font color="#ff0000">unknown type <% $type %></font>
% }
% $n++;
<%once>
my $conf = new FS::Conf;
-my @config_items = grep { $_->key != ~/^invoice_(html|latex|template)/ }
- $conf->config_items;
+my @config_items = $conf->config_items;
my %confitems = map { $_->key => $_ } @config_items;
+my %element_types = map { $_ => 1 } qw(
+ select-part_svc select-part_pkg select-pkg_class
+);
+
</%once>
<%init>