2012-10-30 18:58:54 +00:00
|
|
|
|
|
|
|
require system.class
|
|
|
|
|
|
|
|
#if {![exists -proc class]} { package require oo }
|
|
|
|
#class browse {}
|
|
|
|
|
|
|
|
set _flatten [system pkginst flatten]
|
|
|
|
|
|
|
|
proc _addicon {img {hover ""} {class va}} {
|
|
|
|
set icon "<img src=$img class=\"$class\" height=21"
|
|
|
|
if {$hover ne ""} {
|
|
|
|
append icon " alt=\"$hover\" title=\"$hover\""
|
|
|
|
}
|
|
|
|
append icon ">"
|
|
|
|
return $icon
|
|
|
|
}
|
|
|
|
|
2013-02-25 22:31:54 +00:00
|
|
|
proc {dir expiry} {dir} {
|
|
|
|
if {[catch {
|
|
|
|
set fd [open "$dir/.autoexpire"]
|
|
|
|
set days $([read $fd] + 0)
|
|
|
|
$fd close
|
|
|
|
}]} { set days 0 }
|
|
|
|
if {!$days} { set days 7 }
|
|
|
|
return $days
|
|
|
|
}
|
|
|
|
|
2012-10-30 18:58:54 +00:00
|
|
|
proc {dir iconset} {dir} {
|
|
|
|
set icons {}
|
|
|
|
set attrs {}
|
|
|
|
|
|
|
|
set noflat 0
|
|
|
|
if $::_flatten {
|
|
|
|
if {[string match {\[*\]} [file tail $dir]]} { set noflat 1 }
|
|
|
|
if {[file exists "$dir/.noflatten"]} { set noflat 1 }
|
|
|
|
if $noflat { lappend icons \
|
|
|
|
[_addicon "/img/flat-tyre.png" "No-flatten" }
|
|
|
|
lappend attrs "noflat=$noflat"
|
|
|
|
}
|
|
|
|
|
2013-01-18 18:47:14 +00:00
|
|
|
set autoshrinkr 0
|
|
|
|
if {[file exists "$dir/.autoshrinkr"]} {
|
|
|
|
set autoshrinkr 1
|
|
|
|
lappend icons [_addicon "/img/compressr.png" \
|
|
|
|
"Recursive Auto-shrink"]
|
|
|
|
lappend attrs "autoshrinkr=1"
|
|
|
|
}
|
|
|
|
|
2012-10-30 18:58:54 +00:00
|
|
|
set autoshrink 0
|
2013-01-18 18:47:14 +00:00
|
|
|
if {!$autoshrinkr && [file exists "$dir/.autoshrink"]} {
|
2012-10-30 18:58:54 +00:00
|
|
|
set autoshrink 1
|
|
|
|
lappend icons [_addicon "/img/compress.png" "Auto-shrink"]
|
2013-01-18 18:47:14 +00:00
|
|
|
lappend attrs "autoshrink=1"
|
2012-10-30 18:58:54 +00:00
|
|
|
}
|
|
|
|
|
2013-01-18 18:47:14 +00:00
|
|
|
|
2012-10-30 18:58:54 +00:00
|
|
|
set autodedup 0
|
|
|
|
if {[file exists "$dir/.autodedup"]} {
|
|
|
|
set autodedup 1
|
|
|
|
lappend icons [_addicon "/img/dedup.png" "Auto-dedup"]
|
2013-01-18 18:47:14 +00:00
|
|
|
lappend attrs "autodedup=1"
|
|
|
|
}
|
|
|
|
|
|
|
|
set autodecryptr 0
|
|
|
|
if {[file exists "$dir/.autodecryptr"]} {
|
|
|
|
set autodecryptr 1
|
|
|
|
lappend icons [_addicon "/img/decryptr.png" \
|
|
|
|
"Recursive Auto-decrypt"]
|
|
|
|
lappend attrs "autodecryptr=1"
|
2012-10-30 18:58:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set autodecrypt 0
|
2013-01-18 18:47:14 +00:00
|
|
|
if {!$autodecryptr && [file exists "$dir/.autodecrypt"]} {
|
2012-10-30 18:58:54 +00:00
|
|
|
set autodecrypt 1
|
|
|
|
lappend icons [_addicon "/img/decrypt.png" "Auto-decrypt"]
|
2013-01-18 18:47:14 +00:00
|
|
|
lappend attrs "autodecrypt=1"
|
2012-10-30 18:58:54 +00:00
|
|
|
}
|
|
|
|
|
2013-01-08 22:43:43 +00:00
|
|
|
set autompg 0
|
|
|
|
if {[file exists "$dir/.autompg"]} {
|
|
|
|
set autompg 1
|
|
|
|
lappend icons [_addicon "/img/mpg.png" "Auto-MPG Extract"]
|
2013-01-18 18:47:14 +00:00
|
|
|
lappend attrs "autompg=1"
|
2013-01-08 22:43:43 +00:00
|
|
|
}
|
|
|
|
|
2013-02-25 22:31:54 +00:00
|
|
|
set autoexpire 0
|
|
|
|
if {[file exists "$dir/.autoexpire"]} {
|
|
|
|
set days [{dir expiry} $dir]
|
|
|
|
set autoexpire 1
|
|
|
|
lappend icons [_addicon "/img/clock.png" \
|
|
|
|
"Auto-Expire ($days day$($days == 1 ? "" : "s"))"]
|
|
|
|
lappend attrs "autoexpire=1" "autoexpiredays=$days"
|
|
|
|
}
|
|
|
|
|
2012-10-30 18:58:54 +00:00
|
|
|
return [list $icons $attrs]
|
|
|
|
}
|
|
|
|
|