Update notifications to work with tablesorter v2.28.15

This commit is contained in:
bergware
2017-08-20 18:14:23 +02:00
parent ef3ca5a01b
commit 3166e49fa2
4 changed files with 15 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
Menu="Notifications:3"
Title="Notification Agents"
Tag="rss-square"
---
<script>
var scripts = new Object();

View File

@@ -2,6 +2,7 @@ Menu="UserPreferences"
Type="xmenu"
Title="Notification Settings"
Icon="notifications.png"
Tag="phone-square"
---
<?PHP
/* Copyright 2005-2017, Lime Technology

View File

@@ -47,12 +47,12 @@ function archiveList(init) {
<?if ($display['resize']):?>
resize();
<?endif;?>
$('#archive_table').tablesorter({headers:{5:{sorter:false}}});
$('#archive_table').tablesorter({headers:{5:{sorter:false}},textExtraction:function(n,t,i){return ($(n).attr('data') ? $(n).attr('data') : $(n).text());}});
} else {
$('#archive_table').trigger('update',true);
$('#archive_table').trigger('update');
}
$('#archive_list .expand-child td').hide();
for (var i = 0; i < rows.length; i++) $('#archive_list .expand-child.row'+rows[i]+' td').show();
$('#archive_list .tablesorter-childRow td').hide();
for (var i = 0; i < rows.length; i++) $('#archive_list .tablesorter-childRow.row'+rows[i]+' td').show();
setTimeout(archiveList,30000);
});
}
@@ -60,7 +60,7 @@ function askConfirmation() {
swal({title:"Are you sure?",text:"This will delete all notification files!",type:"warning",showCancelButton:true},function(){$.post('/webGui/include/DeleteLogFile.php',{log:'*.notify'},function(){archiveList();});});
}
function openClose(row) {
var extra = '#archive_list .expand-child.row'+row+' td';
var extra = '#archive_list .tablesorter-childRow.row'+row+' td';
if ($(extra).is(":visible")) {
$(extra).hide();
rows.remove(row);
@@ -80,6 +80,6 @@ $(function(){
</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 style="text-align:right"><?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"></tbody>
<tbody id="archive_list"><tr><td colspan="5" style="text-align:center;padding-top:12px"><i class='fa fa-spinner fa-spin icon'></i><em>Please wait, loading information ...</em></td></tr></tbody>
</table>
<input type="button" value="Done" onclick="done()">

View File

@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2012-2016, Bergware International.
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -11,7 +11,7 @@
*/
?>
<?
$docroot = $docroot ?: @$_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
$docroot = $docroot ?: $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Wrappers.php";
$dynamix = parse_plugin_cfg('dynamix',true);
@@ -26,20 +26,20 @@ foreach ($files as $file) {
$empty = false;
$archive = basename($file);
if ($extra = count($fields)>6) {
$td_ = "<td rowspan='3'><a href='#' onclick='openClose($row)'>"; $_td = "</a></td>";
$td_ = "<td data='xxx' rowspan='3'><a href='#' onclick='openClose($row)'>"; $_td = "</a></td>";
} else {
$td_ = "<td style='white-space:nowrap'>"; $_td = "</td>";
$td_ = "<td data='xxx' style='white-space:nowrap'>"; $_td = "</td>";
}
$c = 0;
foreach ($fields as $field) {
if ($c==5) break;
$item = $field ? explode('=', $field, 2) : ["","-"];
echo (!$c++) ? "<tr>$td_".date("{$dynamix['notify']['date']} {$dynamix['notify']['time']}", $item[1])."$_td" : "<td>{$item[1]}</td>";
echo (!$c++) ? "<tr>".str_replace('xxx',$item[1],$td_).date("{$dynamix['notify']['date']} {$dynamix['notify']['time']}", $item[1])."$_td" : "<td>{$item[1]}</td>";
}
echo "<td style='text-align:right'><a href='#' onclick='$.post(\"/webGui/include/DeleteLogFile.php\",{log:\"$archive\"},function(){archiveList();});return false' title='Delete notification'><i class='fa fa-trash-o'></i></a></td></tr>";
if ($extra) {
$item = explode('=', $field, 2);
echo "<tr class='expand-child row$row'><td colspan='5'>{$item[1]}</td></tr><tr class='expand-child row$row'><td colspan='5'></td></tr>";
echo "<tr class='tablesorter-childRow row$row'><td colspan='5'>{$item[1]}</td></tr><tr class='tablesorter-childRow row$row'><td colspan='5'></td></tr>";
$row++;
}
}