& /Elements/Tabs, tabs => $tabs, actions => $actions, current_tab => $current_tab, tabs_scalar => $tabs_scalar &>
<%INIT>
my $id = $Ticket->id();
my $tabs_scalar = '';
my $tabs = {
A => { title => 'Display',
path => "Ticket/Display.html?id=".$id,
},
Ab => { title => 'History',
path => "Ticket/History.html?id=".$id,
},
B => { title => 'Basics',
path => "Ticket/Modify.html?id=".$id,
},
C => { title => 'Dates',
path => "Ticket/ModifyDates.html?id=".$id,
},
D => { title => 'People',
path => "Ticket/ModifyPeople.html?id=".$id,
},
E => { title => 'Links',
path => "Ticket/ModifyLinks.html?id=".$id,
},
F => { title => 'Jumbo',
path => "Ticket/ModifyAll.html?id=".$id,
},
};
my $actions;
if ($Ticket->CurrentUserHasRight('ModifyTicket') or
$Ticket->CurrentUserHasRight('CommentOnTicket')) {
$actions->{'Comment'} =
{
title => 'Comment',
path => "Ticket/Update.html?Action=Comment&id=".$id,
}
};
if ($Ticket->CurrentUserHasRight('ModifyTicket') or
$Ticket->CurrentUserHasRight('ReplyToTicket')) {
$actions->{'Reply'} =
{
title => 'Reply',
path => "Ticket/Update.html?Action=Respond&id=".$id,
}
};
if ($Ticket->CurrentUserHasRight('OwnTicket')) {
if ($Ticket->OwnerObj->id == $RT::Nobody->id) {
$actions->{'Take'} =
{
path => "Ticket/Display.html?Action=Take&id=".$id,
title => 'Take'
};
}
elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id) {
$actions->{'Steal'} =
{
path => "Ticket/Display.html?Action=Steal&id=".$id,
title => 'Steal'
};
}
}
if ($Ticket->CurrentUserHasRight('ModifyTicket')) {
if ($Ticket->Status ne 'resolved') {
$actions->{'Resolve'} =
{
path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=".$id,
title => 'Resolve'
};
}
if ($Ticket->Status ne 'open') {
$actions->{'Open'} =
{
path => "Ticket/Display.html?Status=open&id=". $id,
title => 'Open'
};
}
}
if (defined $session{'tickets'}) {
my $items = $session{'tickets'}->ItemsArrayRef();
my @indexs = grep(($items->[$_]->id == $Ticket->Id), 0 .. $#{$items});
if ($items->[0]) {
if ($items->[$indexs[0]]->id == $Ticket->Id) {
# Don't display prev links if we're on the first ticket
if ( $items->[0]->id != $Ticket->id ) {
$tabs_scalar .= '[<< First] ';
$tabs_scalar .= '[< Prev] ';
}
# Don't display next links if we're on the last ticket
if ( $Ticket->id != $items->[-1]->id ) {
$tabs_scalar .= '[Next >] ';
$tabs_scalar .= '[Last >>]';
}
$tabs_scalar .= "
";
}
}
}
%INIT>
<%ARGS>
$Ticket => undef
$current_tab => undef
%ARGS>