forked from hummypkg/webif
Add Type (Extension) sort and tidy selection options
This commit is contained in:
parent
ac13c730a8
commit
2ea56fd045
@ -142,7 +142,7 @@ proc entry {file} {{i 0}} {
|
||||
if {[$ts get definition] eq ""} {
|
||||
set type gen
|
||||
set ts 0
|
||||
set img Video_Other
|
||||
set img Video_Other
|
||||
set omenu oopt
|
||||
} else {
|
||||
set omenu opt
|
||||
@ -338,8 +338,19 @@ proc s_size {a b} {
|
||||
tailcall s_file_stat $a $b size
|
||||
}
|
||||
|
||||
proc s_ext {a b} {
|
||||
set at [file extension $a]
|
||||
set bt [file extension $b]
|
||||
if {$at == $bt} {
|
||||
return [string compare -nocase $a $b]
|
||||
} else {
|
||||
return [string compare -nocase $at $bt]
|
||||
}
|
||||
}
|
||||
|
||||
set files [readdir -nocomplain $dir]
|
||||
switch $order {
|
||||
5 { set files [lsort -command s_ext $files] }
|
||||
1 { set files [lsort -command s_time $files] }
|
||||
2 { set files [lreverse [lsort -command s_time $files]] }
|
||||
3 { set files [lsort -command s_size $files] }
|
||||
@ -351,19 +362,20 @@ set dinuse [system dirinuse $dir]
|
||||
foreach file $files { entry "$dir/$file" }
|
||||
|
||||
puts "
|
||||
<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>
|
||||
|
||||
Directories: $dircount, Files: $filecount
|
||||
Select: <a href=# id=selectall>All</a> | <a href=# id=deselectall>None</a>
|
||||
Folders: $dircount, Files: $filecount
|
||||
"
|
||||
|
||||
# Sort icons
|
||||
puts "<div id=sortdiv>"
|
||||
set sortlist {
|
||||
{0 sort_name name {Alphabetical order A->Z}}
|
||||
{1 sort_date date {Oldest first}}
|
||||
{2 sort_date reverse-date {Newest first}}
|
||||
{3 sort_size size {Smallest first}}
|
||||
{4 sort_size reverse-size {Largest first}}}
|
||||
{0 sort_name Name {Alphabetical order A->Z}}
|
||||
{5 sort_type Type {Type A->Z}}
|
||||
{1 sort_date Date {Oldest first}}
|
||||
{2 sort_date Reverse-date {Newest first}}
|
||||
{3 sort_size Size {Smallest first}}
|
||||
{4 sort_size Reverse-size {Largest first}}
|
||||
}
|
||||
puts "
|
||||
Sort by: "
|
||||
foreach sl $sortlist {
|
||||
|
BIN
webif/html/img/sort_type.gif
Normal file
BIN
webif/html/img/sort_type.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
Loading…
Reference in New Issue
Block a user