X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FCalendarSlotSchedule;h=8a0c617d9336a1a84513eb478b1a810be23b1d30;hb=7cfd11c02730df0bd27f03b8da765666af0a0edc;hp=3af90ff3e9dcb10cde326d42a739cb9085407c12;hpb=afb12da321c052f3628f628e429b59f8ab6453a8;p=freeside.git diff --git a/rt/share/html/Elements/CalendarSlotSchedule b/rt/share/html/Elements/CalendarSlotSchedule index 3af90ff3e..8a0c617d9 100644 --- a/rt/share/html/Elements/CalendarSlotSchedule +++ b/rt/share/html/Elements/CalendarSlotSchedule @@ -8,39 +8,51 @@ @username => () % foreach my $username ( @username ) { - - -% for my $t (@Tickets) { -% next unless $t->OwnerObj->Name eq $username; % -% next unless RTx::Calendar::LocalDate($t->StartsObj->Unix) -% eq $Date->strftime('%F'); #today +% 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'; +% } % -% my($sm, $sh) = ($t->StartsObj->Localtime('user'))[1,2]; -% my $starts = $sh*60 + $sm; +% #block out / show / color code existing appointments +% foreach my $id ( keys %{ $schedule{'scheduled'} } ) { % -% my($dm, $dh) = ($t->DueObj->Localtime('user'))[1,2]; -% my $due = $dh*60 + $dm; +% my( $starts, $due, $col, $t ) = @{ $schedule{'scheduled'}->{$id} }; % -% next if $starts >= ($tod_row+$timestep) || $due < $tod_row; +% next if $starts >= ($tod_row+$timestep) || $due < $tod_row; % -% warn $starts. ' = '. ($tod_row+$timestep); -% if ( $starts >= $tod_row ) { - <% $t->Id %> -% } else { - cont<% $t->Id %>... -% } -% } - +% if ( $starts >= $tod_row ) { +% $bgcolor = $col; +% $content .= ($content?', ':''). $id; #XXX more +% } else { +% $bgcolor = $col; +% } +% } + + " + ><% $content %> % } <%ONCE> my $default_slots = RT->Config->Get('CalendarWeeklySlots') || 5; my $default_timestep = RT->Config->Get('CalendarWeeklySizeMin') || 30; #1/2h +<%INIT> + +use RTx::Schedule qw( UserDaySchedule ); + +