add channel info page

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@381 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-09-09 19:38:37 +00:00
parent 0eb305c32c
commit 1d44efdcdc
5 changed files with 136 additions and 9 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 0.6.8-3
Version: 0.6.9
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.3),hmt(>=1.0.6),ssmtp

113
var/mongoose/cgi-bin/channel.jim Executable file
View File

@ -0,0 +1,113 @@
#!/mod/bin/jimsh
package require cgi
package require sqlite3
source /mod/var/mongoose/lib/setup
require altrow progressbar epg.class
puts "Content-Type: text/html"
puts ""
header
cgi_input
proc f2c {frequency} {
set ch int($((($frequency / 1000) - 303.25) / 8))
return [expr int($ch)]
}
if {[catch {set db [sqlite3.open /var/lib/humaxtv/channel.db]} msg]} {
puts "Error opening channel database: $msg"
exit
}
puts "
<button id=expandall>Expand All</button>
<button id=collapseall>Collapse All</button>
<br><br>
<table class=borders>
<tr>
<th>Channel</th>
<th>Frequency</th>
<th>Signal Strength</th>
<th>Signal Quality</th>
<th>Channels</th>
</tr>
"
foreach tw [$db query {
select tsIdx, usTsID, ulFrequency, ucLevel, ucQuality
from TBL_TS
order by ulFrequency
}] {
lassign $tw x tsIdx x usTsID x ulFrequency x ucLevel x ucQuality
altrow
puts "
<td>[f2c $ulFrequency]</td>
<td>[expr $ulFrequency / 1000.0] MHz</td>
"
puts "<td>[progressbar $ucLevel]</td>"
puts "<td>[progressbar $ucQuality]</td>"
set channels [$db query {
select usLcn, szSvcName, szPrvName, aucDefaultAuthority
from TBL_SVC left join TBL_PRV using (prvIdx)
where tsIdx = %s
order by usLcn
} $tsIdx]
puts "<td>[llength $channels]
<a class=mchan ts=$tsIdx href=#>
<img border=0 height=14
src=/images/421_1_00_CH_Title_2R_Arrow.png>
view
</a></td>"
puts "</tr>"
puts "<tr id=mchan_$tsIdx class=mchan style=\"display: none\">
<td colspan=5>"
puts "<table style=\"margin-left: 5em\">"
puts "<tr>
<th colspan=3>Channel</th>
<th>Provider</th>
<th>Authority</th>
</tr>"
foreach chan $channels {
lassign $chan x lcn x name x prv x auth
set name [string range $name 1 end]
set prv [string range $prv 3 end]
altrow
puts "<td class=va>"
puts "[epg channelicon $name 50]</td>
<td>$lcn</td><td>$name</td>"
puts "</td><td>"
puts $prv
puts "</td><td>"
puts $auth
puts "</td>"
puts "</tr>"
}
puts "</table>"
puts "</td></tr>"
}
puts "</table>"
puts {
<script type=text/javascript>
$(document).ready(function() {
$('a.mchan').click(function(e) {
e.preventDefault();
$('#mchan_' + $(this).attr('ts')).slideToggle('slow');
});
$('#expandall').button().click(function() {
$('tr.mchan').slideDown('slow');
});
$('#collapseall').button().click(function() {
$('tr.mchan').slideUp('slow');
});
});
</script>
}

View File

@ -8,6 +8,14 @@ require altrow
puts "Content-Type: text/html"
puts ""
set databases {
/var/lib/humaxtv/rsvp.db
/var/lib/humaxtv/rsv.db
/var/lib/humaxtv/setup.db
/var/lib/humaxtv/channel.db
/mnt/hd2/dms_cds.db
}
header
cgi_input
@ -62,11 +70,16 @@ proc db_info {db_file} {
$db close
}
db_info /var/lib/humaxtv/rsvp.db
db_info /var/lib/humaxtv/rsv.db
db_info /var/lib/humaxtv/setup.db
db_info /var/lib/humaxtv/channel.db
db_info /mnt/hd2/dms_cds.db
if {$fdb == 0} {
puts "Please choose database to view:<ul>"
foreach db $databases {
puts "<li><a href=$::env(REQUEST_URI)?db=[file tail $db]>
$db</a></li>"
}
puts "</ul>"
} else {
foreach db $databases { db_info $db }
}
footer

View File

@ -111,6 +111,8 @@ $(document).ready(function() {
<div class=footer>
<ul>
<li>
<a href=/cgi-bin/channel.jim>Channel Information</a>
</li><li>
<a href=/cgi-bin/db.jim target=_blank>SQLite3 Database Dump</a>
</li><li>
<a href=/jim/ref.html target=_blank>Jim Reference Manual</a> |

View File

@ -1,7 +1,7 @@
#!/mod/bin/jimsh
source /mod/var/mongoose/lib/setup
require altrow rsv.class progressbar
require altrow rsv.class progressbar epg.class
puts {
<div id=dialogue></div>
@ -154,8 +154,7 @@ proc eventrow {event {table TBL_RESERVATION}} {
if {[$event get usLcn] ne ""} {
puts "
<td>
<img src=\"/img/channels/[$event channel_name].png\"
width=50>
[epg channelicon [$event channel_name] 50]
</td>
<td nowrap>[$event get usLcn]<br>
[$event channel_name]</td>