X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FSearch%2FSchedule.html;h=be5a140efc2f896f0b4bc1f37437806aac278c37;hb=09ae66f29fc7cbd46c13ae1f9361713cbce54153;hp=9ba41c7e3aab4d2b588283cfcbbdee894bae9f30;hpb=778b8c70120cce490e8c6ddb534f1302200e0ad6;p=freeside.git diff --git a/rt/share/html/Search/Schedule.html b/rt/share/html/Search/Schedule.html index 9ba41c7e3..be5a140ef 100644 --- a/rt/share/html/Search/Schedule.html +++ b/rt/share/html/Search/Schedule.html @@ -1,25 +1,251 @@ -<& /Elements/Header, Title => 'Schedule' &> +<& /Elements/Header, Title => 'Schedule', JavaScript => 0 &> -%#init_overlib.html -%foreach my $file (@files) { - -%} + <& /Search/Calendar.html, @_, Query => "( Status = 'new' OR Status = 'open' OR Status = 'stalled') AND ( Type = 'reminder' OR 'Type' = 'ticket' )", #XXX and we have the magic custom field - slots => scalar( @{ $ARGS{username} } ), + slots => scalar(@usernames), Embed => 'Schedule.html', + DimPast => 1, Display => 'Schedule', - DisplayArgs => [ username => $ARGS{username} ], + DisplayArgs => [ username => \@usernames, + LengthMin => $LengthMin, + #oops, more freeside abstraction-leaking + custnum => $ARGS{custnum}, + pkgnum => $ARGS{pkgnum}, + ], &> +<%ONCE> + +my $timestep = RT->Config->Get('CalendarWeeklySizeMin') || 30; #1/2h + + <%init> + my @files = (); #if ( ! $initialized ) { push @files, map "overlibmws$_", ( '', qw( _iframe _draggable _crossframe ) ); push @files, map { "${_}contentmws" } qw( iframe ajax ); #%} + +my @usernames = (); +if ( ref($ARGS{username}) ) { + @usernames = @{ $ARGS{username} }; +} elsif ( $ARGS{username} ) { + @usernames = ( $ARGS{username} ); +} else { + #look them up ourslves... again, more FS abstraction-leaking, but + # we want to link to the schedule view, and better than doing this every + # menu render + use FS::Record qw( qsearch ); + use FS::sched_item; + my @sched_item = qsearch('sched_item', { 'disabled' => '', }); + @usernames = map $_->access_user->username, @sched_item; +} + +( my $LengthMin = $ARGS{LengthMin} ) =~ /^\d+$/ or die 'non-numeric LengthMin'; + +my $cells = int($LengthMin / $timestep); +$cells++ if $LengthMin % $timestep; +