<TABLE> <TR> % while ( my $KeywordSelect = $KeywordSelects->Next ) { % my $CurrentKeywords = $TicketObj->KeywordsObj($KeywordSelect->id); % my $Descendents = $KeywordSelect->KeywordObj->Descendents; <TD VALIGN=TOP> <% $KeywordSelect->Name %> <BR> <INPUT TYPE="hidden" NAME="KeywordSelectMagic<% $KeywordSelect->id %>" VALUE="1"> <SELECT NAME="KeywordSelect<% $KeywordSelect->id %>" <% $KeywordSelect->Single ? "" : " MULTIPLE " %> SIZE=5> %# %# %# All of this cruft is so we have a 'no keyword' selector for single %# keywords that's only selected when there's no value. % % my $selected_keywords = 0; % foreach my $kid ( keys %{$Descendents} ) { % my $selected = 0; % if ($CurrentKeywords->HasEntry($kid)) { $selected_keywords++; $selected=1;} <OPTION VALUE="<% $kid %>" <% $selected && 'SELECTED'%>> <% $Descendents->{$kid} %> </OPTION> % } % if ( $KeywordSelect->Single) { <OPTION VALUE="" <% ($selected_keywords == 0) && 'SELECTED' %> >(empty)</OPTION> % } </SELECT> </TD> % } </TR> </TABLE> <%INIT> my $KeywordSelects = $TicketObj->QueueObj->KeywordSelects; </%INIT> <%ARGS> $TicketObj => undef </%ARGS>