-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlogview.tpl
132 lines (127 loc) · 4.37 KB
/
logview.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
{if isset($permoverview['b_virtualserver_log_view']) AND empty($permoverview['b_virtualserver_log_view'])}
<section class="content container-fluid">
<div class="row">
<div class="col-xs-12 col-xs-offset-0 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
<div class="box box-danger">
<div class="box-header"><h3 class="box-title">{$lang['error']}</h3></div>
<div class="box-body">
<p class="lead">{$lang['nopermissions']}</p>
</div>
</div>
</div>
</div>
</section>
{else}
<script>
$(function () {
var table = $("#traffic").DataTable({
"language": {
"url": dataTableLang
},
"autoWidth": false,
"order": [[ 0, "desc" ]],
"columnDefs": [
{ targets: 0, responsivePriority: 1},
{ targets: 4, responsivePriority: 2},
{ targets: 'no-sort', orderable: false },
{ targets: 'no-search', searchable: false }
],
"processing": true,
initComplete: function() {
var api = this.api();
new $.fn.dataTable.Buttons(api, {
"buttons": [
{
text: "{$lang['showmoreentrys']}",
className: "btn btn-primary btn-flat btn_showmoreentrys",
action: function ( e, dt, node, config ) {
add_entries();
}
}
]
});
$('#traffic_length').parent('.col-sm-6').removeClass('col-sm-6').addClass('col-sm-6 col-md-4');
$('#traffic_filter').parent('.col-sm-6').removeClass('col-sm-6').addClass('col-sm-6 col-md-4 col-md-push-4').after('<div class="col-sm-12 col-md-4 col-md-pull-4 text-center"><div id="traffic_buttons"></div></div>');
$('#traffic_processing').css('top', '7%');
$('.pagination').addClass('pagination-flat');
api.buttons().container().prependTo( '#traffic_buttons' );
$('#traffic_wrapper .row:eq(0) .col-sm-4')
}
});
$(window).resize(function(){
$("#traffic").css('width', '100%');
$("#traffic").DataTable().columns.adjust().draw();
});
function add_entries(){
var begin_pos = $('#begin_pos').val();
var url = "index.php?site=logview&sid={$sid}";
table.processing(true);
$('.btn_showmoreentrys').addClass('disabled');
{literal}
$.post(url, {begin_pos: begin_pos }, function(data){
{/literal}
data = $.parseHTML(data);
$.each(data, function(key, itm){
if (itm.className == 'wrapper') {
var base = itm.children[2].children[0].children[0].children[0];
var elems = base.children[0].children[1].children[1].children;
var lastID = elems.length - 1;
$.each(elems, function(uKey, uItm){
console.log(uKey);
table.row.add( [
uItm.children[0].innerText,
uItm.children[1].innerText,
uItm.children[2].innerText,
uItm.children[3].innerText,
uItm.children[4].innerText
] ).draw( false );
if (uKey == lastID) {
$('#begin_pos').val(base.children[0].children[0].value);
$('.btn_showmoreentrys').removeClass('disabled');
table.processing( false );
}
});
}
});
});
}
});
</script>
<section class="content container-fluid">
<div class="row">
<div class="col-xs-12 col-xs-offset-0 col-sm-10 col-sm-offset-1 col-md-10 col-md-offset-1 col-lg-10 col-lg-offset-1">
<div class="box box-primary">
<div class="box-body" id="main_content">
<input type="hidden" id="begin_pos" name="begin_pos" value="{$begin_pos}"/>
<table class="table table-striped dt-responsive" id="traffic">
<thead>
<tr>
<th width="20%">{$lang['date']}</th>
<th width="5%">{$lang['level']}</th>
<th width="10%">{$lang['type']}</th>
<th width="10%">{$lang['serverid']}</th>
<th width="55%">{$lang['message']}</th>
</tr>
</thead>
<tbody>
{if !empty($serverlog)}
{foreach key=key item=value from=$serverlog}
{if empty($smarty.post.type.error) AND empty($smarty.post.type.warning) AND empty($smarty.post.type.debug) AND empty($smarty.post.type.info) OR $smarty.post.type.error == $value['level'] OR $smarty.post.type.warning == $value['level'] OR $smarty.post.type.debug == $value['level'] OR $smarty.post.type.info == $value['level']}
<tr>
<td>{$value[0]}</td>
<td>{$value[1]}</td>
<td>{$value[2]}</td>
<td>{$value[3]}</td>
<td>{$value[4]}</td>
</tr>
{/if}
{/foreach}
{/if}
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
{/if}