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
|
<%args>
$Date => undef
$Object => undef
$DateTypes => undef
$DayOfWeek => undef
$TicketsSpanningDays => undef
$WeekTicketPosition => undef
$CurrentPostion => undef
</%args>
<%perl>
my $spanning_tickets_for_today = $TicketsSpanningDays->{$today} || [];
my $spanning_tickets_for_tomorrow = $TicketsSpanningDays->{$tomorrow} || [];
my $first_day_of_the_event = 0;
my $last_day_of_the_event = 0;
# If the ticket is not in the spanning tickets for today array, it means
# it's the first day of the event
if ( ( ! grep { $_ eq $TicketId } @$spanning_tickets_for_today ) ) {
$first_day_of_the_event = 1;
}
if ( ( !grep { $_ eq $TicketId } @$spanning_tickets_for_tomorrow ) ) {
$last_day_of_the_event = 1;
# This frees up the position for the next ticket
$WeekTicketPosition->{$CurrentPostion}->{id} = "";
}
</%perl>
<div class="day
% if ( $last_day_of_the_event || $DayOfWeek eq 7 ) {
last-day
% }
% if ( $first_day_of_the_event || $DayOfWeek eq 1 ) {
first-day
% }
% my $status_class = 'event-status-'.$status;
% $status_class =~ s/\s+/-/g;
<% $status_class %>
" style="
% if ( $CalendarStatusColorMap{$status} ) {
background-color: <%$CalendarStatusColorMap{$status}%> !important;
% } else {
background-color: <%$CalendarStatusColorMap{'_default_'}%> !important;
% }
% # We need to decrease the z-index of the spanning days of an event
% # so the event title (which is placed on the div of the first day of the
% # event and has a z-index of 4) is visible, since it cross multiple days.
% if ( (grep { $_ eq $TicketId } @$spanning_tickets_for_today)
% && $DayOfWeek ne 1 ) {
z-index: 3;
% }
" data-object="<% $Object->Type %>-<% $Object->id %>">
<small>
<div class="event-icon" style="
% if ($last_day_of_the_event
% && !$first_day_of_the_event) {
float: right;
% }
">
% if ( $first_day_of_the_event || $last_day_of_the_event ) {
% my $icon = RTx::Calendar::GetEventImg( $Object, $today, $DateTypes, $IsReminder, $session{'CurrentUser'} );
<% $icon|n %>
% }
</div>
<div class="event-info">
% if ( $first_day_of_the_event || $DayOfWeek eq 1 ) {
<a class="event-title" 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>
% # Placeholder for the event details that will be loaded via AJAX on hover
<span class="tip">
</span>
% }
</div>
</small>
</div>
<%init>
use RTx::Calendar;
my $today = $Date->strftime("%F");
my $tomorrow = $Date->clone()->add(days => 1)->strftime("%F");
my $TicketId;
my $ticket;
my $subject;
my $IsReminder;
my $status;
if ($Object->Type eq 'reminder') {
$IsReminder = 1;
if ($Object->RefersTo->First) {
$ticket = $Object->RefersTo->First->TargetObj;
$TicketId = $ticket->Id;
$subject = $Object->Subject . " (" . $ticket->Subject . ")";
$status = $Object->Status;
}
} else {
$TicketId = $Object->Id;
$subject = $Object->Subject;
$status = $Object->Status;
}
my %CalendarStatusColorMap = RT->Config->Get('CalendarStatusColorMap');
my $display_owner = $RT::CalendarDisplayOwner;
$display_owner ||= RT->Config->Get('CalendarDisplayOwner')
if RT->can('Config');
</%init>
|