diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-04-12 19:18:27 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-04-12 19:18:27 -0700 |
commit | 9f1a3b2bd30562d52fa9d2d0c7afab08f5efff41 (patch) | |
tree | 197b586aa226b7f98084c83bf02df63efd363a1b /rt | |
parent | e6341bb01533cc32252676ea40bb94bbd2613a37 (diff) |
installers (calendaring), RT#16584
Diffstat (limited to 'rt')
-rw-r--r-- | rt/share/html/Elements/CalendarSlotSchedule | 17 | ||||
-rw-r--r-- | rt/share/html/Search/Calendar.html | 74 | ||||
-rw-r--r-- | rt/share/html/Search/Schedule.html | 3 |
3 files changed, 53 insertions, 41 deletions
diff --git a/rt/share/html/Elements/CalendarSlotSchedule b/rt/share/html/Elements/CalendarSlotSchedule index e94bddfe2..88202d417 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 bf07ff3e2..a6df9fc75 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 0f8896c87..8a1861695 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} ], &> |