updated diagnostics page, jquery 1.12

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2598 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2016-02-08 15:32:17 +00:00
parent e316ad3a5a
commit 131b8980ac
24 changed files with 356 additions and 258 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 1.2.7-1
Version: 1.2.7-2
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.18),lighttpd(>=1.4.39),jim(>=0.76),jim-oo,jim-sqlite3(>=0.76),jim-cgi(>=0.7),jim-binary(>=0.76),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.2.1),hmt(>=2.0.9),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,wireless-tools(>=29-1),dbupdate,recmon(>=2.0.7)

View File

@ -1,18 +0,0 @@
#!/bin/sh
[ -n "$QUERY_STRING" ] && rma="${QUERY_STRING##*=}" || rma=0
echo "Content-Type: text/plain"
echo
if [ "$rma" = 1 ]; then
modver="`cat /etc/modversion`"
if [ "$modver" -ge 215 ]; then
touch /var/lib/humaxtv_backup/.rma
else
touch /var/lib/humaxtv/.rma
fi
else
touch /var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT
fi

View File

@ -15,11 +15,19 @@ lappend databases {*}[glob /mod/var/tvdb/*.db]
header
puts {
<div class=va>
<img class=va src=/img/db.png height=50>
&nbsp;
Database Browser
</div>
}
set ftab [cgi_get tab]
set fdb [cgi_get db]
if {$fdb != 0} {
puts "<h1><a href=/db/index.jim>Remove filters</a></h1>"
puts "<h3><a href=/db/index.jim>Remove filters</a></h3>"
}
proc escape {data} {
@ -48,8 +56,8 @@ proc db_info {db_file} {
where type='table' order by name
}]
puts "<h1><a href=/db/index.jim?db=[file tail $db_file]>
$db_file</a></h1>"
puts "<h3><a href=/db/index.jim?db=[file tail $db_file]>
$db_file</a></h3>"
foreach table $tables {
set table [lindex $table 1]

View File

@ -2,7 +2,7 @@
package require cgi
source /mod/webif/lib/setup
require pretty_size system.class pkg.class
require pretty_size system.class pkg.class plugin
jqplugin enadis
jscss script.js style.css
@ -10,13 +10,14 @@ header
pkg loaddiagmeta
set model [system model]
set smv [system modversion 1]
puts {
<fieldset class=cleft>
<legend>Utilities</legend>
<div class=cleft>
<fieldset>
<legend>Diagnostics</legend>
<table>
<tr>
<td>Run Diagnostic:</td>
<td class=va><span class=cleft>
@ -50,115 +51,75 @@ puts {
<button id=runfopkg>Force re-install</button>
</td>
</tr>
<tr><td colspan=2 id=results class=hidden></td></tr>
<tr><td colspan=2 style="height: 10px"></td></tr>
<tr>
<td colspan=2 align=center>
<button id=runedit class=half>File Editor</button>
<button id=dbinfo class=half>Database Browser</button>
</td>
</tr>
<tr>
<td colspan=2 align=center>
}
if {[system model] eq "HDR"} {
puts { <button id=diskdiag class=half>Hard Disk</button> }
}
puts {
<button id=channelinfo class=half>Channel Information</button>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<button id=dspace class=half>Disk Space</button>
</table>
</fieldset>
}
if {[system model] eq "HDR"} {
puts { <button id=dlna class=half>DLNA Server</button> }
}
######################################################################
# Utilities
puts {
</td>
</tr>
<tr><td colspan=2 style="height: 10px"></td></tr>
<tr>
<td colspan=2>
<button id=reboot class=red style="width: 100%">Reboot System</button>
</td>
</tr>
<tr>
<td colspan=2>
<button id=runreset style="width: 100%"
}
if {$smv < 200} {
puts -nonewline " disabled class=ui-state-disabled"
}
puts {
>
Remove all custom firmware packages and settings
</button>
}
if {$smv < 200} {
puts {
<div class=footnote style="text-align: center">
(Install custom firmware v2.00 to enable this option)
</div>
proc util {icon id text {link "#"} {extra ""}} {{col 0}} {
if {[incr col] > 3} {
puts "</tr><tr>"
set col 1
}
}
puts {
<div id=resetdone class="hidden blood">
Restart your Humax with the remote control.<br>
Allow it to turn off completely before restarting.<br>
</div>
</td>
</tr>
<tr>
<td colspan=2>
<button id=runrma style="width: 100%"
}
if {$smv < 213} {
puts -nonewline " disabled class=ui-state-disabled"
}
puts {
>
Set Return-to-manufacturer (RMA) Mode
</button>
}
if {$smv < 213} {
puts {
<div class=footnote style="text-align: center">
(Install custom firmware v2.13 to enable this option)
</div>
if {![string match "*/*" $icon]} {
set icon "/img/$icon.png"
}
puts "
<td>
<a href=$link id=$id>
<img class=button src=$icon>
<br>
<span class=label>$text</span>$extra
</a>
</td>
"
}
puts {
<fieldset>
<legend>Utilities</legend>
<table class=button>
<tr>
}
</td>
util "editor" "editor" "File Editor" "/edit/edit.jim"
util "db" "dbinfo" "Database Browser" "/db/"
util "aerials" "muxinfo" "Mux Info" "/diag/mux.jim"
if {$model eq "HDR"} {
util "disc" "disk" "Disk Diagnostics" "/diag/disk.jim"
util "dspace" "diskspace" "Disk Space" "/diag/dspace/"
util "dlna_large" "dlna" "DLNA Reset" "/dlna/dlna.jim"
}
if {$smv >= 310} {
util "safe" "safe" "Safe Mode" "#" "<br><span id=saferesult></span>"
}
util "reset" "reset" "CFW Reset" "#" "<br><span id=resetresult></span>"
util "shredder" "rma" "RMA" "#" "<br><span id=rmaresult></span>"
util "bluering" "reboot" "Reboot System" "/restart/"
eval_plugins diag
puts {
</tr>
</table>
</fieldset>
<fieldset class=left>
}
######################################################################
# Second column
puts "</div><div class=left>"
######################################################################
# Log Files
puts {
<fieldset>
<legend>View Log Files</legend>
}
@ -177,6 +138,74 @@ foreach file [lsort -command logsort $loglist] {
puts {
</fieldset>
</div>
}
######################################################################
# Confirmation dialogues
puts {
<div id=safeconfirm class=hidden xtitle="Safe Mode">
<div class=va>
<img class=va src=/img/safe.png height=50>
<span class="va blood">
<i>Safe mode on next boot is currently
<b><span class=cur></span></b></i>
</span>
</div><div>
Safe Mode allows you to start up your Humax without
any of the custom firmware packages in order to run
diagnostics or troubleshoot the system.
<br><br>
If enabled, Safe Mode will be entered the
next time that the system starts up and this will be
indicated by the word <i>SAFE</i> appearing on the front
panel after the Custom Firmware version message.
<br><br>
Safe Mode can be disabled again via a simple web
interface which is available in safe mode or via the
telnet menu.
</div>
</div>
<div id=resetconfirm class=hidden xtitle="CFW Reset">
<div class=va>
<img class=va src=/img/reset.png height=50>
<span class="va blood">
<i>CFW Reset on next boot is currently
<b><span class=cur></span></b></i>
</span>
</div><div>
When the CFW Reset option is enabled, all custom firmware
packages and settings will be removed on the next system
startup and a blank custom firmware environment will be
initialised.
<br><br>
The initial bootstrap web interface will be running to allow
the installation of the full web interface and supporting
packages.
</div>
</div>
<div id=rmaconfirm class=hidden xtitle="Return to Manufacturer">
<div class=va>
<img class=va src=/img/shredder.png height=50>
<span class="va blood">
<i>RMA Clear on next boot is currently
<b><span class=cur></span></b></i>
</span>
</div><div>
When the RMA Clear option is enabled, all custom firmware
packages and settings will be removed on the next system
startup and the custom firmware environment will <b>not</b> be
re-initialised.
<br><br>
Once in this state, the installation of an official Humax
firmware file followed by the System Flush update image
will return this unit to a factory state with no remaining
traces of the Custom Firmware remaining.
</div>
</div>
}
footer

View File

@ -18,6 +18,11 @@ if {[catch {set db [sqlite3.open /var/lib/humaxtv/channel.db]} msg]} {
}
puts "
<div class=va>
<img class=va src=/img/aerials.png height=50>
&nbsp;
Tuned Multiplex Information
</div>
<button id=expandall>Expand All</button>
<button id=collapseall>Collapse All</button>
<br><br>

36
webif/html/diag/rpc.jim Executable file
View File

@ -0,0 +1,36 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
set act [cgi_get act "getall"]
set opt [cgi_get opt]
set files {
safe "/var/lib/humaxtv/mod/safemode"
reset "/var/lib/humaxtv/mod/_RESET_CUSTOM_FIRMWARE_ENVIRONMENT"
rma "/var/lib/humaxtv_backup/.rma"
}
if {$act eq "getall"} {
httpheader "application/json"
set ret {}
foreach {k v} $files {
lappend ret "\"$k\":\"[file exists $v]\""
}
puts [concat "{\n" [join $ret ",\n"] "\n}"]
exit
}
httpheader
if {$opt ni $files} {
puts 0
}
switch $act {
set { file touch $files($opt) }
unset { file delete $files($opt) }
get { puts -nonewline [file exists $files($opt)] }
}

View File

@ -5,17 +5,8 @@ $('button').button();
$('#rundiag').button({icons: {primary: "ui-icon-play"}});
$('#runfopkg').button({icons: {primary: "ui-icon-play"}});
$('#runedit').button({icons: {primary: "ui-icon-folder-open"}});
$('#dbinfo').button({icons: {primary: "ui-icon-wrench"}});
$('#channelinfo').button({icons: {primary: "ui-icon-script"}});
$('#diskdiag').button({icons: {primary: "ui-icon-disk"}});
$('#dlna').button({icons: {primary: "ui-icon-video"}});
$('#dspace').button({icons: {primary: "ui-icon-search"}});
$('#reboot').button({icons: {primary: "ui-icon-power"}});
//$('#runreset').button({icons: {primary: "ui-icon-radio-on"}});
//$('#runrma').button({icons: {primary: "ui-icon-radio-on"}});
$('#rundiag').click(function() {
$('#rundiag').on('click', function() {
var val = $('#diagsel').val();
if (val == '0')
val = $('#seq').val();
@ -28,7 +19,7 @@ $('#rundiag').click(function() {
});
});
$('#runfopkg').click(function() {
$('#runfopkg').on('click', function() {
$('#results')
.slideDown()
.text('\n\nForcibly re-installing package, please wait...\n\n')
@ -39,70 +30,7 @@ $('#runfopkg').click(function() {
});
});
$('#runedit').click(function(e) {
e.preventDefault();
window.location = '/edit/edit.jim';
});
$('#dbinfo').click(function(e) {
e.preventDefault();
window.location = '/db/index.jim';
});
$('#channelinfo').click(function(e) {
e.preventDefault();
window.location = '/diag/channel.jim';
});
$('#diskdiag').click(function(e) {
e.preventDefault();
window.location = 'disk.jim';
});
$('#dlna').click(function(e) {
e.preventDefault();
window.location = '/dlna/dlna.jim';
});
$('#dspace').click(function(e) {
e.preventDefault();
window.location = 'dspace/index.jim';
});
$('#reboot').click(function(e) {
e.preventDefault();
window.location = '/restart/index.jim';
});
$('#runreset').click(function(e) {
e.preventDefault();
if (!confirm('Are you sure? This will completely remove all packages and settings.'))
return;
if (!confirm('Are you really sure?'))
return;
if (!confirm('One last time, are you sure?'))
return;
$.get('/cgi-bin/cfwreset.cgi', function() {
$('button').disable();
$('#resetdone').slideDown();
});
});
$('#runrma').click(function(e) {
e.preventDefault();
if (!confirm('Are you sure? This will completely remove all packages and settings and return the unit to state where you can re-install official firmware ready to return a faulty box to Humax for repair.'))
return;
if (!confirm('Are you really sure?'))
return;
if (!confirm('One last time, are you sure?'))
return;
$.get('/cgi-bin/cfwreset.cgi?rma=1', function() {
$('button').disable();
$('#resetdone').slideDown();
});
});
$('a.logclear').click(function(e) {
$('a.logclear').on('click', function(e) {
var t = $(this);
e.preventDefault();
if (!confirm('Delete ' + $(this).attr('file') + '?'))
@ -117,6 +45,71 @@ $('a.logclear').click(function(e) {
});
});
$.getJSON('/diag/rpc.jim?act=getall', function(data) {
$.each(data, function(k, v) {
if (v == '1')
$('#' + k + 'result').text('(Enabled)');
else
$('#' + k + 'result').text('');
});
});
$('#safe,#reset,#rma').on('click', function(e) {
e.preventDefault();
opt = $(this).attr('id');
$d = $('#' + opt + 'confirm');
title = $d.attr('xtitle');
$.get('/diag/rpc.jim?act=get&opt=' + opt, function(data) {
if (data == "1")
{
act = 'unset';
tact = 'Disable';
cur = 'enabled';
}
else
{
act = 'set';
tact = 'Enable';
cur = 'disabled';
}
$d.find('span.cur').text(cur);
$d.dialog({
height: 'auto',
width: 500,
modal: true,
title: title,
buttons: [
{
text: tact + ' ' + title,
icons: {
primary: "ui-icon-check"
},
click: function() {
$.get('/diag/rpc.jim?act=' + act +
'&opt=' + opt, function() {
$d.dialog('close');
$('#' + opt + 'result')
.text('(Now ' + tact + 'd)');
});
}
},
{
text: "Cancel",
icons: {
primary: "ui-icon-close"
},
click: function() {
$d.dialog('close');
}
}
]
});
});
});
});

View File

@ -1 +1,26 @@
button.half { width: 48%; }
table.button td
{
text-align: center;
vertical-align: top;
}
img.button
{
height: 80px;
padding: 0 2em;
border: 0;
}
span.label
{
font-weight: bold;
}
#saferesult, #rmaresult, #resetresult
{
font-style: italic;
color: #ff4000;
}

View File

@ -45,7 +45,11 @@ if {[system is_listening 9000]} {
jscss script.js
puts "
<fieldset class=cleft>
<legend>DLNA Server Information</legend>
<legend class=va>
<img class=va src=/img/dlna_large.png height=50>
&nbsp;
DLNA Server Information
</legend>
<table class=keyval cellpadding=5>
<tr>

BIN
webif/html/img/aerials.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
webif/html/img/db.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
webif/html/img/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
webif/html/img/dspace.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
webif/html/img/editor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
webif/html/img/reset.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
webif/html/img/safe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
webif/html/img/shredder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

File diff suppressed because one or more lines are too long

5
webif/html/js/jquery-1.12.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
jquery-1.11.3.min.js
jquery-1.12.0.min.js

View File

@ -11,33 +11,27 @@ puts {
<title>
}
source /mod/webif/include/model.jim
incr ::mws::headerdone
puts {
</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link rel="icon" href="/favicon.ico" sizes="16x16 32x32 64x64"
type="image/vnd.microsoft.icon" />
<link rel="apple-touch-icon" href="/img/fav/57.png" />
<link rel="apple-touch-icon" sizes="57x57" href="/img/fav/57.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/img/fav/72.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/img/fav/114.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/img/fav/144.png" />
<link type="text/css" href="/lib/jquery.ui/jquery-ui.min.css"
rel="Stylesheet" />
<link href="/css/style.css" rel="Stylesheet" type="text/css" />
<link href="/css/EXTRA.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/lib/jquery.ui/jquery-ui.min.js"></script>
<script type="text/javascript" src="/charts/high/highcharts.js"></script>
}
if {[info exists _mws_js]} {
foreach js $::_mws_js {
puts "<script type=text/javascript src=\"$js\"></script>"
}
foreach css $::_mws_css {
puts "<link href=\"$css\" rel=stylesheet type=text/css />"
}
incr ::_mws_headerdone
<meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1" />
<link rel=icon href=/favicon.ico sizes="16x16 32x32 64x64"
type=image/vnd.microsoft.icon />
<link rel=apple-touch-icon href=/img/fav/57.png />
<link rel=apple-touch-icon sizes=57x57 href=/img/fav/57.png />
<link rel=apple-touch-icon sizes=72x72 href=/img/fav/72.png />
<link rel=apple-touch-icon sizes=114x114 href=/img/fav/114.png />
<link rel=apple-touch-icon sizes=144x144 href=/img/fav/144.png />
}
::mws::_css /lib/jquery.ui/jquery-ui.min.css
::mws::_css /css/style.css
::mws::_css /css/EXTRA.css
::mws::_js /js/jquery.js
::mws::_js /lib/jquery.ui/jquery-ui.min.js
::mws::_js /charts/high/highcharts.js
::mws::emit_jscss
puts {
</head>
<body>

View File

@ -1,5 +1,6 @@
if {![exists -proc require]} {
proc require {args} {{done {}}} {
foreach file $args {
if {$file ni $done} {
@ -9,6 +10,18 @@ if {![exists -proc require]} {
}
}
require system.class
set ::mws::headerdone 0
set ::mws::js {}
set ::mws::css {}
set ::mws::q "[system pkgver]"
require fileops overrides utils
# Jim 0.75 removes legacy 'case'; some plugins still use it.
# This will fix the simple cases.
alias case switch
proc httpredirect {url {extra ""}} {
puts -nonewline "Location: $url\r\n"
if {$extra ne ""} {
@ -35,18 +48,15 @@ if {![exists -proc require]} {
set done 1
}
set ::_mws_headerdone 0
set ::_mws_js {}
set ::_mws_css {}
proc header {{type "text/html"} {cache 0}} {
httpheader $type $cache
uplevel source /mod/webif/html/lib/header.jim
incr ::_mws_headerdone
incr ::mws::headerdone
}
proc noheader {} {
emit_jscss
incr ::_mws_headerdone
incr ::mws::headerdone
::mws::emit_jscss
}
proc footer {} {
@ -61,28 +71,28 @@ if {![exists -proc require]} {
uplevel source /mod/webif/html/m/lib/footer.jim
}
proc _css {file} {
if {$::_mws_headerdone} {
puts "<link href=\"$file\" rel=stylesheet type=text/css />"
proc ::mws::_css {file} {
if {$::mws::headerdone} {
puts "<link href=\"$file?$::mws::q\" rel=stylesheet type=text/css />"
} else {
lappend ::_mws_css $file
lappend ::mws::css $file
}
}
proc _js {file} {
if {$::_mws_headerdone} {
puts "<script type=text/javascript src=\"$file\"></script>"
proc ::mws::_js {file} {
if {$::mws::headerdone} {
puts "<script type=text/javascript src=\"$file?$::mws::q\"></script>"
} else {
lappend ::_mws_js $file
lappend ::mws::js $file
}
}
proc emit_jscss {} {
foreach js $::_mws_js { _js $js }
foreach css $::_mws_css { _css $css }
proc ::mws::emit_jscss {} {
foreach js $::mws::js { ::mws::_js $js }
foreach css $::mws::css { ::mws::_css $css }
}
proc _jqplugin_sort {a b} {
proc ::mws::_jqplugin_sort {a b} {
return $([string length $a] - [string length $b])
}
@ -94,27 +104,22 @@ if {![exists -proc require]} {
if {![file isdirectory $dir]} {
error "Unknown JQ Plugin - '$name'"
}
foreach file [lsort -command _jqplugin_sort [\
foreach file [lsort -command ::mws::_jqplugin_sort [\
glob -nocomplain "$dir/*.js"]] {
set file [join [lrange [split $file /] 4 end] /]
_js "/$file"
::mws::_js "/$file"
}
foreach file [lsort -command _jqplugin_sort [\
foreach file [lsort -command ::mws::_jqplugin_sort [\
glob -nocomplain "$dir/*.css"]] {
set file [join [lrange [split $file /] 4 end] /]
_css "/$file"
::mws::_css "/$file"
}
}
}
proc jscss {{js ""} {css ""}} {
foreach j $js { _js $j }
foreach c $css { _css $c }
foreach j $js { ::mws::_js $j }
foreach c $css { ::mws::_css $c }
}
require fileops overrides utils
# Jim 0.75 removes legacy 'case'
alias case switch
}

View File

@ -145,8 +145,25 @@ proc {system kernelver} {} {{ver ""}} {
return $ver
}
# Newer version below is over 100 times faster
#proc {system pkgver} {{pkg webif}} {
# return [lrange [split [exec opkg list-installed $pkg] " "] 2 end]
#}
proc {system pkgver} {{pkg webif}} {
return [lrange [split [exec opkg list-installed $pkg] " "] 2 end]
if {[catch {set fp [open /mod/var/opkg/info/$pkg.control r]}]} {
return 0
}
set v 0
foreach line [split [$fp read] "\n"] {
if {[string equal -length 9 $line "Version: "]} {
lassign $line x v
break
}
}
$fp close
return $v
}
proc {system pkginst} {pkg} {