Add Type (Extension) sort and tidy selection options

This commit is contained in:
prpr 2023-06-13 01:37:00 +01:00
parent ac13c730a8
commit 2ea56fd045
2 changed files with 21 additions and 9 deletions

View File

@ -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>
&nbsp;&nbsp;
Directories: $dircount, Files: $filecount
Select: <a href=# id=selectall>All</a> | <a href=# id=deselectall>None</a>
&nbsp;&nbsp;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 {

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 B