#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require epg.class
proc eventtab {type title} {
set events [rsv list $type]
if {[set num [llength $events]] <= 0} return
puts "
$title ($num)\n";
foreach event $events {
set name [$event name]
set rsvicon [$event icon]
set RKIcon [$event RKIcon]
set icons ""
if {$type eq "pending"} {
switch [$event get action] {
0 { set icon "add" }
1 { set icon "close" }
2 { set icon "ar" }
3 { set icon "pad" }
4 { set icon "folder" }
}
append icons ""
}
if {$rsvicon ne ""} {
append icons ""
}
if {$RKIcon ne ""} {
append icons ""
}
set s [$event get nsttime]
set d [$event get nduration]
set e $($s + $d)
set n [clock seconds]
set recording 0
if {$d > 0 && $n > $s && $n < $e} {
set recording 1
}
set last "[clock format $s -format {%a %d %b %Y %H:%M %Z}]"
if {$n > $e && [$event get ersvtype] <= 3} {
set ds "--- -- --- ---- --:--"
set dur "--:--:--
(Last: $last)"
} else {
set ds $last
set dur "[clock format [$event get nduration] \
-format %T]"
}
puts "
[epg channelicon [$event channel_name] 80]
$icons $name
$ds $dur
";
if {$recording} {
set perc $(($n - $s) * 100 / $d)
puts "
[progressbar $perc]
"
}
puts "";
}
}
mheader
puts ""
eventtab "pending" "Pending Events"
eventtab "TBL_RESERVATION" "Active Events"
puts "
"
mfooter