summaryrefslogtreecommitdiff
path: root/httemplate/elements/select-table.html
diff options
context:
space:
mode:
authorjeff <jeff>2007-02-08 01:46:45 +0000
committerjeff <jeff>2007-02-08 01:46:45 +0000
commit83a6a677f62ca501011d9bac6371344dbb5a13b3 (patch)
tree1608249d6e0855dd24c3c9a7609ddad6ba3a0590 /httemplate/elements/select-table.html
parent10fdcf4c76e4dd14f7fb738665e3fb401af3c28a (diff)
agent type on package add/edit (ticket 1446)
Diffstat (limited to 'httemplate/elements/select-table.html')
-rw-r--r--httemplate/elements/select-table.html10
1 files changed, 9 insertions, 1 deletions
diff --git a/httemplate/elements/select-table.html b/httemplate/elements/select-table.html
index 0c3c00563..3235ef627 100644
--- a/httemplate/elements/select-table.html
+++ b/httemplate/elements/select-table.html
@@ -9,8 +9,11 @@
<OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col() } @records ) {
+% my $matches = 0;
+% ref($opt{'value'}) ? (exists($opt{'value'}->{$record->$key()}) and $matches=1)
+% : ($opt{'value'} == $record->$key() and $matches=1);
- <OPTION VALUE="<% $record->$key() %>"<% $opt{'value'} == $record->$key() ? ' SELECTED' : '' %>><% $record->$name_col() %>
+ <OPTION VALUE="<% $record->$key() %>"<% $matches ? ' SELECTED' : '' %>><% $record->$name_col() %>
% }
@@ -59,6 +62,7 @@ if ( $opt{records} ) {
}
unless ( ! $opt{value}
+ or ref($opt{value})
or ! exists( $opt{hashref}->{disabled} ) #??
or grep { $opt{value} == $_->$key() } @records
) {
@@ -72,6 +76,10 @@ unless ( ! $opt{value}
push @records, $record if $record;
}
+if ( ref( $opt{value} ) eq 'ARRAY' ) {
+ $opt{value} = { map { $_ => 1 } @{$opt{value}} };
+}
+
my @pre_options = $opt{pre_options} ? @{ $opt{pre_options} } : ();
</%init>