Changed Download logs to download the logs currently being shown, not always the current logs - note, doesn't filter first.

Removed "delete" case in logs.php
Moved logging check out of case statements to avoid duplication.
Changed wording of clear logs warning.
Pretty-print the JSON on log export - requires PHP 5.4.
This commit is contained in:
Richard Underwood 2016-08-25 10:23:31 +01:00
parent ff8df5e5b2
commit befb891174
2 changed files with 69 additions and 68 deletions

View file

@ -114,7 +114,7 @@ if ($blocklogin === TRUE) {
<div id="dnssecinfo">
</div>
<div id="clearlogs" style="display: none;">
Are you sure you want to clear all the logs? Maybe download them
Are you sure you want to clear the current logs? Maybe download them
first<?php if($allowrotatelogs) { ?>, or use "Rotate logs" to save
them on the server<?php } ?>?
</div>
@ -1121,13 +1121,13 @@ $(document).ready(function () {
icon: 'img/export.png',
text: 'Download logs',
click: function () {
var $zexport = $.get("logs.php?action=export", function(data) {
var $zexport = $.get("logs.php?action=export&logfile=" + $('#logfile').val(), function(data) {
console.log(data);
blob = new Blob([data], { type: 'text/plain' });
var dl = document.createElement('a');
dl.addEventListener('click', function(ev) {
dl.href = URL.createObjectURL(blob);
dl.download = 'nseditlogs.txt';
dl.download = $('#logfile').val() == "" ? 'nseditlogs.txt':$('#logfile').val() + ".txt";
}, false);
if (document.createEvent) {