-% my %saw = ();
-% foreach my $value ( keys %hash ) {
-% local($^W)=0; next if $saw{$value}++;
-% my $label = $hash{$value};
-%
-
-
- <option value="<% $value %>"<% $value eq $conf->config($i->key) || ( $type eq 'selectmultiple' && grep { $_ eq $value } $conf->config($i->key) ) ? ' SELECTED' : '' %>><% $label %>
-% }
-% my $curvalue = $conf->config($i->key);
-% if ( $conf->exists($i->key) && $curvalue
-% && ! $hash{$curvalue}
-% ) {
-%
-
-
- <option value="<% $conf->config($i->key) %>" SELECTED><% exists( $hash{ $conf->config($i->key) } ) ? $hash{ $conf->config($i->key) } : $conf->config($i->key) %>
-% }
-
-
- </select>
-% } elsif ( $type eq 'select-sub' ) {
-
-
- <select name="<% $i->key. $n %>">
- <option value="">
-% my %options = &{$i->options_sub};
-% my @options = sort { $a <=> $b } keys %options;
-% my %saw;
-% foreach my $value ( @options ) {
-% local($^W)=0; next if $saw{$value}++;
-%
-
- <option value="<% $value %>"<% $value eq $conf->config($i->key) ? ' SELECTED' : '' %>><% $value %>: <% $options{$value} %>
-% }
-% if ( $conf->exists($i->key) && $conf->config($i->key) && ! exists $options{$conf->config($i->key)} ) {
-
- <option value=<% $conf->config($i->key) %> SELECTED><% $conf->config($i->key) %>: <% &{ $i->option_sub }( $conf->config($i->key) ) %>
-% }
-
- </select>
-% } elsif ( $type eq 'editlist' ) {
-
-
- <script>
- function doremove<% $i->key. $n %>() {
- fromObject = document.OneTrueForm.<% $i->key. $n %>;
- for (var i=fromObject.options.length-1;i>-1;i--) {
- if (fromObject.options[i].selected)
- deleteOption<% $i->key. $n %>(fromObject,i);
- }
- }
- function deleteOption<% $i->key. $n %>(object,index) {
- object.options[index] = null;
- }
- function selectall<% $i->key. $n %>() {
- fromObject = document.OneTrueForm.<% $i->key. $n %>;
- for (var i=fromObject.options.length-1;i>-1;i--) {
- fromObject.options[i].selected = true;
- }
- }
- function doadd<% $i->key. $n %>(object) {
- var myvalue = "";
-% if ( defined($i->editlist_parts) ) {
-% foreach my $pnum ( 0 .. scalar(@{$i->editlist_parts})-1 ) {
+% my %hash = ();
+% if ( $config_item->select_enum ) {
+% tie %hash, 'Tie::IxHash',
+% '' => '', 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 };
+% } else {
+% 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. '"' );
+% }
+%
+% my %saw = ();
+% foreach my $value ( keys %hash ) {
+% local($^W)=0; next if $saw{$value}++;
+% my $label = $hash{$value};
+%
+
+ <option value="<% $value %>"
+
+% if ( $value eq $conf->config($key, $agentnum)
+% || ( $type eq 'selectmultiple'
+% && grep { $_ eq $value } $conf->config($key, $agentnum) ) ) {
+
+ SELECTED
+
+% }
+
+ ><% $label %>
+
+% }
+% my $curvalue = $conf->config($key, $agentnum);
+% if ( $conf->exists($key, $agentnum) && $curvalue && ! $hash{$curvalue} ) {
+
+ <option value="<% $curvalue %>" SELECTED>
+
+% if ( exists( $hash{ $conf->config($key, $agentnum) } ) ) {
+
+ <% $hash{ $conf->config($key, $agentnum) } %>
+
+% }else{
+
+ <% $curvalue %>
+
+% }
+% }
+
+ </select>
+
+% } elsif ( $type eq 'select-sub' ) {
+% $submit++;
+
+ <select name="<% "$key$n" %>" <% $config_item->multiple ? 'MULTIPLE' : '' %>>
+
+% unless ( $config_item->multiple ) {
+ <option value="">
+% }
+
+% my %options = &{$config_item->options_sub};
+% my @options = keys %options;
+% my $sortsub = $config_item->sort_sub || sub { $a <=> $b };
+% @options = sort $sortsub @options;
+% my %saw;
+% foreach my $value ( @options ) {
+% local($^W)=0; next if $saw{$value}++;
+
+ <option value="<% $value %>"