forked from hummypkg/webif
add flatten support
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@560 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
parent
8166af0f1b
commit
43f6281410
@ -1,7 +1,7 @@
|
||||
Package: webif
|
||||
Priority: optional
|
||||
Section: web
|
||||
Version: 0.8.5-1
|
||||
Version: 0.8.6
|
||||
Architecture: mipsel
|
||||
Maintainer: af123@hummypkg.org.uk
|
||||
Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4-1),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.2),ssmtp,anacron
|
||||
|
@ -8,6 +8,7 @@ puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
set nicesplice [system pkginst nicesplice]
|
||||
set flatten [system pkginst flatten]
|
||||
|
||||
set ignore {.nts .thm .hmt .hmi}
|
||||
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov}
|
||||
@ -15,8 +16,10 @@ set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov}
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
#set env(REQUEST_URI) ''
|
||||
#set _cgi(dir) "/media/My Video/\[Don't Die Young\]"
|
||||
if {![dict exists env REQUEST_URI]} {
|
||||
set env(REQUEST_URI) ''
|
||||
set _cgi(dir) "/media/My Video/"
|
||||
}
|
||||
|
||||
if {![dict exists $env QUERY_STRING]} { set env(QUERY_STRING) "root" }
|
||||
|
||||
@ -28,6 +31,8 @@ if {$order eq "-"} {
|
||||
}
|
||||
|
||||
proc directory {file bfile} {
|
||||
global flatten
|
||||
|
||||
regsub -all " +" $bfile "" tbfile
|
||||
puts "<div class=va>"
|
||||
puts "<img border=0 class=va id=\"img$tbfile\"
|
||||
@ -38,11 +43,30 @@ proc directory {file bfile} {
|
||||
file=\"$file\">"
|
||||
puts "$bfile</a><span class=filesize id=\"$tbfile\">
|
||||
</span>"
|
||||
puts "
|
||||
|
||||
set noflat 0
|
||||
if $flatten {
|
||||
if {[string match {\[*\]} [file tail $file]]} { set noflat 1 }
|
||||
if {[file exists "$file/.noflatten"]} {
|
||||
set noflat 1
|
||||
}
|
||||
|
||||
if $noflat {
|
||||
puts "<img alt=\"No-flatten\" title=\"No-flatten\"
|
||||
class=va src=/img/flat-tyre.png height=21>"
|
||||
}
|
||||
}
|
||||
|
||||
puts -nonewline "
|
||||
<a href=#>
|
||||
<img class=\"dopt va\" border=0 width=45
|
||||
<img class=\"dopt va\" border=0 width=45 "
|
||||
if $flatten { puts -nonewline "noflat=$noflat " }
|
||||
puts "
|
||||
src=/images/181_1_00_Help5_OPT_Plus.png>
|
||||
</a>
|
||||
"
|
||||
|
||||
puts "
|
||||
<div class=\"results blood\" style=\"margin: 0 0 0 5em\"></div>
|
||||
"
|
||||
puts "</div>"
|
||||
@ -196,6 +220,13 @@ puts {
|
||||
<ul id=doptmenu class=contextMenu>
|
||||
<li class=delete><a href=#delete>Delete</a></li>
|
||||
<li><a href=#rename>Rename</a></li>
|
||||
}
|
||||
|
||||
if $flatten {
|
||||
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }
|
||||
}
|
||||
|
||||
puts {
|
||||
</ul>
|
||||
|
||||
<div id=renameform title="Rename media file" style="display: none">
|
||||
|
@ -217,6 +217,17 @@ function preparemenu(el, menu)
|
||||
|
||||
}
|
||||
|
||||
function preparedmenu(el, menu)
|
||||
{
|
||||
if (el.attr('noflat') != undefined)
|
||||
{
|
||||
if (el.attr('noflat') > 0)
|
||||
$(menu).changeContextMenuItem('#flat', 'Allow Flatten');
|
||||
else
|
||||
$(menu).changeContextMenuItem('#flat',
|
||||
'Prevent Flatten');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
@ -328,6 +339,12 @@ var dmenuclick = function(action, el, pos)
|
||||
$('#drenameform').dialog('open');
|
||||
break;
|
||||
|
||||
case 'flat':
|
||||
var url = '/cgi-bin/browse/flat.jim?file=' +
|
||||
encodeURIComponent(file);
|
||||
$.get(url, function() { window.location.reload(true); });
|
||||
break;
|
||||
|
||||
default:
|
||||
alert('Unhandled action: ' + action);
|
||||
break;
|
||||
@ -347,7 +364,8 @@ var dmenuclick = function(action, el, pos)
|
||||
$('img.dopt').contextMenu(
|
||||
{
|
||||
menu: 'doptmenu',
|
||||
leftButton: true
|
||||
leftButton: true,
|
||||
beforeShow: preparedmenu
|
||||
},
|
||||
dmenuclick
|
||||
);
|
||||
|
28
var/mongoose/cgi-bin/browse/flat.jim
Executable file
28
var/mongoose/cgi-bin/browse/flat.jim
Executable file
@ -0,0 +1,28 @@
|
||||
#!/mod/bin/jimsh
|
||||
|
||||
package require cgi
|
||||
source /mod/var/mongoose/lib/ts.class
|
||||
|
||||
puts "Content-Type: text/html"
|
||||
puts ""
|
||||
|
||||
cgi_input
|
||||
#cgi_dump
|
||||
|
||||
set dir [cgi_get file]
|
||||
if {![file isdirectory $dir]} { exit }
|
||||
set noflat 0
|
||||
if {[string match {\[*\]} [file tail $dir]]} {
|
||||
set ndir [string range [file tail $dir] 1 end-1]
|
||||
file rename $dir "[file dirname $dir]/$ndir"
|
||||
puts "Unflagged directory as noflatten."
|
||||
exit
|
||||
}
|
||||
if {[file exists "$dir/.noflatten"]} {
|
||||
file delete "$dir/.noflatten"
|
||||
puts "Unflagged directory as noflatten."
|
||||
} else {
|
||||
close [open "$dir/.noflatten" w]
|
||||
puts "Flagged directory as noflatten."
|
||||
}
|
||||
|
BIN
var/mongoose/html/img/flat-tyre.png
Normal file
BIN
var/mongoose/html/img/flat-tyre.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Loading…
Reference in New Issue
Block a user