appointment drag and drop, RT#34237
[freeside.git] / rt / share / html / Search / Calendar.html
index a6df9fc..2c19296 100644 (file)
@@ -16,6 +16,7 @@ $Embed       => undef
 $Display     => undef
 @DisplayArgs => ()
 $slots       => $default_slots
+$DimPast     => 0
 </%ARGS>
 
 % my $title;
@@ -77,7 +78,7 @@ $slots       => $default_slots
     </table>
 % }
 
-<table class="rtxcalendar">
+<table class="<% $WeekDay ? 'rtxweeklycalendar' : 'rtxcalendar' %>">
 
   <thead>
 
@@ -205,7 +206,7 @@ $slots       => $default_slots
 %               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;
@@ -247,27 +248,30 @@ $slots       => $default_slots
 %     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,
           &>
 %
@@ -397,7 +401,8 @@ while ( $wt < $etime ) { push @week_rows, $wt; $wt+=$timestep }
 
 </%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';
 
@@ -468,7 +473,7 @@ my $TempQuery = "( Status = 'new' OR Status = 'open' OR Status = 'stalled')
  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');
 }
@@ -483,11 +488,11 @@ my @Dates = grep { $TempFormat =~ m/__${_}(Relative)?__/ } @DateTypes;
 # 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>
@@ -511,7 +516,7 @@ my %Tickets = RTx::Calendar::FindTickets($session{'CurrentUser'}, $TempQuery, \@
   $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>