$Display => undef
@DisplayArgs => ()
$slots => $default_slots
+$DimPast => 0
</%ARGS>
% my $title;
</table>
% }
-<table class="rtxcalendar">
+<table class="<% $WeekDay ? 'rtxweeklycalendar' : 'rtxcalendar' %>">
+
+ <thead>
+
+% unless ( $WeekDay ) {
+
+ <tr>
+ <td class="labels" colspan=<% $WeekDay ? 2 : 1 %>></td>
+% for ( @{$week{$weekstart}} ) {
+ <th colspan=<% $WeekDay ? $slots : 1 %>><%$rtdate->GetWeekday($_)%></th>
+% }
+ </tr>
+ </thead>
+ <tbody>
-<thead>
-<tr>
-<td class="labels" colspan=<% $WeekDay ? 2 : 1 %>></td>
-% for ( @{$week{$weekstart}} ) {
-<th colspan=<% $WeekDay ? $slots : 1 %>><%$rtdate->GetWeekday($_)%></th>
% }
-</tr>
-</thead>
-<tbody>
<tr>
-% if ( $WeekDay ) {
- <td class="controls" rowspan=<% $rowspan+2 %> valign="middle">
- <& week_collapse, date=>$start, Month=>$OrigMonth, Year=>$OrigYear, QueryString=>$QueryString, Embed=>$Embed, &>
- </td>
- </td>
-% } else {
+% unless ( $WeekDay ) {
<& td_week_expand, date=>$start, Month=>$Month, Year=>$Year, QueryString=>$QueryString, Embed=>$Embed, &>
% }
% if ( $WeekDay ) {
- <td class="labels"></td>
+ <td class="labels" colspan=2></td>
% my $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);
- <td colspan=<%$slots%>
- class="weekly
- <% $is_today ? 'today'
- : $is_yesterday ? 'yesterday'
- : $is_aweekago ? 'aweekago'
- : ''
- %>"
- >
- <div class="<% $is_today ? 'todays'
- : ''
- %>calendardate"
- ><% $rtdate->GetMonth($date->month-1). ' '. $date->day %></div>
-
- </td>
+ <th colspan=<%$slots%>
+ class="labels"
+%# <% $is_today ? 'today'
+%# : $is_yesterday ? 'yesterday'
+%# : $is_aweekago ? 'aweekago'
+%# : ''
+%# %>"
+%# <div class="<% $is_today ? 'todays'
+%# : ''
+%# %>calendardate"
+ ><% $rtdate->GetWeekday( $week{$weekstart}->[$sday++] ). ' '.
+ $rtdate->GetMonth($date->month-1). ' '.
+ $date->day
+ %>
+ </th>
% $date = $set->next($date);
% if ( $date->day_of_week == $startday_of_week ) {
</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+)$/ ) {
%
% grep {
% my $meth = $_.'Obj';
%
-% #XXX off by 1h on daylight savings boundaries.. 2 sundays a year
-% my $tod = ( $Ticket->$meth->Unix
-% - $Ticket->$meth->SetToMidnight(Timezone=>'user')
-% ) / 60;
+% my($m, $h) = ($Ticket->$meth->Localtime('user'))[1,2];
+% my $tod = $h*60 + $m;
%
-% RTx::Calendar::LocalDate($Ticket->$meth->Unix) eq $date->strftime('%F') #today
+% LocalDate($Ticket->$meth->Unix) eq $date->strftime('%F') #today
% && $tod >= $row && $tod < ($row+$timestep); #and in timeslot
% } keys %DateTypes;
% next unless keys %dt;
% 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="<% $offmonth ? 'offmonth'
- : $is_today ? 'today'
- : $is_yesterday ? 'yesterday'
- : $is_aweekago ? 'aweekago'
+ class="<% $past ? 'past' : '' %><% $offmonth ? 'offmonth' : '' %><%
+ $is_today ? ' today'
+ : $is_yesterday ? ' yesterday'
+ : $is_aweekago ? ' aweekago'
: ''
%>"
>
<div class="<% $is_today ? 'todays'
- : $offmonth ? 'offmonth'
- : ''
+ : ( $past ? 'past' : ''). ($offmonth ? 'offmonth' : '' )
%>calendardate"
><% $date->day %></div>
% if ( defined($Display) && $Display =~ /^(\w+)$/ ) {
%
% my $el = "/Elements/CalendarDay$1";
- <& $el, Tickets => $Tickets{$date->strftime("%F")},
- Date => $date,
- DateTypes => \%DateTypes,
+ <& $el, CurrentUser => $session{CurrentUser},
+ Tickets => $Tickets{$date->strftime("%F")},
+ Date => $date,
+ today => $today,
+ DateTypes => \%DateTypes,
@DisplayArgs,
&>
%
</%ONCE>
<%INIT>
-use RTx::Calendar qw(FirstDay LastDay LastDayOfWeek);
+use RTx::Calendar qw( FirstDay LastDay LastDayOfWeek DatesClauses LocalDate
+ SearchDefaultCalendar FindTickets );
$Embed =~ /^[\w\.]*$/ or die 'xss';
AND ( Owner = '" . $session{CurrentUser}->Id ."' OR Owner = 'Nobody' )
AND ( Type = 'reminder' OR 'Type' = 'ticket' )";
-if ( my $Search = RTx::Calendar::SearchDefaultCalendar($session{CurrentUser}) ) {
+if ( my $Search = SearchDefaultCalendar($session{CurrentUser}) ) {
$TempFormat = $Search->SubValue('Format');
$TempQuery = $Search->SubValue('Query');
}
# used to display or not a date in Element/CalendarEvent
my %DateTypes = map { $_ => 1 } @Dates;
-$TempQuery .= RTx::Calendar::DatesClauses(\@Dates, $start->strftime("%F"), $end->strftime("%F"));
+$TempQuery .= DatesClauses(\@Dates, $start->strftime("%F"), $end->strftime("%F"));
# print STDERR ("-" x 30), "\n", $TempQuery, "\n";
-my %Tickets = RTx::Calendar::FindTickets($session{'CurrentUser'}, $TempQuery, \@Dates, $start->strftime("%F"), $end->strftime("%F"));
+my %Tickets = FindTickets($session{'CurrentUser'}, $TempQuery, \@Dates, $start->strftime("%F"), $end->strftime("%F"));
</%INIT>
<%def td_week_expand>
$QueryString => undef
$Embed => undef
</%args>
- <a href="<%$RT::WebPath%>/Search/<%$Embed||'Calendar.html'%>?Month=<% $Month %>&Year=<% $Year %>&<%$QueryString%>"><img src="<%$RT::WebPath%>/NoAuth/images/week-collapse.gif" STYLE="height:384px;width:11px"></a>
+ <a href="<%$RT::WebPath%>/Search/<%$Embed||'Calendar.html'%>?Month=<% $Month %>&Year=<% $Year %>&<%$QueryString%>"><img src="<%$RT::WebPath%>/NoAuth/images/week-collapse.gif" STYLE="height:384px;width:11px;border:none"></a>
</%def>
<%def td_time>