From Request Tracker Wiki
Revision as of 15:15, 6 April 2016 by Admin (talk | contribs) (2 revisions imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I'd say this is one of the more confusing aspects of callbacks.

Some people reference this mysterious directory as ...rt3/local/html/Callbacks/<MyCallbacks>/...

Others reference it even MORE mysteriously as ...rt3/local/html/Callbacks/*/...

Do this -- don't make yourself crazy. Wherever it says anything like that -- just name the directory


Now, since you're here. I'm guessing you're slightly baffled about all this Callback gibberish anyway.

Here's what they're saying.

In RT, each page is made up of a lot of different parts. Each of these parts is stored in a different area in the (hard to navigate) rt3 source tree.

Now, in each page, there are sub-objects -- often referred to as Elements -- potentially referred to as other things as well. These Elements in the original source tree hold the magical Callbacks (don't panic, I'm still explaining).

So! For example -- you open a Ticket. It shows you all that Metadata junk (that's a group of Elements), and it shows you the History (that's an Element) and so on.

Let's pretend that you want to mess with the History display (as I did when I wanted to learn this painful lesson).

First you have to find the original bit that makes this happen. You'll find it under the .../share/html/Ticket tree.

That means that it's a sub-Element of the Ticket display... that almost makes sense.

Under the .../share/html/Ticket directory -- there's an Elements directory.

Inside THAT directory is a little piece of code called "ShowHistory".

Now -- as a hardcore coder, you COULD edit that file -- but you'd be sorry later on. RT changes dramatically between versions, and you might make a lot of changes to that Element and then have that work lost later on.

The right way to edit it directly is to create an "override" version under .../local/html/Ticket/Elements/ShowHistory ... but even THAT might not be great because the code would still be subject to change without notice.

So you use Callbacks! Let's get excited.

All a Callback does is check a directory for potential extra code.

So, in this "ShowHistory" Element, there's are many Callbacks -- one is called "SkipTransaction"

What that means is that when the ShowHistory Element's code is being run, it checks against the .../local/html/Callbacks/MyCallbacks/Ticket/Elements/ShowHistory directory to see if there is a FILE in there named "SkipTransaction" ... if so, run the code in that file.

That's the magic -- it's a way of calling out to new code without losing your place in the source code.


When you want to edit a Callback, you create a FILE according to the name suggested by the programmer who made that Callback -- and store it in the right place as described above.

Hope that helps.