diff --git a/var/mongoose/cgi-bin/browse.jim b/var/mongoose/cgi-bin/browse.jim index 9dbe074..04c90e0 100755 --- a/var/mongoose/cgi-bin/browse.jim +++ b/var/mongoose/cgi-bin/browse.jim @@ -16,14 +16,16 @@ cgi_input #cgi_dump #set env(REQUEST_URI) '' -#set _cgi(dir) "/media/My Video/Chuggington" +#set _cgi(dir) "/media/My Video/\[Don't Die Young\]" proc directory {file bfile} { regsub -all " +" $bfile "" tbfile puts "
" - puts "" puts "" + puts "" + puts "" puts "$bfile
" } @@ -269,11 +271,14 @@ if {$parent ne ""} { # Strip double slashes regsub -all -- {\/+} "$dir/*" "/" dir +# Escape square brackets (for glob) +regsub -all {([\\[])} $dir {\\\1} dir + foreach file [lsort [glob -nocomplain "$dir"]] { entry $file } -puts "Select all | none" +puts "Select all | none" puts "" @@ -281,6 +286,9 @@ puts "
" puts { + } # Join diff --git a/var/mongoose/cgi-bin/browse/browse.js b/var/mongoose/cgi-bin/browse/browse.js index 33b10d7..0bbb4a4 100755 --- a/var/mongoose/cgi-bin/browse/browse.js +++ b/var/mongoose/cgi-bin/browse/browse.js @@ -19,6 +19,11 @@ }; })(jQuery); +function disableall() +{ + $('button,a,input').disable(); +} + function epginfo_callback(data, status, xhr) { var width = 85; @@ -76,7 +81,10 @@ function delete_callback(file, type, id) var results = el + ' .results'; var url = '/cgi-bin/browse/delete.jim?file=' + encodeURIComponent(file) + '&type=' + type; - $(results).load(url, function() { + $(results) + .html('Deleting, please wait...') + .slideDown('slow') + .load(url, function() { $(el).delay(3000).slideUp(300, function() { $(el).remove(); }); @@ -350,6 +358,11 @@ var menuclick = function(action, el, pos) $.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir), new_folder_callback); + // Uncheck everything + $('input.fs:checked').attr('checked', false); + + // Buttons + $('#dedup').button().click(function() { window.location = '/cgi-bin/dedup.jim?dir=' + encodeURIComponent(dir); @@ -385,7 +398,24 @@ var menuclick = function(action, el, pos) $('#delete').button().disable() .click(function() { - console.log("delete"); + var files = new Array(); + var els = $('input.fs:checked + a').each(function() { + files.push(encodeURIComponent($(this).attr('file'))); + }); + //console.log("%o", files); + var str = 'Are you sure you want to delete ' + files.length + + ' file'; + if (files.length != 1) str += 's'; + str += '?'; + if (confirm(str)) + { + disableall(); + $('#deletewait').slideDown('slow'); + window.location.href = + '/cgi-bin/browse/mdelete.jim?dir=' + + encodeURIComponent(dir) + '&files=' + + files.join(); + } }); $('input.fs').change(function() { diff --git a/var/mongoose/cgi-bin/browse/join.jim b/var/mongoose/cgi-bin/browse/join.jim index 152292b..f335160 100755 --- a/var/mongoose/cgi-bin/browse/join.jim +++ b/var/mongoose/cgi-bin/browse/join.jim @@ -69,6 +69,11 @@ Joining:
puts { +} + +footer +