From 9b5498af1c032bada926b585eefd6510bda746a1 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Fri, 4 Sep 2015 20:49:26 +0000 Subject: [PATCH] browse plugins git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2460 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- webif/html/browse/index.jim | 26 ++++++++++++++++++-------- webif/html/browse/script.js | 5 +++++ webif/html/diag/disk.jim | 20 ++++++++++++-------- 4 files changed, 36 insertions(+), 17 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index fbf07f0..5d04842 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 1.2.4-1 +Version: 1.2.4-3 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: webif-channelicons(>=1.1.18),lighttpd(>=1.4.35-2),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.0),hmt(>=2.0.5),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) diff --git a/webif/html/browse/index.jim b/webif/html/browse/index.jim index 2beb0f5..b4849c6 100755 --- a/webif/html/browse/index.jim +++ b/webif/html/browse/index.jim @@ -5,10 +5,13 @@ source /mod/webif/lib/setup require ts.class pretty_size system.class settings.class escape browse.class \ plugin epg.class +set mroot [system mediaroot] +set dir [cgi_get dir $mroot] + jqplugin contextMenu bar enadis jscss script.js style.css -set plugins { dmenu {} menu {} omenu {} } +set plugins { dmenu {} menu {} omenu {} buttons {} } eval_plugins browse header @@ -266,9 +269,6 @@ proc entry {file} {{i 0}} { puts "" } -set mroot [system mediaroot] -set dir [cgi_get dir $mroot] - ###################################################################### # Render web page @@ -404,8 +404,6 @@ if {$nicesplice} { puts { } } -puts "
" - # De-duplicate puts { @@ -417,12 +415,24 @@ puts { if {[file exists /mnt/hd3/Streamer_down_file]} { puts { } } +# Plugin buttons + +if {[llength $plugins(buttons)]} { + puts "
" + foreach plugin $plugins(buttons) { + lassign $plugin tag options + puts " + + " + } +} + puts "
" footer diff --git a/webif/html/browse/script.js b/webif/html/browse/script.js index 4dd326b..d19c566 100755 --- a/webif/html/browse/script.js +++ b/webif/html/browse/script.js @@ -1010,6 +1010,11 @@ var dmenuclick = function(action, el, pos) }); }); + $('button.plugin').button().on('click', function() { + window.location.href = $(this).attr('act'); + return false; + }); + $('input.fs').change(function() { var num = $('input.fs:checked').size(); if (num > 0) diff --git a/webif/html/diag/disk.jim b/webif/html/diag/disk.jim index cf31713..4740bcf 100755 --- a/webif/html/diag/disk.jim +++ b/webif/html/diag/disk.jim @@ -126,22 +126,26 @@ foreach line [split [exec /mod/bin/smartctl -A $device] "\n"] { } set left "" if {$id ni $nolife && - [expr $flags & 0x18] == 0x10 && $val == $worst && $val <= 100} { + [expr $flags & 0x18] == 0x10 && $val == $worst && $val <= 100 && + $thresh < 100} { # Event counter which is not a rate and has not regressed. set notes "" set left [expr 100 - 100 * (100 - $val) / (100 - $thresh)] if {$left < 10} { set class orangeshade } if {$rval > 0 && [dict exists $derive $id]} { - set total [expr \ - round(($rval / (100 - $left) * 100) \ - / 10000) * 10000 \ - ] - set remain $($total - $rval) - set notes "$remain of approximately $total $derive($id)" + if {$left < 100} { + set total [expr \ + round(($rval / (100 - $left) * 100) \ + / 10000) * 10000 \ + ] + set remain $($total - $rval) + set notes "$remain of approximately" + append notes " $total $derive($id)" + } } set left "$left%" } - if {[string match "*Temperature_Cel*" $name]} { + if {$id == 190} { append val " ([expr 100 - $val]°C)" append worst " ([expr 100 - $worst]°C)" append thresh " ([expr 100 - $thresh]°C)"