X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FSearch%2FCalendar.html;h=f66f27d792862907d63af52671ea03c343efb064;hb=9a51fd5542ee9979bea99a39c83d63e221e59155;hp=e5a1c28a5d26e976c549856076b9ca0ede6f03c2;hpb=d5933aea7be7beddc995fb35cdd034231d2c515f;p=freeside.git diff --git a/rt/share/html/Search/Calendar.html b/rt/share/html/Search/Calendar.html index e5a1c28a5..f66f27d79 100644 --- a/rt/share/html/Search/Calendar.html +++ b/rt/share/html/Search/Calendar.html @@ -7,125 +7,216 @@ $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)%> - -Calendar Preferences and Help - -% 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}} ) { % } + +% 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 = !$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); + + + +% $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 &> +% } +% } % } - -% $date = $set->next($date); -% if ( $date->day_of_week == $startday_of_week ) { - -% } + % } -
<%$rtdate->GetWeekday($_)%>
+
<% ( $WeekDay ? $rtdate->GetMonth($date->month-1). ' ' : '' ). + $date->day + %>
+ +% my $sp = 3; +% for my $t ( @{ $Tickets{$date->strftime("%F")} } ) { +% $sp--; + <& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &> +% } + <% ($sp>0) ? '
'x$sp : '' |n %> + +
<% $date->week_number %>
-

<%$date->day%>

-% for my $t ( @{ $Tickets{$date->strftime("%F")} } ) { -<& /Elements/CalendarEvent, Object => $t, Date => $date, DateTypes => \%DateTypes &> -% } -
- - - - - -
-«<%$rtdate->GetMonth($PMonth)%> - -<%$rtdate->GetMonth($NMonth)%>» -
+% unless ( $WeekDay ) { + + + -
+ «<%$rtdate->GetMonth($PMonth)%> +
- - + + + +
-
+
+ + + + +% my $year = (localtime)[5] + 1900; + + +%# <& /Elements/Submit&> + + + + + <%$rtdate->GetMonth($NMonth)%>» +
- -% my $year = (localtime)[5] + 1900; - -<& /Elements/Submit&> - +% #XXX an option to turn off "Calendar Preferences and Help" for embedded +% # (and weekly?) use + + + + - + + + +% } -
+
+ Calendar Preferences and Help
- : <&|/l&>Created
- : <&|/l&>Due
- : <&|/l&>Resolved
- : <&|/l&>Last Updated
- : <&|/l&>Created, <&|/l&>Due
- : <&|/l&>Reminders
- : <&|/l&>Starts
- : <&|/l&>Started
- : <&|/l&>Starts, <&|/l&>Due
+% foreach my $legend (keys %legend) { +
+ + +% my $more = 0; +% foreach ( @{$legend{$legend}} ) { + <% $more++ ? ', ' : '' %> + <&|/l&><% $_ %> +% } +
- +<%ONCE> + +my %legend = ( + 'created' => ['Created'], + 'due' => ['Due'], + 'resolved' => ['Resolved'], + 'updated' => ['Last Updated'], + 'created_due' => ['Created','Due'], + 'reminder' => ['Reminders'], + 'started' => ['Started'], + 'starts_due' => ['Starts','Due'], +); + + <%INIT> -use RTx::Calendar qw(FirstDay LastDay); +use RTx::Calendar qw(FirstDay LastDay LastDayOfWeek); my $title = loc("Calendar"); @@ -143,15 +234,24 @@ my $startday_of_week = ${$week{$weekstart}}[0] || 7; my $endday_of_week = ${$week{$weekstart}}[-1] || 7; my $today = DateTime->today; -my $date = FirstDay($Year, $Month + 1, $startday_of_week ); -my $end = LastDay ($Year, $Month + 1, $endday_of_week ); +my $yesterday = $today->clone->subtract( days=>1 ); +my $aweekago = $today->clone->subtract( days=>7 ); + +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, @@ -168,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'); @@ -192,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 + + + + +