From d068d930733758928c1f0a1f8645967ccbd3b64c Mon Sep 17 00:00:00 2001 From: hummypkg Date: Mon, 27 Jun 2011 21:59:07 +0000 Subject: [PATCH] improve directory size display git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@207 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/browse.jim | 1 + var/mongoose/cgi-bin/browse/browse.js | 7 ++++++- var/mongoose/cgi-bin/browse/sizes.jim | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CONTROL/control b/CONTROL/control index 6aa580cf..dcbb828c 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -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 diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index 64911827..3a24539c 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -221,6 +221,7 @@ foreach part [split $dir /] { append stub $name puts "$name } +puts "" puts "" # Parent directory diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index 276ac9a7..5f04ac75 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -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); - $('#' + folder).text(' (' + size + 'iB)'); + 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); } diff --git a/var/mongoose/cgi-bin/browse/sizes.jim b/var/mongoose/cgi-bin/browse/sizes.jim index 0313ec7c..6dca32c1 100755 --- a/var/mongoose/cgi-bin/browse/sizes.jim +++ b/var/mongoose/cgi-bin/browse/sizes.jim @@ -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\" : \"\""