X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fwebrt%2FTicket%2FElements%2FTabs;fp=rt%2Fwebrt%2FTicket%2FElements%2FTabs;h=8cce197de3bf6066c5701b8d9b0af3f8f8d1a324;hp=0000000000000000000000000000000000000000;hb=3ef62a0570055da710328937e7f65dbb2c027c62;hpb=030438c9cb1c12ccb79130979ef0922097b4311a diff --git a/rt/webrt/Ticket/Elements/Tabs b/rt/webrt/Ticket/Elements/Tabs new file mode 100755 index 000000000..8cce197de --- /dev/null +++ b/rt/webrt/Ticket/Elements/Tabs @@ -0,0 +1,126 @@ +<& /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 .= "

"; + } + } +} + + + +<%ARGS> +$Ticket => undef +$current_tab => undef +