--- /dev/null
+<& /Admin/Elements/Header, Title => 'Admin KeywordSelects' &>
+<& /Admin/Elements/Tabs, current_tab => 'Admin/KeywordSelects/' &>
+
+A <B>KeywordSelect</B> is a link between a <B>Keyword</B> and a object
+(currently just <B>Tickets</B>), titled by the <I>Name</I> field of the Keyword such that:
+<ul>
+<li>Object display will contain a field, titled with the <I>Name</I> field of
+the <B>Keyword</B> and showing any descendent keywords.
+<li>Object creation for this field will contain a field, titled with the
+<I>Name</I> field of the <B>Keyword</B> and containing the descendents of
+the <B>Keyword</B> as choices.
+<li>Searches for this object type will contain a selection field titled with
+the <I>Name</I> field of the <B>Keyword</B> and containing the descendents
+of the <B>Keyword</B> as choices.
+<TABLE WIDTH=100%>
+
+
+
+ <TD VALIGN=TOP>
+ <h2>Create KeywordSelect</h2>
+ <FORM NAME="ModifyKeywordSelect" METHOD="POST" ACTION="<%$RT::WebPath%>/Admin/KeywordSelects/Modify.html">
+ [<%$title |n %>]
+ <BR>
+
+ <INPUT TYPE="hidden" NAME="id" VALUE="<% $id %>">
+ Keyword
+ <SELECT NAME="Parent">
+
+%while ( $parent = $parents->Next ) {
+
+ <OPTION VALUE="<% $parent->id %>" <% defined($KeywordSelect->Parent) && $parent->id == $KeywordSelect->Parent ? ' SELECTED' : '' %>><% $parent->Name %></OPTION>
+
+% }
+
+ </SELECT>
+ <BR>
+ Object
+ <SELECT NAME="ObjectType">
+ <OPTION SELECTED>Ticket</OPTION>
+ </SELECT>
+ <BR>
+
+%foreach $queue ( keys %queues ) {
+ addOption("<% $queues{$queue} %>", "<% $queue %>", false, <% $queue == $KeywordSelect->ObjectValue ? 'true' : 'false' %> )
+%}
+ }
+}
+</SCRIPT>
+
+ Limit to <SELECT NAME="ObjectField" onChange="ChangeObjectValue(this)">
+ <OPTION VALUE="" <% $KeywordSelect->ObjectField ? '' : ' SELECTED' %>>(none)</OPTION>
+ <OPTION VALUE="Queue" <% $KeywordSelect->ObjectField eq 'Queue' ? ' SELECTED' : '' %>>Queue</OPTION>
+ </SELECT>
+ <SELECT NAME="ObjectValue">
+ <OPTION VALUE="<% $KeywordSelect->ObjectValue %>">
+ <% $KeywordSelect->ObjectField ? $queues{$KeywordSelect->ObjectValue} : "(n/a)" %></OPTION>
+ </SELECT><BR>
+ <INPUT TYPE="hidden" NAME="SingleMagic" VALUE="1">
+ <INPUT TYPE="checkbox" NAME="Single" VALUE="1" <% $KeywordSelect->Single ? ' CHECKED' : '' %>>Allow single selection only<BR>
+ Limit to <INPUT TYPE="text" NAME="Generations" SIZE="2" VALUE="<% $KeywordSelect->Generations %>"> generations (0 = no limit)<BR>
+ <& /Elements/Submit, Label => $submit &>
+
+</FORM>
+
+<%INIT>
+
+
+my $KeywordSelect = new RT::KeywordSelect($session{CurrentUser});
+
+my($title, $submit);
+
+if ( $Create ) {
+ $title = "Create a new KeywordSelect";
+ $submit = "Create";
+ $id = "new";
+} else {
+ if ( $id eq 'new' ) {
+ $id = $KeywordSelect->Create (
+ Parent => $Parent,
+ ObjectType => $ObjectType,
+ ObjectField => $ObjectField,
+ ObjectValue => $ObjectValue,
+ Single => $Single,
+ Generations => $Generations,
+ ) or Abort "can't create KeywordSelect";
+ } else {
+ $KeywordSelect->Load($id) || Abort("Can't load keyword id $id");
+ #false laziness
+ $KeywordSelect->SetParent($Parent) if defined($Parent);
+ $KeywordSelect->SetObjectType($ObjectType) if defined($ObjectType);
+ $KeywordSelect->SetObjectField($ObjectField) if defined($ObjectField);
+ $KeywordSelect->SetObjectValue($ObjectValue) if defined($ObjectValue);
+ $KeywordSelect->SetSingle($Single) if defined($SingleMagic);
+ $KeywordSelect->SetGenerations($Generations) if defined($Generations);
+ }
+ $title = "Modify the KeywordSelect <B>". $KeywordSelect->KeywordObj->Name. "</B>";
+ $submit = "Modify";
+
+}
+
+ my $parents = new RT::Keywords($session{CurrentUser});
+ $parents->UnLimit;
+ my $parent;
+
+my $queues = new RT::Queues($session{CurrentUser});
+$queues->UnLimit;
+
+my %queues;
+my $queue;
+$queues{$queue->id} = $queue->Name while $queue = $queues->Next;
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Create => undef
+$Parent => undef
+$ObjectType => undef
+$ObjectField => undef
+$ObjectValue => undef
+$Single => undef
+$SingleMagic => undef
+$Generations => undef
+</%ARGS>
+
+
+ <& /Admin/Elements/ModifyKeywordSelect, 'Create'=>'1' &>
+ </TD>
+
+ <TD VALIGN=TOP>
+ <H2>Modify KeywordSelect</H2>
+
+ <& /Admin/Elements/SelectModifyKeywordSelect &>
+ </TD>
+</TR>
+
+</TABLE>