--- /dev/null
+ <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>
+
+<SCRIPT>
+function addOption(text, value, defaultselected, selected) {
+ var option = new Option(text, value, defaultselected, selected )
+ var length = document.ModifyKeywordSelect.ObjectValue.length;
+ document.ModifyKeywordSelect.ObjectValue.options[length] = option
+}
+function ChangeObjectValue(what) {
+ Value = what.options[what.selectedIndex].value
+ if ( Value == "(none)" ) {
+ document.ModifyKeywordSelect.ObjectValue.options.length = 0
+ addOption("(n/a)", "", false, false)
+ }
+ if ( Value == "Queue" ) {
+ document.ModifyKeywordSelect.ObjectValue.options.length = 0
+%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>
+