[rt-users] Home page Change

Andy Harrison aharrison at gmail.com
Mon Nov 29 08:46:00 EST 2004


On Mon, 29 Nov 2004 11:49:04 +0100 (CET), attend rid <lopolo_fr at yahoo.fr> wrote:
> 
> I understood that the "newest unowned tickets" list in the start page
> includes mails to all queues. Is it possible to change the queues included
> in that list? 

Sure. Create <RT_DIR>/local/html/Elements if it doesn't already exist.
 Then use <RT_DIR>/share/html/Elements/MyRequests as a template.

Here's how I did one for our network department.

<&|/Elements/TitleBox, 
        title => loc("[_1] newest unowned tickets in Network Queues", $rows),
        title_href => "Search/Results.html".$QueryString &>

% # print "Testing: ", $Query;

<& /Elements/TicketList, 
        Format => "'<a
href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#',
'<a href=\"$RT::WebPath/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject',
QueueN
ame, ExtendedStatus, CreatedRelative, '<A
HREF=\"$RT::WebPath/Ticket/Display.html?Action=Take&id=__id__\">".loc('Take')."</a>/TITLE: '
",
        Query => $Query,
        OrderBy => 'Created',
        Order => 'DESC',
        ShowNavigation => 0,
        Rows => $rows

        &>
</&>
<%init>
my $rows = $RT::MyRequestsLength;

my %NetworkQueues = ( 
    'network'                 => 9,
    'network-circuit-order'   => 57,
    'network-emo'             => 37,
    'network-escalation'      => 15,
    'network-inventory'       => 49,
    'network-maintenance'     => 17,
    'network-port-capacity'   => 46,
    'network-problem'         => 47,
    'network-project-tasks'   => 48,
    'network-sales-order'     => 51,
    'network-verizon'         => 24,
);

# my $Query = "Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')";

my $Query = " ( Queue = ";
my $First = 1;

foreach ( keys %NetworkQueues ) {
    $Query .= " OR Queue = " unless $First;
    $Query .= $NetworkQueues{ $_ };
    undef $First if $First;;
}
    $Query .= " ) AND ( Status = 'new' OR Status = 'open')";

my $QueryString = '?' . $m->comp('/Elements/QueryString', 
            Query => $Query,
            Order => 'DESC',
            OrderBy => 'Priority') if ($Query);

</%init>

Then copy <RT_DIR>/share/html/index.html to <RT_DIR>/local/html and
modify the local dir copy.

I extended the MyRequests part a bit and added the lines:

% my $GroupObj = RT::Group->new( $session{ 'CurrentUser' } );
% my $PrincipalObj = RT::Principal->new( $session{ 'CurrentUser' } );
% $PrincipalObj->Load( $session{ 'CurrentUser' }->id );
% $GroupObj->LoadUserDefinedGroup( 'Network' );
% my $HasMember = $GroupObj->HasMemberRecursively( $PrincipalObj );
% unless ( $HasMember ) {
<& /Elements/MyRequests &>
<BR>
% }
% if ( $HasMember ) {
<& /Elements/NetworkRequests &>
% }
<BR>

Sort of a crappy way to do it, but it works fine.

-- 
Andy Harrison



More information about the rt-users mailing list