[rt-users] StockAnswers Addin, Abuse, and dead ticket purging.

Gorazd Bozic gorazd.bozic at arnes.si
Fri Mar 15 04:02:20 EST 2002


"Rob Mitzel" wrote:
> Hey gang,
> 
> Just a quick question...anyone ever used the contributed StockAnswers addin?
> I was just setting it up, and it's quite neat (as to why I'll explain in a
> sec), but I was curious...any way to insert a blank line in them?  I made up
> some stock answers, and it seems to crap out as soon as it hits a blank
> line. (Robert Spier?  You here?) :)

I had the same problems and solved it by a slight modification of
StockAnswers.html. At the end of this file you have:

for my $n (@templates) {
 open(IN,"<$n") or next;
 local $/ = "";
 my $t = <IN>;
 $n =~ s{^.+/(.+?)/(.+?)$}{$1:$2};
 push @data, [$n,$t];
}

which I modified to

for my $n (@templates) {
 open(IN,"<$n") or next;
 local $/ = "";
 my $t = join('', <IN>); $t =~ s/\n/\\n/gs; $t =~ s/\'/\\\'/gs;
 $n =~ m{^.+/(.+?)/(.+?)$}; my ($dir,$name) = ($1,$2);
 if ($t =~ s/^\$title:\s*(.+?)\\n//) { $name = $1; }
 $n = "$dir:$name";
 push @data, [$n,$t];
}

Since I didn't like filenames as titles of answers, this patched version
looks for a line of the form

$title: title of this answer

in sets the title of the answer accordingly. If there's no '$title:' 
line in the file, it still uses the name of the file in the list of
available answers.

Regards,
Gorazd





More information about the rt-users mailing list