Re: clarification on callbacks

Matt Zagrabelny <[email protected]>
Newsgroups gmane.comp.bug-tracking.request-tracker.user
Message-ID <CAOLfK3UhLiUWsX8uh+P33r7HrGH_ni4cP4ORsEPs70_fWXp+RQ@mail.gmail.com>
Hey Alex,

On Tue, Oct 11, 2016 at 3:27 PM, Alex Hall <[email protected]> wrote:
> Hello list,
> I'm considering trying out a callback. Ken suggested it as a way to add a
> link to pages that will let users toggle between self-service and standard
> interfaces, and I'm very much hoping I can use it to customize the way
> history displays on ticket summary pages.
>
> From what I've read so far, it seems like a callback is analogous to a
> subclass. If I have a 'renderer' class that can make pretty text from raw
> HTML, I might then subclass it and override the function that parses text to
> make it work on XML. Yes, it's a very terrible example, but hopefully the
> idea is correct.
>
> Anyway, a callback in RT seems a lot like that. I want the ticket page to
> display how it already does, but I don't like the history part. Thus, I copy
> the file to the proper callback directory, then modify it. RT will, when it
> knows it has to use Display.html, look in callbacks first and use my
> version. Only if I don't provide one will it use the default one in
> share/html/Tickets.
>
> Do I have this right--copy the existing file to callbacks and modify it? Or
> do I make a blank file, override only the bits I want to in there, and not
> copy the whole thing? Am I thinking about callbacks all wrong?

You are thinking about Callbacks wrong. :)

They are hook points in the HTML (Mason) of RT.

Many (most?) RT extension will have some callbacks in them. Here is a
nice easy one to get your feet wet:

https://github.com/bestpractical/rt-extension-commentoncreate

Take a look at the source for this extension and note the
html/Callbacks directory. Then look in your RT share/html directory
for where those callbacks would appear.

In this particular instance, rt-extension-commentoncreate adds a
"comment" box just below the "create" content box on the
Ticket/Create.html page.

So you can see from the source of the extension, it will add something
to the AfterMessageBox callback in the Create.html Mason component.

I'll let you dig a little bit more with this extension or another one
to get more familiar with callbacks.

Also, read the documentation:

https://docs.bestpractical.com/rt/4.4.1/writing_extensions.html#Callbacks

-m
---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Boston - October 24-26
* Los Angeles - Q1 2017
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.