summaryrefslogtreecommitdiff
path: root/rt/webrt/Ticket/Elements/EditKeywordSelects
blob: 34ade9f25649286ee7c5bc6fb31bd1f013e6781e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

<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>