forked from hummypkg/webif
bug fixes
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@542 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
8146627f18
commit
fcb4615c82
@ -16,14 +16,16 @@ cgi_input
|
|||||||
#cgi_dump
|
#cgi_dump
|
||||||
|
|
||||||
#set env(REQUEST_URI) ''
|
#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} {
|
proc directory {file bfile} {
|
||||||
regsub -all " +" $bfile "" tbfile
|
regsub -all " +" $bfile "" tbfile
|
||||||
puts "<div class=va>"
|
puts "<div class=va>"
|
||||||
puts "<a href=$::env(REQUEST_URI)?dir=[cgi_quote_url $file]>"
|
|
||||||
puts "<img border=0 class=va id=\"img$tbfile\"
|
puts "<img border=0 class=va id=\"img$tbfile\"
|
||||||
src=/images/711_1_09_Media_Folder.png>"
|
src=/images/711_1_09_Media_Folder.png>"
|
||||||
|
puts "<input class=\"fs fsdir\" type=checkbox>"
|
||||||
|
puts "<a href=\"$::env(REQUEST_URI)?dir=[cgi_quote_url $file]\"
|
||||||
|
file=\"$file\">"
|
||||||
puts "$bfile</a><span class=filesize id=\"$tbfile\">
|
puts "$bfile</a><span class=filesize id=\"$tbfile\">
|
||||||
</span></div>"
|
</span></div>"
|
||||||
}
|
}
|
||||||
@ -269,11 +271,14 @@ if {$parent ne ""} {
|
|||||||
# Strip double slashes
|
# Strip double slashes
|
||||||
regsub -all -- {\/+} "$dir/*" "/" dir
|
regsub -all -- {\/+} "$dir/*" "/" dir
|
||||||
|
|
||||||
|
# Escape square brackets (for glob)
|
||||||
|
regsub -all {([\\[])} $dir {\\\1} dir
|
||||||
|
|
||||||
foreach file [lsort [glob -nocomplain "$dir"]] {
|
foreach file [lsort [glob -nocomplain "$dir"]] {
|
||||||
entry $file
|
entry $file
|
||||||
}
|
}
|
||||||
|
|
||||||
puts "Select <a href=# id=selectall>all</a> | <a href=# id=deselectall>none</a>"
|
puts "<a href=# id=selectall>Select all</a> | <a href=# id=deselectall>none</a>"
|
||||||
|
|
||||||
puts "</fieldset>"
|
puts "</fieldset>"
|
||||||
|
|
||||||
@ -281,6 +286,9 @@ puts "<div class=brow>"
|
|||||||
|
|
||||||
puts {
|
puts {
|
||||||
<button id=delete>Delete</button>
|
<button id=delete>Delete</button>
|
||||||
|
<div id=deletewait class=blood style="display: none">
|
||||||
|
<img src=/img/loading.gif>Deleting may take some time, please be patient...
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
# Join
|
# Join
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
};
|
};
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
function disableall()
|
||||||
|
{
|
||||||
|
$('button,a,input').disable();
|
||||||
|
}
|
||||||
|
|
||||||
function epginfo_callback(data, status, xhr)
|
function epginfo_callback(data, status, xhr)
|
||||||
{
|
{
|
||||||
var width = 85;
|
var width = 85;
|
||||||
@ -76,7 +81,10 @@ function delete_callback(file, type, id)
|
|||||||
var results = el + ' .results';
|
var results = el + ' .results';
|
||||||
var url = '/cgi-bin/browse/delete.jim?file=' +
|
var url = '/cgi-bin/browse/delete.jim?file=' +
|
||||||
encodeURIComponent(file) + '&type=' + type;
|
encodeURIComponent(file) + '&type=' + type;
|
||||||
$(results).load(url, function() {
|
$(results)
|
||||||
|
.html('<img src=/img/loading.gif>Deleting, please wait...')
|
||||||
|
.slideDown('slow')
|
||||||
|
.load(url, function() {
|
||||||
$(el).delay(3000).slideUp(300, function() {
|
$(el).delay(3000).slideUp(300, function() {
|
||||||
$(el).remove();
|
$(el).remove();
|
||||||
});
|
});
|
||||||
@ -350,6 +358,11 @@ var menuclick = function(action, el, pos)
|
|||||||
$.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
|
$.getJSON('/cgi-bin/browse/newdir.jim?dir=' + encodeURIComponent(dir),
|
||||||
new_folder_callback);
|
new_folder_callback);
|
||||||
|
|
||||||
|
// Uncheck everything
|
||||||
|
$('input.fs:checked').attr('checked', false);
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
|
||||||
$('#dedup').button().click(function() {
|
$('#dedup').button().click(function() {
|
||||||
window.location = '/cgi-bin/dedup.jim?dir='
|
window.location = '/cgi-bin/dedup.jim?dir='
|
||||||
+ encodeURIComponent(dir);
|
+ encodeURIComponent(dir);
|
||||||
@ -385,7 +398,24 @@ var menuclick = function(action, el, pos)
|
|||||||
|
|
||||||
$('#delete').button().disable()
|
$('#delete').button().disable()
|
||||||
.click(function() {
|
.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() {
|
$('input.fs').change(function() {
|
||||||
|
@ -69,6 +69,11 @@ Joining: <div id=progressbar></div>
|
|||||||
puts {
|
puts {
|
||||||
<script type=text/javascript>
|
<script type=text/javascript>
|
||||||
|
|
||||||
|
$('#filelist li').hover(
|
||||||
|
function() { $(this).css('cursor', 'pointer'); },
|
||||||
|
function() { $(this).css('cursor', 'auto'); }
|
||||||
|
);
|
||||||
|
|
||||||
var handle = 0;
|
var handle = 0;
|
||||||
|
|
||||||
function update()
|
function update()
|
||||||
|
55
var/mongoose/cgi-bin/browse/mdelete.jim
Executable file
55
var/mongoose/cgi-bin/browse/mdelete.jim
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
#!/mod/bin/jimsh
|
||||||
|
|
||||||
|
package require cgi
|
||||||
|
source /mod/var/mongoose/lib/setup
|
||||||
|
require ts.class pretty_size
|
||||||
|
|
||||||
|
puts "Content-Type: text/html\r\n\r\n"
|
||||||
|
header
|
||||||
|
|
||||||
|
cgi_input 1
|
||||||
|
#cgi_dump
|
||||||
|
set dir [cgi_unquote_input [cgi_get dir]]
|
||||||
|
|
||||||
|
puts "<div id=deleting class=blood><img src=/img/loading.gif>Deleting...</div>"
|
||||||
|
puts "<ul style=\"list-style-type: square\">"
|
||||||
|
foreach file [split [cgi_get files] ","] {
|
||||||
|
set file [cgi_unquote_input $file]
|
||||||
|
puts -nonewline "<li>\"$file\"..."
|
||||||
|
|
||||||
|
if {[file isdirectory $file]} {
|
||||||
|
puts -nonewline "Directory..."
|
||||||
|
puts [exec /mod/bin/busybox/rm -rf $file]
|
||||||
|
puts -nonewline "Done..."
|
||||||
|
} elseif {[string match {*.ts} $file]} {
|
||||||
|
set ts [ts fetch $file]
|
||||||
|
if {[catch {$ts delete} msg]} {
|
||||||
|
puts -nonewline "Error loading TS file..."
|
||||||
|
} else {
|
||||||
|
puts -nonewline "Done..."
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if {[catch {file delete $ts} msg]} {
|
||||||
|
puts -nonewline "Error: $msg"
|
||||||
|
} else {
|
||||||
|
catch {file delete "[file rootname $file].hmi"}
|
||||||
|
puts -nonewline "Done..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
puts "</li>"
|
||||||
|
}
|
||||||
|
puts "</ul>"
|
||||||
|
puts "<button id=back dir=\"$dir\">Back to media list</button>";
|
||||||
|
|
||||||
|
puts {
|
||||||
|
<script type=text/javascript>
|
||||||
|
$('#deleting').slideUp('slow');
|
||||||
|
$('#back').button().click(function() {
|
||||||
|
window.location.href = '/cgi-bin/browse.jim?dir=' +
|
||||||
|
encodeURIComponent($('#back').attr('dir'));
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
|
||||||
|
footer
|
||||||
|
|
Loading…
Reference in New Issue
Block a user