webif/var/mongoose/include/sched.jim
hummypkg 1b8761b8f3 fix diskspace bug, add sortable schedule list, fix plugin bug
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@276 2a923420-c742-0410-a762-8d5b09965624
2011-07-17 20:52:33 +00:00

188 lines
4.1 KiB
Plaintext
Executable File

#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require altrow rsv.class progressbar
set events [rsv list]
puts {
<script type=text/javascript>
$.tablesorter.addParser({
id: 'programme',
is: function () { return false; },
format: function(s) {
return s.toLowerCase().replace(/---/, 'zzz');
},
type: 'text'
});
$.tablesorter.addParser({
id: 'date',
is: function () { return false; },
format: function(s) {
var d = new Date(s.substring(0, s.length - 4));
return d.getTime();
},
type: 'numeric'
});
$(document).ready(function() {
$('#schedtable').tablesorter({
headers: {
1: { sorter: false },
3: { sorter: 'programme' },
4: { sorter: 'date' },
5: { sorter: 'date' },
5: { sorter: false },
6: { sorter: false },
7: { sorter: false }
}
});
});
</script>
<table id=schedtable class="borders tablesorter">
<thead>
<tr>
<th></th>
<th>&nbsp;</th><th>Channel</th>
<th>Programme</th>
<th>Start Time</th>
<th>Duration</th>
<th>Mode</th>
<th>Event/Series ID</th>
<th>Events</th>
</tr>
</thead>
<tbody>
}
foreach event $events {
set name [$event name]
altrow
set rsvicon ""
switch [$event get ersvtype] {
1 { set rsvicon "175_1_00_Reservation_Watch.png" }
2 { set rsvicon "175_1_00_Reservation_Watch.png" }
3 { set rsvicon "175_1_11_Reservation_Record.png" }
5 { set rsvicon "745_1_10_Video_2Live.png" }
6 { set rsvicon "745_1_11_Video_1REC.png" }
7 { set rsvicon "345_6_08_ST_Ad_Hoc.png" }
}
set series 0
if {[$event get ucRecKind] == 4} {
set RKIcon "175_1_11_Series_Record.png"
set series 1
} else {
switch [$event get erepeat] {
1 {set RKIcon "521_1_00_RP_Daily_C.png"}
2 {set RKIcon "521_1_00_RP_Weekly_C.png"}
3 {set RKIcon "521_1_00_RP_Weekdays_C.png"}
4 {set RKIcon "521_1_00_RP_Weekend_C.png"}
default {set RKIcon ""}
}
}
if {$rsvicon ne ""} {
set rsvicon "<img src='images/$rsvicon' height=20>
}
if {$RKIcon ne ""} {
set RKIcon "<img src='images/$RKIcon' height=20>
}
puts "<td>[$event get ulslot]</td>"
if {[$event get usLcn] ne ""} {
puts "
<td>
<img src=\"/img/channels/[$event channel_name].png\"
width=50>
</td>
<td nowrap>[$event get usLcn]<br>
[$event channel_name]</td>
"
} else {
puts "<td>&nbsp;<br><br></td><td>&nbsp;</td>"
}
puts "<td nowrap>$name</td>"
set s [$event get nsttime]
set d [$event get nduration]
set e $($s + $d)
set n [clock seconds]
if { $n > $e } {
puts "<td class=blood nowrap class=va>"
} else {
puts "<td nowrap class=va>"
}
puts "[clock format $s -format "%a %d %b %Y"]<br>
[clock format $s -format "%H:%M %Z"]"
if {$d > 0 && $n > $s && $n < $e} {
puts "<br>"
set perc [expr [expr $n - $s] * 100 / $d]
puts "<img class=va src=/images/745_1_11_Video_1REC.png>"
puts [progressbar $perc]
}
puts "</td>"
puts "<td>[clock format [$event get nduration] -format %T]</td>"
puts "<td nowrap>$rsvicon $RKIcon</td>"
puts "<td nowrap>"
set crid [join [lrange [split [$event get szCRID] /] 1 end]]
if {$crid != ""} {
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
if $series { puts -nonewline "s" }
puts "crid=/$crid>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>
[$event get szCRID]"
puts "</a>"
}
puts "</td>"
puts "<td nowrap>"
set flag 0
foreach ev [split [$event get szEventToRecord] "|"] {
if {$ev eq ""} { continue }
set ev [string range $ev 1 end]
if {$flag} { puts "<br>" }
incr flag
set crid [join [lrange [split $ev /] 1 end]]
puts -nonewline "<a href=/cgi-bin/epg_search.jim?"
puts "crid=/$crid>
<img border=0 src=/images/421_1_00_CH_Title_2R_Arrow.png
height=14>
$ev"
puts "</a>"
}
puts "</td>"
if {[$event get aulEventToRecordInfo] != ""} {
puts "<td>*</td>"
}
puts "</tr>"
}
puts "</tbody></table>"
puts "<font class=footnote>Click on the CRID to view episodes.</font>"
puts {
<small>
<button onclick="window.location='/backup.shtml';">
Backup/Restore Scheduled Recordings/Events
</button>
<button onclick="window.location='/cgi-bin/db.jim?db=rsv.db&tab=TBL_RESERVATION';">
Raw database view
</button>
<script type=text/javascript>
$('button').button();
</script>
}