diff --git a/var/mongoose/html/css/style.css b/var/mongoose/html/css/style.css index ea9e7d73..61eeb540 100644 --- a/var/mongoose/html/css/style.css +++ b/var/mongoose/html/css/style.css @@ -247,6 +247,12 @@ pre, .pre color: black; } +.redshade +{ + background: #ff4000; + color: white; +} + img.progress { background: transparent url(/img/percentback.png) top left no-repeat; diff --git a/var/mongoose/html/diag/diag.jim b/var/mongoose/html/diag/diag.jim index b4a0b5a4..558c8485 100755 --- a/var/mongoose/html/diag/diag.jim +++ b/var/mongoose/html/diag/diag.jim @@ -46,6 +46,7 @@ puts { + diff --git a/var/mongoose/html/diag/disk.jim b/var/mongoose/html/diag/disk.jim new file mode 100755 index 00000000..1fdad3be --- /dev/null +++ b/var/mongoose/html/diag/disk.jim @@ -0,0 +1,162 @@ +#!/mod/bin/jimsh + +package require cgi +source /mod/webif/lib/setup +require system.class + +puts "Content-Type: text/html" +puts "" + +header + +set space [system diskspace] +set device [string range [lindex $space 5] 0 end-1] + +set smart Unknown +set line "" +# smartctl uses non-zero exit status to indicate health hence catch. +catch { set line [exec /mod/bin/smartctl -H $device | sed -n 5p] } msg +if {$msg ne "" && $line eq ""} { set line $msg } +if {$line ne ""} { + set smart [string range [lindex [split $line :] 1] 1 end] +} + +puts " +

+ + SMART data read from device $device +

+
+Disk Information + + +" +foreach line [split [exec /mod/bin/smartctl -i $device] "\n"] { + if {[string match "*Not in smartctl database*" $line]} continue + if {[string match "*: *" $line]} { + regsub -all -- {[[:space:]]+} $line " " line + set fields [split $line ":"] + puts "" + puts "" + } +} +puts { +
SMART Status$smart
[lindex $fields 0][join [lrange $fields 1 end] :]
+
+ +
+Attributes + + + + + + + + + + + + + +} + +#set flag_autokeep 0x20 +#set flag_count 0x10 +#set flag_rate 0x08 +#set flag_speed 0x04 +#set flag_online 0x02 +#set flag_prefailure 0x01 + +set flaglist [split "POSRCK" ""] +set flagdescr [list \ + "P prefailure warning" \ + "O updated online" \ + "S speed/performance" \ + "R error rate" \ + "C event count" \ + "K auto-keep" \ +] + +proc flags {val} { + global flaglist flagdescr + set f "" + set fx "" + loop i 0 [llength $flaglist] { + if {[expr $val & (1 << $i)]} { + append f [lindex $flaglist $i] + append fx "[lindex $flagdescr $i]\n" + } else { + append f "-" + } + } + return "$f" +} + +set i 0 +foreach line [split [exec /mod/bin/smartctl -A $device] "\n"] { + regsub -all -- {[[:space:]]+} $line " " line + regsub -all -- {^[[:space:]]+} $line "" line + if {[incr i] < 8} continue + lassign [split $line] \ + id name flags val worst thresh type updated when rval + set class normal + switch $id { + 5 { if {$rval > 0} { set class orangeshade } } + 197 { if {$rval > 0} { set class redshade } } + 198 { if {$rval > 0} { set class redshade } } + } + puts "" + puts " + + + + + + + + + + + " +} + +puts { +
IDNameFlagsRaw ValueValueWorstThreshTypeUpdatedWhen Failed
$id$name[flags $flags]$rval$val$worst$thresh$type$updated$when
+
+ +
+Self-test logs + + + + + + + + + +} + +set i 0 +foreach line [split [exec /mod/bin/smartctl -l selftest $device] "\n"] { + regsub -all -- {[[:space:]][[:space:]]+} $line "|" line + if {[incr i] < 7} continue + lassign [split $line "|"] id name status remaining when lba + puts " + + + " +} + +puts { +
No.DescriptionStatusRemainingWhenFirst Error LBA
$id$name$status + $remaining + $when + $lba +
+
+} + +footer + diff --git a/var/mongoose/html/diag/script.js b/var/mongoose/html/diag/script.js index e31b0ff7..f4b2b3ba 100644 --- a/var/mongoose/html/diag/script.js +++ b/var/mongoose/html/diag/script.js @@ -49,6 +49,11 @@ $('#channelinfo').click(function(e) { window.location = '/cgi-bin/channel.jim'; }); +$('#diskdiag').click(function(e) { + e.preventDefault(); + window.location = 'disk.jim'; +}); + $('#dlna').click(function(e) { e.preventDefault(); window.location = '/dlna/dlna.jim'; diff --git a/var/mongoose/html/img/disc.png b/var/mongoose/html/img/disc.png new file mode 100644 index 00000000..1b21e1c4 Binary files /dev/null and b/var/mongoose/html/img/disc.png differ diff --git a/var/mongoose/html/m/channel.jim b/var/mongoose/html/m/channel.jim index d189cc54..8d4761db 100755 --- a/var/mongoose/html/m/channel.jim +++ b/var/mongoose/html/m/channel.jim @@ -30,7 +30,7 @@ foreach e $records { set nday [clock format $st -format "%F"] if {$day ne $nday} { set day $nday - puts "
  • + puts "
  • [clock format $st -format "%a %d %b %Y"]
  • " } diff --git a/var/mongoose/html/m/index.jim b/var/mongoose/html/m/index.jim index f9408029..deb7616b 100755 --- a/var/mongoose/html/m/index.jim +++ b/var/mongoose/html/m/index.jim @@ -22,9 +22,9 @@ proc tb {icon txt link {height 80} {width 0}} { if {[file exists "/mod/bin/ir"]} { tb "/img/remote.png" "Remote" "/plugin/ir/m/index.jim\" rel=\"external" } +tb "/images/328_1_26_Menu_TV_Guide.png" "Now/Next" "nownext.jim" tb "/images/323_1_10_Menu_Video.png" "Browse" "#" tb "/images/321_1_00_Menu_CHList.png" "Schedule" "#" -tb "/images/328_1_26_Menu_TV_Guide.png" "Now/Next" "nownext.jim" tb "/img/spanner.png" "Services" "#" tb "/img/packages.png" "Packages" "#" tb "/images/326_1_00_Menu_Settings.png" "Settings" \ diff --git a/var/mongoose/html/m/lib/header.jim b/var/mongoose/html/m/lib/header.jim index 32e73001..1dee4b31 100755 --- a/var/mongoose/html/m/lib/header.jim +++ b/var/mongoose/html/m/lib/header.jim @@ -34,10 +34,12 @@ puts { } +set pageid [string range $env(SCRIPT_NAME) 3 end-4] + puts " -
    +
    diff --git a/var/mongoose/html/m/script.js b/var/mongoose/html/m/script.js index 119a33e4..28e53805 100644 --- a/var/mongoose/html/m/script.js +++ b/var/mongoose/html/m/script.js @@ -5,3 +5,7 @@ $(document).bind('pageinit', function() { }); }); +//$(document).delegate('#channelpage', 'pageinit', function() { + //console.log('pageinit for channelpage'); +//}); + diff --git a/var/mongoose/html/m/style.css b/var/mongoose/html/m/style.css index 6dbd436a..af953dc5 100644 --- a/var/mongoose/html/m/style.css +++ b/var/mongoose/html/m/style.css @@ -1,3 +1,4 @@ + .va { vertical-align: middle; @@ -25,3 +26,14 @@ div.status background: transparent; } +li.stick +{ + display: block; +} + +li.sticky +{ + position: absolute; + top: 0; +} + diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class index e9861b14..32eaa25d 100644 --- a/var/mongoose/lib/system.class +++ b/var/mongoose/lib/system.class @@ -92,10 +92,12 @@ proc {system diskspace} {} { set used 0 set free 0 set perc 0 + set dev 0 foreach line [split [exec /mod/bin/busybox/df -h $part 2>>/dev/null] "\n\r"] { if {[string match "/*" $line]} { regsub -all -- {[[:space:]]+} $line " " line set fields [split $line] + set dev [lindex $fields 0] set size [lindex $fields 1] set used [lindex $fields 2] set free [lindex $fields 3] @@ -105,7 +107,7 @@ proc {system diskspace} {} { } } - return [list $size $used $perc $free $fperc] + return [list $size $used $perc $free $fperc $dev] } proc {system busy} {} {