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-07-05 00:19:02 +00:00
|
|
|
require altrow rsv.class progressbar
|
|
|
|
|
|
|
|
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-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-08-29 22:34:26 +00:00
|
|
|
proc eventheader {{table TBL_RESERVATION}} {
|
2011-08-22 20:55:06 +00:00
|
|
|
puts {
|
|
|
|
<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-08-31 21:47:43 +00:00
|
|
|
set rsvicon "<img src='/images/$rsvicon' height=20>
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
|
|
|
if {$RKIcon ne ""} {
|
2011-08-31 21:47:43 +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-07-05 18:38:42 +00:00
|
|
|
<img src=\"/img/channels/[$event channel_name].png\"
|
2011-07-05 00:19:02 +00:00
|
|
|
width=50>
|
|
|
|
</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]
|
|
|
|
|
|
|
|
if { $n > $e } {
|
|
|
|
puts "<td class=blood nowrap class=va>"
|
2011-06-09 21:16:30 +00:00
|
|
|
} else {
|
2011-07-05 00:19:02 +00:00
|
|
|
puts "<td nowrap class=va>"
|
|
|
|
}
|
2011-07-05 18:38:42 +00:00
|
|
|
puts "[clock format $s -format "%a %d %b %Y"]<br>
|
|
|
|
[clock format $s -format "%H:%M %Z"]"
|
2011-07-05 00:19:02 +00:00
|
|
|
|
|
|
|
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]
|
2011-06-09 21:16:30 +00:00
|
|
|
}
|
2011-07-05 00:19:02 +00:00
|
|
|
|
|
|
|
puts "</td>"
|
|
|
|
|
|
|
|
puts "<td>[clock format [$event get nduration] -format %T]</td>"
|
|
|
|
|
|
|
|
puts "<td nowrap>$rsvicon $RKIcon</td>"
|
2011-07-12 18:57:30 +00:00
|
|
|
if {[$event get aulEventToRecordInfo] != ""} {
|
2011-08-29 22:34:26 +00:00
|
|
|
puts "<td><img src=/img/lightning.png
|
|
|
|
alt=\"Accepted by Humax\"
|
|
|
|
title=\"Accepted by Humax\"></td>"
|
|
|
|
} else {
|
|
|
|
puts "<td> </td>"
|
2011-07-12 18:57:30 +00:00
|
|
|
}
|
2011-06-07 13:26:45 +00:00
|
|
|
puts "</tr>"
|
|
|
|
}
|
2011-08-22 20:55:06 +00:00
|
|
|
|
|
|
|
proc eventfooter {} {
|
|
|
|
puts "</tbody></table>"
|
|
|
|
}
|
|
|
|
|
|
|
|
set events [rsv list pending]
|
|
|
|
if {[llength $events] > 0} {
|
2011-08-29 22:34:26 +00:00
|
|
|
puts "<h2>Pending Schedule Events</h2>"
|
|
|
|
eventheader pending
|
|
|
|
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>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
puts "<h2>Scheduled Events</h2>"
|
|
|
|
set events [rsv list]
|
|
|
|
eventheader
|
|
|
|
foreach event $events {eventrow $event}
|
|
|
|
eventfooter
|
2011-06-07 13:26:45 +00:00
|
|
|
|
2011-07-07 22:33:19 +00:00
|
|
|
puts {
|
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
|
|
|
}
|
|
|
|
|