mirror of
https://github.com/unraid/webgui.git
synced 2026-01-13 05:00:06 -06:00
91 lines
3.3 KiB
Plaintext
91 lines
3.3 KiB
Plaintext
Menu="UNRAID-OS"
|
|
Title="Archived Notifications"
|
|
Icon="icon-archive"
|
|
Tag="archive"
|
|
---
|
|
<?PHP
|
|
/* Copyright 2005-2020, Lime Technology
|
|
* Copyright 2012-2020, Bergware International.
|
|
* Copyright 2012, Andrew Hamer-Adams, http://www.pixeleyes.co.nz.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
<?
|
|
$files = count(glob("{$notify['path']}/archive/*.notify", GLOB_NOSORT));
|
|
?>
|
|
<script>
|
|
var rows = [];
|
|
Array.prototype.remove = function() {
|
|
var val, a = arguments, L = a.length, ax;
|
|
while (L && this.length) {
|
|
val = a[--L];
|
|
while ((ax = this.indexOf(val)) !== -1) this.splice(ax, 1);
|
|
}
|
|
return this;
|
|
};
|
|
<?if ($display['resize']):?>
|
|
function resize(bind) {
|
|
var width = [];
|
|
var h = $('#archive_list').height();
|
|
var s = Math.max(window.innerHeight-340,330);
|
|
if (h>s || bind) {
|
|
$('#archive_list').height(s);
|
|
$('#archive_table tbody tr:first-child td').each(function(){width.push($(this).width());});
|
|
$('#archive_table thead tr th').each(function(i){$(this).width(width[i]);});
|
|
if (!bind) $('#archive_table thead,#archive_table tbody').addClass('fixed');
|
|
}
|
|
}
|
|
<?endif;?>
|
|
function archiveList(init) {
|
|
timers.archive = setTimeout(function(){$('div.spinner.fixed').show('slow');},500);
|
|
$.get('/webGui/include/NotificationsArchive.php',{filter:'<?=addslashes(htmlspecialchars($_GET['filter']))?>'},function(data) {
|
|
clearTimeout(timers.archive);
|
|
if (data) $('#archive_list').html(data);
|
|
if (init) {
|
|
<?if ($display['resize']):?>
|
|
resize();
|
|
<?endif;?>
|
|
$('#archive_table').tablesorter({headers:{5:{sorter:false}},textAttribute:'data'});
|
|
} else {
|
|
$('#archive_table').trigger('update');
|
|
}
|
|
$('#archive_list .tablesorter-childRow td').hide();
|
|
for (var i = 0; i < rows.length; i++) $('#archive_list .tablesorter-childRow.row'+rows[i]+' td').show();
|
|
$('div.spinner.fixed').hide('slow');
|
|
setTimeout(archiveList,30000);
|
|
});
|
|
}
|
|
function askConfirmation() {
|
|
swal({title:"_(Are you sure)_?",text:"_(This will delete all notification files)_!",type:"warning",html:true,showCancelButton:true,confirmButtonText:"_(Proceed)_",cancelButtonText:"_(Cancel)_"},function(){$.post('/webGui/include/DeleteLogFile.php',{log:'*.notify'},function(){archiveList();});});
|
|
}
|
|
function openClose(row) {
|
|
var extra = '#archive_list .tablesorter-childRow.row'+row+' td';
|
|
if ($(extra).is(":visible")) {
|
|
$(extra).hide();
|
|
rows.remove(row);
|
|
} else {
|
|
$(extra).show();
|
|
rows.push(row);
|
|
}
|
|
}
|
|
$(function(){
|
|
archiveList(true);
|
|
<?if ($display['resize']):?>
|
|
$(window).bind('resize',function(){resize(true);});
|
|
<?endif;?>
|
|
});
|
|
|
|
// Adjust the width of thead cells when window resizes
|
|
</script>
|
|
<table class="tablesorter left shift" id="archive_table">
|
|
<thead><tr><th>_(Time)_</th><th>_(Event)_</th><th>_(Subject)_</th><th>_(Description)_</th><th>_(Importance)_</th><th><?if ($files):?><a href="#" onclick="askConfirmation();return false" title="_(Delete all notifications)_"><i class="fa fa-trash"></i></a><?endif;?></th></tr></thead>
|
|
<tbody id="archive_list"><tr><td colspan="6"></td></tr></tbody>
|
|
</table>
|
|
<input type="button" value="_(Done)_" onclick="done()">
|