fix dedup fastpath, cross-device renames, undelete on usb drives, directory menu outside of media root
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1425 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
fa8b6d7e7c
commit
2f570f6ea0
@ -1,7 +1,7 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.13.0
|
||||
Version: 0.13.1
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: webif-channelicons(>=1.0.4-1),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.7),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.10),hmt(>=1.1.13),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.05)
|
||||
|
@ -45,6 +45,14 @@ puts {
|
||||
<li><a href=#download>Download</a></li>
|
||||
</ul>
|
||||
|
||||
<ul id=dooptmenu class=contextMenu style="width: 250px">
|
||||
<li class=delete><a href=#delete>Delete</a></li>
|
||||
<li class=cut><a href=#cut>Cut to clipboard</a></li>
|
||||
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
|
||||
<li class=pwpaste><a href=#paste>Paste to folder</a></li>
|
||||
<li class=separator><a href=#rename>Rename</a></li>
|
||||
</ul>
|
||||
|
||||
<ul id=doptmenu class=contextMenu style="width: 250px">
|
||||
<li class=delete><a href=#delete>Delete</a></li>
|
||||
<li class=cut><a href=#cut>Cut to clipboard</a></li>
|
||||
|
@ -56,9 +56,15 @@ proc directory {file bfile tbfile} {
|
||||
puts [join $icons ""]
|
||||
puts "</span>"
|
||||
|
||||
if {[string first $::mroot $file] >= 0} {
|
||||
set class dopt
|
||||
} else {
|
||||
set class doopt
|
||||
}
|
||||
|
||||
puts -nonewline "
|
||||
<a href=#>
|
||||
<img class=\"dopt va\" border=0 width=45 "
|
||||
<img class=\"$class va\" border=0 width=45 "
|
||||
puts -nonewline [join $attrs " "]
|
||||
puts "
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
@ -223,7 +229,8 @@ proc entry {file} {{i 0}} {
|
||||
puts "</div>"
|
||||
}
|
||||
|
||||
set dir [cgi_get dir [system mediaroot]]
|
||||
set mroot [system mediaroot]
|
||||
set dir [cgi_get dir $mroot]
|
||||
|
||||
######################################################################
|
||||
# Render web page
|
||||
@ -242,6 +249,7 @@ source assets.jim
|
||||
|
||||
puts "
|
||||
<span style=\"display:none\" id=dir>$dir</span>
|
||||
<span style=\"display:none\" id=mediaroot>$mroot</span>
|
||||
<fieldset class=cleft style=\"margin: 0 1em 1em 1em\">
|
||||
<legend style=\"font-size: 1.5em; padding: 0 0.5em 0.5em 0.5em;\">
|
||||
"
|
||||
|
@ -33,12 +33,12 @@ function reloadclipboard()
|
||||
if ($('#clipclear').length)
|
||||
{
|
||||
$('#paste').enable();
|
||||
$('#doptmenu').enableContextMenuItems('#paste');
|
||||
$('#doptmenu,#dooptmenu').enableContextMenuItems('#paste');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#paste').disable();
|
||||
$('#doptmenu').disableContextMenuItems('#paste');
|
||||
$('#doptmenu,#dooptmenu').disableContextMenuItems('#paste');
|
||||
}
|
||||
|
||||
$('#clipclear').button().click(function() {
|
||||
@ -364,6 +364,7 @@ function preparedmenu(el, menu)
|
||||
$(document).ready(function() {
|
||||
|
||||
dir = $('#dir').text();
|
||||
mediaroot = $('#mediaroot').text();
|
||||
|
||||
var menuclick = function(action, el, pos)
|
||||
{
|
||||
@ -625,6 +626,15 @@ var dmenuclick = function(action, el, pos)
|
||||
dmenuclick
|
||||
);
|
||||
|
||||
$('img.doopt').contextMenu(
|
||||
{
|
||||
menu: 'dooptmenu',
|
||||
leftButton: true,
|
||||
beforeShow: preparedmenu
|
||||
},
|
||||
dmenuclick
|
||||
);
|
||||
|
||||
// Disable items which are not yet implemented.
|
||||
$('#optmenu').disableContextMenuItems('#title');
|
||||
|
||||
|
@ -68,6 +68,7 @@ foreach file [readdir $dir] {
|
||||
# Dooooo, it.
|
||||
$ts settitle $syn
|
||||
ts renamegroup $file $fn
|
||||
$ts set_deduped
|
||||
puts -nonewline "Done"
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,11 @@ proc dedupprocess {file} {{seen {}}} {
|
||||
set ts [ts fetch $file 1]
|
||||
|
||||
if {[$ts flag "Deduped"]} {
|
||||
lappend seen [file rootname [file tail $file]]
|
||||
return [list nothing $ts "" ""]
|
||||
# Fast track content which has already been de-duped.
|
||||
set fn [file rootname [file tail $file]]
|
||||
if {$fn in $seen} { set stat dup } else { set stat nothing }
|
||||
lappend seen $fn
|
||||
return [list $stat $ts "" $fn]
|
||||
}
|
||||
|
||||
set dir [file dirname $file]
|
||||
|
@ -1,21 +0,0 @@
|
||||
|
||||
proc {file copy} {{force {}} source target} {
|
||||
try {
|
||||
if {$force ni {{} -force}} {
|
||||
error "bad option \"$force\": should be -force"
|
||||
}
|
||||
|
||||
if {![file exists $source]} {
|
||||
error "source file does not exist."
|
||||
}
|
||||
|
||||
if {$force eq "" && [file exists $target]} {
|
||||
error "error copying \"$source\" to \"$target\": file already exists"
|
||||
}
|
||||
exec /mod/bin/busybox/cp $source $target
|
||||
} on error {msg opts} {
|
||||
incr opts(-level)
|
||||
return {*}$opts $msg
|
||||
}
|
||||
}
|
||||
|
49
var/mongoose/lib/fileops
Normal file
49
var/mongoose/lib/fileops
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
proc {file copy} {{force {}} source target} {
|
||||
try {
|
||||
if {$force ni {{} -force}} {
|
||||
error "bad option \"$force\": should be -force"
|
||||
}
|
||||
|
||||
if {![file exists $source]} {
|
||||
error "source file does not exist."
|
||||
}
|
||||
|
||||
if {$force eq "" && [file exists $target]} {
|
||||
error "error copying \"$source\" to \"$target\": file already exists"
|
||||
}
|
||||
exec /mod/bin/busybox/cp $source $target
|
||||
} on error {msg opts} {
|
||||
incr opts(-level)
|
||||
return {*}$opts $msg
|
||||
}
|
||||
}
|
||||
|
||||
proc {file rename} {{force {}} source target} {
|
||||
try {
|
||||
if {$force ni {{} -force}} {
|
||||
error "bad option \"$force\": should be -force"
|
||||
}
|
||||
|
||||
if {![file exists $source]} {
|
||||
error "source file does not exist."
|
||||
}
|
||||
|
||||
if {$force eq "" && [file exists $target]} {
|
||||
error "error copying \"$source\" to \"$target\": file already exists"
|
||||
}
|
||||
exec /mod/bin/busybox/mv $source $target
|
||||
} on error {msg opts} {
|
||||
incr opts(-level)
|
||||
return {*}$opts $msg
|
||||
}
|
||||
}
|
||||
|
||||
local proc file {cmd args} {
|
||||
switch $cmd {
|
||||
"rename" { tailcall {file rename} {*}$args }
|
||||
"copy" { tailcall {file copy} {*}$args }
|
||||
default { tailcall upcall file $cmd {*}$args }
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
|
||||
proc {file rename} {{force {}} source target} {
|
||||
try {
|
||||
if {$force ni {{} -force}} {
|
||||
error "bad option \"$force\": should be -force"
|
||||
}
|
||||
|
||||
if {![file exists $source]} {
|
||||
error "source file does not exist."
|
||||
}
|
||||
|
||||
if {$force eq "" && [file exists $target]} {
|
||||
error "error copying \"$source\" to \"$target\": file already exists"
|
||||
}
|
||||
exec /mod/bin/busybox/mv $source $target
|
||||
} on error {msg opts} {
|
||||
incr opts(-level)
|
||||
return {*}$opts $msg
|
||||
}
|
||||
}
|
||||
|
@ -41,13 +41,6 @@ if {![exists -proc require]} {
|
||||
uplevel source /mod/webif/html/m/lib/footer.jim
|
||||
}
|
||||
|
||||
# Replace the built-in jim {file copy} command with one that is
|
||||
# largefile safe.
|
||||
|
||||
require filecopy
|
||||
|
||||
# and {file rename} with one that supports cross-filesystem moves.
|
||||
|
||||
require filerename
|
||||
require fileops
|
||||
}
|
||||
|
||||
|
@ -82,8 +82,7 @@ proc {system pkginst} {pkg} {{cache {}} {ncache {}}} {
|
||||
} else break
|
||||
}
|
||||
if {$status eq "unknown"} {
|
||||
puts "Could not get opkg lock after 5 seconds."
|
||||
exit
|
||||
error "Could not get opkg lock after 5 seconds."
|
||||
}
|
||||
|
||||
if {$status ne ""} {
|
||||
|
Loading…
Reference in New Issue
Block a user