tweak diskspace check again

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1935 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2014-06-04 20:35:38 +00:00
parent bd27200ba8
commit 692488a11f
6 changed files with 66 additions and 42 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 1.0.14-1
Version: 1.0.14-2
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.11),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.13),hmt(>=1.1.19),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),mongoose

View File

@ -7,11 +7,12 @@
height: 78px;
font-size: 13px;
line-height: 1.5em;
background: url('/img/bubble.png') left top no-repeat;
background: url(/img/bubble.png) left top no-repeat;
padding: 10px 0 0 0;
text-shadow: 0px 1px 0px #fff;
margin-left: -7em;
margin-top: -6em;
z-index: 1000;
opacity: 0;
}
@ -24,7 +25,7 @@
height: 21px;
color: #fff;
text-shadow: 0px 1px 0px #000;
background: url('/img/button.png') left top no-repeat;
background: url(/img/button.png) left top no-repeat;
}
.jcatitle {

View File

@ -1,50 +1,53 @@
/*
* jQuery Plugin : jConfirmAction
*
* by Hidayat Sagita
* Original by Hidayat Sagita
* http://www.webstuffshare.com
* Licensed Under GPL version 2 license.
*
* Modified by af123
*/
(function($){
jQuery.fn.jConfirmAction = function (options, callback) {
// Some jConfirmAction options (limited to customize language) :
// question : a text for your question.
// yesAnswer : a text for Yes answer.
// cancelAnswer : a text for Cancel/No answer.
var theOptions = jQuery.extend ({
jQuery.fn.dojConfirmAction = function(options, callback) {
var options = jQuery.extend ({
question: "Are You Sure?",
yesAnswer: "Yes",
cancelAnswer: "Cancel"
}, options);
return this.each (function () {
$(this).click(function(e) {
var obj = $(this);
e.preventDefault();
if (obj.next('.jcaquestion').length <= 0)
{
obj.after('<div class=jcaquestion>' +
options.question + '<br/>' +
'<span class=jcayes>' + options.yesAnswer +
'</span>' +
'<span class=jcacancel>' + options.cancelAnswer +
'</span></div>');
var p = $(this);
if($(this).next('.question').length <= 0)
$(this).after('<div class="jcaquestion">'+theOptions.question+'<br/> <span class="jcayes">'+theOptions.yesAnswer+'</span><span class="jcacancel">'+theOptions.cancelAnswer+'</span></div>');
$(this).next('.jcaquestion').animate({opacity: 1}, 300);
$('.jcayes').bind('click', function() {
callback(p);
});
$('.jcacancel').bind('click', function(){
$(this).parents('.jcaquestion').fadeOut(300, function() {
$(this).remove();
});
});
o = obj.next('.jcaquestion');
o.animate({opacity: 1}, 300);
o.find('.jcayes').on('click', function() {
callback(obj);
});
});
o.find('.jcacancel').on('click', function() {
$(this).parents('.jcaquestion')
.fadeOut(300, function() {
$(this).remove();
});
});
}
}
jQuery.fn.jConfirmAction = function(options, callback) {
return this.each(function () {
$(this).on('click', function(e) {
e.preventDefault();
$(this).dojConfirmAction(options, callback);
});
});
};
})(jQuery);

View File

@ -6,7 +6,7 @@
$(this)
.removeClass('ui-state-disabled')
.removeClass('ui-button-disabled')
.removeProp('disabled')
.prop('disabled', false)
.removeAttr('aria-disabled');
});
};

View File

@ -1,9 +1,18 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
require system.class
require system.class pretty_size
lassign [system diskspace 1] size used perc free fperc tsrbuf tsrused
# Calculate the TSR reserve
set tsrreserve $($tsrbuf - $tsrused)
# Adjust values to account for the TSR reserve
set free $($free - $tsrreserve)
set used $($size - $free)
set fperc $($free * 100 / $size)
set perc $(100 - $fperc)
lassign [system diskspace] size used perc free fperc
set dsindex $($perc * 25 / 100 + 1)
if {$dsindex > 25} { set dsindex 25 }
set dsfile [format "%02d" $dsindex]
@ -27,9 +36,9 @@ puts "
<span style=\"float: right\">
<br>
Total space: $size<br>
Used: $used ($perc%)<br>
Free: $free ($fperc%)
Total space: [pretty_size $size]<br>
Used: [pretty_size $used] ($perc%)<br>
Free: [pretty_size $free] ($fperc%)
</span>
"

View File

@ -181,13 +181,24 @@ proc {system diskspace} {{raw 0}} {
set perc $($used * 100 / $size)
set fperc $(100 - $perc)
if {[file isdirectory /mnt/hd2/Tsr]} {
set tsrbuf 21474836480
lassign [exec du -ks /mnt/hd2/Tsr] tsrused
set tsrused $($tsrused * 1024)
} else {
set tsrbuf 0
set tsrused 0
}
if {!$raw} {
set size [pretty_size $size]
set free [pretty_size $free]
set used [pretty_size $used]
set tsrbuf [pretty_size $tsrbuf]
set tsrused [pretty_size $tsrused]
}
return [list $size $used $perc $free $fperc]
return [list $size $used $perc $free $fperc $tsrbuf $tsrused]
}
proc {system diskfree} {} {