8 isset(
$user) or require
$_SERVER[
'DOCUMENT_ROOT'] .
'/page/404.php';
12 <div
class=
"table-responsive p-2">
13 <table
id=
"table-logs" class=
"table table-hover table-striped table-bordered table-sm small" style=
"width:100%">
14 <thead
class=
"bg-info text-center">
19 <th style=
"max-width:50%;">Данные</th>
29 window.dataTablesConfigs[0].ajax =
'<?= Wrong\Models\Selects::find(8)->request ?>';
30 window.dataTablesConfigs[0].initComplete =
function() {
31 $(
'#table-logs_length label').append(
'<button class="btn btn-outline-primary btn-sm" data-action="clean-logs" data-confirm="true" data-body="Очистить лог?" data-callback="logsCleaned" style="font-size:12px;margin-left:7px;"><i class="fa fa-trash"></i> Очистить</button> <button id="toggle-show" class="btn btn-outline-primary btn-sm" style="font-size:12px;margin-left:7px;"><i class="fa fa-eye-slash"></i> <span>Показать</span></button><button class="btn btn-outline-primary btn-sm autoupdate" data-toggle="button" title="Автообновление таблицы" style="font-size:12px;margin-left:5px;"><i class="fa fa-play"></i></button><button class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#hide-table-cols" title="Видимость колонок таблицы <b>' + $(
'title').text() +
'</b>" style="font-size:12px;margin-left:5px;"><i class="fa fa-table"></i></button>');
33 window.autoupdate = window.localStorage.autoupdate ? JSON.parse(window.localStorage.autoupdate) : {};
34 if (window.autoupdate[location.pathname]) {
35 $(
'.autoupdate').trigger(
'click');
38 window.dataTablesConfigs[0].drawCallback =
function(e) {
39 $(window).trigger(
'interaction');
41 window.dataTablesConfigs[0].order = [
44 $(
'#table-logs').DataTable(window.dataTablesConfigs[0]);
46 $(document).on(
'click',
'#toggle-show',
function() {
47 $(
this).find(
'i').toggleClass(
'fa-eye fa-eye-slash');
48 $(window).trigger(
'interaction');
49 if ($(
'#toggle-show').find(
'i').is(
'.fa-eye')) {
50 $(
'.log-show').removeClass(
'show');
55 $(window).on(
"interaction",
function() {
56 $(
'.log-show').not(
'.show').removeAttr(
'style');
57 if ($(
'#toggle-show').find(
'i').is(
'.fa-eye')) {
58 $(
'#toggle-show').find(
'span').html(
'Скрыть');
59 $(
'.log-show').not(
'.show').css({
64 $(
'#toggle-show').find(
'span').html(
'Показать');
65 $(
'.log-show').not(
'.show').css({
67 display:
'-webkit-box',
69 WebkitBoxOrient:
'vertical',
71 textOverflow:
'ellipsis',
76 $(
'.log-show').each((i, el) => {
77 if ($(el).text().match(/
"error"/) || $(el).text().match(/404 Not Found/)) {
78 $(el).addClass(
'bg-danger text-white');
79 $(el).parents(
'tr').addClass(
'bg-danger text-white');
84 $(document).on(
'click',
'#table-logs tbody tr',
function() {
85 $(
this).find(
'.log-show').removeAttr(
'style');
86 if ($(
this).find(
'.log-show').is(
'.show')) {
87 $(
this).find(
'.log-show').css({
89 display:
'-webkit-box',
91 WebkitBoxOrient:
'vertical',
93 textOverflow:
'ellipsis',
98 $(
this).find(
'.log-show').css({
103 $(
this).find(
'.log-show').toggleClass(
'show');
106 function logsCleaned(response) {
107 if (response.error) {
108 errorToast(response.error);
111 successToast(response.message);
112 $(
'.dataTable').DataTable().ajax.reload(
null,
false);
115 $(document).on(
'click',
'.autoupdate',
function() {
116 $(
this).find(
'.fa').toggleClass([
'fa-play',
'fa-stop']);
117 window.autoupdate[location.pathname] = $(
'.autoupdate').is(
'.active');
118 window.localStorage.autoupdate = JSON.stringify(window.autoupdate);
122 $(
'.autoupdate').is(
'.active') && $(
'.dataTable').DataTable().ajax.reload(
null,
false);
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']