X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FSearch%2FCalendar.html;h=f66f27d792862907d63af52671ea03c343efb064;hb=9a51fd5542ee9979bea99a39c83d63e221e59155;hp=0fb5414aa0c295c71a057add549371f79762d682;hpb=e83205c66c30456c657053287a271b074e8da015;p=freeside.git diff --git a/rt/share/html/Search/Calendar.html b/rt/share/html/Search/Calendar.html index 0fb5414aa..f66f27d79 100644 --- a/rt/share/html/Search/Calendar.html +++ b/rt/share/html/Search/Calendar.html @@ -7,45 +7,72 @@ $Order => undef $OrderBy => undef $RowsPerPage => undef $NewQuery => 0 +$WeekDay => undef +$WeekMonth => undef +$WeekYear => undef +$OrigMonth => undef +$OrigYear => undef <& /Elements/Header, Title => $title &> -<& /Ticket/Elements/Tabs, - current_tab => "Search/Calendar.html?$QueryString", - Title => $title &> +<& /Elements/Tabs &> + +% my $title; +% if ( $WeekMonth ) { +% if ( $date->month == $end->month ) { +% $title = $rtdate->GetMonth( $date->month -1 ). ' '. +% $date->day. '-'. $end->day. ', '. $date->year; +% } elsif ( $date->year == $end->year ) { +% $title = +% $rtdate->GetMonth( $date->month -1 ). ' '. $date->day. ' - '. +% $rtdate->GetMonth( $end->month -1 ). ' '. $end->day. ', '. $end->year; +% } else { +% $title = +% $rtdate->GetMonth( $date->month -1 ). ' '.$date->day. ', '. $date->year. +% ' - '. +% $rtdate->GetMonth( $end->month -1 ). ' '.$end->day. ', '. $end->year; +% } +% } else { +% $title = $rtdate->GetMonth($Month) . " $Year" +% } <&| /Widgets/TitleBox, - title => loc('Calendar for ') . $rtdate->GetMonth($Month) . " $Year" , + title => loc('Calendar for '). $title, title_class=> 'inverse', color => "#993333" &> - - - + +
-% my ($PMonth, $PYear) = ($Month - 1, $Year); +% my($PMonth, $PYear, $NMonth, $NYear); +% unless ( $WeekDay ) { + + + + - - + + - -
+% ($PMonth, $PYear) = ($Month - 1, $Year); % if ($PMonth < 0) { % $PYear--; % $PMonth = 11; % } -«<%$rtdate->GetMonth($PMonth)%> - - <% $rtdate->GetMonth($Month). " $Year" %> - -% my ($NMonth, $NYear) = ($Month + 1, $Year); + «<%$rtdate->GetMonth($PMonth)%> + + <% $rtdate->GetMonth($Month). " $Year" %> + +% ($NMonth, $NYear) = ($Month + 1, $Year); % if ($NMonth > 11) { % $NYear++; % $NMonth = 0; % } -<%$rtdate->GetMonth($NMonth)%>» -
+ <%$rtdate->GetMonth($NMonth)%>» +
+% } + % for ( @{$week{$weekstart}} ) { % } @@ -54,24 +81,32 @@ $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); +% 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); - + +% 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 &> +% } +% } % } % } -
<%$rtdate->GetWeekday($_)%>
" > -
<%$date->day%>
+
<% ( $WeekDay ? $rtdate->GetMonth($date->month-1). ' ' : '' ). + $date->day + %>
% my $sp = 3; % for my $t ( @{ $Tickets{$date->strftime("%F")} } ) { @@ -84,47 +119,61 @@ $NewQuery => 0 % $date = $set->next($date); % if ( $date->day_of_week == $startday_of_week ) { -
- - - +% unless ( $WeekDay ) { - + +
-«<%$rtdate->GetMonth($PMonth)%> - -
+ + + - -% my $year = (localtime)[5] + 1900; - + + + - - -
+ «<%$rtdate->GetMonth($PMonth)%> + + + + + +% my $year = (localtime)[5] + 1900; + %# <& /Elements/Submit&> - + - - -<%$rtdate->GetMonth($NMonth)%>» -
+
+ <%$rtdate->GetMonth($NMonth)%>» +
+ +% } +% #XXX an option to turn off "Calendar Preferences and Help" for embedded +% # (and weekly?) use @@ -167,7 +216,7 @@ my %legend = ( <%INIT> -use RTx::Calendar qw(FirstDay LastDay); +use RTx::Calendar qw(FirstDay LastDay LastDayOfWeek); my $title = loc("Calendar"); @@ -187,15 +236,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+1, day=>$WeekDay ); + $end = LastDayOfWeek( $WeekYear, $WeekMonth+1, $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 +268,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 +292,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")); +<%def td_week_expand> +<%args> + $date => undef + $Month => undef + $Year => undef + $QueryString => undef + + + + +<%def td_week_collapse> +<%args> + $date => undef + $Month => undef + $Year => undef + $QueryString => undef + + +
+ + + +