import rt 2.0.14
[freeside.git] / rt / webrt / Ticket / Elements / EditKeywordSelects
1
2 <TABLE>
3     <TR>
4 % while ( my $KeywordSelect = $KeywordSelects->Next ) {
5 % my $CurrentKeywords = $TicketObj->KeywordsObj($KeywordSelect->id);    
6 %   my $Descendents = $KeywordSelect->KeywordObj->Descendents;
7       <TD VALIGN=TOP>
8         <% $KeywordSelect->Name %>
9         <BR>
10           <INPUT TYPE="hidden" NAME="KeywordSelectMagic<% $KeywordSelect->id %>" VALUE="1">
11             <SELECT NAME="KeywordSelect<% $KeywordSelect->id %>"
12               <% $KeywordSelect->Single ? "" : " MULTIPLE " %> SIZE=5>
13 %#
14 %#
15 %#  All of this cruft is so we have a 'no keyword' selector for single
16 %#  keywords that's only selected when there's no value.
17 %
18 % my $selected_keywords = 0;
19 % foreach my $kid ( keys %{$Descendents} ) {
20 % my $selected = 0;
21 % if ($CurrentKeywords->HasEntry($kid)) { $selected_keywords++; $selected=1;}
22               <OPTION VALUE="<% $kid %>" 
23                 <% $selected && 'SELECTED'%>>
24                 <% $Descendents->{$kid} %>
25               </OPTION>
26 %   }
27 %   if ( $KeywordSelect->Single) {
28 <OPTION VALUE="" <% ($selected_keywords == 0) && 'SELECTED' %> >(empty)</OPTION>
29 % }
30             </SELECT>
31       </TD>
32 % }
33     </TR>
34   
35 </TABLE>
36
37
38 <%INIT>
39 my $KeywordSelects = $TicketObj->QueueObj->KeywordSelects;
40 </%INIT>
41
42 <%ARGS>
43 $TicketObj => undef
44 </%ARGS>
45