import rt 2.0.14
[freeside.git] / rt / webrt / Ticket / Elements / EditKeywordSelects
diff --git a/rt/webrt/Ticket/Elements/EditKeywordSelects b/rt/webrt/Ticket/Elements/EditKeywordSelects
new file mode 100644 (file)
index 0000000..34ade9f
--- /dev/null
@@ -0,0 +1,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>
+