X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rt%2Fshare%2Fhtml%2FSearch%2FCalendar.html;h=db781d81bb2cce99b00a9b6f2ad1044bbe58e637;hb=b7e8cfa78c29c9cc561cafa07dbcd82ff58acb50;hp=9d2b6f5466b114503b16fc654d464d78571d6896;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git
diff --git a/rt/share/html/Search/Calendar.html b/rt/share/html/Search/Calendar.html
index 9d2b6f546..db781d81b 100644
--- a/rt/share/html/Search/Calendar.html
+++ b/rt/share/html/Search/Calendar.html
@@ -7,45 +7,54 @@ $Order => undef
$OrderBy => undef
$RowsPerPage => undef
$NewQuery => 0
+$WeekDay => undef
+$WeekMonth => undef
+$WeekYear => undef
+$OrigMonth => undef
+$OrigYear => undef
%args>
<& /Elements/Header, Title => $title &>
-<& /Ticket/Elements/Tabs,
- current_tab => "Search/Calendar.html?$QueryString",
- Title => $title &>
+<& /Elements/Tabs &>
+
<&| /Widgets/TitleBox,
title => loc('Calendar for ') . $rtdate->GetMonth($Month) . " $Year" ,
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($_)%> |
% }
@@ -54,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);
@@ -61,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")} } ) {
@@ -84,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
@@ -167,7 +197,7 @@ my %legend = (
%ONCE>
<%INIT>
-use RTx::Calendar qw(FirstDay LastDay);
+use RTx::Calendar qw(FirstDay LastDay LastDayOfWeek);
my $title = loc("Calendar");
@@ -187,15 +217,22 @@ 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(
next => sub { $_[0]->truncate( to => 'day' )->add( days => 1 ) }
);
-my $QueryString =
+my $QueryString =
$m->comp(
'/Elements/QueryString',
Query => $Query,
@@ -212,7 +249,7 @@ $QueryString ||= 'NewQuery=1';
my $TempFormat = "__Starts__ __Due__";
my $TempQuery = "( Status = 'new' OR Status = 'open' OR Status = 'stalled')
AND ( Owner = '" . $session{CurrentUser}->Id ."' OR Owner = 'Nobody' )
- AND ( Type = 'reminder' OR 'Type' = 'ticket' )";
+ AND ( Type = 'reminder' OR 'Type' = 'ticket' )";
if ( my $Search = RTx::Calendar::SearchDefaultCalendar($session{CurrentUser}) ) {
$TempFormat = $Search->SubValue('Format');
@@ -236,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>