forked from hummypkg/webif
49 lines
928 B
Tcl
Executable File
49 lines
928 B
Tcl
Executable File
#!/mod/bin/jimsh
|
|
|
|
if {[file exists /mod/tmp/notify.log]} {
|
|
|
|
source /mod/webif/lib/setup
|
|
|
|
puts {
|
|
<div id=sysnotify class=warningbox style="width: 90%"><center>
|
|
!! WARNING !!
|
|
<br><br>
|
|
You have pending system notifications:
|
|
<br><br>
|
|
</center>
|
|
<pre>
|
|
}
|
|
|
|
set lines {}
|
|
set seen {}
|
|
set i 0
|
|
foreach line [split [file read /mod/tmp/notify.log] "\n"] {
|
|
set rest [join [lassign [split $line -] date] -]
|
|
if {$rest eq ""} { set rest $date }
|
|
set mul [incr seen($rest)]
|
|
if {$mul > 1} {
|
|
append line " ($mul instances)"
|
|
}
|
|
set lines($rest) [list [incr i] $line]
|
|
}
|
|
|
|
foreach line [lsort -integer -index 0 [dict values $lines]] {
|
|
puts [lindex $line 1]
|
|
}
|
|
|
|
puts {
|
|
</pre>
|
|
<center>
|
|
<button id=sysnotify_ack>Acknowledge</button>
|
|
</center></div>
|
|
<script type=text/javascript>
|
|
$('#sysnotify_ack').button().on('click', function() {
|
|
$('#sysnotify').slideUp('slow');
|
|
$.get('/log/act.jim?file=/mod/tmp/notify.log&action=unlink');
|
|
});
|
|
</script>
|
|
}
|
|
|
|
}
|
|
|