Anyone modify StockAnswers for use in the SelfService page?

Hi All!

I’m trying to modify the Stock Answers contrib to make a “Stock Requests”; a
way for users creating tickets to enter pre-formatted text. I’m not having
much luck so far… I can’t seem to get it working. I’m just wondering if
anyone else has done this yet? Am I breaking new ground that makes the
hairpulling worth while? :wink:

Thanks for your time!

Mike

Michael K. Brown
Lab Technician
ATM Engineering Services - Lab Services
Tel: (613) 784-4354
michael.k.brown@alcatel.com

I’m trying to modify the Stock Answers contrib to make a “Stock Requests”; a
way for users creating tickets to enter pre-formatted text. I’m not having
much luck so far… I can’t seem to get it working. I’m just wondering if
anyone else has done this yet? Am I breaking new ground that makes the
hairpulling worth while? :wink:

Michael, could you tell us specifically which URL you're trying to

insert the questions into? From there it should be quite simple to insert
the text.

Hi Aaron!

I’ve put

<& Elements/ShowStock/Requests &>
<& /Elements/MessageBox, Name=> “Content” &>

into an otherwise unmodified Create.html copied to
/usr/local/rt2/local/WebRT/html/SelfService/

I’ve modified StockAnswers0.2 to create StockRequests in
/usr/local/rt2/local/WebRT/html/SelfService/Elements/

I’ll include the modified StockAnswers below. My problem is that I don’t
get anything into the drop down list. I’m not a programmer, so I’d
appreciate any advise you can give me!

Thanks!

Mike

<%doc>
$Id: ShowStockRequests,v 1.0 2002/04/29 15:52:33 mkbrown Exp $
</%doc>
<%args>
$Queue => “”
</%args>

Stock Requests... % $i = 0; % for (@data) { % my ($n,$t) = @$_; <% $n %> %}

<%init>

my
$templateDir="$RT::MasonLocalComponentRoot/…/…/templates/StockRequests";
my @templates = ();
my @data;
push (@templates, glob( $templateDir . $Queue . “/*” ))
if ($Queue && -d $templateDir . $Queue );

special case for the global directory

push (@templates, glob( $templateDir . “global/*” ))
if (-d $templateDir . “global”);
@templates = grep { !/(?:/|,v|~)$/ } @templates;

for my $n (@templates) {
open(IN,"<$n") or next;
local $/ = “”;
my $t = join(’’, ); $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];
}

</%init>From: Aaron T Porter [mailto:atporter@primate.net]
Sent: April 29, 2002 17:04
To: Michael K Brown
Cc: rt-users@lists.fsck.com
Subject: Re: [rt-users] Anyone modify StockAnswers for use in the
SelfService page?

I’m trying to modify the Stock Answers contrib to make a “Stock Requests”;
a
way for users creating tickets to enter pre-formatted text. I’m not
having
much luck so far… I can’t seem to get it working. I’m just wondering if
anyone else has done this yet? Am I breaking new ground that makes the
hairpulling worth while? :wink:

Michael, could you tell us specifically which URL you're trying to

insert the questions into? From there it should be quite simple to insert
the text.

Well, I’m the new maintainer of the StockAnswers project. I am working on a
release of more or less a complete rewrite. I know how StockAnswers works,
(and used to work). Basically you need to follow the same basic instructions
as for the Stock Answers except using Ticket/Create.html. You’ll also need
to add a Name=“TicketCreate” to the form element of Create.html,
And in the javascript code the lines with:
"window.opener.document.TicketUpdate
you need to change the TicketUpdate to TicketCreate
and the UpdateContent to Content.
This should get you in the right direction.
Also make sure that your responses don’t have CR in them. The current code
does not handle this well. The new code will handle both CRLF and LF line
endings ok. Also the new code supports variable substitution.
I will be posting a new release of the code in the next day or so.

Let me know if you need further assistance,

Michael Grubb
System Administrator
R & K, Inc. (000domains.com
mgrubb@fifthvision.netOn Monday 29 April 2002 03:49 pm, Michael K Brown wrote:

Hi All!

I’m trying to modify the Stock Answers contrib to make a “Stock Requests”;
a way for users creating tickets to enter pre-formatted text. I’m not
having much luck so far… I can’t seem to get it working. I’m just
wondering if anyone else has done this yet? Am I breaking new ground that
makes the hairpulling worth while? :wink:

Thanks for your time!

Mike

Michael K. Brown
Lab Technician
ATM Engineering Services - Lab Services
Tel: (613) 784-4354
michael.k.brown@alcatel.com


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

Have you read the FAQ? The RT FAQ Manager lives at http://fsck.com/rtfm