blob: 65dd58c9f9fe4526d4bd91cfa566e00ac4ed663a (
plain)
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
127
128
129
|
<%args>
$Date => undef
$Object => undef
$DateTypes => undef
</%args>
<div class="tooltip">
<small>
% if ($IsReminder and RTx::Calendar::LocalDate($Object->DueObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/reminder.png" />
% } elsif ($DateTypes->{Resolved}
% and RTx::Calendar::LocalDate($Object->ResolvedObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/resolved.png" />
% } elsif ($DateTypes->{Starts} and $DateTypes->{Due}
% and RTx::Calendar::LocalDate($Object->StartsObj->Unix) eq $today and RTx::Calendar::LocalDate($Object->DueObj->Unix) eq $today ) {
<img src="<%$RT::WebImagesURL%>/starts_due.png" />
% } elsif ($DateTypes->{Due} and $DateTypes->{Created}
% and RTx::Calendar::LocalDate($Object->DueObj->Unix) eq $today and RTx::Calendar::LocalDate($Object->CreatedObj->Unix) eq $today ) {
<img src="<%$RT::WebImagesURL%>/created_due.png" />
% } elsif ($DateTypes->{Starts}
% and RTx::Calendar::LocalDate($Object->StartsObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/starts.png" />
% } elsif ($DateTypes->{Due}
% and RTx::Calendar::LocalDate($Object->DueObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/due.png" />
% } elsif ($DateTypes->{Created}
% and RTx::Calendar::LocalDate($Object->CreatedObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/created.png" />
% } elsif ($DateTypes->{Started}
% and RTx::Calendar::LocalDate($Object->StartedObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/started.png" />
% } elsif ($DateTypes->{LastUpdated}
% and RTx::Calendar::LocalDate($Object->LastUpdatedObj->Unix) eq $today) {
<img src="<%$RT::WebImagesURL%>/updated.png" />
% }
<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$TicketId%>">
<% $Object->QueueObj->Name %> #<% $TicketId %>
<% $display_owner ? 'by ' . $Object->OwnerObj->Name : '' %>
<% length($Object->Subject) > 80 ? substr($Object->Subject, 0, 77) . "..." : $Object->Subject %></a></small><br />
<span class="tip">
<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$TicketId%>">
<% $Object->QueueObj->Name %> #<% $TicketId %>
</a>
:</strong> <% $subject%><br />
<br />
%# logic taken from Ticket/Search/Results.tsv
% foreach my $attr (@display_fields) {
% my $value;
%
% if ($attr =~ /(.*)->ISO$/ and $Object->$1->Unix <= 0) {
% $value = '-';
% } else {
% my $method = '$Object->'.$attr.'()';
% $method =~ s/->ISO\(\)$/->ISO( Timezone => 'user' )/;
% $value = eval $method;
% if ($@) {die "<b>Check your CalendarPopupFields config in etc/RT_SiteConfig.pm</b>.<br /><br />Failed to find \"$attr\" - ". $@};
% }
<strong><&|/l&><% $label_of{$attr} %></&>:</strong> <% $value %><br />
% }
<br />
</span>
</div>
<%init>
use RTx::Calendar;
my $today = $Date->strftime("%F");
my $TicketId;
my $ticket;
my $subject;
my $IsReminder;
if ($Object->Type eq 'reminder') {
$IsReminder = 1;
if ($Object->RefersTo->First) {
$ticket = $Object->RefersTo->First->TargetObj;
$TicketId = $ticket->Id;
$subject = $Object->Subject . " (" . $ticket->Subject . ")";
}
} else {
$TicketId = $Object->Id;
$subject = $Object->Subject;
}
my $display_owner = $RT::CalendarDisplayOwner;
$display_owner ||= RT->Config->Get('CalendarDisplayOwner')
if RT->can('Config');
# 3.6 config
my @display_fields = @RT::CalendarPopupFields;
# 3.8 config
# the if condition is weird but it doesn't work with 3.8.0 without the last part
@display_fields = RT->Config->Get('CalendarPopupFields')
if 0 == @display_fields and RT->can('Config') and RT->Config->Get('CalendarPopupFields');
# default
if (0 == @display_fields) {
@display_fields = qw(OwnerObj->Name CreatedObj->ISO StartsObj->ISO
StartedObj->ISO LastUpdatedObj->ISO DueObj->ISO
ResolvedObj->ISO Status Priority
Requestors->MemberEmailAddressesAsString);
}
my %label_of;
for my $field (@display_fields) {
my $label = $field;
$label =~ s'Obj-.(?:AsString|Name|ISO)''g;
$label =~ s'-\>MemberEmailAddressesAsString''g;
$label_of{$field} = $label;
}
</%init>
|