2011-06-07 13:26:45 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
2011-07-01 22:56:53 +00:00
|
|
|
source /mod/var/mongoose/lib/setup
|
2011-09-09 19:38:37 +00:00
|
|
|
require altrow rsv.class progressbar epg.class
|
2011-07-05 00:19:02 +00:00
|
|
|
|
|
|
|
puts {
|
2011-08-29 22:34:26 +00:00
|
|
|
<div id=dialogue></div>
|
2011-07-17 20:52:33 +00:00
|
|
|
<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() {
|
2011-08-22 20:55:06 +00:00
|
|
|
$('table.tablesorter').tablesorter({
|
2011-07-17 20:52:33 +00:00
|
|
|
headers: {
|
|
|
|
1: { sorter: false },
|
|
|
|
3: { sorter: 'programme' },
|
|
|
|
4: { sorter: 'date' },
|
|
|
|
5: { sorter: 'date' },
|
|
|
|
5: { sorter: false },
|
|
|
|
6: { sorter: false },
|
|
|
|
7: { sorter: false }
|
|
|
|
}
|
|
|
|
});
|
2011-12-19 15:57:03 +00:00
|
|
|
$('table.tablesorter thead th').filter('[class!=header]')
|
|
|
|
.addClass('headerplain');
|
2011-07-17 20:52:33 +00:00
|
|
|
});
|
2011-08-29 22:34:26 +00:00
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
function docancel()
|
|
|
|
{
|
|
|
|
var table = $('#dialogue').attr('table');
|
|
|
|
var slot = $('#dialogue').attr('slot');
|
|
|
|
|
|
|
|
if (confirm('Really remove scheduled event?'))
|
|
|
|
{
|
|
|
|
$.get('/cgi-bin/sched_cancel.jim?slot=' + slot +
|
|
|
|
'&table=' + table, function() {
|
|
|
|
window.location.reload(true);
|
|
|
|
});
|
|
|
|
$('#dialogue').dialog('close');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var $buttons1 = {
|
|
|
|
"Close" : function() {$(this).dialog('close');}
|
|
|
|
};
|
|
|
|
var $buttons2 = $.extend(
|
|
|
|
{"Cancel Event": function() { docancel() }},
|
|
|
|
$buttons1);
|
|
|
|
|
|
|
|
var $dialog = $('#dialogue').dialog({
|
|
|
|
title: "Schedule Details",
|
|
|
|
modal: false, autoOpen: false,
|
|
|
|
height: 500, width: 700,
|
|
|
|
show: 'scale', hide: 'fade',
|
|
|
|
draggable: true, resizable: true,
|
|
|
|
buttons: $buttons2,
|
|
|
|
close: function(e,u) { $('#dialogue').empty().html(
|
|
|
|
'<img src="/img/loading.gif" alt="loading">'); }
|
|
|
|
});
|
|
|
|
|
|
|
|
function schedpopup(e, o)
|
|
|
|
{
|
|
|
|
e.preventDefault();
|
|
|
|
var slot = o.attr('slot');
|
|
|
|
var table = o.attr('table');
|
|
|
|
$('#dialogue').attr('slot', slot).attr('table', table);
|
|
|
|
|
|
|
|
var url = '/cgi-bin/sched_info.jim?slot=' + slot +
|
|
|
|
'&table=' + table;
|
|
|
|
$('#dialogue').load(url);
|
|
|
|
$dialog.dialog('open');
|
|
|
|
}
|
|
|
|
$('a.schedule').click(function(e) { schedpopup(e, $(this)) });
|
|
|
|
});
|
2011-07-17 20:52:33 +00:00
|
|
|
</script>
|
2011-08-22 20:55:06 +00:00
|
|
|
}
|
2011-07-17 20:52:33 +00:00
|
|
|
|
2011-09-05 22:23:29 +00:00
|
|
|
proc eventheader {{table TBL_RESERVATION} note} {
|
2011-08-22 20:55:06 +00:00
|
|
|
puts {
|
2011-09-05 22:23:29 +00:00
|
|
|
<fieldset style="display: inline; padding: 1em">
|
|
|
|
<legend>
|
|
|
|
}
|
|
|
|
puts "<h3>$note</h3>"
|
|
|
|
puts {
|
|
|
|
</legend>
|
2011-08-22 20:55:06 +00:00
|
|
|
<table class="borders tablesorter">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2011-08-29 22:34:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if {$table eq "pending" } { puts "<th>Action</th>" }
|
|
|
|
|
|
|
|
puts {
|
2011-08-22 20:55:06 +00:00
|
|
|
<th></th>
|
|
|
|
<th> </th><th>Channel</th>
|
|
|
|
<th>Programme</th>
|
|
|
|
<th>Start Time</th>
|
|
|
|
<th>Duration</th>
|
|
|
|
<th>Mode</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
}
|
2011-07-05 00:19:02 +00:00
|
|
|
}
|
|
|
|
|
2011-08-29 22:34:26 +00:00
|
|
|
proc eventrow {event {table TBL_RESERVATION}} {
|
2011-07-05 18:38:42 +00:00
|
|
|
set name [$event name]
|
2011-06-07 13:26:45 +00:00
|
|
|
|
|
|
|
altrow
|
|
|
|
|
2011-08-29 22:34:26 +00:00
|
|
|
set rsvicon [$event icon]
|
|
|
|
set RKIcon [$event RKIcon]
|
2011-07-05 00:19:02 +00:00
|
|
|
if {[$event get ucRecKind] == 4} {
|
2011-06-09 21:16:30 +00:00
|
|
|
set series 1
|
2011-06-07 13:26:45 +00:00
|
|
|
} else {
|
2011-08-29 22:34:26 +00:00
|
|
|
set series 0
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if {$rsvicon ne ""} {
|
2011-12-19 15:57:03 +00:00
|
|
|
set rsvicon "<img src='/images/$rsvicon' height=20>"
|
|
|
|
if {[$event get ersvtype] == 3} {
|
|
|
|
if {[$event padded]} {
|
|
|
|
set padding "<- [expr [$event get ulPreOffset] / 60], [expr [$event get ulPostOffset] / 60] ->"
|
|
|
|
append rsvicon \
|
|
|
|
"<img src=/img/pad.png height=20
|
|
|
|
title=\"$padding\" alt=\"$padding\">"
|
|
|
|
} else {
|
|
|
|
append rsvicon \
|
|
|
|
"<img src=/img/ar.png height=20>"
|
|
|
|
}
|
|
|
|
}
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
|
|
|
if {$RKIcon ne ""} {
|
2011-12-19 15:57:03 +00:00
|
|
|
set RKIcon "<img src='/images/$RKIcon' height=20>"
|
2011-07-05 00:19:02 +00:00
|
|
|
}
|
|
|
|
|
2011-08-29 22:34:26 +00:00
|
|
|
if {$table eq "pending"} {
|
|
|
|
if {[$event get action] == 0} {
|
|
|
|
set icon "add"
|
|
|
|
} else {
|
|
|
|
set icon "close"
|
|
|
|
}
|
|
|
|
puts "<td align=center>
|
|
|
|
<img class=va width=30 src=/img/$icon.png></td>"
|
|
|
|
}
|
|
|
|
|
2011-07-07 22:33:19 +00:00
|
|
|
puts "<td>[$event get ulslot]</td>"
|
|
|
|
|
2011-07-05 00:19:02 +00:00
|
|
|
if {[$event get usLcn] ne ""} {
|
|
|
|
puts "
|
|
|
|
<td>
|
2011-09-09 19:38:37 +00:00
|
|
|
[epg channelicon [$event channel_name] 50]
|
2011-07-05 00:19:02 +00:00
|
|
|
</td>
|
2011-07-05 18:38:42 +00:00
|
|
|
<td nowrap>[$event get usLcn]<br>
|
|
|
|
[$event channel_name]</td>
|
2011-07-05 00:19:02 +00:00
|
|
|
"
|
|
|
|
} else {
|
2011-07-17 20:52:33 +00:00
|
|
|
puts "<td> <br><br></td><td> </td>"
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
|
|
|
|
2011-08-29 22:34:26 +00:00
|
|
|
puts "<td nowrap>
|
|
|
|
<a slot=[$event get ulslot] table=$table
|
|
|
|
href=# class=schedule>$name</a>
|
|
|
|
</td>"
|
2011-07-05 00:19:02 +00:00
|
|
|
|
|
|
|
set s [$event get nsttime]
|
|
|
|
set d [$event get nduration]
|
|
|
|
set e $($s + $d)
|
|
|
|
set n [clock seconds]
|
|
|
|
|
2011-09-11 21:23:42 +00:00
|
|
|
set ds "[clock format $s -format "%a %d %b %Y"]<br>
|
2011-07-05 18:38:42 +00:00
|
|
|
[clock format $s -format "%H:%M %Z"]"
|
2011-07-05 00:19:02 +00:00
|
|
|
|
2011-09-11 21:23:42 +00:00
|
|
|
if { $n > $e && [$event get ersvtype] <= 3} {
|
|
|
|
puts "<td nowrap class=va
|
|
|
|
alt=\"$ds\" title=\"$ds\">
|
|
|
|
--- -- --- ----<br>--:--"
|
|
|
|
puts "</td><td>--:--:--</td>"
|
|
|
|
} else {
|
|
|
|
puts "<td nowrap class=\"va"
|
|
|
|
if {$n > $e} { puts " blood" }
|
|
|
|
puts "\">$ds"
|
|
|
|
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><td>"
|
|
|
|
puts "[clock format [$event get nduration] -format %T]</td>"
|
2011-06-09 21:16:30 +00:00
|
|
|
}
|
2011-07-05 00:19:02 +00:00
|
|
|
|
2011-12-19 15:57:03 +00:00
|
|
|
puts "<td nowrap>$rsvicon $RKIcon</td><td>"
|
2011-07-12 18:57:30 +00:00
|
|
|
if {[$event get aulEventToRecordInfo] != ""} {
|
2011-12-19 15:57:03 +00:00
|
|
|
puts "<img src=/img/lightning.png
|
2011-08-29 22:34:26 +00:00
|
|
|
alt=\"Accepted by Humax\"
|
2011-12-19 15:57:03 +00:00
|
|
|
title=\"Accepted by Humax\">"
|
2011-07-12 18:57:30 +00:00
|
|
|
}
|
2011-12-19 15:57:03 +00:00
|
|
|
puts "</td>";
|
2011-06-07 13:26:45 +00:00
|
|
|
puts "</tr>"
|
|
|
|
}
|
2011-08-22 20:55:06 +00:00
|
|
|
|
|
|
|
proc eventfooter {} {
|
2011-09-05 22:23:29 +00:00
|
|
|
puts "</tbody></table></fieldset>"
|
2011-08-22 20:55:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set events [rsv list pending]
|
|
|
|
if {[llength $events] > 0} {
|
2011-09-05 22:23:29 +00:00
|
|
|
eventheader pending "Pending Scheduled Events"
|
2011-08-29 22:34:26 +00:00
|
|
|
foreach event $events {eventrow $event pending}
|
2011-08-22 20:55:06 +00:00
|
|
|
eventfooter
|
|
|
|
puts {
|
|
|
|
<small>
|
|
|
|
<button onclick="window.location='/cgi-bin/db.jim?db=rsvp.db&tab=pending';">
|
|
|
|
Raw database view
|
|
|
|
</button>
|
|
|
|
</small>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set events [rsv list]
|
2011-09-05 22:23:29 +00:00
|
|
|
eventheader "live" "Scheduled Events"
|
2011-08-22 20:55:06 +00:00
|
|
|
foreach event $events {eventrow $event}
|
|
|
|
eventfooter
|
2011-06-07 13:26:45 +00:00
|
|
|
|
2011-07-07 22:33:19 +00:00
|
|
|
puts {
|
2011-09-05 22:23:29 +00:00
|
|
|
<br>
|
2011-07-12 18:57:30 +00:00
|
|
|
<small>
|
2011-07-07 22:33:19 +00:00
|
|
|
<button onclick="window.location='/backup.shtml';">
|
2011-07-12 18:57:30 +00:00
|
|
|
Backup/Restore Scheduled Recordings/Events
|
|
|
|
</button>
|
|
|
|
<button onclick="window.location='/cgi-bin/db.jim?db=rsv.db&tab=TBL_RESERVATION';">
|
|
|
|
Raw database view
|
2011-07-07 22:33:19 +00:00
|
|
|
</button>
|
2011-07-12 18:57:30 +00:00
|
|
|
<script type=text/javascript>
|
|
|
|
$('button').button();
|
|
|
|
</script>
|
2011-07-07 22:33:19 +00:00
|
|
|
}
|
|
|
|
|