X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FSearch%2FCalendar.html;h=db781d81bb2cce99b00a9b6f2ad1044bbe58e637;hp=8a1b796090caaeb1793fdfdd5639e1dd28592659;hb=19cae13fbfa17207f58c2ad44cb94f57caf64356;hpb=3f20bec8cc551e82274aa79bf1eb6ad8464e1558
diff --git a/rt/share/html/Search/Calendar.html b/rt/share/html/Search/Calendar.html
index 8a1b79609..db781d81b 100644
--- a/rt/share/html/Search/Calendar.html
+++ b/rt/share/html/Search/Calendar.html
@@ -7,6 +7,11 @@ $Order => undef
$OrderBy => undef
$RowsPerPage => undef
$NewQuery => 0
+$WeekDay => undef
+$WeekMonth => undef
+$WeekYear => undef
+$OrigMonth => undef
+$OrigYear => undef
%args>
<& /Elements/Header, Title => $title &>
@@ -17,34 +22,39 @@ $NewQuery => 0
title_class=> 'inverse',
color => "#993333" &>
-
-
-
-% my ($PMonth, $PYear) = ($Month - 1, $Year);
+% my($PMonth, $PYear, $NMonth, $NYear);
+% unless ( $WeekDay ) {
+
+
+ <%$rtdate->GetMonth($NMonth)%>»
+ |
+
+
+% }
+ |
% for ( @{$week{$weekstart}} ) {
<%$rtdate->GetWeekday($_)%> |
% }
@@ -53,6 +63,11 @@ $NewQuery => 0
+% if ( $WeekDay ) {
+ <& td_week_collapse, date=>$date, Month=>$OrigMonth, Year=>$OrigYear, QueryString=>$QueryString &>
+% } else {
+ <& td_week_expand, date=>$date, Month=>$Month, Year=>$Year, QueryString=>$QueryString &>
+% }
% while ($date <= $end) {
%
% my $offmonth = $date->month != ($Month + 1);
@@ -60,7 +75,7 @@ $NewQuery => 0
% my $is_yesterday = (DateTime->compare($yesterday, $date) == 0);
% my $is_aweekago = (DateTime->compare($aweekago, $date) == 0);
- 0
%>"
>
<%$date->day%>
+ ><% ( $WeekDay ? $rtdate->GetMonth($date->month). ' ' : '' ).
+ $date->day
+ %>
% my $sp = 3;
% for my $t ( @{ $Tickets{$date->strftime("%F")} } ) {
@@ -83,47 +100,61 @@ $NewQuery => 0
% $date = $set->next($date);
% if ( $date->day_of_week == $startday_of_week ) {
- |
+
+% if ( $date <= $end ) {
+
+% if ( $WeekDay ) {
+ <& td_week_collapse, date=>$date, Month=>$OrigMonth, Year=>$OrigYear, QueryString=>$QueryString &>
+% } else {
+ <& td_week_expand, date=>$date, Month=>$Month, Year=>$Year, QueryString=>$QueryString &>
+% }
+% }
% }
% }
-
-
+
+% }
+% #XXX an option to turn off "Calendar Preferences and Help" for embedded
+% # (and weekly?) use
@@ -166,7 +197,7 @@ my %legend = (
%ONCE>
<%INIT>
-use RTx::Calendar qw(FirstDay LastDay);
+use RTx::Calendar qw(FirstDay LastDay LastDayOfWeek);
my $title = loc("Calendar");
@@ -186,8 +217,15 @@ my $endday_of_week = ${$week{$weekstart}}[-1] || 7;
my $today = DateTime->today;
my $yesterday = $today->clone->subtract( days=>1 );
my $aweekago = $today->clone->subtract( days=>7 );
-my $date = FirstDay($Year, $Month + 1, $startday_of_week );
-my $end = LastDay ($Year, $Month + 1, $endday_of_week );
+
+my( $date, $end);
+if ( $WeekDay ) {
+ $date = DateTime->new( year=>$WeekYear, month=>$WeekMonth, day=>$WeekDay );
+ $end = LastDayOfWeek( $WeekYear, $WeekMonth, $WeekDay, $endday_of_week );
+} else {
+ $date = FirstDay($Year, $Month + 1, $startday_of_week );
+ $end = LastDay ($Year, $Month + 1, $endday_of_week );
+}
# use this to loop over days until $end
my $set = DateTime::Set->from_recurrence(
@@ -235,3 +273,26 @@ $TempQuery .= RTx::Calendar::DatesClauses(\@Dates, $date->strftime("%F"), $end->
my %Tickets = RTx::Calendar::FindTickets($session{'CurrentUser'}, $TempQuery, \@Dates, $date->strftime("%F"), $end->strftime("%F"));
%INIT>
+<%def td_week_expand>
+<%args>
+ $date => undef
+ $Month => undef
+ $Year => undef
+ $QueryString => undef
+%args>
+
+
+ |
+%def>
+
+<%def td_week_collapse>
+<%args>
+ $date => undef
+ $Month => undef
+ $Year => undef
+ $QueryString => undef
+%args>
+
+
+ |
+%def>