Compare commits

..

14 Commits

Author SHA1 Message Date
hummypkg
8ec03f2636 add SSL server support
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@679 2a923420-c742-0410-a762-8d5b09965624
2012-01-19 21:15:52 +00:00
hummypkg
95bef6f458 add network name
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@678 2a923420-c742-0410-a762-8d5b09965624
2012-01-18 22:15:20 +00:00
hummypkg
44038eb7a1 fix another size issue
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@677 2a923420-c742-0410-a762-8d5b09965624
2012-01-18 00:07:25 +00:00
hummypkg
ae607a6071 hover over synopsis, fix sizes, fix delete
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@676 2a923420-c742-0410-a762-8d5b09965624
2012-01-18 00:02:55 +00:00
hummypkg
c5de79b214 Streamline deletion. Touch files into dustbin.
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@674 2a923420-c742-0410-a762-8d5b09965624
2012-01-16 22:28:20 +00:00
hummypkg
fa839705fc rename default bin
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@672 2a923420-c742-0410-a762-8d5b09965624
2012-01-14 23:08:54 +00:00
hummypkg
3d75b93f1a allow deletions from inside dustbin
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@666 2a923420-c742-0410-a762-8d5b09965624
2012-01-14 00:29:44 +00:00
hummypkg
602f96e1ac support variable dustbin name
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@663 2a923420-c742-0410-a762-8d5b09965624
2012-01-14 00:12:07 +00:00
hummypkg
3312a76cc6 dynamic dustbin
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@661 2a923420-c742-0410-a762-8d5b09965624
2012-01-13 23:28:48 +00:00
hummypkg
88026872d9 add dustbin folder image
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@658 2a923420-c742-0410-a762-8d5b09965624
2012-01-13 21:34:24 +00:00
hummypkg
ce2dfa8338 update delete system
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@657 2a923420-c742-0410-a762-8d5b09965624
2012-01-13 21:23:03 +00:00
hummypkg
6e2a0f3e2b dustbin support + bugfix
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@648 2a923420-c742-0410-a762-8d5b09965624
2012-01-10 19:51:45 +00:00
hummypkg
ccb513be49 0.8.11
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@639 2a923420-c742-0410-a762-8d5b09965624
2012-01-08 21:10:38 +00:00
hummypkg
84b5cb9506 reinstate delete, add failed recordings
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@638 2a923420-c742-0410-a762-8d5b09965624
2012-01-08 20:54:07 +00:00
26 changed files with 336 additions and 176 deletions

View File

@@ -1,9 +1,9 @@
Package: webif
Priority: optional
Section: web
Version: 0.8.10
Version: 0.8.13
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.3),ssmtp,anacron
Suggests: ffmpeg,webif-iphone,nicesplice,id3v2
Depends: mongoose(>=3.0-7),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.5),jim-oo,jim-pack,service-control,busybox(>=1.19.3-1),lsof,epg(>=1.0.8),hmt(>=1.1.4),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2
Suggests: ffmpeg,webif-iphone
Description: An evolving web interface for the Humax.

View File

