cleanup directory flag functions. No refresh on flag change

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1356 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2013-01-18 18:47:14 +00:00
parent a294c084b3
commit f550931f71
14 changed files with 116 additions and 62 deletions

View File

@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.10.2-2
Version: 0.11.0
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.0.3),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.5),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.9-1),hmt(>=1.1.10),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.04)
Depends: webif-channelicons(>=1.0.4),mongoose(>=3.0-7),jim(>=0.73-1),jim-oo,jim-sqlite3(>=0.73-1),jim-cgi(>=0.6),jim-binary,service-control(>=1.2),busybox(>=1.20.2-1),lsof,epg(>=1.0.9-1),hmt(>=1.1.10),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)
Suggests: ffmpeg
Description: An evolving web interface for the Humax.

View File

@ -55,7 +55,9 @@ proc directory {file bfile tbfile} {
lassign [{dir iconset} $file] icons attrs
puts "<span class=iconset>"
puts [join $icons ""]
puts "</span>"
puts -nonewline "
<a href=#>

View File

@ -45,7 +45,7 @@ puts {
<li><a href=#download>Download</a></li>
</ul>
<ul id=doptmenu class=contextMenu style="width: 180px">
<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>
<li class=pwcopy><a href=#copy>Copy to clipboard</a></li>
@ -53,10 +53,15 @@ puts {
<li class=separator><a href=#rename>Rename</a></li>
<li class=separator><a href=#resetnew>Reset new flag</a></li>
<li class="separator compress"><a href=#shrink>Auto-Shrink</a></li>
<li class="compressr"><a href=#shrinkr>Recursive Auto-Shrink</a></li>
<li class=dedup><a href=#dedup>Auto-Dedup</a></li>
}
if {$model eq "HDR"} {
puts { <li class=decrypt><a href=#decrypt>Auto-Decrypt</a></li> }
puts {
<li class=decrypt><a href=#decrypt>Auto-Decrypt</a></li>
<li class=decryptr><a href=#decryptr>Recursive Auto-Decrypt
</a></li>
}
}
if $flatten {
puts { <li class="separator"><a href=#flat>No-Flatten</a></li> }

View File

@ -310,6 +310,36 @@ function preparemenu(el, menu)
}
function fixdmenu(el, menu, flag, tag, descr, recurse)
{
var a = el.attr(flag);
var b = el.attr(flag + 'r');
if (a == undefined) a = 0;
if (b == undefined) b = 0;
if (a > 0)
$(menu).changeContextMenuItem(tag, 'Disable ' + descr);
else
$(menu).changeContextMenuItem(tag, 'Enable ' + descr);
if (recurse)
{
if (b > 0)
{
$(menu).changeContextMenuItem(tag + 'r',
'Disable Recursive ' + descr);
$(menu).disableContextMenuItems(tag);
}
else
{
$(menu).changeContextMenuItem(tag + 'r',
'Enable Recursive ' + descr);
$(menu).enableContextMenuItems(tag);
}
}
}
function preparedmenu(el, menu)
{
if (el.attr('noflat') != undefined)
@ -320,42 +350,11 @@ function preparedmenu(el, menu)
$(menu).changeContextMenuItem('#flat',
'Prevent Flatten');
}
if (el.attr('autoshrink') != undefined)
{
if (el.attr('autoshrink') > 0)
$(menu).changeContextMenuItem('#shrink',
'Disable Auto-shrink');
else
$(menu).changeContextMenuItem('#shrink',
'Enable Auto-shrink');
}
if (el.attr('autodedup') != undefined)
{
if (el.attr('autodedup') > 0)
$(menu).changeContextMenuItem('#dedup',
'Disable Auto-dedup');
else
$(menu).changeContextMenuItem('#dedup',
'Enable Auto-dedup');
}
if (el.attr('autodecrypt') != undefined)
{
if (el.attr('autodecrypt') > 0)
$(menu).changeContextMenuItem('#decrypt',
'Disable Auto-decrypt');
else
$(menu).changeContextMenuItem('#decrypt',
'Enable Auto-decrypt');
}
if (el.attr('autompg') != undefined)
{
if (el.attr('autompg') > 0)
$(menu).changeContextMenuItem('#mpg',
'Disable Auto-mpg');
else
$(menu).changeContextMenuItem('#mpg',
'Enable Auto-mpg');
}
fixdmenu(el, menu, 'autoshrink', '#shrink', 'Auto-shrink', 1);
fixdmenu(el, menu, 'autodedup', '#dedup', 'Auto-dedup', 0);
fixdmenu(el, menu, 'autodecrypt', '#decrypt', 'Auto-decrypt', 1);
fixdmenu(el, menu, 'autompg', '#mpg', 'Auto-mpg', 0);
}
$(document).ready(function() {
@ -462,10 +461,28 @@ var menuclick = function(action, el, pos)
}
};
function flagdir(file, flag, iconset, output, options)
{
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=' + flag;
$(output).load(url, function() {
$(iconset)
.empty()
.html('<img src=/img/loading.gif> Updating...')
.load('/cgi-bin/browse/iconset.jim?file=' + file);
if ($(options).attr(flag) == '1')
$(options).attr(flag, 0);
else
$(options).attr(flag, 1);
}).delay(3000).slideUp();
}
var dmenuclick = function(action, el, pos)
{
var direl = $(el).parent().parent();
var file = $(el).parent().prevAll('a.dbf').last().attr('file');
var iconset = $(el).parent().prevAll('span.iconset').last();
var bfile = file.replace(/.*\//g, '');
bfile = bfile.replace(/[\x00-\x1f]+/g, '');
var results = $(el).parent().next('div.results');
@ -521,33 +538,23 @@ var dmenuclick = function(action, el, pos)
break;
case 'flat':
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=noflatten';
$.get(url, function() { window.location.reload(true); });
flagdir(file, 'noflatten', iconset, results, el);
break;
case 'dedup':
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=autodedup';
$.get(url, function() { window.location.reload(true); });
flagdir(file, 'autodedup', iconset, results, el);
break;
case 'mpg':
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=autompg';
$.get(url, function() { window.location.reload(true); });
flagdir(file, 'autompg', iconset, results, el);
break;
case 'shrink':
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=autoshrink';
$.get(url, function() { window.location.reload(true); });
flagdir(file, 'autoshrink', iconset, results, el);
break;
case 'decrypt':
var url = '/cgi-bin/browse/flagdir.jim?dir=' + file +
'&flag=autodecrypt';
$.get(url, function() { window.location.reload(true); });
flagdir(file, 'autodecrypt', iconset, results, el);
break;
case 'resetnew':

View File

@ -0,0 +1,15 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
require browse.class
puts "Content-Type: text/html"
puts ""
set file [cgi_get file]
if {[file isdirectory $file]} {
lassign [{dir iconset} $file] icons #attrs
puts [join $icons ""]
}

View File

@ -71,6 +71,7 @@ foreach tw [$db query {
switch $name {
"BBC ONE" { set mux "PSB1/BBC A" }
"ITV1" { set mux "PSB2/D3&amp;4" }
"ITV" { set mux "PSB2/D3&amp;4" }
"BBC One HD" { set mux "PSB3/BBC B (HD)" }
"ITV3" { set mux "COM4/SDN" }
"Dave" { set mux "COM5/ARQ A" }

View File

@ -65,8 +65,10 @@
.contextMenu LI.cut A { background-image: url(/img/context/cut.png); }
.contextMenu LI.quit A { background-image: url(/img/context/door.png); }
.contextMenu LI.compress A { background-image: url(/img/context/compress.png); }
.contextMenu LI.compressr A { background-image: url(/img/context/compressr.png); }
.contextMenu LI.dedup A { background-image: url(/img/context/dedup.png); }
.contextMenu LI.decrypt A { background-image: url(/img/context/decrypt.png); }
.contextMenu LI.decryptr A { background-image: url(/img/context/decryptr.png); }
.contextMenu LI.mpg A { background-image: url(/img/context/mpg.png); }

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -0,0 +1 @@
context/compressr.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

View File

@ -0,0 +1 @@
context/decryptr.png

View File

@ -2,7 +2,9 @@ puts {
<!-- start of topbar -->
<div id=topbar class=container onclick="location.href='/'; return false;">
<div class=left><img src=/images/154_1_00_WIN_MD116_1L.png></div>
<div class=left>
<img src=/images/154_1_00_WIN_MD116_1L.png>
</div>
<div class=middle>
<!-- Start include diskspace - above other items to work around IE feature.. -->
}
@ -10,6 +12,7 @@ source /mod/webif/include/diskspace.jim
puts {
<!-- End include diskspace -->
<img border=0 src=/images/516_1_26_Freeview_Logo.png>
<!-- <img border=0 height=47 src=/img/FreeviewHD.png> -->
<span style="display: inline; font-size: 150%;
padding: 0 0 0 2em;">
}

View File

@ -28,32 +28,49 @@ proc {dir iconset} {dir} {
lappend attrs "noflat=$noflat"
}
set autoshrinkr 0
if {[file exists "$dir/.autoshrinkr"]} {
set autoshrinkr 1
lappend icons [_addicon "/img/compressr.png" \
"Recursive Auto-shrink"]
lappend attrs "autoshrinkr=1"
}
set autoshrink 0
if {[file exists "$dir/.autoshrink"]} {
if {!$autoshrinkr && [file exists "$dir/.autoshrink"]} {
set autoshrink 1
lappend icons [_addicon "/img/compress.png" "Auto-shrink"]
lappend attrs "autoshrink=$autoshrink"
lappend attrs "autoshrink=1"
}
set autodedup 0
if {[file exists "$dir/.autodedup"]} {
set autodedup 1
lappend icons [_addicon "/img/dedup.png" "Auto-dedup"]
lappend attrs "autodedup=$autodedup"
lappend attrs "autodedup=1"
}
set autodecryptr 0
if {[file exists "$dir/.autodecryptr"]} {
set autodecryptr 1
lappend icons [_addicon "/img/decryptr.png" \
"Recursive Auto-decrypt"]
lappend attrs "autodecryptr=1"
}
set autodecrypt 0
if {[file exists "$dir/.autodecrypt"]} {
if {!$autodecryptr && [file exists "$dir/.autodecrypt"]} {
set autodecrypt 1
lappend icons [_addicon "/img/decrypt.png" "Auto-decrypt"]
lappend attrs "autodecrypt=$autodecrypt"
lappend attrs "autodecrypt=1"
}
set autompg 0
if {[file exists "$dir/.autompg"]} {
set autompg 1
lappend icons [_addicon "/img/mpg.png" "Auto-MPG Extract"]
lappend attrs "autompg=$autompg"
lappend attrs "autompg=1"
}
return [list $icons $attrs]