various changes

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1250 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-11-25 00:22:18 +00:00
parent 775add8c04
commit e666711eeb
8 changed files with 79 additions and 12 deletions

View File

@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.10.1
Version: 0.10.1-1
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.7),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73),jim-cgi(>=0.5),service-control(>=1.2),busybox(>=1.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.7),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.02)
Suggests: ffmpeg
Description: An evolving web interface for the Humax.

View File

@ -110,9 +110,11 @@ switch $action {
}
} else {
if {$mode eq "cut"} {
catch {file rename $path "$dir/[file tail $f]"}
catch {file rename $path \
"$dir/[file tail $path]"}
} else {
catch {file copy $path "$dir/[file tail $f]"}
catch {file copy $path \
"$dir/[file tail $path]"}
}
}
}

View File

@ -30,6 +30,9 @@ if {$cmd eq "update" || $cmd eq "upgrade"} {
chunk "Updating package meta information\r\n"
pkg fetchmeta
chunk "Done.\r\n"
chunk "Updating diagnostic meta information\r\n"
pkg fetchdiagmeta
chunk "Done.\r\n"
}
end_chunked

View File

@ -2,11 +2,13 @@
package require cgi
source /mod/webif/lib/setup
require pretty_size system.class
require pretty_size system.class pkg.class
puts "Content-Type: text/html"
puts ""
pkg loaddiagmeta
set smv [system modversion 1]
header
@ -21,10 +23,24 @@ puts {
<tr>
<td>Run Diagnostic:</td>
<td><input name=seq id=seq autocorrect=off autocapitalize=off
value=general size=30 maxlength=50
<td class=va><span class=cleft>
<select name=diagsel id=diagsel class="text ui-widget-content ui-corner-all">
<option value=0>-- Select diag or type name in box below --
}
foreach diag [array names ::diagmeta] {
puts "<option value=\"$diag\">$diag\n"
}
puts {
</select><br>
<input name=seq id=seq autocorrect=off autocapitalize=off
value="general" size=30 maxlength=50
class="text ui-widget-content ui-corner-all">
</span>
<span class="left va">
<button id=rundiag>Run Diagnostic</button>
</span>
</td>
</tr>

View File

@ -4,11 +4,14 @@ $(function() {
$('button').button();
$('#rundiag').click(function() {
var val = $('#diagsel').val();
if (val == '0')
val = $('#seq').val();
$('#results')
.slideDown()
.text('\n\nRunning diagnostic, please wait...\n\n')
.load('rundiag.jim?diag=' +
encodeURIComponent($('#seq').val()), function() {
.html('<br><br><img src=/img/loading.gif> ' +
'Running diagnostic, please wait...')
.load('rundiag.jim?diag=' + encodeURIComponent(val), function() {
$('#results').wrapInner('<pre>');
});
});

View File

@ -1,14 +1,22 @@
<!--#include virtual="/lib/header.shtml" -->
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/iphone-style-checkboxes.js"></script>
<script type="text/javascript" src="/js/enadis.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input:checkbox').iphoneStyle();
// Don't allow turning off the web server from within the web server..
$('input:checkbox[name=mongoose][class=toggle]').attr('disabled', true);
$('input:checkbox[name=mongoose][class=toggle]').disable();
$(':checkbox').change(function() {
if ($(this).attr('name') == 'mongoose' &&
!$(this).is(':checked'))
alert(
'Note that mongoose is the web server service that ' +
'provides this web interface. If you disable auto-start ' +
'then the web interface will not be available when the ' +
'Humax is restarted.');
var url = '/cgi-bin/service.jim?action=' +
escape($(this).attr('class')) +
'&service=' +

View File

@ -35,7 +35,12 @@ puts {
$('#restart_humaxtv').button()
.click(function() {
if (confirm('Are you sure you wish to perform a restart now?'))
window.location = '/cgi-bin/restart.jim';
if (confirm('Really sure?\n\nThere is a small chance the ' +
' Humax may not restart\n' +
'without physical intervention.\n\n' +
'i.e. pressing the standby button or using the ' +
'remote control'))
window.location = '/cgi-bin/restart.jim';
});
$('#restart_cancel').button()
.click(function() {

View File

@ -9,6 +9,7 @@ class pkg {
}
set ::pkgmeta {}
set ::diagmeta {}
pkg method _load {nm} {
set name $nm
@ -85,6 +86,17 @@ proc {pkg loadmeta} {} {
}
}
proc {pkg loaddiagmeta} {} {
if {[llength $::diagmeta]} { return }
if {![file exists "/mod/var/diag.meta"]} {
catch {pkg fetchdiagmeta}
} else {
set meta [open "/mod/var/diag.meta" r]
set ::diagmeta [read $meta]
$meta close
}
}
proc {pkg fetchmeta} {} {
set f [socket stream hummypkg.org.uk:80]
$f puts -nonewline "GET /hdrfoxt2/pkg.meta HTTP/1.1\r\n"
@ -103,3 +115,21 @@ proc {pkg fetchmeta} {} {
$ff close
}
proc {pkg fetchdiagmeta} {} {
set f [socket stream hummypkg.org.uk:80]
$f puts -nonewline "GET /diag/diag.meta HTTP/1.1\r\n"
$f puts -nonewline "Host: hummypkg.org.uk\r\n"
$f puts -nonewline "\r\n"
set line [string trim [$f gets]]
while {[string length $line]} {
set line [string trim [$f gets]]
}
set ::diagmeta [$f read]
$f close
set ff [open "/mod/var/diag.meta" w]
puts $ff $::diagmeta
$ff close
}