improve directory size display

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@207 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-06-27 21:59:07 +00:00
parent 7025cf09f5
commit d068d93073
4 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 0.5.6
Version: 0.5.7
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: mongoose(>=2.11-5),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.2),jim-oo,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.2),hmt(>=1.0.6),ssmtp

View File

@ -221,6 +221,7 @@ foreach part [split $dir /] {
append stub $name
puts "<a href=$env(REQUEST_URI)?dir=[cgi_quote_url $stub]>$name</a>
}
puts "<span class=filesize id=dirsize></span>"
puts "</legend>"
# Parent directory

View File

@ -20,13 +20,18 @@ function epginfo_callback(data, status, xhr)
function insert_folder_size(folder, size)
{
folder = folder.replace(/ /g, '');
folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
//console.log("Folder: (%s) = (%s)", folder, size);
if (folder == "")
$('#dirsize').text(' (' + size + 'iB)');
else
$('#' + folder).text(' (' + size + 'iB)');
}
function folder_size_callback(data, status, xhr)
{
//console.log("Status: %s", status);
//console.dir(data);
$.each(data, insert_folder_size);
}

View File

@ -8,7 +8,7 @@ puts ""
cgi_input
#cgi_dump
set _cgi(dir) "/media/My Video"
#set _cgi(dir) "/media/My Video"
set dir [dict get $_cgi dir]
@ -18,7 +18,7 @@ puts "{"
foreach line [split [exec /mod/bin/busybox/du -h "$dir/"] "\n"] {
set fields [split $line "\t"]
set size [lindex $fields 0]
set node [lindex [split [lindex $fields 1] '/'] end]
set node [lindex [split [lindex $fields 1] /] end]
puts "\"$node\" : \"$size\","
}
puts "\"dummy\" : \"\""