[freeside-commits] branch FREESIDE_3_BRANCH updated. e052bf55b4c7e36422e053c5ba7b3c924283e603

Ivan ivan at 420.am
Sat Apr 12 19:18:29 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  e052bf55b4c7e36422e053c5ba7b3c924283e603 (commit)
      from  282d98b8ebad35123455dd8ccb414805a1624c6c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e052bf55b4c7e36422e053c5ba7b3c924283e603
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Apr 12 19:18:28 2014 -0700

    installers (calendaring), RT#16584

diff --git a/rt/share/html/Elements/CalendarSlotSchedule b/rt/share/html/Elements/CalendarSlotSchedule
index e94bddf..88202d4 100644
--- a/rt/share/html/Elements/CalendarSlotSchedule
+++ b/rt/share/html/Elements/CalendarSlotSchedule
@@ -1,31 +1,34 @@
 <%ARGS>
+  $Date     => undef,
   @Tickets  => ()
   $slots    => $default_slots,
   $sday     => undef,
   $tod_row  => undef,
   $timestep => $default_timestep,
+  @username => ()
 </%ARGS>
 <%SHARED>
 my @slots = ( [], [], [], [], [], [], [] );
 </%SHARED>
-% warn $sday;
 %       #for my $t ( @{ $Tickets{$date->strftime("%F")} } ) {
 %       for my $t (@Tickets) {
 %
-%         #XXX off by 1h on daylight savings boundaries... 2 sundays a year
-%         my $starts = ($t->StartsObj->Unix - $t->StartsObj->SetToMidnight(Timezone=>'user'))/60;
+%         my($sm, $sh) = ($t->StartsObj->Localtime('user'))[1,2];
+%         my $starts = $sh*60 + $sm;
 %
-%         if ( $starts >= $tod_row && $starts < ($tod_row + $timestep) ) {
+%         if ( RTx::Calendar::LocalDate($t->StartsObj->Unix) eq $Date->strftime('%F') #today
+%                && $starts >= $tod_row && $starts < ($tod_row + $timestep) ) {
 %           #then we're a new entry, find a slot for us
 %           my $s = 0;
 %           while ( ref($slots[$sday]->[$s]) ) { $s++ }
 %           $slots[$sday]->[$s] = [ $t->Id, $t ];
 %         }
 %
-%         #XXX also off by 1h on daylight savings boundaries
-%         my $due = $t->DueObj->Unix - $t->DueObj->SetToMidnight;
+%         my($dm, $dh) = ($t->DueObj->Localtime('user'))[1,2];
+%         my $due = $dh*60 + $dm;
 %
-%         if ( $due <= $tod_row && $due > ($tod_row + $timestep ) ) {
+%         if ( RTx::Calendar::LocalDate($t->DueObj->Unix) eq $Date->strftime('%F') #today
+%                && $due <= $tod_row && $due > ($tod_row + $timestep ) ) {
 %           #then find our slot and remove us
 %           @{ $slots[$sday] } =
 %             map { (!ref($_) || $_->[0] != $t->Id) ? $_ : '' }
diff --git a/rt/share/html/Search/Calendar.html b/rt/share/html/Search/Calendar.html
index bf07ff3..a6df9fc 100644
--- a/rt/share/html/Search/Calendar.html
+++ b/rt/share/html/Search/Calendar.html
@@ -79,52 +79,54 @@ $slots       => $default_slots
 
 <table class="rtxcalendar">
 
-<thead>
-<tr>
-<td class="labels" colspan=<% $WeekDay ? 2 : 1 %>></td>
-% for ( @{$week{$weekstart}} ) {
-<th colspan=<% $WeekDay ? $slots : 1 %>><%$rtdate->GetWeekday($_)%></th>
+  <thead>
+
+% unless ( $WeekDay ) {
+
+    <tr>
+      <td class="labels" colspan=<% $WeekDay ? 2 : 1 %>></td>
+%     for ( @{$week{$weekstart}} ) {
+        <th colspan=<% $WeekDay ? $slots : 1 %>><%$rtdate->GetWeekday($_)%></th>
+%     }
+    </tr>
+  </thead>
+  <tbody>
+
 % }
-</tr>
-</thead>
 
-<tbody>
 <tr>
 
-% if ( $WeekDay ) {
-  <td class="controls" rowspan=<% $rowspan+2 %> valign="middle">
-    <& week_collapse, date=>$start, Month=>$OrigMonth, Year=>$OrigYear, QueryString=>$QueryString, Embed=>$Embed, &>
-  </td>
-  </td>
-% } else {
+% unless ( $WeekDay ) {
   <& td_week_expand, date=>$start, Month=>$Month, Year=>$Year, QueryString=>$QueryString, Embed=>$Embed, &>
 % }
 
 % if ( $WeekDay ) {
 
-    <td class="labels"></td>
+    <td class="labels" colspan=2></td>
 
 %   my $date = $start;
+%   my $sday = 0;
 %   while ($date <= $end) {
 %
 %     my $is_today     = (DateTime->compare($today,     $date) == 0);
 %     my $is_yesterday = (DateTime->compare($yesterday, $date) == 0);
 %     my $is_aweekago  = (DateTime->compare($aweekago,  $date) == 0);
 
-      <td colspan=<%$slots%>
-          class="weekly
-                 <%   $is_today     ? 'today'
-                    : $is_yesterday ? 'yesterday'
-                    : $is_aweekago  ? 'aweekago'
-                    : ''
-                 %>"
-      >
-        <div class="<%   $is_today ? 'todays'
-                       : ''
-                    %>calendardate"
-        ><% $rtdate->GetMonth($date->month-1). ' '. $date->day %></div>
-
-      </td>
+      <th colspan=<%$slots%>
+          class="labels"
+%#                 <%   $is_today     ? 'today'
+%#                    : $is_yesterday ? 'yesterday'
+%#                    : $is_aweekago  ? 'aweekago'
+%#                    : ''
+%#                 %>"
+%#        <div class="<%   $is_today ? 'todays'
+%#                       : ''
+%#                    %>calendardate"
+      ><% $rtdate->GetWeekday( $week{$weekstart}->[$sday++] ). ' '.
+          $rtdate->GetMonth($date->month-1). ' '.
+          $date->day
+       %>
+      </th>
 
 %     $date = $set->next($date);
 %     if ( $date->day_of_week == $startday_of_week ) {
@@ -141,7 +143,15 @@ $slots       => $default_slots
 
     </tr>
 
+        </thead>
+        <tbody>
+
     <tr>
+
+  <td class="controls" rowspan=<% $rowspan+1 %> valign="middle">
+    <& week_collapse, date=>$start, Month=>$OrigMonth, Year=>$OrigYear, QueryString=>$QueryString, Embed=>$Embed, &>
+  </td>
+
 %     #slot header callback
 %     if ( defined($Display) && $Display =~ /^(\w+)$/ ) {
 %
@@ -192,10 +202,8 @@ $slots       => $default_slots
 %             grep {
 %               my $meth = $_.'Obj';
 %
-%               #XXX off by 1h on daylight savings boundaries.. 2 sundays a year
-%               my $tod = (   $Ticket->$meth->Unix
-%                           - $Ticket->$meth->SetToMidnight(Timezone=>'user')
-%                         ) / 60;
+%               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
 %                 && $tod >= $row && $tod < ($row+$timestep); #and in timeslot
diff --git a/rt/share/html/Search/Schedule.html b/rt/share/html/Search/Schedule.html
index 0f8896c..8a18616 100644
--- a/rt/share/html/Search/Schedule.html
+++ b/rt/share/html/Search/Schedule.html
@@ -7,7 +7,8 @@
 
 <& /Search/Calendar.html,
      @_,
-     Embed          => 'Schedule.html',
+     slots       => scalar( @{ $ARGS{username} } ),
+     Embed       => 'Schedule.html',
      Display     => 'Schedule',
      DisplayArgs => [ username => $ARGS{username} ],
 &>

-----------------------------------------------------------------------

Summary of changes:
 rt/share/html/Elements/CalendarSlotSchedule |   17 ++++---
 rt/share/html/Search/Calendar.html          |   74 +++++++++++++++------------
 rt/share/html/Search/Schedule.html          |    3 +-
 3 files changed, 53 insertions(+), 41 deletions(-)




More information about the freeside-commits mailing list