+ </tr>
+
+ </thead>
+ <tbody>
+
+ <tr>
+
+ <td class="controls" rowspan=<% $rowspan+1 %> valign="middle">
+ <& week_collapse, date=>$start, Month=>$OrigMonth, Year=>$OrigYear, QueryString=>$QueryString, Embed=>$Embed, &>
+ </td>
+
+% #slot header callback
+% if ( defined($Display) && $Display =~ /^(\w+)$/ ) {
+%
+% my $el = "/Elements/CalendarSlotHeader$1";
+ <td class="labels"></td>
+% for (0..6) {
+ <& $el, Date => $date,
+ DateTypes => \%DateTypes,
+ slots => $slots,
+ @DisplayArgs,
+ &>
+% }
+% }
+ </tr>
+
+% foreach my $row ( @week_rows ) {
+
+ <tr>
+ <& td_time, $row &>
+
+% $date = $start;
+% my $sday = 0;
+% while ($date <= $end) {
+%
+% my $is_today = (DateTime->compare($today, $date) == 0);
+% my $is_yesterday = (DateTime->compare($yesterday, $date) == 0);
+% my $is_aweekago = (DateTime->compare($aweekago, $date) == 0);
+
+% #slot callback
+% if ( defined($Display) && $Display =~ /^(\w+)$/ ) {
+% my $el = "/Elements/CalendarSlot$1";
+ <& $el, Date => $date,
+ DateTypes => \%DateTypes,
+ Tickets => $Tickets{$date->strftime("%F")} || [],
+ slots => $slots,
+ sday => $sday,
+ tod_row => $row,
+ timestep => $timestep,
+ @DisplayArgs,
+ &>
+% } else {
+
+% #just display the normal events for this day?
+ <td class="weekly" colspan="<%$slots%>">
+% for my $Ticket ( @{ $Tickets{$date->strftime("%F")} } ) {
+% my %dt =
+% map { $_=>1 }
+% grep {
+% my $meth = $_.'Obj';
+%
+% my($m, $h) = ($Ticket->$meth->Localtime('user'))[1,2];
+% my $tod = $h*60 + $m;
+%
+% LocalDate($Ticket->$meth->Unix) eq $date->strftime('%F') #today
+% && $tod >= $row && $tod < ($row+$timestep); #and in timeslot
+% } keys %DateTypes;
+% next unless keys %dt;
+ <& /Elements/CalendarEvent,
+ Object => $Ticket,
+ Date => $date,
+ DateTypes => \%dt
+ &>
+% unless ( $Ticket eq ${ $Tickets{$date->strftime("%F")} }[-1] ) { #hmm, no.. not with "next unless $dt" :/
+ <BR>
+% }
+% }
+ </td>
+
+% }
+
+% $date = $set->next($date);
+% if ( $date->day_of_week == $startday_of_week ) {
+ </tr>
+% if ( $date <= $end ) { #a second week? not going to work for week view yet
+ <tr>
+ <td class="controls" rowspan=<% $rowspan + 2 %> valign="middle">
+ <& week_collapse, date=>$date, Month=>$OrigMonth, Year=>$OrigYear, QueryString=>$QueryString, Embed=>$Embed, &>
+ </td>
+% }
+% }
+%
+% $sday++;
+% } #while ($date <= $end)
+ </tr>
+% } #foreach my $row ( @week_rows )
+%
+% } else {
+%
+% my $date = $start;
+% while ($date <= $end) {
+%
+% my $offmonth = !$WeekDay && $date->month != ($Month + 1);
+% my $is_today = (DateTime->compare($today, $date) == 0);
+% my $is_yesterday = (DateTime->compare($yesterday, $date) == 0);
+% my $is_aweekago = (DateTime->compare($aweekago, $date) == 0);
+%
+% my $past = $DimPast && DateTime->compare($today, $date) == 1;
+
+ <td
+ class="<% $past ? 'past' : '' %><% $offmonth ? 'offmonth' : '' %><%
+ $is_today ? ' today'
+ : $is_yesterday ? ' yesterday'
+ : $is_aweekago ? ' aweekago'
+ : ''
+ %>"
+ >
+ <div class="<% $is_today ? 'todays'
+ : ( $past ? 'past' : ''). ($offmonth ? 'offmonth' : '' )
+ %>calendardate"
+ ><% $date->day %></div>
+
+% if ( defined($Display) && $Display =~ /^(\w+)$/ ) {
+%
+% my $el = "/Elements/CalendarDay$1";
+ <& $el, CurrentUser => $session{CurrentUser},
+ Tickets => $Tickets{$date->strftime("%F")},
+ Date => $date,
+ today => $today,
+ DateTypes => \%DateTypes,
+ @DisplayArgs,
+ &>
+%
+% } else {
+%
+% my $sp = 3;
+% for my $t ( @{ $Tickets{$date->strftime("%F")} } ) {
+% $sp--;
+ <& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &>
+% }
+ <% ($sp>0) ? '<BR>'x$sp : '' |n %>
+%
+% }
+
+ </td>
+
+% $date = $set->next($date);
+% if ( $date->day_of_week == $startday_of_week ) {
+ </tr>
+% if ( $date <= $end ) {
+ <tr>
+ <& td_week_expand, date=>$date, Month=>$Month, Year=>$Year, QueryString=>$QueryString, Embed=>$Embed, &>
+% }
+% }
+
+% } #while ($date <= $end)