ent 9303 audit log extended info

This commit is contained in:
edu.corral 2022-09-23 11:35:17 +02:00
parent d14bcfe616
commit 6a93b4d554
1 changed files with 31 additions and 34 deletions

View File

@ -44,7 +44,7 @@ class AuditLog extends HTML
* *
* @var array * @var array
*/ */
public $AJAXMethods = [ 'draw' ]; public $AJAXMethods = ['draw'];
/** /**
* Ajax page. * Ajax page.
@ -78,7 +78,6 @@ class AuditLog extends HTML
// Set the ajax controller. // Set the ajax controller.
$this->ajaxController = $ajaxController; $this->ajaxController = $ajaxController;
} }
@ -232,7 +231,6 @@ class AuditLog extends HTML
// Load own javascript file. // Load own javascript file.
echo $this->loadJS(); echo $this->loadJS();
} }
@ -368,39 +366,38 @@ class AuditLog extends HTML
// Javascript content. // Javascript content.
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function format ( d ) { function format(d) {
var output = ''; var output = '';
if (d.extendedInfo === '') { if (d.extendedInfo === '') {
output = "<?php echo __('There is no additional information to display'); ?>"; output = "<?php echo __('There is no additional information to display'); ?>";
} else { } else {
output = d.extendedInfo; output = d.extendedInfo;
}
return output;
} }
$(document).ready(function() { return output;
// Add event listener for opening and closing details }
$('#audit_logs tbody').on('click', 'td.show_extended_info', function () {
var tr = $(this).closest('tr'); $(document).ready(function() {
var table = <?php echo 'dt_'.$this->tableId; ?>; // Add event listener for opening and closing details
var row = table.row( tr ); $('#audit_logs tbody').on('click', 'td.show_extended_info', function() {
var tr = $(this).closest('tr');
if ( row.child.isShown() ) { var table = $("#<?php echo $this->tableId; ?>").DataTable();
// This row is already open - close it var row = table.row(tr);
row.child.hide();
tr.removeClass('shown'); if (row.child.isShown()) {
} // This row is already open - close it
else { row.child.hide();
// Open this row tr.removeClass('shown');
row.child( format(row.data()) ).show(); } else {
tr.addClass('shown'); // Open this row
} row.child(format(row.data())).show();
} ); tr.addClass('shown');
} ); }
</script> });
});
</script>
<?php <?php
// EOF Javascript content. // EOF Javascript content.
return ob_get_clean(); return ob_get_clean();