<& /Admin/Elements/Header, Title => 'Edit keywords' &> <& /Admin/Elements/QueueTabs, id => $QueueObj->Id &> <& /Elements/ListActions, actions => \@actions &> <& /Elements/TitleBoxStart, title => $description &>

## Global Keyword Selections

<& /Admin/Elements/ListGlobalKeywordSelects &>
% if ($KeywordSelects->Count > 0 ) {

## Queue Keyword Selections

Delete
% while (my $keywordselect = $KeywordSelects->Next ) {
| <& /Admin/Elements/SelectKeywordSelect, KeywordSelect => $keywordselect &>
% }

% } Add a keyword selection to this queue: %my $ks = new RT::KeywordSelect($session{'CurrentUser'});

- <& /Admin/Elements/SelectKeywordSelect, KeywordSelect => $ks, NamePrefix => 'new' &>

<& /Elements/TitleBoxEnd &> <& /Elements/Submit &> <%init> my (@actions); my $KeywordSelects = new RT::KeywordSelects ($session{'CurrentUser'}); unless ($id =~ /^\d+$/) { Abort("$id isn't a valid Queue id."); } unless ($KeywordSelects->LimitToQueue($id)) { Abort("Couldn't load KeywordSelects."); } my $QueueObj = new RT::Queue($session{'CurrentUser'}); $QueueObj->Load($id); my $description = "Modify Keyword selections for queue '". $QueueObj->Name ."'"; # {{{ if we're trying to create a new keyword select if ($ARGS{'KeywordSelect-new-Name'}) { my $NewKeywordSelect = new RT::KeywordSelect($session{'CurrentUser'}); my ($retval, $msg) = $NewKeywordSelect->Create ( Keyword => $ARGS{'KeywordSelect-new-Keyword'}, ObjectField => 'Queue', ObjectType => 'Ticket', ObjectValue => $QueueObj->Id, Name => $ARGS{'KeywordSelect-new-Name'}, Single => $ARGS{'KeywordSelect-new-Single'}, Depth => $ARGS{'KeywordSelect-new-Depth'} ); push (@actions, $msg); } # }}} # {{{ if we're trying to delete the keywordselect foreach my $key (keys %ARGS) { if ($key =~ /^KeywordSelect-(\d+)-Delete$/) { my $id = $1; my $keywordselect = new RT::KeywordSelect($session{'CurrentUser'}); $keywordselect->Load($id) || push @actions, "Couldn't load keywordSelect"; my ($val, $msg) = $keywordselect->SetDisabled(1); if ($val) { push @actions, 'KeywordSelect disabled.'; } else { push @actions, $msg; } } } # }}} # {{{ if we're modifying keyword selects my @fields = qw(Name Keyword Single Depth); while (my $ks = $KeywordSelects->Next) { foreach my $field (@fields) { if (defined ($ARGS{"KeywordSelect-".$ks->Id."-".$field}) && ($ARGS{"KeywordSelect-".$ks->Id."-".$field} ne $ks->$field())) { my $method = "Set$field"; my ($val, $msg) = $ks->$method($ARGS{"KeywordSelect-".$ks->Id."-".$field}); push @actions, "Keyword Select ". $ks->Name."/$field:".$msg; } } } # }}} <%ARGS> $id => undef #some identifier that a Queue could