From 2ea56fd045f38b0018efce95bba93165ef71d743 Mon Sep 17 00:00:00 2001 From: prpr Date: Tue, 13 Jun 2023 01:37:00 +0100 Subject: [PATCH] Add Type (Extension) sort and tidy selection options --- webif/html/browse/index.jim | 30 +++++++++++++++++++++--------- webif/html/img/sort_type.gif | Bin 0 -> 225 bytes 2 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 webif/html/img/sort_type.gif diff --git a/webif/html/browse/index.jim b/webif/html/browse/index.jim index 8e6f27c..7fa05fc 100755 --- a/webif/html/browse/index.jim +++ b/webif/html/browse/index.jim @@ -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 " -Select all | none -   -Directories: $dircount, Files: $filecount +Select: All | None +  Folders: $dircount, Files: $filecount " # Sort icons puts "
" 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 { diff --git a/webif/html/img/sort_type.gif b/webif/html/img/sort_type.gif new file mode 100644 index 0000000000000000000000000000000000000000..8add029fbee27854145d81991f9c0453717dc181 GIT binary patch literal 225 zcmZ?wbhEHb6krfwXpv@6HMCPRvQsy<(=>JX&%j_{?Pg-{Y3}5koLiojUzJ)=l~G)m zUD}ve(Ogi~UR>8z+SpssJh7^6QdQgJs`kk>9aEcnXLV0s+%scw->jt*=dApX3KV~` zFmf@-Gw3h?0mx1U*0=}ieeugCYE literal 0 HcmV?d00001