From 1045587fbdc2ae3a510b9812c6d21897bd5cb6e3 Mon Sep 17 00:00:00 2001 From: hummypkg Date: Tue, 6 Dec 2011 00:13:41 +0000 Subject: [PATCH] fix error on default browse directory git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@545 2a923420-c742-0410-a762-8d5b09965624 --- CONTROL/control | 2 +- var/mongoose/cgi-bin/browse.jim | 64 ++++++++++++++++++++++-- var/mongoose/cgi-bin/browse/join.jim | 1 + var/mongoose/html/img/sort_date.gif | Bin 0 -> 609 bytes var/mongoose/html/img/sort_name.gif | Bin 0 -> 384 bytes var/mongoose/html/js/touchbridge.js | 70 +++++++++++++++++++++++++++ var/mongoose/lib/settings.class | 4 ++ 7 files changed, 136 insertions(+), 5 deletions(-) create mode 100644 var/mongoose/html/img/sort_date.gif create mode 100644 var/mongoose/html/img/sort_name.gif create mode 100644 var/mongoose/html/js/touchbridge.js diff --git a/CONTROL/control b/CONTROL/control index b6ad90b..2c519df 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.8.3 +Version: 0.8.3-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-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.1),ssmtp diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index 04c90e0..ff8e380 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -2,7 +2,7 @@ package require cgi source /mod/var/mongoose/lib/setup -require ts.class pretty_size system.class +require ts.class pretty_size system.class settings.class puts "Content-Type: text/html" puts "" @@ -18,6 +18,15 @@ cgi_input #set env(REQUEST_URI) '' #set _cgi(dir) "/media/My Video/\[Don't Die Young\]" +if {![dict exists $env QUERY_STRING]} { set env(QUERY_STRING) "root" } + +set order [cgi_get order -] +if {$order eq "-"} { + set order [[settings new] sortorder] +} else { + [settings new] sortorder $order +} + proc directory {file bfile} { regsub -all " +" $bfile "" tbfile puts "
" @@ -192,7 +201,7 @@ puts { @@ -274,12 +283,59 @@ regsub -all -- {\/+} "$dir/*" "/" dir # Escape square brackets (for glob) regsub -all {([\\[])} $dir {\\\1} dir -foreach file [lsort [glob -nocomplain "$dir"]] { - entry $file +proc s_time {a b} { + set ad [file isdirectory $a] + set bd [file isdirectory $b] + + if {$ad && !$bd} { return -1 } + if {$bd && !$ad} { return 1 } + if {$ad && $bd} { + if {$a < $b} { return -1 } + if {$a > $b} { return 1 } + return 0 + } + + file stat $a l + set at $l(ctime) + file stat $b l + set bt $l(ctime) + + if {$at < $bt} { return -1 } + if {$at > $bt} { return 1 } + return 0 } +set files [glob -nocomplain $dir] +switch $order { + 1 { set files [lsort -command s_time $files] } + default { set files [lsort $files] } +} + +foreach file $files { entry $file } + puts "Select all | none" +# Sort icons +puts "
" +set sortlist {{0 sort_name name} {1 sort_date date}} +foreach sl $sortlist { + lassign $sl index img descr + + if {$index} { puts " | " } + + set tag "Currently sorting" + if {$order != $index} { + puts " + " + set tag "Sort" + } + puts " $tag by $descr" + if {$order != $index} { + puts "" + } +} +puts "
" + puts "" puts "
" diff --git a/var/mongoose/cgi-bin/browse/join.jim b/var/mongoose/cgi-bin/browse/join.jim index f335160..74705de 100755 --- a/var/mongoose/cgi-bin/browse/join.jim +++ b/var/mongoose/cgi-bin/browse/join.jim @@ -21,6 +21,7 @@ span.pl { padding-left: 2em; } +

Drag the files below into order, enter a name for the resulting file and then diff --git a/var/mongoose/html/img/sort_date.gif b/var/mongoose/html/img/sort_date.gif new file mode 100644 index 0000000000000000000000000000000000000000..7600325c47cdbbda5da16890a047e9b8006bdba2 GIT binary patch literal 609 zcmZ?wbhEHb6krfwc;?CQ|NsB0_Q~qTcBPHIYDRW{{{H{|``@>p|7tp>GRXBys2Vba zo|RBBD6Z?O?wt1K!`GjG{%e{#XlQGhJNc&NS5>u5UU%$jUPW_qZu#6R|382I`RV&F z18cWmzyH2?_vyozA5FcpocyA{{`mF%&;NzD{+rl)7F4yT7F1;v*Htu6tZ1Dqp^H*0CnjK%*27_MBqdhx-d3-=!ZRWS^Dp!k!8k%7UJ zK?megP@FKZ?`!aEYW8$?Xz6G%V_6DnkYeRyu+gy)W8hzUKEL;Q>8XN@tSvV&298e78bW;^NImf^;O@YB007wV0 A&;S4c literal 0 HcmV?d00001 diff --git a/var/mongoose/html/img/sort_name.gif b/var/mongoose/html/img/sort_name.gif new file mode 100644 index 0000000000000000000000000000000000000000..128b347362c2e4e46d6c9ddd6b1909c11b8a7ebf GIT binary patch literal 384 zcmZ?wbhEHb6krfwxT??a|NsAAzyJRD_51zj?DSPXOw1BpQKCkrD3gFb@}NFT^g3~X}`OfUFxDy73iiJPH7RacA6d2^Cc zxYWv1LYt!W#r2I@m{`uWY>wh(NMvAQbd+0voKb=+VN-yB2sbxNJ-0A}2tR`+8%qyc zKN}aDCIi15g8(b%EY`VPa|IaWlo$k=m#<)1A;_R4#Gt{xX*1_mb`1t0Sq6EIed=mz q>ian48Dv$H7?hPysftST^784%@$p@f7WI_zk@0+>qVm9z!5RP