1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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 .= '[<A HREF="Display.html?id='.
$items->[0]->id.
'"><< First</a>] ';
$tabs_scalar .= '[<A HREF="Display.html?id='.
$items->[$indexs[0]-1]->id.
'">< Prev</a>] ';
}
# Don't display next links if we're on the last ticket
if ( $Ticket->id != $items->[-1]->id ) {
$tabs_scalar .= '[<A HREF="Display.html?id='.
$items->[$indexs[0]+1]->id.
'">Next ></a>] ';
$tabs_scalar .= '[<A HREF="Display.html?id='.
$items->[-1]->id.
'">Last >></a>]';
}
$tabs_scalar .= "<BR><BR>";
}
}
}
</%INIT>
<%ARGS>
$Ticket => undef
$current_tab => undef
</%ARGS>
|