[rt-users] Communicate a message to web UI from inside Scrip?

Jeff Blaine jblaine at kickflop.net
Thu Jan 6 16:44:26 EST 2011


On 1/6/2011 2:00 PM, Ruslan Zakirov wrote:
> More user friendly way to go is to prevent action right in the ui. Look
> at mandatory subject extention as example.

I completely agree.

Unfortunately it doesn't look very doable so far.

Here's what I've got to say after 4 hours.

"Mandatory Subject Extension" works because there's a clear
hook (and flag, $skip_create) available in the callback calls.

There are 2 places that we care about where resolving a ticket
can happen:

Update.html (via clicking the 'Resolve' action link)

Modify.html (via clicking 'Basics')

Oddity: Update.html redirects to Display.html on success.

         Modify.html redisplays Modify.html on success.

Here are my notes (as comments) on these two files:

Modify.html

     # This one doesn't even have a CallbackName (???)
     # How do I make my own Callback?  Proper path for that?
     $m->callback( TicketObj => $TicketObj,
                   CustomFields => $CustomFields,
                   ARGSRef => \%ARGS );

Update.html

     ...

     $m->callback( Ticket => $TicketObj, ARGSRef => \%ARGS,
                  results => \@results, CallbackName => 'Initial' );
     ...

     if ( !$checks_failure && exists $ARGS{SubmitTicket} ) {
         $m->callback( Ticket => $TicketObj, ARGSRef => \%ARGS,
                       CallbackName => 'BeforeDisplay' );
         #
         # All okay -- Complete jump to Display.html and not
         # passing along @results, yet SOMEHOW Display.html
         # shows what was performed.  Mystery to me.
         #
         return $m->comp('Display.html', TicketObj => $TicketObj,
                         %ARGS);
     }
     # ELSE Update.html is called and shows the failed hardcoded
     # checks*it* cared about.
     #
     # This blows, because if the hardcoded checks are okay
     # (but not MY checks), we jump to a completely different
     # page.
     #
     # What would work, I think, is if the "Initial" callback
     # passed $checks_failure so that I could check what I
     # wanted and set $checks_failure to 1 (and update @results)
     # as I saw fit.

Along with all of that, I can't seem to get even a basic callback
working for the life of me.

I have tried all sorts of variations on the following, with
server restarts, and gotten nowhere:

 
/rt/local/html/Callbacks/MyCallbacks/Ticket/TheFile.html/TheCallbackName

Where TheFile.html is something like Update.html

Where TheCallbackName is something like Initial

> Regards, Ruslan. From phone.
>
> 06.01.2011 21:11 пользователь "Jeff Blaine" <jblaine at kickflop.net
> <mailto:jblaine at kickflop.net>> написал:
>  > As part of my current solution (ongoing) to the "Don't allow
>  > resolve if a certain CF is not set" topic, I am resetting
>  > the ticket status back to "open" when I see that someone
>  > tried to resolve while the specific CF was not set.
>  >
>  > Unfortunately, even though my code set the status back to
>  > "open", the "BriefMessage" on the transaction still says
>  > that the status went from "open to resolved" ... yet the
>  > ticket shows properly *as open still*.
>  >
>  > Is there a way to queue one of these notices to the user
>  > from within my Scrip?
>  >
>  > ERROR: Cannot resolve without a value for BlahBlah.



More information about the rt-users mailing list