[rt-users] Customizing Create Ticket Forms

Harald Wagener hwagener at hamburg.fcb.com
Tue Feb 12 12:02:35 EST 2002


Jaime Kikpole wrote:
> 
> On Tue, 12 Feb 2002, Bruce Campbell wrote:
> > Quite simply, by writing your own pages and copying to the appropriate
> > place in the WebRT/html tree.  For some curious reason, a lot of working
> > example pages are already provided for you, including authentication to
> > the RT system ;)
> 
>         OK, OK, you got me there.  I just don't have enough time to do the
> tasks that the boss(es) put on me, let alone my actual job description.
> So I was hoping for something more than just "read the code and figure it
> out."  :)
> 
>         Are there any special cases that I should know about?  For
> example, I'm assuming that /NoAuth/* is for the pages that don't require a
> login process.  Is that correct?

Yes. Actually, there is a directory local/html in Your /path/to/rt2/,
where You can put Your adapted pages. These will be used instead of the
Mason Elements and Pages in /path/to/rt2/html/ and it's sub directories
if they do have the same name and path from there on. So If You have
/path/to/rt2/html/WebRT/index.html and want to change it, You put Your
adapted version into /path/to/rt2/local/html/WebRT/index.html . Same for
Elements and stuff. Now, these aren't Your typical web pages, but they
are 'enriched' with Mason stuff, which You'll recognize by either being
included in tags starting with an ampersand <& .. &>. These are Elements
which will be included, and possibly some attributes will be set as
well.
i.e., 
<& /Elements/TitleBoxStart, title => 'Example', color => '#000000' &> 

will draw the beginning of a Box with the text 'Example' on a black bar. 

Then there might be blocks encased in <%INIT> statements. In these, some
perl code can be specified. I didn't do much about this. But You could
try to modify /Elements/Tabs (respective to
/path/to/rt2/local/html/WebRT that is) to only show the Configuration
link only when Admin users are logged in. It would be like this: 

<%INIT>
my ($tab, $action);
my $toptabs = {    A => { title => 'Mein RT',
                           path => '',
                         },
                    B => { title => 'Suche',
                        path => 'Search/Listing.html'
                      },
 
 
 
                    D => { title => 'Konfiguration',
                           path => 'Admin/'
                         }
                 };
 
 
my $topactions = {
        A => { html => $m->scomp('/Elements/CreateTicket')
                },
        B => { html => $m->scomp('/Elements/GotoTicket')
                }
        };
 
unless ($session{'CurrentUser'}->HasSystemRight('AdminUsers')) {
 
 
$toptabs = {    A => { title => 'Startseite',
                           path => '',
                         }
                 };
};
 
</%INIT>

(this is just an example of an evil hack, a cleaner version is easy to
be found)

Then there is <%ARGS></%ARGS>, in which default values for the arguments
which You intend to manipulate on that page/within that Element are
initialised with reasonable values like undef or "none".

Variables can be inserted into the HTML code if  You enclode them in
percent tags like this:

 <% $toptabs->{$tab}->{'title'}%>

Perl code can be embedded by preceding a given line with a percent sign:

% if ($subtabs_scalar) { #this is perl
<% $subtabs_scalar |n%>  <!-- this is a variable embedded into HTML -->
% }			//this is perl
<B> Some Text <!-- this is HTML --> </B>

Better, correct, and more readable examples is all of the stuff found in
/path/to/rt2/html/WebRT/. There are also some man pages on rt stuff.
Just add /path/to/rt2/man to Your $MANPATH and You're set to read stuff
about RT, RT::CurrentUser and a slew of other things. Beware: These man
pages may be outdated, so You know.

If You need to know more, just google for stuff about Mason, and have a
close look at RT - it should be all You need. A german computer magazine
(iX) had an article about Mason in it's february issue, so if You know
enough german, You can have a look at their web site (they publish some
of their articles online, without any registration - the article can be
found at http://www.heise.de/ix/artikel/2002/02/128/).

Regards,
	Harald



>         What about any special variables or techniques?  For example, if
> someone asked me how to add a module to TWIG, I'd tell them to make a
> directory in features/ named after thier module, to put the main menu
> entry into config/mainmenu.inc.php3, etc.
> 
>         Thanks in advance for any pointers.
> 
>                                                         Off to read code,
>                                                         Jaime
> 

-- 
Harald Wagener      |                           Systemadministrator 
FCB/Wilkens GmbH    |                         Tel.:+49-40-2881-1252 
An der Alster 42    |                         Fax.:+49-40-2881-1263 
20099 Hamburg       |                    http://www.fcb-wilkens.com




More information about the rt-users mailing list