relocate repo files so ND2 is the only code

This commit is contained in:
Oliver Gorwits
2017-04-14 23:08:55 +01:00
parent 9a016ea6ba
commit d23b32500f
469 changed files with 0 additions and 6920 deletions

View File

@@ -0,0 +1,59 @@
[% IF NOT results.size %]
<div class="span2 alert alert-info">The job queue is empty.</div>
[% ELSE %]
<table class="table table-bordered table-condensed table-hover nd_floatinghead">
<thead>
<tr>
<th class="nd_center-cell">Entered</th>
<th class="nd_center-cell">Action</th>
<th class="nd_center-cell">Status</th>
<th class="nd_center-cell">Device</th>
<th class="nd_center-cell">Port</th>
<th class="nd_center-cell">Param</th>
<th class="nd_center-cell">User</th>
<th class="nd_center-cell">Started</th>
<th class="nd_center-cell">Finished</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr
[% ' class="nd_jobqueueitem success"' IF row.status == 'done' %]
[% ' class="nd_jobqueueitem error"' IF row.status == 'error' %]
[% ' class="nd_jobqueueitem info"' IF row.status.search('^queued-') %]
data-content="<pre>[% row.log | html_entity %]</pre>"
>
<td class="nd_center-cell">[% row.entered_stamp | html_entity %]</td>
<td class="nd_center-cell">
[% FOREACH word IN row.action.split('_') %]
[% word.ucfirst | html_entity %]&nbsp;
[% END %]
</td>
[% IF row.status.search('^queued-') %]
<td class="nd_center-cell">Running on &quot;[% row.status.remove('^queued-') | html_entity %]&quot;</td>
[% ELSE %]
<td class="nd_center-cell">[% row.status.ucfirst | html_entity %]</td>
[% END %]
<td class="nd_center-cell">
[% IF row.action == 'discover' AND row.status == 'error' %]
<a href="[% uri_for('/') %]?device=[% row.device | uri %]">[% row.device | html_entity %]</a>
[% ELSE %]
<a href="[% uri_for('/device') %]?q=[% row.device | uri %]">[% row.device | html_entity %]</a>
[% END %]
</td>
<td class="nd_center-cell">[% row.port | html_entity %]</td>
<td class="nd_center-cell">[% row.subaction | html_entity %]</td>
<td class="nd_center-cell">[% row.username | html_entity %]</td>
<td class="nd_center-cell">[% row.started_stamp | html_entity %]</td>
<td class="nd_center-cell">[% row.finished_stamp | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="del" name="job" type="hidden" value="[% row.job | html_entity %]">
<button class="btn nd_adminbutton" name="del" type="submit"><i class="icon-trash text-error"></i></button>
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]

View File