@@ -106,7 +106,7 @@ foreach line $data {
puts " $chan"
if {!$hsvc} {
if {$hsvc eq ""} {
puts " Cannot map channel name to service."
continue
}

View File

@@ -10,8 +10,8 @@ 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}
set ignore {.nts .thm .hmi}
set include {.ts .avi .mpg .mpeg .wmv .mkv .mp3 .mp4 .mov .hmt}
cgi_input
#cgi_dump
@@ -30,13 +30,16 @@ if {$order eq "-"} {
[settings new] sortorder $order
}
set dustbin [system dustbin 1]
proc directory {file bfile} {
global flatten
regsub -all " +" $bfile "" tbfile
puts "<div class=va>"
puts "<img border=0 class=va id=\"img$tbfile\"
src=/images/711_1_09_Media_Folder.png>"
set img "/images/711_1_09_Media_Folder.png"
if {$bfile eq $::dustbin} { set img "/img/Dustbin_Folder.png" }
puts "<img border=0 class=va id=\"img$tbfile\" src=$img>"
puts "<input class=\"fs fsdir\" type=checkbox>"
puts "<a class=dbf
href=\"$::env(REQUEST_URI)?dir=[cgi_quote_url $file]\"
@@ -93,6 +96,12 @@ proc entry {file} {{i 0}} {
set type ts
set ts [ts fetch $file 1]
set img Video_TS
} elseif {$ext eq ".hmt"} {
if {[file exists "${base}.ts"]} { continue }
# Sole hmt file indicates failure to track.
set type bad
set ts 0
set img Video_Failed
} else {
set type gen
set ts 0
@@ -102,22 +111,25 @@ proc entry {file} {{i 0}} {
set new 0
if {$type eq "ts"} {
if {[$ts flag "New"] > 0} { set new 1 }
} else {
if {![file exists "[file rootname $file].hmi"]} { set new 1 }
} elseif {$type eq "gen"} {
if {![file exists "${base}.hmi"]} { set new 1 }
}
if {$new} { append img _New }
set fscl "fs"
set synopsis ""
if {$type eq "ts"} {
set fscl "fs fsts"
set synopsis [cgi_quote_html [$ts get synopsis]]
}
puts "
<div class=\"va bf\" id=[incr i]>
<img class=va border=0 src=/img/$img.png>
<input class=\"$fscl\" type=checkbox>
<a class=bf file=\"[cgi_quote_url $file]\" type=$type href=#>
<a class=bf title=\"$synopsis\"
file=\"[cgi_quote_url $file]\" type=$type href=#>
$bfile
</a>
"

View File

@@ -107,16 +107,17 @@ function new_folder_callback(data, status, xhr)
$.each(data, set_folder_new);
}
function delete_callback(file, type, id)
function delete_callback(file, dir, id)
{
var el = 'div.bf#' + id;
var results = el + ' .results';
var url = '/cgi-bin/browse/delete.jim?file=' + file +
'&type=' + type;
$(results)
.html('<img src=/img/loading.gif>Deleting, please wait...')
.slideDown('slow')
.load(url, function() {
.load('/cgi-bin/browse/delete.jim', {
'dir': dir,
'files': [decodeURIComponent(file)]
}, function() {
$(el).delay(3000).slideUp(300, function() {
$(el).remove();
});
@@ -253,7 +254,6 @@ function preparemenu(el, menu)
$(menu).disableContextMenuItems('#audio');
$(menu).disableContextMenuItems('#crop');
}
$(menu).disableContextMenuItems('#delete');
}
@@ -267,11 +267,12 @@ function preparedmenu(el, menu)
$(menu).changeContextMenuItem('#flat',
'Prevent Flatten');
}
$(menu).disableContextMenuItems('#delete');
}
$(document).ready(function() {
var dir = $('#dir').text();
var menuclick = function(action, el, pos)
{
var file = $(el).parent().prevAll('a.bf').last().attr('file');
@@ -283,7 +284,7 @@ var menuclick = function(action, el, pos)
{
case 'delete':
confirm_action('delete', delete_callback, file,
type, id);
dir, id);
break;
case 'copy':
@@ -367,8 +368,6 @@ var dmenuclick = function(action, el, pos)
switch (action)
{
case 'delete':
var url = '/cgi-bin/browse/delete.jim?file=' + file +
'&type=dir';
if (confirm('Are you sure you wish to delete "' +
decodeURIComponent(file) +
@@ -378,7 +377,10 @@ var dmenuclick = function(action, el, pos)
.html('<img src=/img/loading.gif>' +
'Deleting, please wait...')
.slideDown('slow')
.load(url, function() {
.load('/cgi-bin/browse/delete.jim', {
'dir': dir,
'files': [decodeURIComponent(file)]
}, function() {
$(direl).delay(3000).slideUp(300, function() {
$(direl).remove();
});
@@ -509,8 +511,6 @@ var dmenuclick = function(action, el, pos)
show: 'fade', hide: 'fade',
draggable: false, resizable: false
});
var dir = $('#dir').text();
// Load folder sizes
$.getJSON('/cgi-bin/browse/sizes.jim?dir=' + encodeURIComponent(dir),
@@ -554,7 +554,7 @@ var dmenuclick = function(action, el, pos)
.click(function() {
var files = new Array();
var els = $('input.fsts:checked + a').each(function() {
files.push(encodeURIComponent($(this).attr('file')));
files.push($(this).attr('file'));
});
//console.log("%o", files);
window.location.href = '/cgi-bin/browse/join.jim?files=' +
@@ -565,7 +565,7 @@ var dmenuclick = function(action, el, pos)
.click(function() {
var files = new Array();
var els = $('input.fs:checked + a').each(function() {
files.push($(this).attr('file'));
files.push(decodeURIComponent($(this).attr('file')));
});
//console.log("%o", files);
var str = 'Are you sure you want to delete ' + files.length +
@@ -589,9 +589,10 @@ var dmenuclick = function(action, el, pos)
}
});
$('#pwfeedback').load(
'/cgi-bin/browse/mdelete.jim?dir=' +
encodeURIComponent(dir) + '&files=' +
files.join(), function() {
'/cgi-bin/browse/delete.jim', {
'dir': dir,
'files': files
}, function() {
$('#pwdialogue').dialog('close');
window.location.reload(true);
});
@@ -602,14 +603,20 @@ var dmenuclick = function(action, el, pos)
.click(function() {
var files = new Array();
var els = $('input.fs:checked + a').each(function() {
files.push($(this).attr('file'));
files.push(decodeURIComponent($(this).attr('file')));
});
//console.log("%o", files);
var action = $(this).attr('id');
if (action == 'copy' && !confirm('Are you sure? Copying recordings can take a very long time!'))
if (action == 'copy' && !confirm('Are you sure? ' +
'Copying recordings can take a very long time!'))
return;
$.get('/cgi-bin/browse/clipboard.jim?act=add&mode=' + action +
'&path=' + files.join(), function() {
$.post('/cgi-bin/browse/clipboard.jim', {
'act': 'add',
'dir': dir,
'mode': action,
'path': files
}, function() {
reloadclipboard();
$('input.fs:checked').attr('checked', false);
});
@@ -659,8 +666,6 @@ var dmenuclick = function(action, el, pos)
else
$('#delete,#cut,#copy').disable();
$('#delete').disable();
var num = $('input.fsts:checked').size();
if (num > 1)
$('#join').enable();

View File

@@ -2,9 +2,12 @@
package require cgi
source /mod/var/mongoose/lib/setup
require clipboard.class ts.class chunked
require clipboard.class ts.class
start_chunked "text/html; no-cache\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nPragma: nocache"
puts "Content-Type: text/html; no-cache"
puts "Expires: Thu, 01 Jan 1970 00:00:00 GMT"
puts "Pragma: nocache"
puts ""
cgi_input 1
#cgi_dump
@@ -16,10 +19,10 @@ set action [cgi_get act list]
switch $action {
list {
if {![$cb size]} {
chunk "<i>Clipboard is empty</i>"
puts "<i>Clipboard is empty</i>"
break
}
chunk "<div class=cliplist>"
puts "<div class=cliplist>"
foreach file [$cb get items] {
set img "page_white_copy"
if {[$file get action] eq "cut"} {
@@ -27,36 +30,41 @@ switch $action {
}
set path [$file get path]
set xpath [cgi_quote_html $path]
chunk "<span title=\"$xpath\" alt=\"$xpath\">"
chunk "<img src=/img/context/$img.png>"
puts "<span title=\"$xpath\" alt=\"$xpath\">"
puts "<img src=/img/context/$img.png>"
set dfile [file tail $path]
if {[string length $dfile] > 25} {
set dfile "[string range $dfile 0 22]..."
}
if {[file isdirectory $path]} {
chunk "<img height=16
puts "<img height=16
src=/images/711_1_09_Media_Folder.png>"
}
chunk [cgi_quote_html $dfile]
chunk "<a class=clipdel href=# alt=\"Remove\" title=\"Remove\"
puts [cgi_quote_html $dfile]
puts "<a class=clipdel href=# alt=\"Remove\" title=\"Remove\"
path=\"[cgi_quote_url $path]\">
<img border=0 src=/img/close.png height=16></a>"
chunk "</span>"
puts "</span>"
}
chunk "</div>"
chunk "<button id=clipclear>Empty clipboard</button>"
puts "</div>"
puts "<button id=clipclear>Empty clipboard</button>"
}
add {
if {[set path [cgi_get path]] eq "0"} {
puts "No path."
exit
}
set dir [cgi_unquote_input [cgi_get dir]]
set mode [cgi_get mode copy]
foreach p [split $path ","] {
foreach p $path {
set p [cgi_unquote_input $p]
if {$dir ne "0" && ![string match "$dir/*" $p]} {
puts "$p not in directory<br>"
continue
}
if {![$cb present $p]} {
$cb add $mode $p
chunk "Added $p for $mode<br>"
puts "Added $p for $mode<br>"
}
}
$cb save
@@ -76,16 +84,15 @@ switch $action {
set file [file tail $path]
set mode [$item get action]
chunk "Pasting $file"
chunk_pad
puts "Pasting $file"
if {[file isdirectory $path]} {
# Directory
if {$mode eq "cut"} {
file rename $path "$dir/$file"
catch {file rename $path "$dir/$file"}
} else {
chunk [exec /mod/bin/busybox/cp -r \
$path $dir]
catch {puts [exec /mod/bin/busybox/cp -r \
$path $dir]}
}
} else {
set root [file rootname $path]
@@ -95,9 +102,9 @@ switch $action {
regsub -all {([\\["$])} $root {\\\1} root
foreach f [glob -nocomplain "${root}.*"] {
if {$mode eq "cut"} {
file rename $f "$dir/[file tail $f]"
catch {file rename $f "$dir/[file tail $f]"}
} else {
file copy $f "$dir/[file tail $f]"
catch {file copy $f "$dir/[file tail $f]"}
}
}
}
@@ -107,5 +114,3 @@ switch $action {
}
}
end_chunked

View File

@@ -1,32 +1,97 @@
#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/ts.class
source /mod/var/mongoose/lib/setup
require ts.class pretty_size system.class tdelete
puts "Content-Type: text/html"
puts ""
puts "Content-Type: text/html\r\n"
cgi_input
#cgi_dump
set file [dict get $_cgi file]
set type [dict get $_cgi type]
set dir [cgi_get dir]
if {$type eq "ts"} {
set ts [ts fetch $file]
if {[$ts delete]} {
puts "Successfully deleted $file."
} else {
puts "Problem deleting $file, [$ts get error]"
}
exit
} elseif {$type eq "dir"} {
puts -nonewline "Directory..."
puts [exec /mod/bin/busybox/rm -rf $file]
puts -nonewline "Done..."
#puts "DIR: ($dir)"
if {[system pkginst undelete]} {
set dustbin [system dustbin]
} else {
file delete $file
file delete "[file rootname $file].hmi"
puts "Successfully deleted $file."
set dustbin ""
}
proc bindir {file} {
global dustbin
set dir [file dirname $file]
regsub "^[system mediaroot]" $dir $dustbin dir
system mkdir_p $dir
return $dir
}
proc touch {file} {
exec /mod/bin/busybox/touch $file
}
puts "<div id=deleting class=blood><img src=/img/loading.gif>Deleting...</div>"
puts "<ul style=\"list-style-type: square\">"
foreach file [cgi_get files] {
puts -nonewline "<li>\"$file\"..."
regsub -all {([\\["$])} $dir {\\\1} dir
if {![string match "$dir/*" $file]} {
puts "Error - outside directory."
continue
}
if {[string first $dustbin $file] > -1} {
set ldustbin ""
} else {
set ldustbin $dustbin
}
set done 0
if {[file isdirectory $file]} {
puts -nonewline "Directory..."
if {$ldustbin ne ""} {
set ndir "[bindir $file]/[file tail $file]"
while {[file isdirectory $ndir]} { append ndir "_" }
file rename $file $ndir
touch $ndir
} else {
tdelete $file
}
puts -nonewline "Done..."
set done 1
} elseif {[string match {*.ts} $file]} {
set ts [ts fetch $file]
# Check TS validity
if {![catch {$ts get file}]} {
if {$ldustbin ne ""} {
$ts move [bindir $file] 1
} else {
if {[$ts delete]} {
puts "Successfully deleted $file."
} else {
puts "Problem deleting $file, [$ts get error]"
}
}
set done 1
}
# else treat as normal file.
}
if {!$done} {
if {$ldustbin ne ""} {
set nfile "[bindir $file]/[file tail $file]"
file rename $file $nfile
touch $nfile
} else {
tdelete $file
}
catch {file delete "[file rootname $file].hmi"}
puts -nonewline "Done..."
}
puts "</li>"
}
puts "</ul>"

View File

@@ -1,52 +0,0 @@
#!/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"
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 $file} 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>
}

View File

@@ -16,11 +16,10 @@ set dir [dict get $_cgi dir]
#9.4G /media/My Video/Archive
#1.4G /media/My Video/CSI_ Crime Scene Investigation
puts "{"
foreach line [split [exec /mod/bin/busybox/du -h "$dir/"] "\n"] {
set fields [split $line "\t"]
set size [lindex $fields 0]
set node [file tail [lindex $fields 1]]
# set node [lindex [split [lindex $fields 1] /] end]
regsub -all {([\\["$])} $dir {\\\1} xdir
foreach line [split [exec /mod/bin/busybox/du -h -d 1 "$dir/"] "\n"] {
lassign [split $line "\t"] size node
regsub -- "^$xdir/" $node "" node
puts "\"$node\" : \"$size\","
}

View File

@@ -32,17 +32,19 @@ puts "
<th>Frequency</th>
<th>Signal Strength</th>
<th>Signal Quality</th>
<th>Network</th>
<th>Mux</th>
<th>Channels</th>
<th>&gt;799</th>
</tr>
"
foreach tw [$db query {
select tsIdx, usTsID, ulFrequency, ucLevel, ucQuality
from TBL_TS
select tsIdx, szNetName, usTsID, ulFrequency, ucLevel, ucQuality
from TBL_TS join TBL_NET using (netIdx)
order by ulFrequency
}] {
lassign $tw x tsIdx x usTsID x ulFrequency x ucLevel x ucQuality
lassign $tw \
x tsIdx x netName x usTsID x ulFrequency x ucLevel x ucQuality
altrow
puts "
@@ -51,6 +53,7 @@ foreach tw [$db query {
"
puts "<td>[progressbar $ucLevel]</td>"
puts "<td>[progressbar $ucQuality]</td>"
puts "<td>[string range $netName 3 end]</td>"
set channels [$db query {
select usLcn, szSvcName, szPrvName, aucDefaultAuthority
@@ -59,7 +62,7 @@ foreach tw [$db query {
order by usLcn
} $tsIdx]
set mux "???"
set mux "Local"
set ehs 0
foreach chan $channels {
lassign $chan x lcn x name
@@ -72,6 +75,7 @@ foreach tw [$db query {
"ITV3" { set mux "COM4/SDN" }
"Dave" { set mux "COM5/ARQ A" }
"Film4" { set mux "COM6/ARQ B" }
"Movies4Men" { set mux "Local" }
}
}
puts "<td>$mux</td>"

View File

@@ -11,6 +11,17 @@ puts ""
cgi_input
#cgi_dump
if {[cgi_get act] eq "https"} {
if {[cgi_get val off] eq "off"} {
file delete /mod/etc/mongoose.cert
puts "HTTPS Server will be disabled after next reboot."
} else {
exec /mod/sbin/mongoose_mkcert
puts "HTTPS Server will be enabled after next reboot."
}
exit
}
set settings [settings new]
set hostname [$settings hostname]
@@ -89,6 +100,7 @@ if {$aclact ne "-" && $acluser ne "-"} {
header
puts {
<script type="text/javascript" src="/cgi-bin/settings.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/jconfirmaction.jquery.js"></script>
<link href=/css/jconfirmaction.jquery.css rel=stylesheet type=text/css />
@@ -96,26 +108,6 @@ puts {
<link href=/css/iphone-style-checkboxes.css rel=stylesheet type=text/css />
}
puts {
<script type=text/javascript>
$(document).ready(function () {
$(":submit").button();
$('form.auto').each(function(i, el) {
var id = $(this).attr('id');
var output = '#' + id + '_output'
$(this).ajaxForm({
target: output,
success: function() {
$(output).css('font-style', 'italic');
$(output).show('slow');
$(output).delay(2000).fadeOut('slow');
}
});
});
});
</script>
}
puts "
<fieldset style=\"display: inline\">
<legend>
@@ -140,6 +132,17 @@ puts "
</tr>
"
puts -nonewline "
<tr>
<th class=key>HTTPS web server?</th>
<td><input id=https_toggle name=https type=checkbox value=yes"
if {[file exists /mod/etc/mongoose.cert]} { puts -nonewline " checked" }
puts ">
<div id=https_output></div>
</td>
</tr>
"
puts "
<tr>
<form class=auto id=epg_style method=get action=$env(REQUEST_URI)>

View File

@@ -0,0 +1,58 @@
(function($)
{
$.fn.enable = function()
{
return this.each(function() {
$(this)
.removeClass('ui-state-disabled')
.removeProp('disabled');
});
};
$.fn.disable = function()
{
return this.each(function() {
$(this)
.addClass('ui-state-disabled')
.prop('disabled', true);
});
};
})(jQuery);
$(document).ready(function () {
$(":submit").button();
$(":checkbox").iphoneStyle();
$('form.auto').each(function(i, el) {
var id = $(this).attr('id');
var output = '#' + id + '_output'
$(this).ajaxForm({
target: output,
success: function() {
$(output).css('font-style', 'italic');
$(output).show('slow');
$(output).delay(2000).fadeOut('slow');
}
});
});
$('#https_toggle').change(function() {
var arg = 'off';
if ($(this).attr('checked'))
arg = 'on';
$(this).disable();
$('#https_output')
.empty()
.html('<img src=/img/loading.gif>Please Wait...')
.show('slow')
.load('/cgi-bin/settings.jim?act=https&val=' + arg,
function() {
$('#https_toggle').enable();
$('#https_output')
.css('font-style', 'italic')
.delay(2000).fadeOut('slow');
});
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc altrow ]]} {
if {![exists -proc altrow]} {
proc altrow {} {{i 0}} {
if { $i == 0 } {
puts "<tr class=odd>"

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc cat ]]} {
if {![exists -proc cat]} {
proc cat {file} {
if {[catch {set fp [open $file r}]} { return }
puts [read $fp]

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc classdump]]} {
if {![exists -proc classdump]} {
proc classdump {o} {
foreach var [$o vars] {
puts [format {%20s %s} $var [$o get $var]]

View File

@@ -1,5 +1,5 @@
if {![exists -proc class ]} { package require oo }
if {![exists -proc class]} { package require oo }
class clipboard {
path "/tmp/webif.cb"

View File

@@ -1,7 +1,7 @@
source /mod/var/mongoose/lib/setup
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
require settings.class progressbar rsv.class

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc escape]]} {
if {![exists -proc escape]} {
proc escape {str} {
regsub -all -- {"} "$str" "\\\"" str
return $str

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc class ]]} { package require oo }
if {![exists -proc class]} { package require oo }
class pkg {
name ""

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc pretty_size ]]} {
if {![exists -proc pretty_size]} {
proc pretty_size {size} {
set units {bytes KiB MiB GiB TiB}

View File

@@ -1,5 +1,5 @@
if {[expr ! [exists -proc progressbar ]]} {
if {![exists -proc progressbar]} {
proc progressbar {percent} {
set pos [expr 118 - $percent / 100.0 * 118]
return "<img src=/img/percentimage.png

View File

@@ -1,6 +1,6 @@
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
if {![file exists /mod/etc/webif.db]} {
set settingsdb [sqlite3.open /mod/etc/webif.db]

View File

@@ -1,6 +1,6 @@
if {![exists -proc class ]} { package require oo }
if {![exists -proc sqlite3.open ]} { package require sqlite3 }
if {![exists -proc class]} { package require oo }
if {![exists -proc sqlite3.open]} { package require sqlite3 }
class system {}
@@ -50,6 +50,16 @@ proc {system mediaroot} {} {
return ""
}
proc {system dustbin} {{short 0}} {
set dustbin "\[Deleted Items\]"
if {![catch {set fd [open "/mod/boot/dustbin.name" r]}]} {
set dustbin [lindex [split [read $fd] "\n"] 0]
$fd close
}
if {$short} { return $dustbin }
return "[system mediaroot]/$dustbin"
}
proc {system diskspace} {} {
switch [system model] {
HDR { set part /mnt/hd2 }
@@ -116,3 +126,7 @@ proc {system padding} {} {
return [list $start $stop]
}
proc {system mkdir_p} {dir} {
exec /mod/bin/busybox/mkdir -p $dir
}

19
var/mongoose/lib/tdelete Normal file
View File

@@ -0,0 +1,19 @@
if {![exists -proc tdelete]} {
proc tdelete {path} {
if {[file isdirectory $path]} {
regsub -all {([\\["$])} $path {\\\1} cpath
foreach file [glob -nocomplain "${cpath}/*"] {
if {[file isdirectory $file]} {
tdelete $file
} else {
exec /mod/bin/trm $file
}
}
exec /mod/bin/busybox/rm -rf $path
} else {
exec /mod/bin/trm $path
}
}
}

View File

@@ -1,5 +1,7 @@
if {![exists -proc class ]} { package require oo }
if {![exists -proc class]} { package require oo }
source /mod/var/mongoose/lib/setup
require tdelete
set dmsfile /mnt/hd2/dms_cds.db
@@ -118,10 +120,36 @@ proc {ts fetch} {file {checked 0}} {
}
ts method delete {} {
# Extract file basename
foreach f [glob -nocomplain "[file rootname $file].*"] {
set root [file rootname $file]
# Protect special characters in root.
# In particular [] characters which are used a lot
# for torrent names.
regsub -all {([\\["$])} $root {\\\1} root
foreach f [glob -nocomplain "${root}.*"] {
tdelete $f
puts "Removed $f<br>"
file delete $f
}
return 1
}
ts method move {dst {touch 0}} {
set root [file rootname $file]
regsub -all {([\\["$])} $root {\\\1} root
foreach f [glob -nocomplain "${root}.*"] {
set nf "$dst/[file tail $f]"
file rename $f $nf
if {$touch} {
exec /mod/bin/busybox/touch $nf
}
}
return 1
}
ts method copy {dst} {
set root [file rootname $file]
regsub -all {([\\["$])} $root {\\\1} root
foreach f [glob -nocomplain "${root}.*"] {
file copy $f "$dst/[file tail $f]"
}
return 1
}