Re: [rt-users] need to run code when user presses a button

2015-03-26 Thread Landon Stewart
On Mar 26, 2015, at 11:52 AM, Al Joslin allen.jos...@gmail.com wrote:
 
 I would like to have a button on the display page of a ticket that when 
 clicked runs some code (*) which then causes the display page to refresh
 
 I have the code (*) written which queries a remote database and updates an rt 
 ticket based on what it finds
   - this is all perl code, using DBI to connect the external db
 
 I don’t care if the code is stored in RT or not
 
 How can I do this?
 
 I can create a button on the Ticket display page which submits a form to an 
 url, perhaps I should return the result as a redirect back to the Ticket 
 display page ?

Hi Al,

There is probably a way to hack this into the RT pages but the way I'd probably 
do it is build a separate webpage on a different virtualhost that will do what 
you want (very simple page with the button) and the necessary headers to 
redirect to the referrer.  Then I'd use a custom field to show that page 
(custom fields can show data *or* actual webpage content).  When I click the 
button within the custom field that's displaying this other page it would go to 
that page, do what it's supposed to do and then redirect back to the referrer 
(the display page in RT).  Be sure to protect the page on the virtualhost 
somehow so it's not available to someone who should not see/use it.

Landon Stewart : lstew...@iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com : +1 (888) 909-4932



signature.asc
Description: Message signed with OpenPGP using GPGMail


[rt-users] need to run code when user presses a button

2015-03-26 Thread Al Joslin
I would like to have a button on the display page of a ticket that when clicked 
runs some code (*) which then causes the display page to refresh

I have the code (*) written which queries a remote database and updates an rt 
ticket based on what it finds 
- this is all perl code, using DBI to connect the external db

I don’t care if the code is stored in RT or not

How can I do this?

I can create a button on the Ticket display page which submits a form to an 
url, perhaps I should return the result as a redirect back to the Ticket 
display page ?

thanks
al;



Re: [rt-users] need to run code when user presses a button

2015-03-26 Thread Al Joslin
I've got the buttons into Users, Assets, and Tickets via callbacks -- they went 
in quite cleanly

There's no real page to show as the code doesn't take any params beyond the 
id of the item being updated, and hitting it just updates that RT item with 
data from the old Ticketing system (I put the id's from the old system into 
CF's in the RT elements, loading that via a cron job each night) we're only 
going to use this while we are converting over from the old Ticketing system, 
and hitting it will only redirect to the originating page/item or error if 
there is no id so it should be pretty safe.

Thanks for confirming my plan 

al;


 On Mar 26, 2015, at 5:49 PM, Landon Stewart lstew...@iweb.com wrote:
 
 On Mar 26, 2015, at 11:52 AM, Al Joslin allen.jos...@gmail.com wrote:
 
 I would like to have a button on the display page of a ticket that when 
 clicked runs some code (*) which then causes the display page to refresh
 
 I have the code (*) written which queries a remote database and updates an 
 rt ticket based on what it finds
  - this is all perl code, using DBI to connect the external db
 
 I don’t care if the code is stored in RT or not
 
 How can I do this?
 
 I can create a button on the Ticket display page which submits a form to an 
 url, perhaps I should return the result as a redirect back to the Ticket 
 display page ?
 
 Hi Al,
 
 There is probably a way to hack this into the RT pages but the way I'd 
 probably do it is build a separate webpage on a different virtualhost that 
 will do what you want (very simple page with the button) and the necessary 
 headers to redirect to the referrer.  Then I'd use a custom field to show 
 that page (custom fields can show data *or* actual webpage content).  When I 
 click the button within the custom field that's displaying this other page it 
 would go to that page, do what it's supposed to do and then redirect back to 
 the referrer (the display page in RT).  Be sure to protect the page on the 
 virtualhost somehow so it's not available to someone who should not see/use 
 it.
 
 Landon Stewart : lstew...@iweb.com
 Lead Specialist, Abuse and Security Management
 Spécialiste principal, gestion des abus et sécurité
 http://iweb.com : +1 (888) 909-4932