Fun with custom fields

Two questions on custom fields:

(1) The Administrator Question: I’ve created a “enter multiple values”
field on a queue. When I visit Ticket/Modify.html for a
particular ticket, there’s an edit box prompting me to “enter
multiple values”. How do I do that? “One value to a line” isn’t
it; I just get one big value with multiple lines to it.

(2) The Hacker Question: I have some HTML::Mason code that gets the
list of possible values, then displays them, along with any
tickets that have that value. The code looks like:

><%$Name%>
% foreach my $value (@$Values) {    <%$value%> <%PERL> $Tickets->ClearRestrictions; $Tickets->LimitStatus(VALUE => "new"); $Tickets->LimitStatus(VALUE => "open"); $Tickets->LimitQueue(VALUE => "Bugs", OPERATOR => "="); $Tickets->LimitCustomField(CUSTOMFIELD => 3, OPERATOR => "=", VALUE => "$Name $value"); while (my $Ticket = $Tickets->Next) { <%$Ticket->id%> (<%$Ticket->OwnerObj->Name%>) <%$Ticket->Subject%> % }
% } <%INIT> my $Tickets = RT::Tickets->new($session{'CurrentUser'}); <%ARGS> $Class => 'oddline' $Name => undef $Values => []

Is this, in fact, the best way to do it? It feels vaguely
sluggish, though I haven’t looked into it more; I assume throwing
an index at the values of the custom field would help.

I’m also open to UI suggestions. The listing looks sort of like this:

Name 1, which is potentially quite long
Case 1: 1 (Nobody) Case 1 is broken, 2 (dmaze) Cases 1-3 need help
Case 2: 2 (dmaze) Cases 1-3 need help
Name 2, also potentially quite long
Case 3: 2 (dmaze) Cases 1-3 need help
Case 4

Right now “Name 1”, “Name 2”, “Name 3”, etc. are in alternating colors
(evenrow, oddrow); I have no good way of dealing if the list of
tickets associated with a particular case overflow. I’d also like a
more convenient way of associating a case with a ticket, rather than
forcing users to type out the full name of the name and case possibly
mult8iple times.

David Z. Maze dmaze@cag.lcs.mit.edu
Research Scientist David's Home Page
MIT LCS Computer Architecture Group MIT Computer Architecture Group Home Page

David Z Maze dmaze@cag.lcs.mit.edu writes:

(1) The Administrator Question: I’ve created a “enter multiple values”
field on a queue. When I visit Ticket/Modify.html for a
particular ticket, there’s an edit box prompting me to “enter
multiple values”. How do I do that? “One value to a line” isn’t
it; I just get one big value with multiple lines to it.

Maybe the thing to do is to change RT::Interface::Web;
lib/RT/Interface/Web.pm has, at line 1074 in
ProcessTicketCustomFieldUpdates,

            my @values =
              ( ref( $ARGSRef->{$arg} ) eq 'ARRAY' ) 
              ? @{ $ARGSRef->{$arg} }
              : ( $ARGSRef->{$arg} );

so if the value entered is a single multiline string and nothing in
the intervening CGI-to-Perl interface converts it into an array ref,
it gets passed on as a single string. ‘split /\n/, $ARGSRef->{$arg}’
for the else case here might be closer to what I want.

David Maze dmaze@mit.edu David's Home Page
“Theoretical politics is interesting. Politicking should be illegal.”
– Abra Mitchell