replace glob with readdir in some cases. Move paste button to clipboard

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@711 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-02-01 21:02:43 +00:00
parent a3ecbe1d3f
commit fa9905d8bd
4 changed files with 31 additions and 37 deletions

View File

@ -249,12 +249,6 @@ if {$parent ne ""} {
"
}
# Strip double slashes
regsub -all -- {\/+} "$dir/*" "/" dir
# Escape square brackets (for glob)
regsub -all {([\\[])} $dir {\\\1} dir
proc s_time {a b} {
set ad [file isdirectory $a]
set bd [file isdirectory $b]
@ -277,13 +271,13 @@ proc s_time {a b} {
return 0
}
set files [glob -nocomplain $dir]
set files [readdir -nocomplain $dir]
switch $order {
1 { set files [lsort -command s_time $files] }
default { set files [lsort $files] }
}
foreach file $files { entry $file }
foreach file $files { entry "$dir/$file" }
puts "<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>"
@ -326,7 +320,6 @@ puts "<div class=brow>"
puts {
<button id=copy>Copy</button>
<button id=cut>Cut</button>
<button id=paste>Paste</button>
<button id=delete>Delete</button>
<button id=newdir>New Folder</button>
<div id=deletewait class=blood style="display: none">

View File

@ -19,6 +19,8 @@
};
})(jQuery);
var dir;
function disableall()
{
$('button,a,input').disable();
@ -51,6 +53,29 @@ $('a.clipdel').click(function() {
});
});
$('#paste').button()
.click(function() {
disableall();
$('#pwdialogue').dialog({
title: "Pasting from clipboard",
modal: true, autoOpen: true,
height: 'auto', width: 'auto',
show: 'scale', hide: 'fade',
draggable: false, resizable: false,
closeOnEscape: false,
open: function() {
$('.ui-dialog-titlebar-close').hide();
}
});
$('#pwfeedback').load(
'/cgi-bin/browse/clipboard.jim?act=paste&dir='
+ encodeURIComponent(dir), function() {
$('#pwdialogue').dialog('close');
window.location.reload(true);
});
});
// End Clipboard post-load actions
});
@ -269,7 +294,7 @@ function preparedmenu(el, menu)
$(document).ready(function() {
var dir = $('#dir').text();
dir = $('#dir').text();
var menuclick = function(action, el, pos)
{
@ -647,28 +672,6 @@ var dmenuclick = function(action, el, pos)
});
});
$('#paste').button().disable()
.click(function() {
disableall();
$('#pwdialogue').dialog({
title: "Pasting from clipboard",
modal: true, autoOpen: true,
height: 'auto', width: 'auto',
show: 'scale', hide: 'fade',
draggable: false, resizable: false,
closeOnEscape: false,
open: function() {
$('.ui-dialog-titlebar-close').hide();
}
});
$('#pwfeedback').load(
'/cgi-bin/browse/clipboard.jim?act=paste&dir='
+ encodeURIComponent(dir), function() {
$('#pwdialogue').dialog('close');
window.location.reload(true);
});
});
$('#newdir').button().click(function() {
$('#newdirform').dialog({
autoOpen: true,

View File

@ -47,6 +47,7 @@ switch $action {
puts "</span>"
}
puts "</div>"
puts "<button id=paste>Paste to current folder</button>"
puts "<button id=clipclear>Empty clipboard</button>"
}
add {

View File

@ -13,8 +13,6 @@ cgi_input
set dir [cgi_get dir "/media/My Video"]
set doit [cgi_get doit 0]
# Strip double slashes
header
puts "<fieldset style=\"display: inline\">
@ -28,11 +26,10 @@ puts "<fieldset style=\"display: inline\">
</tr>
"
regsub -all -- {\/+} "$dir/*" "/" sdir
set seen {}
foreach file [lsort [glob -nocomplain "$sdir"]] {
foreach file [readdir $dir] {
set file "$dir/$file"
if {[file extension $file] ne ".hmt"} { continue }
altrow
set ts [ts fetch $file 1]