blob: 8a0c617d9336a1a84513eb478b1a810be23b1d30 (
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
|
<%ARGS>
$Date => undef
@Tickets => ()
$slots => $default_slots
$sday => undef
$tod_row => undef
$timestep => $default_timestep
@username => ()
</%ARGS>
% foreach my $username ( @username ) {
%
% my %schedule = UserDaySchedule( username => $username,
% 'date' => $Date->strftime('%F'),
% Tickets => \@Tickets,
% );
%
% my $bgcolor = '666666;border-color:#555555';
% my $content = '';
%
% #white out available times
% foreach my $avail ( @{ $schedule{'avail'} } ) {
% my( $start, $end ) = @$avail;
% next if $start >= ($tod_row+$timestep) || $end <= $tod_row;
% $bgcolor = 'FFFFFF';
% }
%
% #block out / show / color code existing appointments
% foreach my $id ( keys %{ $schedule{'scheduled'} } ) {
%
% my( $starts, $due, $col, $t ) = @{ $schedule{'scheduled'}->{$id} };
%
% next if $starts >= ($tod_row+$timestep) || $due < $tod_row;
%
% if ( $starts >= $tod_row ) {
% $bgcolor = $col;
% $content .= ($content?', ':''). $id; #XXX more
% } else {
% $bgcolor = $col;
% }
% }
<td style="background:#<%$bgcolor%>" class="weekly"
%# <% $is_today ? 'today'
%# : $is_yesterday ? 'yesterday'
%# : $is_aweekago ? 'aweekago'
%# : ''
%# %>"
><% $content %></td>
% }
<%ONCE>
my $default_slots = RT->Config->Get('CalendarWeeklySlots') || 5;
my $default_timestep = RT->Config->Get('CalendarWeeklySizeMin') || 30; #1/2h
</%ONCE>
<%INIT>
use RTx::Schedule qw( UserDaySchedule );
</%INIT>
|