clear log function

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1256 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2012-12-01 22:00:03 +00:00
parent ebcd6cdbf7
commit d661c8016e
4 changed files with 47 additions and 3 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 0.10.1-4
Version: 0.10.1-5
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.19.3-1),lsof,epg(>=1.0.9),hmt(>=1.1.7),ssmtp,anacron,trm,openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2),stripts(>=1.1.2),smartmontools,tmenu(>=1.02)

View File

@ -0,0 +1,24 @@
#!/mod/bin/jimsh
package require cgi
source /mod/webif/lib/setup
puts "Content-Type: text/html"
puts ""
set logdirs {/var/log /mod/tmp /mnt/hd3}
set logext {.log}
cgi_input
#cgi_dump
set log [cgi_get file 0]
set ldir [file dirname $log]
if {[file dirname $log] in $logdirs && [file extension $log] in $logext} {
file copy -force "/dev/null" $log
puts "Cleared $log"
exit
}
puts "Cannot clear $log"

View File

@ -176,7 +176,11 @@ foreach file [lsort [concat \
]] {
puts "<a href=# class=log file=\"$file\">
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
[file tail $file]</a> ([pretty_size [file size $file]]) <br>"
[file tail $file]</a>
(<span class=lsize>[pretty_size [file size $file]]</span>)
<a class=\"va footnote logclear\" href=# file=\"$file\">
<img class=va border=0 src=/img/close.png width=20>Clear</a>
<br>"
}
puts {

View File

@ -27,7 +27,8 @@ $('#runfopkg').click(function() {
});
});
$('a.log').click(function() {
$('a.log').click(function(e) {
e.preventDefault();
$('#results')
.slideDown()
.text('\n\nLoading log, please wait...\n\n')
@ -37,6 +38,21 @@ $('a.log').click(function() {
});
});
$('a.logclear').click(function(e) {
var t = $(this);
e.preventDefault();
if (!confirm('Delete ' + $(this).attr('file') + '?'))
return;
$('#results')
.slideDown()
.text('\n\nClearing log, please wait...\n\n')
.load('clearlog.jim?file=' +
encodeURIComponent($(this).attr('file')), function() {
$('#results').wrapInner('<pre>');
$(t).prev('span.lsize').html('0 bytes');
});
});
$('#runedit').click(function(e) {
e.preventDefault();
window.location = '/edit/edit.jim';