The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
[% 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>