fix minor file browser bugs

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@291 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2011-08-20 20:45:23 +00:00
parent 767021557f
commit d5b27acd46
3 changed files with 21 additions and 4 deletions

View File

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

View File

@ -5,6 +5,8 @@ package require sqlite3
source /mod/var/mongoose/lib/setup
require ts.class
#puts "Content-Type: text/plain\r\n\r\n"
cgi_input
#cgi_dump
@ -21,8 +23,7 @@ if {[file exists $dmsfile]} {
set muri [$db query "
select tblresource.mimetype, contenturi
from tblresource join tblmedia using (mediaid)
where localurl = '$rfile'
"]
where localurl = '%s'" $rfile]
if {$muri != ""} {
set rec [lindex $muri 0]
set xuri [lindex $rec 3]

View File

@ -2,6 +2,7 @@
package require cgi
#puts "Content-Type: text/plain"
puts "Content-Type: application/json"
puts ""
@ -18,9 +19,24 @@ 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 [file tail [lindex $fields 1]]
# set node [lindex [split [lindex $fields 1] /] end]
puts "\"$node\" : \"$size\","
}
# Handle symbolic links.
foreach file [glob -nocomplain "$dir/*"] {
if {[catch {set lk [file readlink $file]}]} continue
foreach line [split [exec /mod/bin/busybox/du -h "$lk"] "\n"] {
set fields [split $line "\t"]
if {[lindex $fields 1] eq $lk} {
set node [file tail $file]
set size [lindex $fields 0]
puts "\"$node\" : \"@$size\","
}
}
}
puts "\"dummy\" : \"\""
puts "}"