@@ -0,0 +1,88 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Date Added</th>
<th class="nd_center-cell">MAC Address</th>
<th class="nd_center-cell">Enabled</th>
<th class="nd_center-cell">Reason</th>
<th class="nd_center-cell">Email</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell"></td>
<td class="nd_center-cell"><input data-form="add" name="mac" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="active" type="checkbox" checked></td>
<td class="nd_center-cell"><input data-form="add" name="why" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="cc" type="email"></td>
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% WHILE (row = results.next) %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell">[% row.date | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="update" name="mac" type="text" value="[% row.mac | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="active" type="checkbox" [% 'checked="checked"' IF row.active %]>
</td>
<td class="nd_center-cell">
<input data-form="update" name="why" type="text" value="[% row.why | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="cc" type="email" value="[% row.cc | html_entity %]">
</td>
<td class="nd_center-cell">
<button class="btn nd_adminbutton" name="update" type="submit"><i class="icon-save text-warning"></i></button>
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label-[% count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label-[% count %]">Are you sure?</h3>
</div>
<div class="modal-body">
<blockquote>
<p class="text-info">Monitor for &quot;[% row.mac | html_entity %]&quot; will be removed.</p>
</blockquote>
<input data-form="del" name="mac" type="hidden" value="[% row.mac | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"columnDefs": [
{
"targets": [ 0, 2, 5 ],
"searchable": false
},
{
"targets": [ 0, 2, 5 ],
"orderable": false
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,105 @@
[% IF orphans.size > 0 %]
<div class="accordion" id="accordion-orphans">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-orphan" href="#collapse-orphan">
<i class="icon-chevron-up"></i> &nbsp;
Orphaned Devices
</a>
</div>
<div id="collapse-orphan" class="accordion-body collapse">
<div class="accordion-inner">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Device</th>
<th>Location</th>
<th>Contact</th>
<th>Vendor</th>
<th>Model</th>
</tr>
</thead>
<tbody>
[% FOREACH row IN orphans %]
<tr>
<td><a href="[% uri_for('/device') %]?q=[% row.ip | uri %]">
[% row.dns || row.name || row.ip | html_entity %]</a></td>
<td>
[% IF row.location %]
<a href="[% search_device %]&q=[% row.location | uri %]&location=[% row.location | uri %]">
[% row.location | html_entity %]</a>
[% ELSE %]
[Not Set]
[% END %]
</td>
<td>[% row.contact | html_entity %]</td>
<td>[% row.vendor | html_entity %]</td>
<td>[% row.model | html_entity %]</td>
</tr>
[%END%]
</tbody>
</table>
</div>
</div>
</div>
</div>
[% END %]
[%# The largest graph is considered the main network, all others are
considered orphaned, so we need two to generate div %]
[% IF graphs.size > 1 %]
<div class="accordion" id="accordion-networks">
[% count = 0 %]
[% FOREACH network IN graphs %]
[% count = count + 1 %]
[%# The largest is not an orphan, so skip %]
[% NEXT IF count == 1 %]
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-target="#collapse-[% count %]" href="#collapse-[% count %]">
<i class="icon-chevron-up"></i> &nbsp;
Orphaned Network: [% count - 1 | html_entity %] Size: [% network.size | html_entity %] Devices
</a>
</div>
<div id="collapse-[% count %]" class="accordion-body collapse">
<div class="accordion-inner">
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Device</th>
<th>Location</th>
<th>Contact</th>
<th>Vendor</th>
<th>Model</th>
</tr>
</thead>
<tbody>
[% FOREACH row IN network %]
<tr>
<td><a href="[% uri_for('/device') %]?tab=netmap&q=[% row.ip | uri %]">
[% row.dns || row.name || row.ip | html_entity %]</a></td>
<td>
[% IF row.location %]
<a href="[% search_device %]&q=[% row.location | uri %]&location=[% row.location | uri %]">
[% row.location | html_entity %]</a>
[% ELSE %]
[Not Set]
[% END %]
</td>
<td>[% row.contact | html_entity %]</td>
<td>[% row.vendor | html_entity %]</td>
<td>[% row.model | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
</div>
</div>
</div>
[% END %]
</div>
[% END %]
<script>
$('.accordion').on('show hide', function (n) {
$(n.target).siblings('.accordion-heading').find('.accordion-toggle i').toggleClass('icon-chevron-up icon-chevron-down');
});
</script>

View File

@@ -0,0 +1,51 @@
[% USE CSV -%]
[% CSV.dump(['Orphaned Devices']) %]
[% CSV.dump([ 'Device' 'IP' 'Device Location' 'Contact' ' Vendor'
'Model' ]) %]
[% FOREACH row IN orphans %]
[% mydlist = [] %]
[% mydevice = row.dns || row.name %]
[% mydlist.push(mydevice) %]
[% mydlist.push(row.ip) %]
[% mydlist.push(row.location) %]
[% mydlist.push(row.contact) %]
[% mydlist.push(row.vendor) %]
[% mydlist.push(row.model) %]
[% CSV.dump(mydlist) %]
[% END %]
[% IF graphs.size > 1 %]
[% count = 0 %]
[% FOREACH network IN graphs %]
[% count = count + 1 %]
[%# The largest is not an orphan, so skip %]
[% NEXT IF count == 1 %]
[% CSV.dump([' ']) %]
[% ntwk_header = [] %]
[% ntwk_header.push('Orphaned Network') %]
[% ntwk_header.push(count - 1) %]
[% CSV.dump(ntwk_header) %]
[% CSV.dump([ 'Device' 'IP' 'Device Location' 'Contact' ' Vendor'
'Model' ]) %]
[% FOREACH row IN network %]
[% mydlist = [] %]
[% mydevice = row.dns || row.name %]
[% mydlist.push(mydevice) %]
[% mydlist.push(row.ip) %]
[% mydlist.push(row.location) %]
[% mydlist.push(row.contact) %]
[% mydlist.push(row.vendor) %]
[% mydlist.push(row.model) %]
[% CSV.dump(mydlist) %]
[% END %]
[% END %]
[% END %]

View File

@@ -0,0 +1,55 @@
[% IF results.count == 0 %]
<div class="span3 alert alert-info">The aren't enough jobs to report.</div>
[% ELSE %]
<table id="app-data-table" class="table table-bordered table-condensed table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Action</th>
<th class="nd_center-cell">Number of Devices</th>
<th class="nd_center-cell">Queued At</th>
<th class="nd_center-cell">Started</th>
<th class="nd_center-cell">Finished</th>
<th class="nd_center-cell">Time Elapsed</th>
</tr>
</thead>
</tbody>
[% WHILE (row = results.next) %]
<tr
[% IF NOT mac AND row.action == 'macsuck' %]
class="info"
[% SET mac = 1 %]
[% ELSIF NOT arp AND row.action == 'arpnip' %]
class="info"
[% SET arp = 1 %]
[% ELSIF NOT dis AND row.action == 'discover' %]
class="info"
[% SET dis = 1 %]
[% ELSIF NOT nbt AND row.action == 'nbtstat' %]
class="info"
[% SET nbt = 1 %]
[% END %]
>
<td class="nd_center-cell">[% row.action.ucfirst | html_entity %]</td>
<td class="nd_center-cell">[% row.number | html_entity %]</td>
<td class="nd_center-cell">[% row.entered_stamp | html_entity %]</td>
<td class="nd_center-cell">[% row.start | html_entity %]</td>
<td class="nd_center-cell">[% row.end | html_entity %]</td>
<td class="nd_center-cell">[% row.elapsed | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
<script>
$(document).ready(function() {
$('#app-data-table').dataTable({
"paging": false,
"searching": false,
"info": false,
"order": [[ 2, 'desc' ], [ 5, 'desc' ]],
"pageLength": 50
} );
} );
</script>

View File

@@ -0,0 +1,75 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Device Name</th>
<th class="nd_center-cell">Device IP</th>
<th class="nd_center-cell">Number of Ports</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell"><input data-form="add" name="dns" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="ip" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="ports" type="number"></td>
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% WHILE (row = results.next) %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell"><a class="nd_linkcell"
href="[% uri_for('/device') %]?q=[% row.ip | uri %]">[% row.dns | html_entity %]</a></td>
<td class="nd_center-cell">[% row.ip | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="update" name="ports" type="number" value="[% row.port_count | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="dns" type="hidden" value="[% row.dns | html_entity %]">
<input data-form="update" name="ip" type="hidden" value="[% row.ip | html_entity %]">
<button class="btn nd_adminbutton" name="update" type="submit"><i class="icon-save text-warning"></i></button>
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label-[% count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label-[% count %]">Are you sure?</h3>
</div>
<div class="modal-body">
<blockquote>
<p class="text-info">
Pseudo-device &quot;[% row.dns | html_entity %] / [% row.ip | html_entity %]&quot; will be deleted.</p>
</blockquote>
<input data-form="del" name="dns" type="hidden" value="[% row.dns | html_entity %]">
<input data-form="del" name="ip" type="hidden" value="[% row.ip | html_entity %]">
<input data-form="del" name="ports" type="hidden" value="[% row.port_count | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"columnDefs": [ {
"targets": [ 2, 3 ],
"orderable": false,
"searchable": false
} ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,39 @@
[% IF results.count == 0 %]
<div class="span3 alert alert-info">The aren't enough jobs to report.</div>
[% ELSE %]
<table id="asd-data-table" class="table table-bordered table-condensed table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Action</th>
<th class="nd_center-cell">Device</th>
<th class="nd_center-cell">Started</th>
<th class="nd_center-cell">Finished</th>
<th class="nd_center-cell">Time Elapsed</th>
</tr>
</thead>
</tbody>
[% WHILE (row = results.next) %]
<tr>
<td class="nd_center-cell">[% row.action.ucfirst | html_entity %]</td>
<td class="nd_center-cell"><a class="nd_linkcell"
href="[% uri_for('/device') %]?q=[% row.device | uri %]">[% row.device | html_entity %]</a></td>
<td class="nd_center-cell">[% row.started | html_entity %]</td>
<td class="nd_center-cell">[% row.finished | html_entity %]</td>
<td class="nd_center-cell">[% row.elapsed | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
<script>
$(document).ready(function() {
$('#asd-data-table').dataTable({
"paging": false,
"searching": false,
"info": false,
"order": [[ 4, 'desc' ], [ 0, 'asc' ], [ 1, 'asc' ] ],
"pageLength": 12
});
} );
</script>

View File

@@ -0,0 +1,101 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Left Device</th>
<th class="nd_center-cell">Left Port</th>
<th class="nd_center-cell">Right Device</th>
<th class="nd_center-cell">Right Port</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell">
<div class="input-append">
<input data-form="add" class="nd_topo_dev nd_topo_dev1" name="dev1" type="text">
<span class="add-on nd_topo_dev_caret"><i class="icon-caret-down icon-large"></i></span>
</div>
</td>
<td class="nd_center-cell">
<div class="input-append">
<input data-form="add" class="nd_topo_port nd_topo_dev1" name="port1" type="text">
<span class="add-on nd_topo_port_caret"><i class="icon-caret-down icon-large"></i></span>
</div>
</td>
<td class="nd_center-cell">
<div class="input-append">
<input data-form="add" class="nd_topo_dev nd_topo_dev2" name="dev2" type="text">
<span class="add-on nd_topo_dev_caret"><i class="icon-caret-down icon-large"></i></span>
</div>
</td>
<td class="nd_center-cell">
<div class="input-append">
<input data-form="add" class="nd_topo_port nd_topo_dev2" name="port2" type="text">
<span class="add-on nd_topo_port_caret"><i class="icon-caret-down icon-large"></i></span>
</div>
</td>
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% WHILE (row = results.next) %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell"><a class="nd_linkcell" href="[% uri_for('/device') %]?q=[% row.device1.ip | uri %]">
[% (row.device1.dns || row.device1.name || row.device1.ip) | html_entity %]</a>
</td>
<td class="nd_center-cell">[% row.port1 | html_entity %]</td>
<td class="nd_center-cell"><a class="nd_linkcell" href="[% uri_for('/device') %]?q=[% row.device2.ip | uri %]">
[% (row.device2.dns || row.device2.name || row.device2.ip) | html_entity %]</a></td>
<td class="nd_center-cell">[% row.port2 | html_entity %]</td>
<td class="nd_center-cell">
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label-[% count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label-[% count %]">Are you sure?</h3>
</div>
<div class="modal-body">
<blockquote>
<p class="text-info">The link between these two ports will be removed:</p>
<p>&nbsp;</p>
<ul>
<li><p class="text-info">[% (row.device1.dns || row.device1.name || row.device1.ip) | html_entity %],&nbsp;
[% row.port1 | html_entity %]</p></li>
<li><p class="text-info">[% (row.device2.dns || row.device2.name || row.device2.ip) | html_entity %],&nbsp;
[% row.port2 | html_entity %]</p></li>
</ul>
</blockquote>
<input data-form="del" name="dev1" type="hidden" value="[% row.dev1 | html_entity %]">
<input data-form="del" name="port1" type="hidden" value="[% row.port1 | html_entity %]">
<input data-form="del" name="dev2" type="hidden" value="[% row.dev2 | html_entity %]">
<input data-form="del" name="port2" type="hidden" value="[% row.port2 | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"columnDefs": [ {
"targets": [ 4 ],
"orderable": false,
"searchable": false
} ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,42 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th>Observing Device</th>
<th>Undiscovered Neighbor</th>
<th class="nd_center-cell">Last Discovery Attempt</th>
<th class="nd_center-cell">Last Discovery Log</th>
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr>
<td><a href="[% device_ports %]&q=[% row.ip | uri %]&f=[% row.port | uri %]">
[% row.dns || row.name || row.ip | html_entity %] ( [% row.port | html_entity %] ) </a></td>
<td>
[% IF row.remote_ip %]
<a href="[% search_node %]&q=[% row.remote_ip | uri %]">
[% row.remote_ip | html_entity %]
</a> ([% row.remote_port | html_entity %])
[% '<br />' IF row.remote_id or row.remote_type %]
[% ' id: '_ row.remote_id IF row.remote_id %]
[% ' type: '_ row.remote_type IF row.remote_type %]
[% ELSE %]
Known Device's MAC Address seen on this Port during Macsuck
[% END %]
</td>
<td class="nd_center-cell">[% row.finished | html_entity %]</td>
<td class="nd_center-cell">[% row.log | html_entity %]</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"order": [[ 2, 'desc' ], [ 1, 'asc' ] ],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,18 @@
[% USE CSV -%]
[% CSV.dump([ 'Observing Device' 'Device Port'
'Remote IP' 'Remote Port' 'Remote ID' 'Remote Type'
'Last Discovery Attempt' 'Discovery Log']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.dns || row.name || row.ip) %]
[% mylist.push(row.port) %]
[% mylist.push(row.remote_ip) %]
[% mylist.push(row.remote_port) %]
[% mylist.push(row.remote_id) %]
[% mylist.push(row.remote_type) %]
[% mylist.push(row.finished) %]
[% mylist.push(row.log) %]
[% CSV.dump(mylist) %]
[% END %]

View File

@@ -0,0 +1,61 @@
[% IF results.count == 0 %]
<div class="span2 alert alert-info">The user activity log is empty.</div>
[% ELSE %]
<table id="aul-data-table" class="table table-bordered table-condensed table-hover" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Creation</th>
<th class="nd_center-cell">User</th>
<th class="nd_center-cell">User IP</th>
<th class="nd_center-cell">Event</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</table>
[% END %]
<script>
$(document).ready(function() {
$('#aul-data-table').dataTable( {
"serverSide": true,
"order": [[ 0, "desc" ]],
"ajax": "[% uri_for('/ajax/control/admin/userlog/data') %]",
"columns": [{
"data": 'creation',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return moment(data).format('YYYY-MM-DD HH:mm');
}
}, {
"data": 'username',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'userip',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'event',
"className": "nd_center-cell",
"render": function(data, type, row, meta) {
return he.encode(data || '');
}
}, {
"data": 'entry',
"className": "nd_center-cell",
"searchable": false,
"orderable": false,
"render": function(data, type, row, meta) {
return '<input data-form="del" name="entry" type="hidden" value="' + encodeURIComponent(data) +
'"><button class="btn nd_adminbutton" name="del" type="submit"><i class="icon-trash text-error"></i></button>';
}
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,106 @@
<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th class="nd_center-cell">Full Name</th>
<th class="nd_center-cell">Username</th>
<th class="nd_center-cell">Password</th>
<th class="nd_center-cell">LDAP Auth</th>
<th class="nd_center-cell">Port Control</th>
<th class="nd_center-cell">Administrator</th>
<th class="nd_center-cell">Created</th>
<th class="nd_center-cell">Last Login</th>
<th class="nd_center-cell">Note</th>
<th class="nd_center-cell">Action</th>
</tr>
</thead>
</tbody>
<tr>
<td class="nd_center-cell"><input data-form="add" name="fullname" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="username" type="text"></td>
<td class="nd_center-cell"><input data-form="add" name="password" type="password"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="ldap"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="port_control"></td>
<td class="nd_center-cell"><input data-form="add" type="checkbox" name="admin"></td>
<td class="nd_center-cell"></td>
<td class="nd_center-cell"></td>
<td class="nd_center-cell"><input data-form="add" name="note" type="text"></td>
<td class="nd_center-cell">
<button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
</td>
</tr>
[% SET count = 0 %]
[% FOREACH row IN results %]
[% SET count = count + 1 %]
<tr>
<td class="nd_center-cell">
<input data-form="update" name="fullname" type="text" value="[% row.fullname | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="username" type="text" value="[% row.username | html_entity %]">
</td>
<td class="nd_center-cell">
<input data-form="update" name="password" type="password" value="********">
</td>
<td class="nd_center-cell">
<input data-form="update" name="ldap" type="checkbox" [% 'checked="checked"' IF row.ldap %]>
</td>
<td class="nd_center-cell">
<input data-form="update" name="port_control" type="checkbox" [% 'checked="checked"' IF row.port_control %]>
</td>
<td class="nd_center-cell">
<input data-form="update" name="admin" type="checkbox" [% 'checked="checked"' IF row.admin %]>
</td>
<td class="nd_center-cell">[% row.created | html_entity %]</td>
<td class="nd_center-cell">[% row.last_seen | html_entity %]</td>
<td class="nd_center-cell">
<input data-form="update" name="note" type="text" value="[% row.note | html_entity %]">
</td>
<td class="nd_center-cell">
<button class="btn nd_adminbutton" name="update" type="submit"><i class="icon-save text-warning"></i></button>
<button class="btn" data-toggle="modal"
data-target="#nd_devdel-[% count %]" type="button"><i class="icon-trash text-error"></i></button>
<div id="nd_devdel-[% count %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label-[% count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label-[% count %]">Are you sure?</h3>
</div>
<div class="modal-body">
<blockquote>
<p class="text-info">User &quot;[% row.username | html_entity %]&quot; will be deleted.</p>
</blockquote>
<input data-form="del" name="username" type="hidden" value="[% row.username | html_entity %]">
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="del" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
<script>
$(document).ready(function() {
$('#data-table').dataTable({
"columnDefs": [
{
"targets": [ 2, 3, 4, 5, 6, 7, 8, 9 ],
"searchable": false
},
{
"targets": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
"orderable": false
}
],
[% INCLUDE 'ajax/datatabledefaults.tt' -%]
} );
} );
</script>

View File

@@ -0,0 +1,18 @@
[% USE CSV -%]
[% CSV.dump([ 'Full Name' 'Username'
'LDAP Auth' 'Port Control' 'Administrator' 'Created'
'Last Login' 'Note']) %]
[% FOREACH row IN results %]
[% mylist = [] %]
[% mylist.push(row.fullname) %]
[% mylist.push(row.username) %]
[% mylist.push(row.ldap) %]
[% mylist.push(row.port_control) %]
[% mylist.push(row.admin) %]
[% mylist.push(row.created) %]
[% mylist.push(row.last_seen) %]
[% mylist.push(row.note) %]
[% CSV.dump(mylist) %]
[% END %]